H2Lib  3.0
Data Structures | Typedefs | Functions
tet3drt0

Lowest order Raviart-Thomas space on a three-dimensional tetrahedral mesh. More...

Data Structures

struct  _tet3drt0
 Representation of a trial space with lowest order Raviart-Thomas basis functions on a three-dimensional tetrahedral mesh. More...
 

Typedefs

typedef struct _tet3drt0 tet3drt0
 Representation of a trial space with Raviart-Thomas edge basis functions on a three-dimensional tetrahedral mesh.
 
typedef tet3drt0ptet3drt0
 Pointer to tet3drt0 object.
 
typedef const tet3drt0pctet3drt0
 Pointer to a constant tet3drt0 object.
 

Functions

ptet3drt0 new_tet3drt0 (pctet3d gr)
 Create a tet3drt0 object using a tet3d mesh. More...
 
void update_tet3drt0 (ptet3drt0 rt0)
 Update the numbers of degrees of freedoms and fixed faces after mixed boundary conditions were set. More...
 
void del_tet3drt0 (ptet3drt0 rt)
 Delete a tet3drt0 object. More...
 
psparsematrix build_tet3drt0_A_sparsematrix (pctet3drt0 dc)
 Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions and representing the upper left block of the saddle-point problem. More...
 
psparsematrix build_tet3drt0_B_sparsematrix (pctet3drt0 dc)
 Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions for the flux and piecewise- constant functions for the pressure representing the lower left block of the saddle-point problem. More...
 
psparsematrix build_tet3drt0_A_interaction_sparsematrix (pctet3drt0 dc)
 Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions and representing the upper left block of the saddle-point problem representing the interaction matrix. More...
 
psparsematrix build_tet3drt0_B_interaction_sparsematrix (pctet3drt0 dc)
 Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions for the flux and piecewise- constant functions for the pressure representing the lower left block of the saddle-point problem representing the interaction matrix. More...
 
void assemble_tet3drt0_darcy_A_sparsematrix (pctet3drt0 dc, psparsematrix A, psparsematrix Af, pavector K)
 Assemble the upper left block of the system matrix. More...
 
void assemble_tet3drt0_darcy_B_sparsematrix (pctet3drt0 dc, psparsematrix A, psparsematrix Af)
 Assemble the lower left block of the system matrix. More...
 
void assemble_tet3drt0_b_D_avector (pctet3drt0 dc, field(*f)(const real *e, void *fdata), void *fdata, pavector d)
 Discretize Dirichlet boundary values. More...
 
void assemble_tet3drt0_b_f_avector (ptet3drt0 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector fv)
 Discretize an $L^2$ -functional. More...
 
void assemble_tet3drt0_g_N_avector (ptet3drt0 dc, field(*f)(const uint *e, void *data), void *data, pavector g)
 Discretize Neumann Boundary values. More...
 
real norml2_pressure_centroid_tet3drt0 (pctet3drt0 dc, field(*f)(const real *x, void *fdata), void *fdata, pcavector x2)
 Compute the $L^2$-norm of the discretization error for the pressure using the centroid rule. More...
 
real norml2_pressure_facemidpoint_tet3drt0 (pctet3drt0 dc, field(*f)(const real *x, void *fdata), void *fdata, pcavector x2)
 Compute the $L^2$-norm of the discretization error for the pressure using the centroid rule. More...
 
real norml2_flux_centroid_tet3drt0 (pctet3drt0 dc, void(*q)(const real *x, void *fdata, pavector v), void *fdata, pcavector x1, pcavector g)
 Compute the $L^2$-norm of the discretization error for the flux using the centroid rule. More...
 
real norml2_flux_facemidpoint_tet3drt0 (pctet3drt0 dc, void(*q)(const real *x, void *fdata, pavector v), void *fdata, pcavector x1, pcavector g)
 Compute the $L^2$-norm of the discretization error for the flux using the face midpoint rule. More...
 
pclustergeometry build_tet3drt0_A_clustergeometry (pctet3drt0 rt, uint *idx)
 Create a clustergeometry object for the clustering ofthe degrees of freedom (edges). More...
 
pclustergeometry build_tet3drt0_B_clustergeometry (pctet3drt0 rt, uint *idx)
 Create a clustergeometry object for the clustering of the triangles. More...
 

Detailed Description

Lowest order Raviart-Thomas space on a three-dimensional tetrahedral mesh.

E.g., this space is useful to discretize darcy's flow(Raviart-Thomas) and conservation of mass (piecewise constant functions), this leads to a saddle-point problem:

\[ \begin{pmatrix} A & B^T\\ B & \end{pmatrix} \begin{pmatrix} x_1\\ x_2 \end{pmatrix} = \begin{pmatrix} b_D\\ b_f \end{pmatrix} \]

Function Documentation

void assemble_tet3drt0_b_D_avector ( pctet3drt0  dc,
field(*)(const real *e, void *fdata)  f,
void *  fdata,
pavector  d 
)

Discretize Dirichlet boundary values.

For each Dirichlet face, the function $f$ is evaluated with the face midpoint rule and the result is written to the corresponding entry in the result vector. for each non boundary face the corresponding entry is zero.

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

Discretize an $L^2$ -functional.

For each tetrahedron the entry of $fv_i$ is computed by applying the face-midpoint quadrature. Since $fv$ is cleared before this step, the result is given by $fv_i = \int_{T_i} f(x) \,dx$.

Parameters
dctet3drt0 object describing the trial space.
fRight-hand side function of the conservation of mass.
fdataAdditional data for f.
fvTarget vector of dimension dc->t2->triangles.
void assemble_tet3drt0_darcy_A_sparsematrix ( pctet3drt0  dc,
psparsematrix  A,
psparsematrix  Af,
pavector  K 
)

Assemble the upper left block of the system matrix.

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

Parameters
dctet3drt0 object describing the trial space.
ATarget matrix for degrees of freedom.
AfTarget matrix for interactions between fixed vertices and degrees of freedom.
KVector of length dc->t3->tetrahedra filled with a (constant) permeability for each element
void assemble_tet3drt0_darcy_B_sparsematrix ( pctet3drt0  dc,
psparsematrix  A,
psparsematrix  Af 
)

Assemble the lower left block of the system matrix.

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

Parameters
dctet3drt0 object describing the trial space.
ATarget matrix for degrees of freedom.
AfTarget matrix for interactions between fixed vertices and degrees of freedom.
void assemble_tet3drt0_g_N_avector ( ptet3drt0  dc,
field(*)(const uint *e, void *data)  f,
void *  data,
pavector  g 
)

Discretize Neumann Boundary values.

Subtracting $A_f g$ resp. $Bf g$ from the right-hand side of our equation, where $A_f$ resp. $Bf g$ is the interaction matrix, yields the right-hand side of the problem with Neumann boundary conditions.

Parameters
dctet3drt0 object describing the trial space.
fNeumann Boundary values.
dataAdditional data for f.
gTarget vector of dimension dc->nfix.
pclustergeometry build_tet3drt0_A_clustergeometry ( pctet3drt0  rt,
uint idx 
)

Create a clustergeometry object for the clustering ofthe degrees of freedom (edges).

Create a clustergeometry object basing on a triangular tri2d mesh and Raviart-Thomas functions.

Parameters
rttet3drt0 object.
idxArray of indices (here: for the degrees of freedoms (edges)).
Returns
Clustergeometry object.
psparsematrix build_tet3drt0_A_interaction_sparsematrix ( pctet3drt0  dc)

Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions and representing the upper left block of the saddle-point problem representing the interaction matrix.

Creates a sparse matrix matching the Raviart-Thomas functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share one tetrahedron, 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 edge, i.e. has to be between 0 and nfix-1.

Parameters
dctet3drt0 object describing the space.
Returns
Sparse matrix with dc->ndof rows and dc->nfix columns.
psparsematrix build_tet3drt0_A_sparsematrix ( pctet3drt0  dc)

Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions and representing the upper left block of the saddle-point problem.

Creates a sparse matrix matching the Raviart-Thomas functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share at least one tetrahedron, 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
dctet3drt0 object describing the space.
Returns
Sparse matrix with dc->ndof rows and columns.
pclustergeometry build_tet3drt0_B_clustergeometry ( pctet3drt0  rt,
uint idx 
)

Create a clustergeometry object for the clustering of the triangles.

Create a clustergeometry object basing on a triangular tri2d mesh and linear nodal basis functions.

Parameters
rttet3drt0 object.
idxArray of indices (here: for the triangles).
Returns
Clustergeometry object.
psparsematrix build_tet3drt0_B_interaction_sparsematrix ( pctet3drt0  dc)

Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions for the flux and piecewise- constant functions for the pressure representing the lower left block of the saddle-point problem representing the interaction matrix.

Creates a sparse matrix matching the Raviart-Thomas functions for the flux and piecewise-constant functions for the pressure: if the supports of basis functions $\varphi_i$ (pressure) and $\varphi_j$ (flux) share at least one tetrahedron, the entry $a_{ij}$ appears in the graph of the matrix.

$i$ refers to the number of tetrahedra in the mesh, i.e., the indices are between 0 and dc->t3->tetrahedra-1 and $j$ is the index of a fixed face, i.e. has to be between 0 and nfix-1.

Parameters
dctri2drt0 object describing the space.
Returns
Sparse matrix with dc->t3->tetrahedra rows anddc->nfix columns.
psparsematrix build_tet3drt0_B_sparsematrix ( pctet3drt0  dc)

Create a sparsematrix with a sparsity pattern matching the lowest order Raviart-Thomas functions for the flux and piecewise- constant functions for the pressure representing the lower left block of the saddle-point problem.

Creates a sparse matrix matching the Raviart-Thomas functions for the flux and piecewise-constant functions for the pressure: if the supports of basis functions $\varphi_i$ (pressure) and $\varphi_j$ (flux) share at least one tetrahedron, the entry $a_{ij}$ appears in the graph of the matrix.

$i$ refers to the number of triangles in the mesh, i.e., the indices are between 0 and dc->t2->triangles-1 and $j$ refers to degrees of freedom,i.e., the indices are between 0 and ndof-1.

Parameters
dctet3drt0 object describing the space.
Returns
Sparse matrix with dc->t3->tetrahedra rows anddc->ndof columns.
void del_tet3drt0 ( ptet3drt0  rt)

Delete a tet3drt0 object.

Parameters
rtObject to be deleted.
ptet3drt0 new_tet3drt0 ( pctet3d  gr)

Create a tet3drt0 object using a tet3d mesh.

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

Parameters
grMesh
Returns
tet3drt0 object matching gr.
real norml2_flux_centroid_tet3drt0 ( pctet3drt0  dc,
void(*)(const real *x, void *fdata, pavector v)  q,
void *  fdata,
pcavector  x1,
pcavector  g 
)

Compute the $L^2$-norm of the discretization error for the flux using the centroid rule.

Compare the function f for the flux to the discrete function for the flux described by the vector x1 (for the degrees of freedom) and g (for the fixed Neumann edges). Measure the difference in the $L^2$-norm using the centroid rule for approximation of the integral.

Parameters
dctet3drt0 object describing the trial space.
fFunction.
fdataAdditional data for f.
x1Coefficients of the discrete function.
gCoefficients of fixed parts of the discrete function.
Returns
$L^2$-norm of the discretization error of the flux.
real norml2_flux_facemidpoint_tet3drt0 ( pctet3drt0  dc,
void(*)(const real *x, void *fdata, pavector v)  q,
void *  fdata,
pcavector  x1,
pcavector  g 
)

Compute the $L^2$-norm of the discretization error for the flux using the face midpoint rule.

Compare the function f for the flux to the discrete function for the flux described by the vector x1 (for the degrees of freedom) and g (for the fixed Neumann edges). Measure the difference in the $L^2$-norm using the face midpoint rule for approximation of the integral.

Parameters
dctri2drt0 object describing the trial space.
fFunction.
fdataAdditional data for f.
x1Coefficients of the discrete function.
gCoefficients of fixed parts of the discrete function.
Returns
$L^2$-norm of the discretization error of the flux.
real norml2_pressure_centroid_tet3drt0 ( pctet3drt0  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pcavector  x2 
)

Compute the $L^2$-norm of the discretization error for the pressure using the centroid rule.

Compare the pressure function f to the discrete function for the pressure described by the vector x2. Measure the difference in the $L^2$-norm using the midpoint rule for approximation of the integral.

Parameters
dctet3drt0 object describing the trial space.
fFunction.
fdataAdditional data for f.
x2Coefficients of discrete function.
Returns
$L^2$-norm of discretization error of the pressure.
real norml2_pressure_facemidpoint_tet3drt0 ( pctet3drt0  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pcavector  x2 
)

Compute the $L^2$-norm of the discretization error for the pressure using the centroid rule.

Compare the pressure function f to the discrete function for the pressure described by the vector x2. Measure the difference in the $L^2$-norm using the centroid rule for approximation of the integral.

Parameters
dctet3drt0 object describing the trial space.
fFunction.
fdataAdditional data for f.
x2Coefficients of discrete function.
Returns
$L^2$-norm of discretization error of the pressure.
void update_tet3drt0 ( ptet3drt0  rt0)

Update the numbers of degrees of freedoms and fixed faces after mixed boundary conditions were set.

Set the mixed boundary conditions in another function. Then the call of this functions updates the numbers and the numbering of degrees of freedoms and fixed faces.

Parameters
rt0This structure is updated.