Personal tools
You are here: Home Forum Use Boundary Conditions / Material properties

Boundary Conditions / Material properties

Up to Use

Boundary Conditions / Material properties

Posted by Andreas Nickel at March 07. 2010



my question is:

Is it possible to define boundary conditions and material properties with python script in Salome?

If it is possible, how can I do this? I didn't find it in the online documentation.


Thanks for your help.


Re: Boundary Conditions / Material properties

Posted by Cacciatorino at March 08. 2010

Salome-Meca has something that does it, even if in a simplified way. It take the groups from the mesh and put them in the comm file for code-aster, with the use of a simple wizard.


May be you can study it and adapt to your needs.

Re: Boundary Conditions / Material properties

Posted by Eric Galichet at February 24. 2011

Hello everybody,

I write my message here because i'm in the same case of Andy. I'm defined my geometry and my mesh on a python script and I would like to know how you can define materials properties and boundary conditions on this script. And I don't want to pass throught the .comm file.  I looked for the documentation about it but i didn't find it. Can you help me?


Thanks a lot for your help.


Re: Boundary Conditions / Material properties

Posted by Guillermo Giraldo at February 24. 2011

Hello Eric,

Although the Finite Element Method is only one and has a definite work flux (geometry definition, meshing, boundary conditions, solving, post-processing) different platforms assume different approaches to implement it. If you are coming from Ansys for example, you could be thinking that Salome is the equivalent of the pre-processing module, but that's not the case, simply because in this approach the boundary condition and material definition doesn't belong to the pre-processing part of the analysis but to the problem-definition-solvig part. This is a huge advantage if you want, for example, use the same mesh for different kind of analysis (thermic, elastic, plastic, modal) which don't share the same BCs and material properties. It is also a disadvantage if you want, for example, make a limit analysis on the load and change it in a scripting fashion or vary the material properties (is that your case?).

That being said, the best you can do in your geometry-meshing script is to define the mesh groups where the BCs are going to be applied. Next, if you are using Code-Aster for the solving task, you really have to mess with the comm file. But don't be scared: if you achieved to build your own meshing script, that won't be hard. Remember that the comm file accepts python statements.

Re: Boundary Conditions / Material properties

Posted by Eric Galichet at February 25. 2011

Hello Guillermo,

Thanks for your quick answer. 

I already managed on my python script the definition of groups on geometry and on mesh modules on which i gonna apply BCs and loads. If I well understand, I have to write a comm file with groups, material and BCs properties and import it to the script? or generate it from Salome Meca? I ask this question because I would like to make an automatic calculation and just use Salome to visualize results. Is it possible? 

Can I execute Aster through my python script? 

Thanks for your help which is very capital for me.


Re: Boundary Conditions / Material properties

Posted by Guillermo Giraldo at February 25. 2011

The comm file  is the execution script for the Aster solver, and it has almost nothing to do with Salome. I say "almost" because if you are using Salome-Meca, then you can automatically create 3 predefined comm files from the Aster module (this module is what gives the "Meca" to Salome-Meca). As I said, the comm file is itself a script, which purpose is to define the type of study, physic properties, boundary conditions and calculation results. 

I recommend you to check the documentation in for an introduction to Aster and Salome Meca.

Now, for answering your questions:

1st. Write a comm file according to your needs, or create it with Eficas (you can launch it from within Salome-Meca).

2nd. For the calculation to work, you also need an export file, which you can create using ASTK. This one tells Aster wich comm file and mesh file to use, beside other parameters.

3rd. For the automation part, make a call to the aster run script and pass the export file as argument, something like:

     subprocess.Popen("/YOURPATH/SALOME-MECA-2010.2-LGPL-i386/aster/bin/as_run exportFile.export")

4th. Import the results to Salome (manually or from your script).

Re: Boundary Conditions / Material properties

Posted by Eric Galichet at March 03. 2011

I'll write the .comm file on my script (with the base on Eficas). I made a method to export the .MED file in my directory from my mesh.


Thank you very much for your help and your time.

I gonna work on it and if I've other problems, I'll call you back on the forum. 



Powered by Ploneboard
Document Actions