automatic simulations using python

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
TechnikerHF
Posts: 2
Joined: Wed Apr 17, 2019 6:05 am
Location: Bückeburg, Germany

automatic simulations using python

Postby TechnikerHF » Wed Apr 17, 2019 6:47 am

Hello everybody

I would like to set up a python script to run several simulations automaticaly.
Firs I planed to use this:
https://forum.freecadweb.org/viewtopic. ... rom+python
I have not tested yet, but I think it should.

Secound I would like to export the results (like displacement, tension, or frequencies, etc.) in a seperated file (.txt or .csv), optinaly all results in one file.

The purpose of this work should be to run the computer over night to compute several simulations, which I prepeared bevore and to analise only the result-values next day.

Many thanks in advance!
User avatar
bernd
Posts: 7321
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: automatic simulations using python

Postby bernd » Wed Apr 17, 2019 2:38 pm

TechnikerHF wrote:
Wed Apr 17, 2019 6:47 am
I would like to set up a python script to run several simulations automaticaly.
Firs I planed to use this:
https://forum.freecadweb.org/viewtopic. ... rom+python
I have not tested yet, but I think it should.
this topic is a bit outdated. Try this https://www.freecadweb.org/wiki/FEM_Tut ... ep_by_step If you encounter problems just ask in the forum.
User avatar
bernd
Posts: 7321
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: automatic simulations using python

Postby bernd » Wed Apr 17, 2019 2:39 pm

TechnikerHF wrote:
Wed Apr 17, 2019 6:47 am
Secound I would like to export the results (like displacement, tension, or frequencies, etc.) in a seperated file (.txt or .csv), optinaly all results in one file.
which file format. You could export them to vtk?!
User avatar
TechnikerHF
Posts: 2
Joined: Wed Apr 17, 2019 6:05 am
Location: Bückeburg, Germany

Re: automatic simulations using python

Postby TechnikerHF » Thu Apr 18, 2019 6:26 pm

Thank you for the quick reply and the further Information! It seems there is a chance to find a practical solution. I hope I can reach it with my little programming skills.

bernd wrote:
Wed Apr 17, 2019 2:38 pm
this topic is a bit outdated. Try this https://www.freecadweb.org/wiki/FEM_Tut ... ep_by_step If you encounter problems just ask in the forum.
Thank you, I will try it as soon a possible!


bernd wrote:
Wed Apr 17, 2019 2:39 pm
which file format. You could export them to vtk?!
I would like to generate a table (for example .csv) with following content:

values: [input force] [absolute displacement] [vonMises stress] [max. stress] [min. stress]
sim1
sim2
sim3

or for the eigenmode:

values: [frequency 1] [frequency 2] [frequency 3] [frequency 4] [frequency 5]
sim1
sim2
sim3

Is it possible to safe such result-values into a specific file using the same python-script?
The result-mesh should be saved in the FreeCAD-File itself. If I need a more specific analysis I could open the FreeCAD-File.
User avatar
bernd
Posts: 7321
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: automatic simulations using python

Postby bernd » Fri Apr 19, 2019 6:24 pm

your result export should be possible with a few lines of Python. You just need to write the result values into a file.