What kind of object is CompiledSubDomain(“x < 1 && x < 1”)? Is it just a list of points…(0,0), (.5,.5) … or is there more information contained in that?
SubDomain instance. The methods can be looked up via
help(leave_right_top) in this case, much like for any other instance in python.
The reason for my question is that my SubMesh will not be as simple as identifying nodes in a particular region. I actually need to pull out the coordinates of my mesh, identify certain points on that mesh, then create the SubMesh based on those certain points
I see… If you just need to integrate on a portion of your mesh then you might not need
SubMesh per se. That could be done simply via a
MeshFunction, say marking the first 50 cells of your mesh and integrating over those
from dolfin import *
import numpy as np
mesh = UnitSquareMesh(10, 10)
meshMarks = cpp.mesh.MeshFunctionSizet(mesh, mesh.topology().dim())
meshMarks.array()[np.arange(50)] = 2
dx = Measure("dx", domain=mesh, subdomain_data=meshMarks)
u = Function(FunctionSpace(mesh, "DG", 0))
u.vector()[:] = 1
assemble(u * dx(2)) # should give 0.25
Now as long as you can identify the cells via some rule then tweaking the above method should work. Just go to the corresponding index (in the same order as the cells) in
meshMarks.array() and assign the value of your marker.
But if you have a list of points, then you might have to compute the cells which collide with those points (see this post) and then define the subdomain like in this case. There may be a more efficient approach, but I can’t think of one off the bat.
But if all this can be done in the pre-processing, then simply create a mesh with required markers and load the data into corresponding mesh functions at the beginning.