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

how the code compute $\nabla {u}$ in projection, $u$ is the solution from Lagrange elements of degree 1.

0 votes

how does the code compute the $\nabla {u}$ when do the projection, where $u$ is the solution from the Lagrange elements of degree 1. Because cross the cells boundary the $\nabla {u}$ have different values.

asked May 17, 2016 by bin.li FEniCS Novice (240 points)

1 Answer

0 votes

Have a look at the code, it is straightforward:
(v is here the input argument).

# Define variational problem for projection
w = TestFunction(V)
Pv = TrialFunction(V)
a = ufl.inner(w, Pv)*dx
L = ufl.inner(w, v)*dx

# Assemble linear system
A, b = assemble_system(a, L, bcs=bcs,
                       form_compiler_parameters=form_compiler_parameters)

Then this is solved.
This is the L2-projection.

answered May 17, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)
...