I'd like to build a mesh of a 2d rectangle that contains a small circle. I'd like the node-spacing along the circle to be fine, where the node-spacing along the boundary of the rectangle to be sparse. Currently, I can only seem to send one spacing parameter to generate_mesh:
from dolfin import *
from mshr import *
cx, cy, radius = 0.5, 0.5, 0.1
lx, ly = 1.0, 1.0
RESOLUTION = 20
class circle(SubDomain):
def inside(self, x, on_boundary):
return pow(x[0] - cx, 2) + pow(x[1] - cy, 2) <= pow(radius, 2) + DOLFIN_EPS
# Define 2D geometry
domain1 = Rectangle(Point(0.0, 0.0), Point(lx, ly))
domain2 = Circle(Point(cx,cy),radius)
domain = domain1 - domain2
mesh = generate_mesh(domain, RESOLUTION)
I'd like to be able to pass two (or more) values for the resolution parameter, if possible? One for each domain?
EDIT:
I'm noticing the following quirk:
Let's say I want to compute a path integral about my circle (which, incidentally, why I'd like to increase the resolution). Simply refining the mesh doesn't seem to improve the accuracy.
Example: The circumference of the circle in this example is 2*pi / 10 ~ 0.6283185307179586.
When I compute the following path integration:
markers = FacetFunctionSizet(mesh, 0)
ds = ds[markers]
circle().mark(markers,1)
form = 1*ds(1,domain=mesh)
ans = assemble(form)
print(ans)
Which returns: 0.627309698109
Increasing the RESOLUTION from 20 to 100 does not improve this answer at all. I'm a little vexxed by this, so any guidance would be greatly appreciated.