Support to BESO optimization module

Last week I started a project focusing on topology optimization. When searching for algorithms to implement, I noticed that CalculiX already had an optimization module, called BESO for CalculiX. This module works based on Bi-directional Evolutionary Structural Optimization, an algorithm that attributes different states to each element of a mesh: this state can be a void (hole on geometry), a material, or a combination of both (less stiff material). This code can be used for static analysis, buckling, heat transfer, or even failure index.

It’s workflow is not so difficult to understand:


When the input file is made for simple analysis (in my case, just a static linear one), it is needed to fill in some information about the optimization setup and goals:

  • Which regions should be kept untouched;
  • Which materials will be used, including void materials and real ones;
  • What mass goal will be used, for instance, a goal of 0.4 says that 60% of the material will be removed (the optimizer will try to achieve this, but not necessarily it will be possible)
  • Which filter should be used: there are many different filters, each one has its own features and is described well in the python files as comments
  • What optimization will be conducted, such as stiffness, failure index, buckling, or heat transfer
  • Some convergence setup, as mass removal ratio per iteration, max number of iterations and etc.

When this config is done (many of them can be kept as default), one can run the code, and eventually, it will achieve convergence. What I ask here is if it’s possible to implement this code on PrePoMax as an optimization module for topology. It may sound like a difficult process, but František Löffelmann made an incredible job on this library, I think it is not too time-consuming to implement it in PPM’s shell interface and would be a great achievement for our community.

1 Like

@lucas_bueno, I’ve thought about asking for something similar - a topology optimization module based on BESO.
However, I do think it would take a reasonable effort to put it together and blend it with PrePoMax.

1 Like

Maybe I didn’t express it well, sorry. I do think it is difficult to implement, however, most of the work of making the algorithm work is already done by Löffelmann on its python code. The hard thing would be implementing it on PPM, of course. Not sure which priority would @Matej set this on, but it would be awesome for our open source FEM community for having a topology optimizer.

1 Like

Well, for me this is a very interesting topic in general but I did not consider supporting it in PrePoMax yet. I am also not convinced that BESO is a very good option since the resulting geometry has many sharp edges with very high-stress concentrations.

1 Like

to avoid, may the piece of element switched the properties from Compression_Only to Tension_Only material or vice versa. it has some limitation in tension and compression values, not purely deleted the element automatically based on criterion as topology optimization does.

An alternative would be the SIMP algorithm with local stiffness variation and density/stiffness penalization and filtering. For pure mechanical applications one could use nodal temperatures to control the local properties.

2 Likes

I also think that this could be a better alternative. Using temperature to change material properties should work for all cases that do not include some thermal loads. I did something like this using Abaqus some 10-15 years ago and got some nice results but the code is not usable anymore and I have no time to do it again.

Hi @Matej, thank you for replying. As I see it, BESO may not be the best solution as I’ve thought. I researched optimization algorithms and most commercial software (Ansys, Abaqus, and SolidWorks) use SIMP as an optimization method, which as you mentioned, could be a better alternative.

However, to this day I’ve only found BESO already implemented in CalculiX. In this FreeCAD thread Fandal (the guy who made the BESO library, a.k.a. František Löffelmann) explains why he used BESO instead of SIMP, mostly because of easier implementation when he made the code.

As no other good optimizer is currently available for CalculiX, don’t you think BESO developed by him could be used in the meantime? Maybe with some “experimental” label or something like this. In defense of this method, I spent yesterday reading the following paper: A comparison between the SIMP and BESO methods using open-source software and they made an awesome job comparing the BESO code I mentioned before with their SIMP algorithm implementation and noticed that, in page 67,

… Both the SIMP and BESO method optimizers gave similar results in most of the optimizations. They both will produce an idea of a good structure with optimized material usage for the purpose, but it is also possibly not the best one.

Of course, it is not the ideal scenario to use the BESO algorithm, but I think it would be good for some purposes, especially because PPM software is very user-friendly, exactly what this algorithm lacks and this would be a great match.

Again, thank you all for replying with your own opinions, I did not know this other method “SIMP” and was a great piece of knowledge.

As I said it is an interesting topic but before supporting such functionality I will have to check if it is worth it. I would not like to spend a lot of time on a feature that would not give the expected results. Or results that are not useful later for the application of the optimal design. SO this will have to wait a little :slight_smile:

1 Like

I understand. If you need any help on this topic, please let us know. I would be happy to help in any means.

1 Like

Hi,
I created the code as experimental and so the implementation of the BESO method is somewhat cumbersome. The original trials were with multimaterial optimization and with use of failure indices to drive the optimization, however it doesn’t work as good as I expected at the beginning. There are also several settings which I added during the time of experiments. Relatively reasonable results are for compliance minimization or heat flow in case of so called solid-void optimization, which are “classical” tasks for topology optimization. Not to abandon this functionality, I created a GUI for FreeCAD which helps with the setting of these basic tasks.

SIMP method is really more frequent than BESO method. BESO sequentially removes (and/or adds material), so you obtain discrete results for multiple masses (full history of the material removal), but it is principally slower and probably also more prone to stack in local minimum. SIMP uses variable pseudo-densities which is more efficient, if implemented correctly. The result for SIMP is just one solution (rounded to discrete if not fully converged). I was thinking about adding the option to use SIMP within the existing framework (it should not be so difficult), but I have never/not yet started.

The code as it is now slows down for larger meshes (say above 200 000 elements, which is not so many for topology optimization). In my opinion, full potential of the continuous development would be when developing the optimization directly in CalculiX.

1 Like

Is the speed or slowness of the implemented procedure the result of using python or in the number of steps it takes to converge?

Both. It needs more iterations (evaluation of the static analysis by CalculiX) compared to SIMP. Slowdown of the large models is probably due to large python dicts which are used in the code extensively instead of numpy arrays. And third, BESO algorithm, compared to literature, is modified to enable switching between multiple materials, which is not so efficient for classical tasks when you want to find a topology of just one material.

The python code is easy to manage for simple cases, but, e.g., when I wanted to implement frequency and buckling, I struggled with how to access matrices which, I suppose, are used inside CalculiX. That’s why I think implementation in CalculiX way would have larger potential.

To give at least some positives: implementation considers multiple load cases (as time steps in CalculiX), it can work with shells and solids, it touches only elements from the selected elset(s), the rest of the model can be arbitrary.

2 Likes