ElmerFEM is losing bits of multibody mesh made in Salome.

The graphical user interface of Elmer
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

I have made a mesh in Salome (see picture in second post, mesh refinements bodies of voids not shown) that is supposed to be used for a multibody magnetostatics simulation with various levels of mesh refinement. The mesh is sizable enough that Elmer has considerable lag running on a computer, a laptop, with a 6/12 core 9th gen Intel i7 processor, 16GB of RAM, and an Nvidia Quadro RTX 3000 . I'm running Windows 10. I have the most recent binary of ElmerGUI with MPI and Salome 9.11.0 installed.

I import the file in UNV format. The file seemingly imports flawlessly at this point with the correct number of bodies appearing in the tree but with just one surface. Elmer runs smoothly up to this point. I then split/divide the surface with 20 degree splitting parameter. The performance of ElmerGUI comes to a screeching halt. After hiding the four layers of mesh refinement that are intended to be the free space/air/void portions of the simulation, I come to find that 12 of the 24 magnets are just the circular interface between the two halves of those 12 magnets (see pictures). (NOTE: Each of the 24 magnets is divided in half to establish the plus and minus/north and south poles of the magnets.)

When selecting some of the items from body tree, some of those interfaces light up, but some the tree items do not have a corresponding body light up. Further, when I go to unify some of the faces/boundaries of the magnets that are displayed, they proceed to disappear. One of the pictures attached has this shown for two of the magnet bodies. Part of me believes that the mesh is still there, and ElmerGUI is simply very unhappy with the size of my mesh. However, whether it's unhappy or not, I need to see the boundaries to unify them as well as properly assign body and boundary conditions.

What is going on here? How do I fix it?

Picture of expected Salome mesh is in second post.
Attachments
mesh_after_unifying_surfaces.PNG
Mesh disappears after unifying surfaces of magnets.
(73.95 KiB) Not downloaded yet
flat_mesh_2.PNG
View 2 of messed up/missing meshes
(29.82 KiB) Not downloaded yet
flat_mesh_1.PNG
View 1 of messed up/missing meshes
(50.99 KiB) Not downloaded yet
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

Here is the image of the mesh in Salome.
Attachments
This is what I'm expecting to import into ElmerGUI.
This is what I'm expecting to import into ElmerGUI.
salome_is_correct.PNG (76.3 KiB) Viewed 937 times
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by kevinarden »

ElmerGUI displays bodies by displaying their boundary surface, if the boundary has 2 parents then 1 body will display and the other will not. It only uses the first parent.

The better approach is to use groups in Salome. Groups of volume elements become bodies and groups of surface elements become boundaries.
You can manually group in Mesh or Group volumes and surfaces in geometry and the mesh groups are built when meshing.

If you then create the Elmer mesh with ElmerGrid you will get an additional file called mesh.names that names the bodies and surfaces using the group names from Salome. This provides the best control over bodies and boundaries in the mesh.

ElmerGrid 8 2 mesh.unv -autoclean
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

Thank you, Kevin. I will try to do that. It might take me a bit to muddle through understanding how to perform those operations, but I will certainly be trying them. I had absolutely zero knowledge that this was how decisions in Salome affected Elmer.
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

kevinarden wrote: 05 Jan 2024, 12:06 ElmerGUI displays bodies by displaying their boundary surface, if the boundary has 2 parents then 1 body will display and the other will not. It only uses the first parent.

The better approach is to use groups in Salome. Groups of volume elements become bodies and groups of surface elements become boundaries.
You can manually group in Mesh or Group volumes and surfaces in geometry and the mesh groups are built when meshing.

If you then create the Elmer mesh with ElmerGrid you will get an additional file called mesh.names that names the bodies and surfaces using the group names from Salome. This provides the best control over bodies and boundaries in the mesh.

ElmerGrid 8 2 mesh.unv -autoclean
So I tried to do this. I, as far as I can tell, managed to create face groups and volume groups. I am confused as to why I'm unable to now make sub-meshes with those faces, but I figured out how to make face groups that lack the middle, shared face. The mesh was generated from the partitioned -> exploded volumes/solids. So, to some extent, I have succeeded here. (I have found ways to crash Salome while trying to explode using multi-selection in "explode.")

It's when I start using Elmer where I run into problems. If I don't load the ElmerGrid mesh when a new project is started, ElmerGUI crashes. ElmerGrid seems to run to completion without any error. Much to my dismay, I've ended up with an even more frustrating situation where all 24 of the magnets are showing up as flat meshes.

Also, while ElmerGrid clearly found the names of the entities (see picture), the labels do not show up in ElmerGUI, but maybe that's the intended design.

I wanted to provide a log file, but I'm not sure where to find one.

I know part of my issue is that I'm not really certain of how the Salome geometry hierarchy is used to produce meshes. Part of this confusion was alluded to earlier in this post where I'm not sure why a sub-mesh could not be made with the group of faces from the magnets despite being able to use the two end faces of a "void" cylinder in conjunction with the volume of that same "void" cylinder in a different attempt at meshing this model.

Is there anything else that comes to mind that I might be doing wrong? Is there something else I can provide to help determine the answer to this question?
Attachments
ElmerGrid correctly identifying labels
ElmerGrid correctly identifying labels
elemergrid_output.PNG (45.84 KiB) Viewed 918 times
Circles for the magnet meshes
Circles for the magnet meshes
flat_mesh_even_worse.PNG (22.06 KiB) Viewed 918 times
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by kevinarden »

There is a chapter in here on external tools that cover salome and gmsh
https://www.nic.funet.fi/pub/sci/physic ... dElmer.pdf

sending the salome file would be helpful
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by kevinarden »

This would be my work flow for this type of meshing
The documents and Salome file are here
https://github.com/mrkearden/modeling
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

kevinarden wrote: 06 Jan 2024, 13:10 This would be my work flow for this type of meshing
The documents and Salome file are here
https://github.com/mrkearden/modeling
Thank you! Between your last two posts and a bit of experimenting I have made the meshing import into Elmer properly. However, the exact reasons why the solution was the solution.

I certainly learned things from you and the links you posted, especially the very brief explanation of your usual workflow. Even if I knew the solution to the problem I was seeing, there were things I did not know regarding that workflow. However, the workflow didn't solve the flat mesh issue in my desired meshing goals directly. I did figure that out at a superficial level.

One thing I wonder about your workflow is the lack of cuts. All of the tutorials that I watched on YouTube utilized cuts. Why don't you use cuts? The tutorials make it seem like they are necessary, but your workflow make it very clear they are not necessary. Why would I want to use cuts other than to build the actual geometry of a solid part?

Also, the solution was to remove the torus that I had surrounded the magnets with to apply some mesh refinement (see picture). I found that when I used just a sphere for air like in your workflow guide the magnets' meshes were properly generated in Elmer. However, no matter what I did, the flat meshes continued to appear in my meshes until after I removed the torus. Do you know what would be causing this?
Attachments
Example of the torus mesh refinement zone. The mesh of the torus was supposed to have a more fine resolution than that demonstrated in this picture, and my previous attempts did obtain that refinement.
Example of the torus mesh refinement zone. The mesh of the torus was supposed to have a more fine resolution than that demonstrated in this picture, and my previous attempts did obtain that refinement.
magnets_with_torus.PNG (73.02 KiB) Viewed 892 times
ender_wiggin
Posts: 18
Joined: 21 Jun 2023, 22:56
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by ender_wiggin »

I take that back. It did not work as expected. The magnets did import properly before splitting surfaces because a region of high refinement in the air at the center of the circle ended up being joined as a single body. This is of course not what I want. When I went to split those bodies, the ends of those magnets disappeared.

Maybe what I am doing is unnecessary, but I don't know what to expect if the refinement area and the magnets light up when just the refinement area is selected.

Edit: The picture provided is after the splitting, as such only the center is highlighted red.
Attachments
This is after dividing the boundary between the center and the magnets.
This is after dividing the boundary between the center and the magnets.
magnets_with_center_refinement.PNG (42.18 KiB) Viewed 890 times
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: ElmerFEM is losing bits of multibody mesh made in Salome.

Post by kevinarden »

Splitting is not necessary in ElmerGUI if you manage everything in Salome. I use partition instead of cuts, because with cuts you end up with multiple parts and have to worry about coincident nodes and mis-matching boundaries, etc.

Using partitions you end up with 1 part, 1 mesh, with multiple bodies, that have no interface issues.

I think you can add your salome file to the github repository, if you want me to look at it.
Post Reply