H2Lib  3.0
Data Structures | Typedefs | Functions
tet3dp1

Piecewise linear space with nodal basis functions on a three-dimensional tetrahedral mesh. More...

Data Structures

struct  _tet3dp1
 Representation of a trial space with piecewise linear nodal basis functions on a three-dimensional tetrahedral mesh. More...
 

Typedefs

typedef struct _tet3dp1 tet3dp1
 Representation of a trial space with piecewise linear nodal basis functions on a three-dimensional tetrahedral mesh.
 
typedef tet3dp1ptet3dp1
 Pointer to a tet3dp1 object.
 
typedef const tet3dp1pctet3dp1
 Pointer to a constant tet3dp1 object.
 

Functions

ptet3dp1 new_tet3dp1 (pctet3d gr)
 Create a tet3dp1 object using a tet3d mesh. More...
 
void del_tet3dp1 (ptet3dp1 dc)
 Delete a tet3dp1 object. More...
 
psparsematrix build_tet3dp1_sparsematrix (pctet3dp1 dc)
 Create a sparsematrix with a sparsity pattern matching the nodal basis functions. More...
 
psparsematrix build_tet3dp1_interaction_sparsematrix (pctet3dp1 dc)
 Create a sparsematrix with a sparsity pattern matching the nodal basis functions. More...
 
psparsematrix build_tet3dp1_prolongation_sparsematrix (pctet3dp1 dfine, pctet3dp1 dcoarse, pctet3dref rf)
 Create a prolongation matrix. More...
 
void assemble_tet3dp1_laplace_sparsematrix (pctet3dp1 dc, psparsematrix A, psparsematrix Af)
 Assemble stiffness matrix. More...
 
void assemble_tet3dp1_mass_sparsematrix (pctet3dp1 dc, psparsematrix M, psparsematrix Mf)
 Assemble mass matrix. More...
 
void assemble_tet3dp1_dirichlet_avector (pctet3dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector d)
 Discretize Dirichlet boundary values. More...
 
void assemble_tet3dp1_functional_avector (pctet3dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector b)
 Discretize an $L^2$-functional. More...
 
real normmax_tet3dp1 (pctet3dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector xs)
 Compute the vertex-wise maximum norm of the discretization error. More...
 
real norml2_tet3dp1 (pctet3dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pcavector xs, pcavector xf)
 Compute the $L^2$-norm of the discretization error. More...
 
pclustergeometry build_tet3dp1_clustergeometry (pctet3dp1 p1, uint *idx)
 Create a clustergeometry object for a FEM-discretisation with p1-functions. More...
 

Detailed Description

Piecewise linear space with nodal basis functions on a three-dimensional tetrahedral mesh.

Function Documentation

void assemble_tet3dp1_dirichlet_avector ( pctet3dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pavector  d 
)

Discretize Dirichlet boundary values.

For each fixed vertex, the function $f$ is evaluated and the result is written to the corresponding entry in the result. In the standard case, this provides us with a coefficient vector corresponding to the piecewise linear interpolation of the Dirichlet boundary values. Subtracting $A_f d$ from the right-hand side of our equation, where $A_f$ is the interaction matrix, yields the right-hand side of the problem with homogeneous Dirichlet boundary conditions.

Parameters
dctet3dp1 object describing the trial space.
fDirichlet boundary values.
fdataAdditional data for f.
dTarget vector of dimension dc->nfix.
void assemble_tet3dp1_functional_avector ( pctet3dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pavector  b 
)

Discretize an $L^2$-functional.

For each triangle tetrahedra, the element vector is computed by applying the edge-midpoint quadrature. Its components are then added to the corresponding entries in $b$. Since $b$ is cleared before this step, the result is given by $b_i = \int f(x) \varphi_i(x) \,dx$.

Parameters
dctet3dp1 object describing the trial space.
fRight-hand side function.
fdataAdditional data for f.
bTarget vector of dimension dc->ndof.
void assemble_tet3dp1_laplace_sparsematrix ( pctet3dp1  dc,
psparsematrix  A,
psparsematrix  Af 
)

Assemble stiffness matrix.

Element matrices for all tetrahedra are computed and added to the corresponding entries in A and Af.

Parameters
dctet3dp1 object describing the trial space.
ATarget matrix for degrees of freedom.
AfTarget matrix for interactions between fixed vertices and degrees of freedom.
void assemble_tet3dp1_mass_sparsematrix ( pctet3dp1  dc,
psparsematrix  M,
psparsematrix  Mf 
)

Assemble mass matrix.

Element matrices for all tetrahedra are computed and added to the corresponding entries in M and Mf.

Parameters
dctet3dp1 object describing the trial space.
MTarget matrix for degrees of freedom.
MfTarget matrix for interactions between fixed vertices and degrees of freedom.
pclustergeometry build_tet3dp1_clustergeometry ( pctet3dp1  p1,
uint idx 
)

Create a clustergeometry object for a FEM-discretisation with p1-functions.

Create a clustergeometry object basing on a tetrahedral tet3d mesh and linear nodal basis function.

Parameters
p1tet3dp1 object.
idxArray of indices.
Returns
Clustergeometry object
psparsematrix build_tet3dp1_interaction_sparsematrix ( pctet3dp1  dc)

Create a sparsematrix with a sparsity pattern matching the nodal basis functions.

Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share at least one triangle, the entry $a_{ij}$ appears in the graph of the matrix.

Here, only $i$ refers to a degree of freedom, while $j$ is the index of a fixed vertex, i.e., has to be between 0 and nfix-1.

Parameters
dctet3dp1 object describing the space.
Returns
Sparse matrix with dc->ndof rows and dc->nfix columns.
psparsematrix build_tet3dp1_prolongation_sparsematrix ( pctet3dp1  dfine,
pctet3dp1  dcoarse,
pctet3dref  rf 
)

Create a prolongation matrix.

dcoarse and dfine have to correspond to a coarse mesh and its refinement created by refine_tet3d. The refinement relationship is described by rf.

This function not only creates the matrix, but also fills it with correct coefficients.

Parameters
dfinetet3dp1 object corresponding to the refined mesh.
dcoarsetet3dp1 object corresponding to the coarse mesh.
rfRefinement relationship.
Returns
sparsematrix containing the prolongation matrix.
psparsematrix build_tet3dp1_sparsematrix ( pctet3dp1  dc)

Create a sparsematrix with a sparsity pattern matching the nodal basis functions.

Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share at least one triangle, the entry $a_{ij}$ appears in the graph of the matrix.

Here, both $i$ and $j$ refer to degrees of freedom, i.e., there indices are between 0 and ndof-1.

Parameters
dctet3dp1 object describing the space.
Returns
Sparse matrix with dc->ndof rows and columns.
void del_tet3dp1 ( ptet3dp1  dc)

Delete a tet3dp1 object.

Parameters
dcObject to be deleted.
ptet3dp1 new_tet3dp1 ( pctet3d  gr)

Create a tet3dp1 object using a tet3d mesh.

The boundary flags gr->xb are used to decide whether a vertex corresponds to a degree of freedom or is fixed.

Parameters
grMesh
Returns
tet3dp1 object matching gr.
real norml2_tet3dp1 ( pctet3dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pcavector  xs,
pcavector  xf 
)

Compute the $L^2$-norm of the discretization error.

Compare the function f to the discrete function described by the vector xs (for the degrees of freedom) and xf (for the fixed vertices). Measure the difference in the $L^2$-norm.

Parameters
dctet3dp1 object describing the trial space.
fFunction.
fdataAdditional data for f.
xsCoefficients of discrete function.
xfCoefficients of fixed part of discrete function
Returns
$L^2$-norm of discretization error.
real normmax_tet3dp1 ( pctet3dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pavector  xs 
)

Compute the vertex-wise maximum norm of the discretization error.

Evaluate f in all non-fixed vertices and compute the difference with the corresponding component of xs. The maximum of the absolute values gives the vertex-wise $\ell^\infty$-norm of the discretization error.

Parameters
dctet3dp1 object describing the trial space.
fFunction.
fdataAdditional data for f.
xsCoefficients of discrete function.
Returns
$\ell^\infty$-norm of discretization error.