# Tag the geometry with Salome

**URL:** <https://festim.discourse.group/t/tag-the-geometry-with-salome/45>\
**Category:** User Support\
**Created:** [May 24, 2024, 1:05am UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45 "2024-05-24T01:05:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinshen](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/xinshen/32/194_2.png) [@xinshen](https://festim.discourse.group/u/xinshen)\
**Post date:** [May 24, 2024, 1:05am UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45/1 "2024-05-24T01:05:08Z")

</div>

Hi all, I have a few questions about tagging the geometry with Salome. I would appreciate it if someone could help me.

- FESTIM-workshop/tasks/task08.ipynb  
[FESTIM-workshop/tasks/task08.ipynb at main · festim-dev/FESTIM-workshop · GitHub](https://github.com/festim-dev/FESTIM-workshop/blob/main/tasks/task08.ipynb)

```auto
def convert_med_to_xdmf(
    med_file,
    cell_file="mesh_domains.xdmf",
    facet_file="mesh_boundaries.xdmf",
    cell_type="tetra",
    facet_type="triangle",
):

```

Is cell\_file refers to the groups of volumes in Salome, and is facet\_file refers to the groups of faces in Salome? If yes, are the mesh files (.med) of the groups of volumes and the groups of faces exported separately into two .med files? How are the mesh files of groups of volumes and the groups of faces exported separately? Or is it just one mesh file containing the volumes and the faces, then use the meshio to separate the volumes and faces?

1. What is the function of the code as below?

```auto
correspondance_dict = msh.cell_tags

cell_data_types = msh.cell_data_dict["cell_tags"].keys()

```

1. “The subdomains (volumes and surfaces) in the .med file were given tags.” Does this mean that the tags are given when the subdomains are built with Salome? For example, tag (is tag=name?) the tungsten volume 6, Cu volume 7, CuCrZr volume 8 in Salome before exporting the meshing file (.med)?

- interface\_conditions\_paper/iter\_2d\_case.py  
[interface\_conditions\_paper/iter\_2d\_case.py at d40ee0fb3daf0a7622a3e41c84b14014595cbab0 · RemDelaporteMathurin/interface\_conditions\_paper · GitHub](https://github.com/RemDelaporteMathurin/interface_conditions_paper/blob/d40ee0fb3daf0a7622a3e41c84b14014595cbab0/iter_2d_case.py)

```auto
id_top_surf = 9
id_coolant_surf = 10
id_left_surf = 11

```

If the geometry is built as below, are top\_surf, coolant\_surf and left\_surf all on the X-Y plane with the geometry in Salome?  
 ![image](https://global.discourse-cdn.com/free1/uploads/festim/original/1X/e1af033273aade14d39d14f394805f27b8f6b1b7.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/festim/original/1X/c125bb2eba9f6f778ba27f1a863394e73993bdaf.png)

---

<div class="post-metadata">

**Author:** ![remidm](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/remidm/32/4_2.png) [@remidm](https://festim.discourse.group/u/remidm)\
**Post date:** [May 24, 2024, 9:15am UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45/2 "2024-05-24T09:15:09Z")

</div>

1. In Salome, the mesh and groups of volumes and faces are exported to a single MED file.  
However in FESTIM needs two separate XDMF files for the volume mesh and tags and the facet tags (boundaries).  
The arguments `cell_file` and `facet_file` in this function are the path of these two files that will be written when converting the MED file.

2. In salome, volumes and surfaces are given names (eg. top\_surface, coolant\_surface, tungsten\_volume, etc.). In the XDMF files, each subdomain is tagged with an integer. The `correspondance_dict` has the correspondance between the names and the integers. `cell_data_types` is a list of cell types contained in the mesh. Typically, for a 3D unstructured mesh you will have only tetrahedra and triangles.

3. 

> [@xinshen](#):
>
> Does this mean that the tags are given when the subdomains are built with Salome?

In salome you can only tag the subdomains with strings and the software automatically assign an integer to it and it’s not user-controlled. This is why `correspondance_dict` is very important!

You are showing a 3D geometry so it’s hard to draw parallels with the paper since it’s 2D. It depends how you tag things in SALOME.  
A good way to check is to

- Mesh and tag in SALOME
- convert to XDMF with meshio
- open the XDMF files in Paraview and inspect the subdomains

---

<div class="post-metadata">

**Author:** ![xinshen](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/xinshen/32/194_2.png) [@xinshen](https://festim.discourse.group/u/xinshen)\
**Post date:** [May 24, 2024, 11:09am UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45/3 "2024-05-24T11:09:27Z")

</div>

1. In code as below, should I change the ‘med\_file’ to the file name that I want to convert?

```auto
def convert_med_to_xdmf(
    med_file,

```

1. Does “the software automatically assign an integer to it and it’s not user-controlled” mean that I should check the converted XDMF file to know the subdomains with their corresponding integer?

2. I want to reproduce the 2D results in your article “Influence of interface conditions on hydrogen transport studies”. So I thought I can just use some surfaces from 3D geometry with Salome as the 2D W/Cu/CuCrZr model used in the paper. Is it a wrong way to do that?

---

<div class="post-metadata">

**Author:** ![remidm](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/remidm/32/4_2.png) [@remidm](https://festim.discourse.group/u/remidm)\
**Post date:** [May 24, 2024, 11:30am UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45/4 "2024-05-24T11:30:31Z")

</div>

1. Yes
2. The `correspondance_dict` in the conversion script should give you the correspondance between the names of the subdomains you have in the SALOME mesh and the integers. So in theory this should be enough, but you should double check by opening the converted XDMF files yes.
3. I suppose this would work yes

---

<div class="post-metadata">

**Author:** ![xinshen](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/xinshen/32/194_2.png) [@xinshen](https://festim.discourse.group/u/xinshen)\
**Post date:** [May 24, 2024, 12:21pm UTC](https://festim.discourse.group/t/tag-the-geometry-with-salome/45/5 "2024-05-24T12:21:00Z")

</div>

Thank you so much for answering all the questions. I really appreciate it.
