Skip to content

Instantly share code, notes, and snippets.

@presheaf
Created April 17, 2018 10:58
Show Gist options
  • Save presheaf/52a88007a842825b05beecbbd297c741 to your computer and use it in GitHub Desktop.
Save presheaf/52a88007a842825b05beecbbd297c741 to your computer and use it in GitHub Desktop.
from dolfin import *
from xii import *
N = 20
EPS = 1E-3
_mesh = RectangleMesh(Point(0, -1), Point(1, 1), N, 2 * N)
stokes_subdomain = dolfin.CompiledSubDomain(
"x[1] > 0", eps=EPS
)
subdomains = MeshFunction('size_t', _mesh, _mesh.topology().dim(), 0)
# Awkward marking
for cell in cells(_mesh):
x = cell.midpoint().array()
if stokes_subdomain.inside(x, False):
subdomains[cell] = 1
else:
subdomains[cell] = 0
submeshes, interface, _ = mortar_meshes(
subdomains, range(2), strict=True, tol=EPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment