Integration over different volumes
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?
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).
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)
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)