mesh.domains().set_marker


116
views
0
5 months ago by
Ovais  
Hi there, I am trying to mark boundary of a mesh through a code obtained from a repo. I have been able to successfully achieve my aim but i am not able to understand the exact function of a line which has been quite often used in such codes.
# Marking boundaries 
class Epicardium(SubDomain): 			
	def inside(self, x, on_boundry):
		return on_boundry

class Endocardium(SubDomain): 			
	def inside(self, x, on_boundry):
		return (x[0]*x[0]+x[2]*x[2] < (a2*a2)*(1.0-(x[1]*x[1])/(c2*c2)) + 1e-7) and on_boundry

class Base(SubDomain): 		
	def inside(self, x, on_boundry):
		return (x[1] > -1e-7) and on_boundry

def Make_SubDomains(mesh):
	mf = FacetFunction("size_t", mesh)							# for marking facets the function has to be defined
	mf.set_all(0)												# set value of all facets to zero
	Epicardium().mark(mf, 40)  									# External boundary facets to be marked 40
	Endocardium().mark(mf, 30)									# Inside boundary facets marked 30
	Base().mark(mf,10) 											# Base boundary facets marked 10
	#plot(mf,interactive=True)
	for facet in facets(mesh):                                  
		mesh.domains().set_marker((facet.index(), mf[facet]), 2)

	return mf​

I want to understand the purpose of the line in the loop i.e. mesh.domains().set_marker((facet.index(), mf[facet]), 2). What it does and why is it necessary ? . I have tried to print this whole line and i do understand that it sets all facets to logic: false.But why is it required ?

Some guidance would be really welcome.
Best regards.

Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »