## Topology optimization

About the development of the FEM module/workbench.

Moderator: bernd

fandaL
Posts: 384
Joined: Thu Jul 24, 2014 8:29 am

### Topology optimization

For a longer time I was working on a topology optimization script using CalculiX. I have uploaded the project to the GitHub
https://github.com/fandaL/beso
so if someone is interested, you can follow description there and try it. Current state is that I tested it on very simple examples; theoretically it should work also on more complex models, it needs slightly more FEM understanding, more model preparation, and much more computational power. I'm slowly learning programming on this so the quality of the code is corresponding, therefore critical comments are welcomed although I might not be able to correct everything. There is also still a lot of basic stuff to implement and connect to a FreeCAD functionality.
lever_resulting_mesh.png (39.02 KiB) Viewed 15053 times
Transparent material is initial volume (filled by a mesh) and depicted mesh is final result after removal by algorithm. It is a proposal of material distribution in a lever loaded by the force on the right side, with horizontal fix on the top, and constrained displacement in radial and axial direction on the middle ring (so it can turn around the middle ring centre)
Pauvres_honteux
Posts: 384
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

### Re: Topology optimization

fandaL, you're my hero!

I never thought I would experience an open source topology optimizer in my lifetime! I'm all cock a-hoop over this!!!

Now I've just got a couple of questions; you mention the possibility it uses 1:st order elements for calculations. If so do you think it's possible in some future to make use of 2:nd order elements? Is this somehow a limitation of Calculix?

Clock cycles: would the calculations run faster if one used a different programming language? Or would it be possible to significantly optimize the code in some way once one get familiar with the code? I'm primarely thinking of code which runs over and over again.
bernd
Posts: 11096
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Topology optimization

fandaL wrote:For a longer time I was working on a topology optimization script using CalculiX. I have uploaded the project to the GitHub
https://github.com/fandaL/beso
This looks awesome, even 2D and documantation allrady ! Is it an research project ?

FEM on FreeCAD is really growing
fandaL
Posts: 384
Joined: Thu Jul 24, 2014 8:29 am

### Re: Topology optimization

...you mention the possibility it uses 1:st order elements for calculations. If so do you think it's possible in some future to make use of 2:nd order elements?
At the moment it is possible to use 1st or 2nd order triangle and 1st or 2nd order tetrahedron. Script computes centres of gravity and volume of those elements. At the moment these calculations are with certain inaccuracy for 2nd order elements because there are used the same formulas as for 1st order elements.
Is this somehow a limitation of Calculix?
CalxuliX can calculate volumes (may be I will use them), but I didn't found CalculiX to output centres of gravity or, even better, position of integration points. I plan to ask someone about integration over an element shape function which could solve these problems.
Clock cycles: would the calculations run faster if one used a different programming language? Or would it be possible to significantly optimize the code in some way once one get familiar with the code? I'm primarely thinking of code which runs over and over again.

Most of the time CalculiX is running a classical FEM analysis in each iteration. Commercial topology optimizers use slightly different method (SIMP), which pure form is better from the mathematical point of view – there is also an educational code available [1], not such a monster in compare to my trials :-]. I decided for BESO method because I found an explanation which I understood better at that time.
Speed of convergence can be controlled by an input parameter “evolutionary_volume_ratio”, but if you set too big value, you get result of poorer quality. Some potential to get it faster is in the more complex method or their combination, I should read more.
Hexaheral or pentahedral mesh have also theirs potential.
Is it an research project ?
Not officially. Partially I worked on it during some school tasks, but it will not be possible later, not in that way, since I already passed all my courses.

[1] http://www.topopt.dtu.dk/files/matlab.pdf
saso
Posts: 1597
Joined: Fri May 16, 2014 1:14 pm
Contact:

### Re: Topology optimization

ha, awesome, we are really not far behind, since it was just days ago since i have read that autodesk was adding something like this to inventor

https://revitstructureblog.wordpress.co ... nnections/

PS: as i understand this is something similar right? not sure since this is not really what i normally work with
fandaL
Posts: 384
Joined: Thu Jul 24, 2014 8:29 am

### Re: Topology optimization

as i understand this is something similar right?
Yes. Same workflow.
In case of sheetmetal part like this, I would prefer shell mesh especially for the rough optimization. Or maybe 3d mesh was on less mouse clicks.
bernd
Posts: 11096
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

### Re: Topology optimization

There is another OpenSource topology optimization software available. Just found http://en.z88.de/z88arion/ but did not test it.

fandaL
Posts: 384
Joined: Thu Jul 24, 2014 8:29 am

### Re: Topology optimization

There is another OpenSource topology optimization software available. Just found http://en.z88.de/z88arion/ but did not test it.
Seems good. They are farther , which demotivate me a little bit in continuing my work . I should reevaluate my motivation.
DMST1990
Posts: 8
Joined: Fri Jun 24, 2016 7:43 am

### Re: Topology optimization

I have written my own optimizer which is open source. (in python)
In this case i use calculiX for solving the physical equation.
You can optimize any problem and model which run on calculiX.

There are different types of optimization:

Maximize Heat-Exchange.
Maximize Stiffnes.
Multi physic topology optimization. (Solving a problem for heat exchange and stiffnes)

https://github.com/DMST1990/ToOptiX