I sort of just mimic two sections from the tutorial “defining subdomains” and “setting multiple boundary conditions”.
First, I defined two subdomains, two disks in a square in 2D. Then marked them. Then defined measures.
def cell1_subdomain(x):
return (x[0]-c1_x)**2 + (x[1]-c1_y)**2 <= r1**2
def cell2_subdomain(x):
return (x[0]-c2_x)**2 + (x[1]-c2_y)**2 <= r2**2
subdomain_locator = [(1, cell1_subdomain),
(2, cell2_subdomain)]
facet_indices2, facet_markers2 = [], []
for (marker, locator) in subdomain_locator:
facets = mesh.locate_entities(domain_p, gdim, locator)
facet_indices2.append(facets)
facet_markers2.append(np.full_like(facets, marker))
facet_indices2 = np.hstack(facet_indices2).astype(np.int32)
facet_markers2 = np.hstack(facet_markers2).astype(np.int32)
sorted_facets2 = np.argsort(facet_indices2)
facet_tag2 = mesh.meshtags(domain_spatial_exclusion, gdim, facet_indices2[sorted_facets2], facet_markers2[sorted_facets2])
dx_p = Measure("dx", domain=domain_p, subdomain_data=facet_tag2)
But when I tried to compute area by assemble_scale of form(1 * dx_p(1)) it seems much smaller than the actual area of the circle. It seems I did not mark all the cells in the circle? How to solve this?