# Module compute¶

compute_L2_norm(MF, U, mim, CVids=None)

Compute the L2 norm of the (real or complex) field U.

If CVids is given, the norm will be computed only on the listed elements.

compute_L2_dist(MF, U, mim, mf2, U2, CVids=None)

Compute the L2 distance between U and U2.

If CVids is given, the norm will be computed only on the listed elements.

compute_H1_semi_norm(MF, U, mim, CVids=None)

Compute the L2 norm of grad(U).

If CVids is given, the norm will be computed only on the listed elements.

compute_H1_semi_dist(MF, U, mim, mf2, U2, CVids=None)

Compute the semi H1 distance between U and U2.

If CVids is given, the norm will be computed only on the listed elements.

compute_H1_norm(MF, U, mim, CVids=None)

Compute the H1 norm of U.

If CVids is given, the norm will be computed only on the listed elements.

compute_H2_semi_norm(MF, U, mim, CVids=None)

Compute the L2 norm of D^2(U).

If CVids is given, the norm will be computed only on the listed elements.

compute_H2_norm(MF, U, mim, CVids=None)

Compute the H2 norm of U.

If CVids is given, the norm will be computed only on the listed elements.

compute_gradient(MF, U, mf_du)

Compute the gradient of the field U defined on MeshFem mf_du.

The gradient is interpolated on the MeshFem mf_du, and returned in DU. For example, if U is defined on a P2 MeshFem, DU should be evaluated on a P1-discontinuous MeshFem. mf and mf_du should share the same mesh.

U may have any number of dimensions (i.e. this function is not restricted to the gradient of scalar fields, but may also be used for tensor fields). However the last dimension of U has to be equal to the number of dof of mf. For example, if U is a [3x3xNmf] array (where Nmf is the number of dof of mf), DU will be a [Nx3x3[xQ]xNmf_du] array, where N is the dimension of the mesh, Nmf_du is the number of dof of mf_du, and the optional Q dimension is inserted if Qdim_mf != Qdim_mf_du, where Qdim_mf is the Qdim of mf and Qdim_mf_du is the Qdim of mf_du.

compute_hessian(MF, U, mf_h)

Compute the hessian of the field U defined on MeshFem mf_h.

compute_eval_on_triangulated_surface(MF, U, Nrefine, CVLIST=None)

[OBSOLETE FUNCTION! will be removed in a future release] Utility function designed for 2D triangular meshes : returns a list of triangles coordinates with interpolated U values. This can be used for the accurate visualization of data defined on a discontinous high order element. On output, the six first rows of UP contains the triangle coordinates, and the others rows contain the interpolated values of U (one for each triangle vertex) CVLIST may indicate the list of convex number that should be consider, if not used then all the mesh convexes will be used. U should be a row vector.

compute_interpolate_on(MF, U, *args)

Synopsis: Ui = compute_interpolate_on(MeshFem MF, vec U, {MeshFem mfi | Slice sli | vec pts})

Interpolate a field on another MeshFem or a Slice or a list of points.

• Interpolation on another MeshFem mfi:
mfi has to be Lagrangian. If mf and mfi share the same mesh object, the interpolation will be much faster.
• Interpolation on a Slice sli:
this is similar to interpolation on a refined P1-discontinuous mesh, but it is much faster. This can also be used with Slice(‘points’) to obtain field values at a given set of points.
• Interpolation on a set of points pts

compute_extrapolate_on(MF, U, mfe)

Extrapolate a field on another MeshFem.

If the mesh of mfe 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 mfe is not exactly included in mf (imagine interpolation between a curved refined mesh and a coarse mesh), then values which are outside mf will be extrapolated.

compute_error_estimate(MF, U, mim)

Compute an a posteriori error estimate.

Currently there is only one which is available: for each convex, the jump of the normal derivative is integrated on its faces.

compute_error_estimate_nitsche(MF, U, mim, GAMMAC, GAMMAN, lambda_, mu_, gamma0, f_coeff, vertical_force)

Compute an a posteriori error estimate in the case of Nitsche method.

Currently there is only one which is available: for each convex, the jump of the normal derivative is integrated on its faces.

compute_convect(MF, U, mf_v, V, dt, nt, option=None, *args)

Synopsis: compute_convect(MeshFem MF, vec U, MeshFem mf_v, vec V, scalar dt, int nt[, string option[, vec per_min, vec per_max]])

Compute a convection of U with regards to a steady state velocity field V with a Characteristic-Galerkin method. The result is returned in-place in U. This method is restricted to pure Lagrange fems for U. mf_v should represent a continuous finite element method. dt is the integration time and nt is the number of integration step on the caracteristics. option is an option for the part of the boundary where there is a re-entrant convection. option = ‘extrapolation’ for an extrapolation on the nearest element, option = ‘unchanged’ for a constant value on that boundary or option = ‘periodicity’ for a peridiodic boundary. For this latter option the two vectors per_min, per_max has to be given and represent the limits of the periodic domain (on components where per_max[k] < per_min[k] no operation is done). This method is rather dissipative, but stable.