Integration over different volumes

427
views
1
5 months ago by
Hi,

I am trying to solve a problem on a cylindrical shell like below:

The inner hole has a radius of 0.6 and the big cylinder has a radius of 1. I have used GMSH to create this cylinder and when I convert it to shell.xml it gives me two additional files shell_physical_region.xml and shell_facet_region.xml.
First of all, what is the use of each?
second of all, what should I do if I want to integrate a function Pi for the radius between 0.6 to 0.8 using a certain set of parameters and then from 0.8 to 1 using a different set of parameters? In other words, how can I break the volume integral  $\int\pi dx$πdx into the two volumes?

Community: FEniCS Project

2
5 months ago by
1. facets are required for imposing boundary condition. (For further details on marking of facets and boundary condition you should read Fenics manual chap 4 on Subdomains and Boundary Conditions here)
def Make_SubDomains(mesh):
mf = FacetFunction("size_t", mesh)
mf.set_all(0)

File("facet_function.xml")>> mf
return mf​

2. for integrating over the inner or outer volume you can use the following :-
(30 is the boundary of interest marked through facet_function).

mesh = Mesh('abc.xml')

def Make_SubDomains(mesh):
mf = FacetFunction("size_t", mesh)
mf.set_all(0)

File("facet_function.xml")>> mf
return mf

#Identify boundaries as facets and add markes to facets through call of Make_SubDomains
boundaries = Make_SubDomains(mesh)
ds = ds[boundaries]
n_mesh = FacetNormal(mesh)

X = SpatialCoordinate(mesh)
vol = abs(assemble((-1.0/3.0)*dot(X, n_mesh)*ds(30)))
print(vol)


I am using FEniCS 2016.1.0. This code gives correct volume on my system. You may try. ( divergence theorem has been used to convert volume integral to a surface integral in above formulation)

best regards.
Thanks for the answer. Could you please also tell me what is the use of the abc_physical_region.xml? Also I am able to mark different boundaries for a volume but I have a problem breaking a volume into smaller volumes. Do we still need to use facet region for breaking the volume into smaller volumes or that's when the physical_region comes into play?
written 5 months ago by Navid Mirzaei
I have not used gmsh before except for changing format of meshes. But you can easily make out the purpose of any xml file related to mesh by opening it in Notepad++ and comparing it with your mesh file in xml format.

Why do u want to break the volume into separate volumes ? post a separate question with few details.
Regards.
written 5 months ago by Ovais
Physical region contains information on 3D subdomains in a 3D mesh. With this you can for example prescribe different material behaviour or accomplish the task you were interested in, i.e. the integration.
In gmsh you should be able to define markers for different parts of your mesh. For example you could define a marker 1 for the inner part $.6\le r\le.8$.6r.8 ) and a marker 2 for the outer part ( $.8\le r\le1.$.8r1. ). Then you can define the integrals over the different parts as explained here:
written 5 months ago by klunkean
Thank both of you. Your answers were enlightening. I figured that If I originally define to concentric cylinders from gmsh it does the marking itself and I really don't need to bother with marking.
Thank you so much.
written 5 months ago by Nima
do u know how to mark boundaries on an imported mesh in gmsh ? if you know or find some source on it please do share
written 5 months ago by Ovais
1
Yes. If you add your physical surfaces one by one (not all together) then after conversion into .xml if you open the facet_region file you will see the software has originally marked the surfaces.
written 5 months ago by Nima
Thanks for the responce. I have a mesh that have been created through some other software but i was able to mark the faces through preprocessor of Ansys. After that i have imported the mesh as .stl format into gmsh. Once i open the mesh in gmsh i get message pasted below. Now can you please guide me how to convert this to .xml format with facets ?. I am able to the mesh as .msh format and then convert through dolfin-convert but in that case i dont get any facets. What to do ? (i mean how to get .xml format facets of this mesh)
---------------------------------------------------------------------------------------

Info : 3266 facets in solid 0
Info : 13311 facets in solid 1
Info : 4577 facets in solid 2
Info : 1 facets in solid 3
Info : 7615 facets in solid 4
Info : 4480 facets in solid 5