Topology optimization

About the development of the FEM module/workbench.

Moderator: bernd

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

Topology optimization

Postby fandaL » Sun Apr 24, 2016 10:24 pm

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.
And for picture readers :)
lever_resulting_mesh.png
lever_resulting_mesh.png (39.02 KiB) Viewed 8880 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)
User avatar
Pauvres_honteux
Posts: 195
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Topology optimization

Postby Pauvres_honteux » Tue Apr 26, 2016 4:22 am

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.
User avatar
bernd
Posts: 8023
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Topology optimization

Postby bernd » Tue Apr 26, 2016 9:13 am

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 :D
fandaL
Posts: 332
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Postby fandaL » Tue Apr 26, 2016 11:58 am

...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
User avatar
saso
Posts: 1279
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Topology optimization

Postby saso » Tue Apr 26, 2016 1:48 pm

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 :D

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 :roll:
fandaL
Posts: 332
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Postby fandaL » Tue Apr 26, 2016 7:41 pm

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.
User avatar
bernd
Posts: 8023
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Topology optimization

Postby bernd » Mon May 02, 2016 11:51 am

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

BTW: Z88 will be available as solver for FreeCAD FEM soon.
fandaL
Posts: 332
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Postby fandaL » Tue May 03, 2016 10:59 am

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: 7
Joined: Fri Jun 24, 2016 7:43 am

Re: Topology optimization

Postby DMST1990 » Fri Jun 24, 2016 7:52 am

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

https://www.youtube.com/watch?v=o17b7C4N1uI

In the new version which is not up to date, you can simulate optimized crash profils.
fandaL
Posts: 332
Joined: Thu Jul 24, 2014 8:29 am

Re: Topology optimization

Postby fandaL » Sat Jun 25, 2016 8:48 am

Hi, welcome to the FreeCAD forum.
It seems good. I put it to my candidate list on which programs to look. ;)