This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Quadrature on a finer mesh

+2 votes

I have two meshes. One fine mesh on which my diffusion coefficient K is defined. And one coarse mesh on which I want to have my degrees of freedom. I know that the coarse functions can be expressed in the fine space, so that, in principle the quadrature could be made exact by prolonging the coarse space functions to the fine space and use standard quadrature rules.

Now, the question is: is it possible to perform the quadrature for the assemble command in the following code on the fine mesh somehow? If I am not mistaken, what happens in the background is that the fine function K is projected to Vc. I basically want the opposite: To prolong u and v to Vf to perform the quadrature.

from dolfin import *
import numpy as np

# Create one fine and one coarse mesh
meshFine   = UnitSquareMesh(2, 2)
meshCoarse = UnitSquareMesh(1, 1)

# Create CG spaces on the two meshes
Vf = FunctionSpace(meshFine, "CG", 1)
Vc = FunctionSpace(meshCoarse, "CG", 1)

# Let K be a fine function
K = Function(Vf)

# Set K to something, here random values
K.vector()[:] = np.random.rand(K.vector().size())

u = TrialFunction(Vc)
v = TestFunction(Vc)

# Assemble the matrix corresponding to a diffusion operator
# with fine diffusion data K.
A = assemble(K*dot(grad(u),grad(v))*dx(meshCoarse))
asked Feb 12, 2015 by hellman FEniCS Novice (360 points)
...