Using Salome

Salome is an open-source generic platform for Pre- and Post-Processing for numerical simulation. Its key features are:

  • Supports interoperability between CAD modeling and computation software (CAD-CAE link).

  • Provides access to all functionalities via the integrated Python console.

This latter feature is especially convenient. You can easily build a CAD model and save all the performed operations within a python script. This script may be later run either in TUI (eg. batch) or GUI mode. For instance, to create a cube and mesh it:

salome -w1 [-t] testcube_mesh.py

-t option is used to switch to the TUI (eg. command line) mode.

For detailed use of Salome, see:

If the test python scripts are not available in your Docker or Singularity images you may found then here:

1. Basic examples

In the following examples we assume that you have pulled a singularity image from a Sregistry service for Salome and HiFiMagnet. For sake of simplicity the images are been named:

  • salome.simg

  • hifimagnet.simg

You shall adapt the scripts to the actual names of the images.

1.1. Check MeshGems installation

Assuming that your home directory contains a Salome directory with the python script ghs3d_demo.py. You can test your installation by running:

singularity exec \
  [-H $HOME:/home/$USER] \
  [--pwd /home/$USER/Salome] \
  -B $STORE/DISTENE/DLim:/opt/DISTENE/DLim:ro \
  salome.simg \
  salome -w1 -t ghs3d_demo.py

where:

  • $STORE/DISTENE/DLim is the directory containing a valid dlim8.key license file.

1.2. A simple med mesh in TUI mode

Assuming that your home directory contains a Salome directory with the python script testcube_mesh.py. You can test your installation by running:

singularity exec \
  [-H $HOME:/home/$USER] \
  [--pwd /home/$USER/Salome] \
  -B $STORE/DISTENE/DLim:/opt/DISTENE/DLim:ro \
  salome.simg \
  salome -w1 -t testcube_mesh.py

The default mesh format generated by Salome is med. This mesh format may not be supported by Feel++. You can convert a med mesh into a gmsh mesh (msh):

singularity exec \
  [-H $HOME:/home/$USER] \
  [--pwd /home/$USER/Salome] \
   hifimagnet.simg \
   gmsh -0 -bin testcube.med -o testcube.msh

1.3. Create a simple object in GUI mode

  • start salome

  • activate the Geometry module by clicking on the proper icon or selecting it in the dropdown menu

  • create a simple object

  • extract the boundary of the object …​

  • rename the boundary …​

  • select the geometry to save and export in your favorite CAD format

You can also:

  • dump the history to a python script script.py

  • save the study

To replay the python script: salome script.py To reload the study: salome study.hdf or load the study from main File menu

A video tutorial for creating and using python script is available here.

1.4. Loading a CAD in GUI mode

  • start salome

  • activate the Geometry module by clicking on the proper icon or selecting it in the dropdown menu

  • import the geometry using the File/Import menu

  • select the proper format

We recommend to use whever possible the XAO file format that provides:

  • a CAD file in BREP,

  • a json file containing extra informations on Groups.

This is very handy for defining CAD region (aka Groups) that will be latter used for Boundary Conditions.

1.5. Create a simple mesh in GUI mode

  • start salome

  • activate the Mesh module by clicking on the proper icon or selecting it in the dropdown menu

Click on the links bellow to see a live demo for creating a mesh with:

1.6. Loading a simple mesh in GUI mode

  • start salome

  • activate the Mesh module by clicking on the proper icon or selecting it in the dropdown menu

  • import the mesh using the File/Import menu

  • select the proper format