H2Lib  3.0
Data Structures | Typedefs | Functions
tri2drt0

Lowest order Raviart-Thomas space on a two-dimensional triangular mesh. More...

Data Structures

struct  _tri2drt0
 Representation of a trial space with lowest order Raviart-Thomas basis functions on a two-dimensional triangular mesh. More...
 

Typedefs

typedef struct _tri2drt0 tri2drt0
 Representation of a trial space with Raviart-Thomas edge basis functions on a two-dimensional triangular mesh.
 
typedef tri2drt0ptri2drt0
 Pointer to tri2drt0 object.
 
typedef const tri2drt0pctri2drt0
 Pointer to a constant tri2drt0 object.
 

Functions

ptri2drt0 new_tri2drt0 (pctri2d rt)
 Create a tri2drt0 object using a tri2d mesh. More...
 
void update_tri2drt0 (ptri2drt0 rt0)
 Update the numbers of degrees of freedoms and fixed edges after mixed boundary conditions were set. More...
 
void del_tri2drt0 (ptri2drt0 dc)
 Delete a tri2drt0 object. More...
 
psparsematrix build_tri2drt0_A_sparsematrix (pctri2drt0 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_tri2drt0_B_sparsematrix (pctri2drt0 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_tri2drt0_A_interaction_sparsematrix (pctri2drt0 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_tri2drt0_B_interaction_sparsematrix (pctri2drt0 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_tri2drt0_darcy_A_sparsematrix (pctri2drt0 dc, psparsematrix A, psparsematrix Af, pavector K)
 Assemble the upper left block of the system matrix. More...
 
void assemble_tri2drt0_darcy_B_sparsematrix (pctri2drt0 dc, psparsematrix A, psparsematrix Af)
 Assemble the lower left block of the system matrix. More...
 
void assemble_tri2drt0_b_D_avector (pctri2drt0 dc, field(*f)(const real *e, void *fdata), void *fdata, pavector d)
 Discretize Dirichlet boundary values. More...
 
void assemble_tri2drt0_b_f_avector (ptri2drt0 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector fv)
 Discretize an $L^2$-functional. More...
 
void assemble_tri2drt0_g_N_avector (ptri2drt0 dc, field(*f)(const uint *e, void *data), void *data, pavector g)
 Discretize Neumann Boundary values. More...
 
real norml2_pressure_centroid_tri2drt0 (pctri2drt0 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 midpoint rule. More...
 
real norml2_pressure_edgemidpoint_tri2drt0 (pctri2drt0 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 edge midpoint rule. More...
 
real norml2_flux_centroid_tri2drt0 (pctri2drt0 dc, void(*f)(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 midpoint rule. More...
 
real norml2_flux_edgemidpoint_tri2drt0 (pctri2drt0 dc, void(*f)(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 edge midpoint rule. More...
 
pclustergeometry build_tri2drt0_A_clustergeometry (pctri2drt0 rt, uint *idx)
 Create a clustergeometry object for the clustering ofthe degrees of freedom (edges). More...
 
pclustergeometry build_tri2drt0_B_clustergeometry (pctri2drt0 rt, uint *idx)
 Create a clustergeometry object for the clustering of the triangles. More...
 

Detailed Description

Lowest order Raviart-Thomas space on a two-dimensional triangular 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_tri2drt0_b_D_avector ( pctri2drt0  dc,
field(*)(const real *e, void *fdata)  f,
void *  fdata,
pavector  d 
)

Discretize Dirichlet boundary values.

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

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

Discretize an $L^2$-functional.

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

Parameters
dctri2drt0 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_tri2drt0_darcy_A_sparsematrix ( pctri2drt0  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
dctri2drt0 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->t2->triangles filled with a (constant) permeability for each element
void assemble_tri2drt0_darcy_B_sparsematrix ( pctri2drt0  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
dctri2drt0 object describing the trial space.
ATarget matrix for degrees of freedom.
AfTarget matrix for interactions between fixed vertices and degrees of freedom.
void assemble_tri2drt0_g_N_avector ( ptri2drt0  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
dctri2drt0 object describing the trial space.
fNeumann Boundary values.
dataAdditional data for f.
gTarget vector of dimension dc->nfix.
pclustergeometry build_tri2drt0_A_clustergeometry ( pctri2drt0  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
rttri2drt0 object.
idxArray of indices (here: for the degrees of freedoms (edges)).
Returns
Clustergeometry object.
psparsematrix build_tri2drt0_A_interaction_sparsematrix ( pctri2drt0  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 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 edge, i.e. has to be between 0 and nfix-1.

Parameters
dctri2drt0 object describing the space.
Returns
Sparse matrix with dc->ndof rows and dc->nfix columns.
psparsematrix build_tri2drt0_A_sparsematrix ( pctri2drt0  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 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
dctri2drt0 object describing the space.
Returns
Sparse matrix with dc->ndof rows and columns.
pclustergeometry build_tri2drt0_B_clustergeometry ( pctri2drt0  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
rttri2drt0 object.
idxArray of indices (here: for the triangles).
Returns
Clustergeometry object.
psparsematrix build_tri2drt0_B_interaction_sparsematrix ( pctri2drt0  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 triangle, 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$ is the index of a fixed edge, i.e. has to be between 0 and nfix-1.

Parameters
dctri2drt0 object describing the space.
Returns
Sparse matrix with dc->t2->triangles rows anddc->nfix columns.
psparsematrix build_tri2drt0_B_sparsematrix ( pctri2drt0  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 triangle, 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
dctri2drt0 object describing the space.
Returns
Sparse matrix with dc->t2->triangles rows anddc->ndof columns.
void del_tri2drt0 ( ptri2drt0  dc)

Delete a tri2drt0 object.

Parameters
dcObject to be deleted.
ptri2drt0 new_tri2drt0 ( pctri2d  rt)

Create a tri2drt0 object using a tri2d mesh.

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

Parameters
rtMesh
Returns
tri2drt0 object matching rt.
real norml2_flux_centroid_tri2drt0 ( pctri2drt0  dc,
void(*)(const real *x, void *fdata, pavector v)  f,
void *  fdata,
pcavector  x1,
pcavector  g 
)

Compute the $L^2$-norm of the discretization error for the flux using the 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 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_flux_edgemidpoint_tri2drt0 ( pctri2drt0  dc,
void(*)(const real *x, void *fdata, pavector v)  f,
void *  fdata,
pcavector  x1,
pcavector  g 
)

Compute the $L^2$-norm of the discretization error for the flux using the edge 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 edge 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_tri2drt0 ( pctri2drt0  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 midpoint 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
dctri2drt0 object describing the trial space.
fFunction.
fdataAdditional data for f.
x2Coefficients of the discrete function.
Returns
$L^2$-norm of the discretization error of the pressure.
real norml2_pressure_edgemidpoint_tri2drt0 ( pctri2drt0  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 edge midpoint 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 edge midpoint rule for approximation of the integral.

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

Update the numbers of degrees of freedoms and fixed edges 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 edges.

Parameters
rt0This structure is updated.