Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2020-09-24 09:36:59

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Python code instead of mesh in astk

Hi,

I try to make a study with different geometry and boundary conditions in Code_Aster and astk. Since I could just manage to insert a mesh (.med-file) in astk, it was not possible for me to vary the geometry. I was able to use shells and beams to vary some parameters of the geometry within astk, but I couldn't change the length of a beam or the size of the shell.

I already programmed (exported and adjusted) a python-script, which I could import to salome to generate my different mesh-files and export these mesh-files manually.
Finally I had to change the .med-file in astk manually to do the different boundary condition studies with that geometry.

Is it possible to use a .py file for geometry and mesh generation in astk and to insert the different geometry parameters (eg. length, width, distance,...) for example with the .distr-file and to perform an automated study with all the different geometry and BC parameters?

Thanks in advance
Florian

Offline

#2 2020-09-28 14:57:26

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Python code instead of mesh in astk

Hello,

where you able to assign on the mesh file through python script, different areas or geometric volumes too?

Offline

#3 2020-09-29 15:45:49

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hello GPSalachs,

Thank you for your reply.

I was able to import the python script with the adapted dimensional settings to salome and to export the mesh manually without any further changes in salome. This mesh I could insert to astk (change the med-file name and the repe name in astk) and perform some simulations with different boundary conditions automatically.
Since I have to change the dimensional settings manually, import it to salome, export the mesh and insert the mesh to astk, I wanted to ask if it is possible to do these steps automatically for example by inserting the python script with the parameters to astk and change the parameters for example by the distr-file.

Probably someone has some better advice to that.

Since I have to perform a Study with a lot of different geometrical parameters (~200 different geometries) and I always have to do that manually, a lot of time and a lot of work has to be done, which could probably easily be automated.

Regards,
Florian

Offline

#4 2020-09-30 22:53:26

mf
Member
Registered: 2019-06-18
Posts: 145

Re: Python code instead of mesh in astk

Hello Florian,

I have no experience with this, but I had an idea. Why don't you try to put all the python stuff into your .comm? Take a look at the file attached: I creates the standard 200³ cube and meshes it, also with standard parameters. This is, of course, extendable to other geometries and meshes etc.

Can't you put something like this in your .comm at the beginning (after DEBUT, of course)? I am pretty sure this should work,

Mario.

Last edited by mf (2020-09-30 23:09:40)


Attachments:
test_box.py, Size: 1.99 KiB, Downloads: 60

Offline

#5 2020-10-01 08:15:37

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hi Mario,

thank you for supporting me also in that question.

I think I was probably not clear enough, because I already managed to do what you provided me. Further more I also introduced some geometry and mesh variables.
I have modified your provided file by a variable for the length, width and thickness of the "cube". I have put that modified file in appendix.

By adjusting the variables in the .py-file and importing that to salome meca, the new mesh can be used in code_aster or exported.

The only problem is that this has to be done manually (at least I have to do it manually) by now.

Since in astk it is possible to modify the variables in the .comm-file via the parameter sets in the .distr-file, I was wondering if it is also possible to include the parameters for the geometry in the .distr-file and modify also these variables in the .py-file to generate a new mesh.

By that it would be possible to do a study on different BC, material properties,... and GEOMETRY!, which is not possible by now (at least I can't manage that automatically).

Florian


Attachments:
test_box_2.py, Size: 2.04 KiB, Downloads: 56

Offline

#6 2020-10-01 10:47:04

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Python code instead of mesh in astk

Hello!
Look at this thread /viewtopic.php?id=24527 ,  it might give hints on the work you are doing.

Offline

#7 2020-10-01 12:28:31

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hello GPSalachs,

Thank you for your suggestion.
I have already seen that thread a few days ago, but in my opinion this is exactly what astk does but without the mesh adaption.

Astk copies the new .comm file to a folder defined in repe and does the simulation with different values in BC, material model,... defined in .distr-file.
Since astk has a GUI and is well programmed, I am wondering if it would be possible to adapt some variables of the mesh and therefor use a .py-file with exporting the respective mesh.

In worst case I probably have to take the python script provided in the other thread to finish my project.

Florian

Offline

#8 2020-10-01 14:40:08

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Python code instead of mesh in astk

If you save the .med by name and then "recall" it in astk by name to continue on with the analysis?

Example:

Save "example.med"

In ASTK:

/PATH/PATH/of/paths/example.med read it on "fort.4"

and in the .comm you could contain the python script to produce the .med file and save it. Now i am not sure if you will have to put it inside the DEBUT() or outside.

Offline

#9 2020-10-01 14:54:02

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hi GPSalachs,

is it possible to include the python code for the geometry and the mesh to the .comm file (as a python code) and to export the mesh to the working folder and overwrite the existing one each simulation step?

If that works it is exactly what I wanted to do.
I thought in the .comm file only the simulation keywords are allow.

I will try that and give feedback as soon as I was successful.

Florian

Offline

#10 2020-10-03 14:22:43

sameer21101970
Member
Registered: 2019-09-06
Posts: 278

Re: Python code instead of mesh in astk

ww.youtube.com/watch?v=Yqp_dW1JuJA

refer YACS  with python loop.

FEAFORALL video ---it is what you want,,,i hope

Offline

#11 2020-10-07 08:14:34

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hi sameer,

thank you for presenting me this tutorial.

It looks somehow like what I wanted, even though it is not in astk but that doesn't matter.
I try to set up a simulation procedure to perform my geometry study with the use of the YACS Module.

Florian

Offline

#12 2020-11-07 20:29:35

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hi all,

with the tutorials of FEAFORALL concerning Salome Automation (1-3) I was able to automate the simulation procedure in YACS instead of ASTK.
Since YACS is even able to offer some further features just as simulation result analysis and further processing, it is much more powerful than ASTK

Thank you all for your help
Florian

Offline

#13 2020-11-08 00:25:11

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Python code instead of mesh in astk

Being interested in the discussion, a question if i may. How where you able to make the study parametric?

Offline

#14 2020-11-08 09:12:28

sameer21101970
Member
Registered: 2019-09-06
Posts: 278

Re: Python code instead of mesh in astk

Good question, yes you can generate different size of geometry, can set mesh size for expanded or contracted geometry. This is very important when industry wants to test with geometry size for best results.

Regarding parametric, I understand that in single run of astk, we are able to apply different load or material parameters and getting multiple output test results.

To my knowledge. Yacs must be able to accept in range python function then it can generate multiple geometry, mesh and solve the same in single run with multiple outputs.

Even OpenTurns can be used.

This should be next video from feaforall. Requesting.

Offline

#15 2020-11-08 10:54:36

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

Hi GPSalachs,

FEAFORALL showed it in the third video just for one parameter set.
If you put that into several loops in YACS, you can perform the simulations for a set of parameter sets.
Further more you have to update the export-file to be able to save the different meshes and the different results.
FEAFORALL explains that update of the export-file in the last few minutes of his third video.

Florian

Offline

#16 2020-11-08 15:17:48

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Python code instead of mesh in astk

Oh ok meshes and geometries, yes!
I wanted to know on the analysis (.comm) file.

Offline

#17 2020-11-08 19:24:38

Florian Dirisamer
Member
Registered: 2020-09-24
Posts: 15

Re: Python code instead of mesh in astk

You can update the .comm file equally to the export file.
You can speed that up by inserting variables in Code_Aster to the simulation to directly update these parameters, then you can update the geometry and the mesh by the procedure shown in the video of FEAFORALL and update the simulation parameters by the short explanation of the third video of FEAFORALL by updating the .comm file via an additional script in YACS (similar to the export-file).

Florian

Offline