gf_compute

Purpose

Various computations involving the solution U of the finite element problem.

Synopsis

N = gf_compute(mf, U, 'L2 norm', mesh_im MIM [,ivec CVLST])
N = gf_compute(mf, U, 'H1 semi norm', mesh_im MIM [,CVLST])
N = gf_compute(mf, U, 'H1 norm', mesh_im MIM [,ivec CVLST])
N = gf_compute(mf, U, 'H2 semi norm', mesh_im MIM [,CVLST])
N = gf_compute(mf, U, 'H2 norm', mesh_im MIM [,ivec CVLST])
DU = gf_compute(mf, U, 'gradient', mesh_fem mfgrad)
D2U = gf_compute(mf, U, 'hessian', mesh_fem mfhess)
U2 = gf_compute(mf, U, 'interpolate on', mesh_fem mf2)
U2 = gf_compute(mf, U, 'interpolate on', mesh_slice sl)
[U2[,mf2,[,X[,Y[,Z]]]]] = gf_compute(mf,U,'interpolate on Q1 grid', 
      {'regular h', hxyz | 'regular N',Nxyz | X[,Y[,Z]]})
U2 = gf_compute(mf, U, 'extrapolate on', mesh_fem mf2)
E = gf_compute(mf, U, 'error estimate',  mesh_im MIM) 

Description

The first two arguments of this function are always mf and U, where U is a field defined on the mesh_fem mf.

gf_compute(mf, U, 'L2 norm', mim, [, CVLST]) : compute the L2 norm of U. If CVLST is indicated, the norm will be computed only on the listed convexes.

gf_compute(mf, U, 'H1 semi norm', mim [, CVLST]) : compute the L2 norm of U.

gf_compute(mf, U, 'H1 norm', mim [, CVLST]) : compute the H1 norm of U.

gf_compute(mf, U, 'H2 semi norm', mim, [, CVLST]) : compute the L2 norm of 2 U.

gf_compute(mf, U, 'H2 norm', mim [, CVLST]) : compute the H2 norm of U.

DU=gf_compute(mf, U, 'gradient', mfgrad) : compute the gradient of the field U defined on mesh_fem mf. The gradient is interpolated on the mesh_fem mfgrad, and returned in DU. In most of the cases, you should choose a discontinuous FEM of mfgrad, since the derivative of U won't be (in the general case) continuous across element faces. For example, if U is defined on a P2 mesh_fem, DU should be evaluated on a P1-discontinuous mesh_fem. mf and mfgrad should share the same mesh. If they also have the same Qdim, then size(DU)==mdim×nbdof(mfgrad), where mdim is the dimension of the common mesh. But if qdim(mfgrad)==1 and qdim(mf) =1, then DU is given as a 3D array of dimensions mdim×qdim(mf)×nbdof(MFGRAD).

D2U=gf_compute(mf, U, 'hessian', mfhess) : compute the second derivative of the field U.

U2 = gf_compute(mf, U, 'interpolate on', mf2) : interpolate a field defined on mesh_fem mf on another (lagrangian) mesh_fem mf2. If mf and mf2 share the same mesh object, the interpolation will be much faster.

U2 = gf_compute(mf, U, 'interpolate on', sl) : interpolate a field defined on mesh_fem mf on a mesh slice (similar to interpolation on a refined P1-discontinuous mesh). This can also be used (with gf_slice('points')) to obtain field values at a given set of points.

[U2[,mf2,[,X[,Y[,Z]]]]] = gf_compute(mf,U, 'interpolate on Q1 grid', {'regular h', hxyz | 'regular N',Nxyz | X[,Y[,Z]]}) : create a cartesian Q1 mesh_fem mf2 and interpolates U on it. The returned field U2 is organized in a matrix such that it can be drawn via the matlab command pcolor.

U2 = gf_compute(mf, U, 'extrapolate on', mf2) : If the mesh of mf2 is stricly included in the mesh of mf, this function does stricly the same job as gf_compute('interpolate on'). However, if the mesh of mf2 is not exactly included in mf (imagine interpolation between a curved refined mesh and a coarse mesh), then values which are slightly outside mf will be extrapolated.

E = gf_compute(mf, U, 'error estimate', mim) can be used to obtain an a posteriori error estimation on each convex of the mesh. Currently there is only error estimator which is available: for each convex, the jump of the normal derivative is integrated on its faces.

Examples

Using the error estimate to refine the worst convexes:

    E=gf_compute(mf, U, 'error_estimate', mim);
    gf_mesh_set(m, 'refine', find(E < 1e-3));