Hi,
I wonder how I can get a scalar product of functions defined on partially overlapping submeshes in the way that only common finite elements contribute into the integral (i.e. we assume that a function is equal to zero at points outside the submesh it was originally defined on)
from dolfin import *
# parameters['allow_extrapolation'] = True
mesh = UnitSquareMesh(32, 32)
submesh1 = UnitSquareMesh(16, 16)
submesh1.scale(.5)
submesh2 = UnitSquareMesh(16, 16)
submesh2.scale(.5)
submesh2.translate(Point(.25, 0))
W = FunctionSpace(mesh, 'P', 1)
W1 = FunctionSpace(submesh1, 'P', 1)
W2 = FunctionSpace(submesh2, 'P', 1)
w1 = Function(W1)
w2 = Function(W2)
w1 = project(w1, W)
w2 = project(w2, W)
dx = Measure('dx', domain=mesh)
w1 * w2 * dx
If I donât specify parameters['allow_extrapolation'] = True
, I get an error (which is reasonable).
If I specify it, I wonât get what I expect (it wonât be a zero extrapolation, kind of ânearestâ instead)
I have seen this work-around. Didnât test it, still wonder if there is a âmore fenics-likeâ way to do this.
I am doing GMsFEM implementation, by the way. So, maybe I have chosen the wrong approach for this problem. I will write about it in more detail later, in the comments.
EDITS:
Change 8 elements in submeshes (code part) to 16, because it is more logical in the problem articulation