Integrate over elements on coarser mesh

3 months ago by

In light of the integration per cell question, I wonder if it's possible to do the same except when the function $e$e is defined on a uniformly refined grid. More precisely, I wonder if it's possible to something like:
from dolfin import *

n = 2
mesh = UnitSquareMesh(n, n)

V = FunctionSpace(mesh.child(), "CG", 1)
e = Expression("sin(pi*x[0])", element=V.ufl_element())

E = assemble(TestFunction(FunctionSpace(mesh, "DG", 0))*e*dx(mesh.child()))​
# should be a vector of length 2*n^2 = 8

diff = assemble(e*dx(mesh.child())) - E.sum()
# should be 0 to machine precision

The function  $e$e  on the fine mesh will be used for determining which cells on the coarse mesh which will be refined.

Thank you.
Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »