Fenics subdomain indicator in mesh file


272
views
-1
5 months ago by
In the Fenics documentation, it is mentionned that

DirichletBC takes three arguments, the first one is our function space V, the next is the boundary condition value and the third is the subdomain indicator which is information stored in the mesh.

Where is the subdomain indicator in the .xml mesh file? How do I change it's value?

--------

Context: I am solving on a domain that has multiple boundary parts, with a constant Dirichlet condition on each part.

The mesh file I'm using was generated using Triangle, and dolfin-convert to get an xml file.
Community: FEniCS Project

3 Answers


0
5 months ago by
So here is how I would do it via GMSH. Suppose I have the following right triangle:

I would use this code to define 3 vertices and then the lines between them and then declaring that there is a surface trapped by these 3 lines using the 'Line Loop' command. After all of this I define the three edges as "Physical lines" and at the end the area as a "Physical surface".

// Gmsh project created on Mon Mar 12 15:04:09 2018
SetFactory("OpenCASCADE");
//+
Point(1) = {0, 0, 0, 1.0};
//+
Point(2) = {2, 0, 0, 1.0};
//+
Point(3) = {0, 0, 0, 1.0};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 1};
//+
Line Loop(1) = {3, 1, 2};
//+
Plane Surface(1) = {1};
//+
Physical Line(1) = {3};
//+
Physical Line(2) = {2};
//+
Physical Line(3) = {1};
//+
Physical Surface(4) = {1};


and then I use the mesh command in the software to mesh it. After that I use "dolfin-convert" to convert it to .xml file. This produces three files that one of them is "filename_facet_region.xml". If you open it you will see that the software has marked each line by numbers 1,2,3 and the inside region is marked by 0. You can use these marks in your code.

-1
5 months ago by
Well I am assuming the mesh has been made via a third software like GMSH. In this software after you create your region bfore asking it to mesh it for you there is a comand that defines physical surfaces. There you can pick the surfaces that you want and mark them. In here the markers are 0, 1, 2 , 3, 4 as you can see in the BC definition part.
What does this change in the resulting .xml mesh file? Perhaps I can write a script to modify what needs to be in my own mesh file.
written 5 months ago by Isabelle Santos  
As stated, I am using Triangle as third-party software to make the mesh.
written 5 months ago by Isabelle Santos  
-1
5 months ago by
Ovais  
As i understand there are two parts to the questions you have asked.

1. identification or marking of boundaries

2. passing boundaries as subdomains in fenics.

For the first part , you have to search for ways to mark boundaries in the software of your choice. Better is to use gmsh as already stated in answer above. A very similar problem has been answered in this post : https://www.allanswered.com/post/rezow/#jrzab

I have tried marking boundaries of a mesh using ansys preprocessor and then i exported the file to gmsh. You can also read this post : https://www.allanswered.com/post/loran/how-to-mark-boundaries-of-irregular-mesh/


Point 2. here is not relevant, since it is addressed in the document I linked to.
written 5 months ago by Isabelle Santos  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »