How to assign boundary conditions to a large amount of surfaces

Numerical methods and mathematical models of Elmer
samuel_user
Posts: 5
Joined: 28 Mar 2019, 12:56
Antispam: Yes

How to assign boundary conditions to a large amount of surfaces

Post by samuel_user »

Here is a simplified example of my problem.
I used gmsh for mesh generation :
$ gmsh cube.geo -3 -order 2 -format unv
Please find attached the cube.geo.
Then I ran ElmerGrid :
$ ElmerGrid 8 2 cube.unv -autoclean
Then I ran ElmerSolver :
$ ElmerSolver cube.sif (see attached)

In cube.sif, if I write Target Boundaries = 2 instead of Target Boundaries (2) = 1 2 (line 42)
and Target Boundaries = 2 instead of Target Boundaries = 3 (line 48)
then I get a bad assignment of potentials on surfaces.

In this example the Physical Surface("Cathode") is made of two surfaces 1 and 2 (see cube.geo) so this is not a problem to change le line 42 as above.
But in case the Physical Surface("Cathode") is made of a large number of surfaces, I will not be able to list all the surfaces like I did line 42 in cube.sif.

Is there a way to simplify this problem?
Attachments
cube.sif
(1.53 KiB) Downloaded 264 times
cube.geo
(1.78 KiB) Downloaded 245 times
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by kevinarden »

seems to be a problem with the translation of gmsh to elmer. in gmsh I get this mesh
gmesh.png
(436.03 KiB) Not downloaded yet
opening in ElmerGui either by unv directly or after ElmerGrid I get this
elmergui.png
elmergui.png (35.76 KiB) Viewed 4914 times
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by kevinarden »

I used salome to create a tet mesh on cube and exported a unv file, read fine into elmer.

I used gmsh to create a tet mesh on cube and exported a unv file, would not read the solid elements into elmer.

Reading the text files of both elmer meshes, I am not seeing the difference yet.
ark
Posts: 14
Joined: 02 May 2017, 15:39
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by ark »

Hi,
To see volume mesh just click View-> Volume mesh in Elmer.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by kevinarden »

Ok, so there are not surfaces on every side?
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by kevinarden »

When i load into ElmerGUI cathode is surface 1 and 2, but anode is surface 3
s3.png
s3.png (31.13 KiB) Viewed 4904 times
ark
Posts: 14
Joined: 02 May 2017, 15:39
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by ark »

Ok, so there are not surfaces on every side?
Using Physical Surfaces approach only the defined surfaces are shown in GUI. And so available to set BC. I see it very comfortable for complex geometries.
When I load into ElmerGUI cathode is surface 1 and 2, but anode is surface 3
Strange, according to my experience 1 and 2 should be together denoted as 1 and 3 as 2, but I use msh instead of unv and my gmsh is not up to date.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by kevinarden »

Your mesh and sif ran fine
ouput.png
(53.4 KiB) Not downloaded yet
samuel_user
Posts: 5
Joined: 28 Mar 2019, 12:56
Antispam: Yes

Re: How to assign boundary conditions to a large amount of surfaces

Post by samuel_user »

Hi,

thanks all for your replies.

Maybe, I was not clear in my request. So I give you some images to illustrate it.

Here is the cube_01.sif file with the two options see CUBE_01 and CUBE_02 paragraphs.
The result of CUBE_01 is shown as cube_01.jpg and the CUBE_02 as cube_02.jpg.
In cube_01.jpg, the second surface "anode" becomes the second surface which composes the "cathode" and the "cathode" becomes the first one.
cube_01.jpg
(384.86 KiB) Not downloaded yet
In cube_02.jpg, the "anode" and "cathode" are well assigned.
cube_02.jpg
(477.15 KiB) Not downloaded yet
Attachments
cube_01.sif
(2.03 KiB) Downloaded 241 times
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: How to assign boundary conditions to a large amount of surfaces

Post by mzenker »

Hi,

as was suggested before, you will get what (I think) you want if you do file->export in gmsh, use .msh as file extension, set the format to "version 2 ASCII" and do NOT check "save all elements". gmsh then saves a mesh file cube.msh with only the physical bodies and boundaries. You can open that file in ElmerGUI. If you don't use ElmerGUI, it's ElmerGrid 14 2 cube.msh on the command line. The mesh will have the boundaries numbered as in the physical surfaces you have defined in gmsh. I have just tested it, your cube has then only two boundaries numbered 1 and 2.

HTH,
Matthias
Post Reply