Hi,
I am working on a solid mechanics problem that is solved on subdomains and then the results (e.g. stresses) are merged into the global domain. It’s not complex like mapping (project/interpolate) since the meshes are according and elements are the same, except I use Quadrature element. I created the MME but it cannot work. Any suggestions are welcome.
import fenics as fe
fe.parameters["form_compiler"]["representation"] = 'quadrature'
import warnings
from ffc.quadrature.deprecation import QuadratureRepresentationDeprecationWarning
warnings.simplefilter("once", QuadratureRepresentationDeprecationWarning)
# create meshes
mesh_whole = fe.RectangleMesh(fe.Point(0,0), fe.Point(2,1), 4, 2)
mesh_left = fe.RectangleMesh(fe.Point(0,0), fe.Point(1,1), 2, 2)
mesh_right = fe.RectangleMesh(fe.Point(1,0), fe.Point(2,1), 2, 2)
# Quadrature element
We = fe.VectorElement('Quadrature', mesh_whole.ufl_cell(), degree=1, dim=4, quad_scheme='default')
# FunctionSpaces based on Quadrature element
W0 = fe.FunctionSpace(mesh_whole, We)
W1 = fe.FunctionSpace(mesh_left, We)
W2 = fe.FunctionSpace(mesh_right, We)
# expression for test
expr = fe.Expression(('x[0]+x[1]', 'x[0]-x[1]', 'x[0]-x[1]', 'x[0]*x[1]'), degree=1)
sig_whole = fe.interpolate(expr, W0)
sig_left = fe.interpolate(expr, W1)
sig_right = fe.interpolate(expr, W2)
# create a function for merging the sig from left and right domain
sig_merged = fe.Function(W0)
# I tried 'interpolate', but it cannot be used for Quadratureelement
# I also tried 'project', but the domain is mismatch
sig_merged.interpolate(sig_left)
sig_merged.interpolate(sig_right)
# finally, I hope to get sig_merged == sig_whole
Thanks,
Ming