How to Write Boundary Conditions?

Numerical methods and mathematical models of Elmer
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

How to Write Boundary Conditions?

Post by sunyuan »

Dear Experts

I'm a newbie of Elmer and Gmsh, I was trying to make a wire system which has a anode wire with 8 field wire surround it, total 9 wires (it's a squared cell).
I made 9 wires geometries with Gmsh and generated mesh, converted by ElmerGrid, then I tried to write .sif file for ElmerSolver, but I don't know how to write the boundary condition. I mean, I want to set the boundaries like: 1800V for anode and 0 for cathode, but when I look at the mesh.header file there were way more elements and boundary elements... So my question is: How can I find the specific wire surface and set them to a certain potential?
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: How to Write Boundary Conditions?

Post by Rich_B »

Hello,

Please review chapter 9 in GetStartedElmer.pdf, the information about using gmsh and ElmerGUI apply to linux users as well as windows users.

https://www.nic.funet.fi/pub/sci/physic ... dElmer.pdf

In other words, open your gmsh created mesh in ElmerGUI (Open, not Open Mesh), and you can select your boundary numbers.

One other tip, be sure to add -autoclean to your elmergrid conversion commands.

Rich.
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by sunyuan »

Please review chapter 9 in GetStartedElmer.pdf, the information about using gmsh and ElmerGUI apply to linux users as well as windows users.
Thank you for the information, but I just forgot to mention that I don't have the GUI of Elmer in my PC because I had a trouble to install proper QT version. Is that a way to choose wires without GUI? I mean the solution exactly in the .sif file.
kevinarden
Posts: 2300
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by kevinarden »

The boundaries are defined in the mesh.boundary file. The bodies in mesh.elements
The format of the files are on page 123 of this manual
https://www.nic.funet.fi/pub/sci/physic ... Manual.pdf
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by sunyuan »

The boundaries are defined in the mesh.boundary file. The bodies in mesh.elements
The format of the files are on page 123 of this manual
I read this file but this didn't answer my question. Let me make an example:

In the mesh.header file it says there are 70704 elements and 948 boundary elements
In the mesh.element and mesh.boundaries these are recorded
In the .sif file, I want to set the boundary condition of the surface of the sphere since the mesh file is made of a simple sphere. So, how can I exactly choose the surface of the sphere? If I write something like:
Boundary condition 1
Boundary targets(1) = 1
potential = 0
End
What does this 1 mean? I know it means the identifier of the body, but I got 948 boundaries in the mesh file which one will this "1" be?
And if I want to set the boundary condition of the specific surface (in another geometry of my original question, 9 wires), how should I choose?
kevinarden
Posts: 2300
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by kevinarden »

This is an example of the elements in mesh.boundary file

1 3 4489 12567 303 84 5 1
2 3 4529 7627 303 82 84 1
3 3 4488 12283 303 2 85 83
4 3 4528 24375 303 162 2 83

the format is
Element label, boundary number, parent element 1. parent element 2, element type(303 is triangle) node 1, node 2, node 3

boundary number is the target in
Boundary condition 1
Boundary targets(1) = 3
potential = 0
End

The 3 in the boundary target corresponds to the boundary number, and every element in the boundary file with that boundary number will be in the boundary condition.

If you have 948 separate boundary numbers that would be unusual but possible, but most likely you have 948 boundary elements, the second column is the boundary number.
kevinarden
Posts: 2300
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by kevinarden »

Which mesh generator are you using? There are ways in salome and gmsh to name bodies and boundaries and when converted with ElmerGrid the names can be used vice the body and boundary numbers.
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by sunyuan »

Thank you very much for the nice explanation!!! I'm using Gmsh to generate mesh file, and after generated the mesh file I just lost the way to find which one is which...Is there a way to know? The same example that I only defined several wires.
kevinarden
Posts: 2300
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by kevinarden »

I make example and attached.

in the geo file you can see where I used gmsh to make physical groups of volumes for bodies, and physical groups of surfaces for boundaries.

When I use ElmerGrid to convert to elmer mesh
ElmerGrid 14 2 wires.msh -autoclean
I get two files that are hepful
entities.sif tell me which body numbers are the ones I named and which boundary numbers are the ones I named
mesh.names names the bodies and boundaries.
I can use this information in the sif to assign bodies and boundaries
or I can include them in the sif and use the names to assign bodies and boundaries instead of the numbers.
examplegmsh.zip
(72.72 KiB) Downloaded 55 times
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

Re: How to Write Boundary Conditions?

Post by sunyuan »

Thank you for the example, that is very helpful!
Post Reply