Space L2 (15-space-l2)ΒΆ

Git reference: Tutorial example 15-space-l2.

The L^2 space is frequently used in Navier-Stokes equations where it keeps the velocity discreetely divergence-free. This example shows how to create an L^2 space, visualize finite element basis functions, and perform an orthogonal L^2-projection of a continuous function onto the FE space.

First, an L^2 space is created as the reader expects:

// Create an L2 space with default shapeset.
L2Space space(&mesh, P_INIT);

The function to be projected is:

scalar CustomExactSolution::value (double x, double y) const
{
  return - pow(x, 4) * pow(y, 5);
}

And the projection is done as follows:

OGProjection::project_global(&space, &sln_exact, &sln, matrix_solver);

Sample basis functions:

Sample basis function Sample basis function Sample basis function Sample basis function

The projection (note that this is a discontinuous function):

Projection

Previous topic

Space H(div) (10-space-hdiv)

Next topic

Remote Computing (20-remote-computing)