make use of Physical groups from Gmsh

The graphical user interface of Elmer
Post Reply
zeljkoT
Posts: 24
Joined: 14 Nov 2018, 12:55
Antispam: Yes

make use of Physical groups from Gmsh

Post by zeljkoT »

I was searching the forum regarding the use of "Physical groups" from gmsh in ElmerGUI. It was already discussed here:

[1] https://www.elmerfem.org/forum/viewtopi ... rve#p23437
[2] https://www.elmerfem.org/forum/viewtopi ... rve#p24515
[3] https://www.elmerfem.org/forum/viewtopi ... rve#p26748
[4] https://www.elmerfem.org/forum/viewtopic.php?t=2242

But none of these discussions led me to a satisfying result. That's why I need to address this topic once more for clarification:

In a 2D axis symmetrical case where lot of boundaries (in this case lines) share the same boundary condition I would like to make use of physical groups defined in gmsh instead of selecting 69 lines one by one in ElmerGUI.

Can somebody suggest a step by step procedure in ElmerGUI please?

*** the non-GUI case would be to define the physical group in gmsh and copy paste the line numbers to the case file and then run the case form command line ***
gmsh_to_case.sif.png
gmsh_to_case.sif.png (43.05 KiB) Viewed 785 times

Thx in advance and cheers
kevinarden
Posts: 2317
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make use of Physical groups from Gmsh

Post by kevinarden »

The grouped physical curve should translate as 1 boundary in ElmerGUI, that is the way it works for me. There are export options in gmsh to ignore groups when saving the msh file, and other etc. options.

Would need more information on how you are using gmsh and ElmerGUI. Perhaps you could post the geo file below?
zeljkoT
Posts: 24
Joined: 14 Nov 2018, 12:55
Antispam: Yes

Re: make use of Physical groups from Gmsh

Post by zeljkoT »

Hi and thx for you quick response.

Currently I'm using Gmsh 4.11.1 (Build date: 20221221) and Elmer v9.0 compiled today 16. of Oct. 23.

The procedure I'm using is as follows:

1. Definition of "Physical Curve" in gmsh
2. Generate mesh (order 2)
3. File -> export -> ".msh" -> Version 2 ASCII -> "Save all elements" checked
4. In ElmerGUI -> file -> Open -> select "simle_dielectrics.msh"

Then I continue to define equation, material etc. in ElmerGUI. But then the physical groups are not imported.


If I leave the "Save all elements" box unchecked (Version 2 ASCII) in gmsh, then if going to ElmerGUI -> file -> Open nothing gets imported or at least nothing is visible. Just in the model tree under Geometry -> input file there is "simle_dielectrics.msh" (screen shot 1.png)
1.png
1.png (45.34 KiB) Viewed 777 times

If first converting the .msh into ElmerSolver format using the command line: ElmerGrid 14 2 "simle_dielectrics.msh" -autoclean
and afterwards in ElmerGUI -> Load mesh then the grouping is done as you mentioned, but it generates bodies instead of boundaries and no mesh is visible, only the boundary (screen shot 2.png).
2.png
(56.52 KiB) Not downloaded yet
I tested it with gmsh export as version 4 as well, but I got same results.

What do you think and thx a lot in advance.
(files in appendix)

Cheers
Attachments
simle_dielectrics.zip
(43.55 KiB) Downloaded 36 times
kevinarden
Posts: 2317
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: make use of Physical groups from Gmsh

Post by kevinarden »

I have just downloaded the zip and will take a better look. However immediate observation is;

Yes gmsh has two options export all elements, in this options physical groups are ignored and all elements are exported.
Export physical groups and in this option anything in a group is not exported.

This is a gmsh issue, not an Elmer issue, Elmer can only process what it is handed.
"Then I continue to define equation, material etc. in ElmerGUI. But then the physical groups are not imported."
No, the physical groups are not exported from gmsh, if you select export all elements.

My solution to this problem is to put everything in a physical group. Some meshers, like salome default everything else not grouped to a default other group, but gmsh does not. So the immediate fix for gmsh is to group everything into some group.
zeljkoT
Posts: 24
Joined: 14 Nov 2018, 12:55
Antispam: Yes

Re: make use of Physical groups from Gmsh

Post by zeljkoT »

Hi and thx for your prompt respond.

Yes, indeed. If I

1. define in gmsh two additional Physical Groups (here surfaces) for the two bodies like:
##############################################
Physical Curve("grd", 86) = {75, 74, 73, 72};
//+
Physical Curve("parFlux", 87) = {76, 63, 71};
//+
Physical Surface("ceramic", 88) = {1};
//+
Physical Surface("air", 89) = {2};
##############################################

2. then export the mesh with leaving "Save all elements" box unchecked (Version 2 ASCII)
3. and continue with ElmerGrid 14 2 "simle_dielectrics.msh" -autoclean in cmd

then it works and it groups the boundaries as defined.

Ok, I understand, somehow gmsh does export the "Curve" group incorrectly if defined without higher dimension group.

Now its clear to me and totally fine.

Thank you so much and have a nice evening.
Cheers
Post Reply