I’m trying to compute the integral on the set of facets that lie on the interface of two subdomain. I found a code on the Ngsolve forum which set up the interface indicator as follows. The file was attached.
[code]def GetInterfaceIndicator(mesh):
dom_indicator = GridFunction(L2(mesh,order=0))
dom_indicator.Set(CoefficientFunction([1,2]))
ffes = FacetFESpace(mesh,order=0)
dom_ind_average = GridFunction(ffes)
mf = BilinearForm(ffes,symmetric=True)
mf += SymbolicBFI(ffes.TrialFunction()ffes.TestFunction(),element_boundary=True)
mf.Assemble()
ff = LinearForm(ffes)
ff += SymbolicLFI(dom_indicatorffes.TestFunction(),element_boundary=True)
ff.Assemble()
dom_ind_average.vec.data = mf.mat.Inverse() * ff.vec
interface_indicator = BitArray(ffes.ndof)
for i in range(len(dom_ind_average.vec)):
if (dom_ind_average.vec[i] > 1.75) or (dom_ind_average.vec[i] < 1.25):
interface_indicator[i] = False
else:
interface_indicator[i] = True
print(“facets marked as interface facets:”, interface_indicator)
return interface_indicator
[/code]
Could you please explain what the dom_ind_average is and why we have 1.75 and 1.25 in the code?
if (dom_ind_average.vec[i] > 1.75) or (dom_ind_average.vec[i] < 1.25):
Does Ngsolve have any functions about setting the similar interfaces, or any literature where I can find some related information?
Thank you so much.
Updated: Source of the attached file
Attachment: 2domain.py