Gmsh-Elmer Query

General discussion about Elmer
Post Reply
iamkbatra
Posts: 10
Joined: 08 Jan 2024, 11:58
Antispam: Yes

Gmsh-Elmer Query

Post by iamkbatra »

Hello Elmer Community,

I have a query regarding adjusting a .geo script in Gmsh to generate a .msh file, specifically for a 2D case. After generating the mesh, I utilize the command ElmerGrid 14 2 filename.msh -autoclean to extract mesh files in Elmer format. However, upon inspection, I noticed that my boundary.mesh file is empty, which seems unusual. Furthermore, upon examining the mesh.names file, I found that it does not include "box1body" in the bodies section.

Strangely, when I open the .msh file in ElmerGUI, I can still see one body and one boundary for my geometry, even though it's not reflected in mesh.names. Could someone please review the attached zip file and suggest any necessary corrections?

Thank you
KBatra
Attachments
gmshelmer.zip
(6.36 KiB) Downloaded 10 times
kevinarden
Posts: 2320
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Gmsh-Elmer Query

Post by kevinarden »

gmshe.png
(60.42 KiB) Not downloaded yet
Your geometry in gmsh is 2d you have a surface and lines
in 2d the surface becomes a body in elmer and the lines become boundaries
in 3D volumes become bodies and surfaces become boundaries

in your geo you name a volume 2 but there are no volumes present.
you name a surface box1boundary but it will become a body in 2D

ElmerGUI adds boundaries if they are missing ElmerGrid does not.

but you have to first decide 2D or 3D,
2D; surfaces and lines are used; named surfaces are bodies, lines boundaries
3D; volumes and surface are used, volumes are bodies, surfaces are boundaries
iamkbatra
Posts: 10
Joined: 08 Jan 2024, 11:58
Antispam: Yes

Re: Gmsh-Elmer Query

Post by iamkbatra »

Thank you for your help, it works as you suggest for my 2D case :)
iamkbatra
Posts: 10
Joined: 08 Jan 2024, 11:58
Antispam: Yes

Re: Gmsh-Elmer Query

Post by iamkbatra »

Hello @kevinarden, and all,

After things worked out at simpler system, as I little complex the system, I am somehow able to manage the bodies by arranging surfaces but could not able to map the lines/boundaries from gmsh to elmer {e.g. boundary1 in elmerGUI shows line(86) in gmsh - something is inconsistent}. Can you please check/suggest what needs to be correct in order to map the (surface) bodies and (lines) boundaries from gmsh to elmer in a consistent manner. Here I attach my testzip file for your kind persual. Thank you very much for the help in advance.

Best regards,
K Batra

P.S. I didnt add physical line entities as I am not sure from where it should start, as it renders strange results in mesh.names file.
Attachments
test.zip
(17.52 KiB) Downloaded 8 times
kevinarden
Posts: 2320
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Gmsh-Elmer Query

Post by kevinarden »

The best approach is to name everything in gmsh, bodies, and boundaries. The default in gmsh is to only save named entities, if you use names.
This gives the most control over what becomes what in elmer.
The easiest way to do this is in the gmsh gui. You can name the boundary, select the lines that should be in that boundary, hit q for done.
Provide new name go to the next one.

If you do not name everything than there is a setting called Mesh.SaveAll that needs to be changed to 1 instead of zero so that gmsh writes everything out to the msh file. But then you have to create and manage bodies and boundaries in Elmer. Not easy to do for complex geometry.

Hence name everything in gmsh! Bodies and boundaries.
Post Reply