H2Lib
3.0
|
Piecewise linear space with nodal basis functions on a two-dimensional triangular mesh. More...
Data Structures | |
struct | _tri2dp1 |
Representation of a trial space with piecewise linear nodal basis functions on a two-dimensional triangular mesh. More... | |
Typedefs | |
typedef struct _tri2dp1 | tri2dp1 |
Representation of a trial space with piecewise linear nodal basis functions on a two-dimensional triangular mesh. | |
typedef tri2dp1 * | ptri2dp1 |
Pointer to a tri2p1 object. | |
typedef const tri2dp1 * | pctri2dp1 |
Pointer to a constant tri2p1 object. | |
Functions | |
ptri2dp1 | new_tri2dp1 (pctri2d gr) |
Create a tri2p1 object using a tri2d mesh. More... | |
void | del_tri2dp1 (ptri2dp1 dc) |
Delete a tri2p1 object. More... | |
psparsematrix | build_tri2dp1_sparsematrix (pctri2dp1 dc) |
Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the system matrix. More... | |
psparsematrix | build_tri2dp1_interaction_sparsematrix (pctri2dp1 dc) |
Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the interaction matrix. More... | |
psparsematrix | build_tri2dp1_prolongation_sparsematrix (pctri2dp1 dfine, pctri2dp1 dcoarse, pctri2dref rf) |
Create a prolongation matrix. More... | |
void | assemble_tri2dp1_laplace_sparsematrix (pctri2dp1 dc, psparsematrix A, psparsematrix Af) |
Assemble stiffness matrix. More... | |
void | assemble_tri2dp1_mass_sparsematrix (pctri2dp1 dc, psparsematrix M, psparsematrix Mf) |
Assemble mass matrix. More... | |
void | assemble_tri2dp1_dirichlet_avector (pctri2dp1 dc, field(*d)(const real *x, void *fdata), void *fdata, pavector dv) |
Discretize Dirichlet boundary values. More... | |
void | assemble_tri2dp1_functional_avector (ptri2dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector fv) |
Discretize an -functional. More... | |
real | normmax_tri2dp1 (pctri2dp1 dc, field(*u)(const real *x, void *fdata), void *fdata, pavector xs) |
Compute the vertex-wise maximum norm of the discretization error. More... | |
real | norml2_tri2dp1 (pctri2dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pcavector xs, pcavector xf) |
Compute the -norm of the discretization error. More... | |
pclustergeometry | build_tri2dp1_clustergeometry (pctri2dp1 p1, uint *idx) |
Create a clustergeometry object for a FEM-discretisation with p1-functions. More... | |
Piecewise linear space with nodal basis functions on a two-dimensional triangular mesh.
void assemble_tri2dp1_dirichlet_avector | ( | pctri2dp1 | dc, |
field(*)(const real *x, void *fdata) | d, | ||
void * | fdata, | ||
pavector | dv | ||
) |
Discretize Dirichlet boundary values.
For each fixed vertex, the function 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 from the right-hand side of our equation, where is the interaction matrix, yields the right-hand side of the problem with homogeneous Dirichlet boundary conditions.
dc | tri2p1 object describing the trial space. |
d | Dirichlet boundary values. |
fdata | Additional data for f . |
dv | Target vector of dimension dc->nfix . |
void assemble_tri2dp1_functional_avector | ( | ptri2dp1 | dc, |
field(*)(const real *x, void *fdata) | f, | ||
void * | fdata, | ||
pavector | fv | ||
) |
Discretize an -functional.
For each triangle, the element vector is computed by applying the edge-midpoint quadrature. Its components are then added to the corresponding entries in . Since is cleared before this step, the result is given by .
dc | tri2p1 object describing the trial space. |
f | Right-hand side function. |
fdata | Additional data for f . |
fv | Target vector of dimension dc->ndof . |
void assemble_tri2dp1_laplace_sparsematrix | ( | pctri2dp1 | dc, |
psparsematrix | A, | ||
psparsematrix | Af | ||
) |
Assemble stiffness matrix.
Element matrices for all triangles are computed and added to the corresponding entries in A
and Af
.
dc | tri2p1 object describing the trial space. |
A | Target matrix for degrees of freedom. |
Af | Target matrix for interactions between fixed vertices and degrees of freedom. |
void assemble_tri2dp1_mass_sparsematrix | ( | pctri2dp1 | dc, |
psparsematrix | M, | ||
psparsematrix | Mf | ||
) |
Assemble mass matrix.
Element matrices for all triangles are computed and added to the corresponding entries in M
and Mf
.
dc | tri2p1 object describing the trial space. |
M | Target matrix for degrees of freedom. |
Mf | Target matrix for interactions between fixed vertices and degrees of freedom. |
pclustergeometry build_tri2dp1_clustergeometry | ( | pctri2dp1 | p1, |
uint * | idx | ||
) |
Create a clustergeometry object for a FEM-discretisation with p1-functions.
Create a clustergeometry object basing on a triangular tri2d mesh and linear nodal basis function.
p1 | tri2dp1 object. |
idx | Array of indices. |
psparsematrix build_tri2dp1_interaction_sparsematrix | ( | pctri2dp1 | dc | ) |
Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the interaction matrix.
Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions and share at least one edge, the entry appears in the graph of the matrix.
Here, only refers to a degree of freedom, while is the index of a fixed vertex, i.e., has to be between 0
and nfix-1
.
dc | tri2p1 object describing the space. |
dc->ndof
rows and dc->nfix
columns. psparsematrix build_tri2dp1_prolongation_sparsematrix | ( | pctri2dp1 | dfine, |
pctri2dp1 | dcoarse, | ||
pctri2dref | rf | ||
) |
Create a prolongation matrix.
dcoarse
and dfine
have to correspond to a coarse mesh and its refinement created by refine_tri2d. The refinement relationship is described by rf
.
This function not only creates the matrix, but also fills it with correct coefficients.
dfine | tri2p1 object corresponding to the refined mesh. |
dcoarse | tri2p1 object corresponding to the coarse mesh. |
rf | Refinement relationship. |
psparsematrix build_tri2dp1_sparsematrix | ( | pctri2dp1 | dc | ) |
Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the system matrix.
Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions and share at least one edge, the entry appears in the graph of the matrix.
Here, both and refer to degrees of freedom, i.e., there indices are between 0
and ndof-1
.
dc | tri2p1 object describing the space. |
dc->ndof
rows and columns. real norml2_tri2dp1 | ( | pctri2dp1 | dc, |
field(*)(const real *x, void *fdata) | f, | ||
void * | fdata, | ||
pcavector | xs, | ||
pcavector | xf | ||
) |
Compute the -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 -norm.
dc | tri2p1 object describing the trial space. |
f | Function. |
fdata | Additional data for f . |
xs | Coefficients of discrete function. |
xf | Coefficients of fixed part of discrete function |
real normmax_tri2dp1 | ( | pctri2dp1 | dc, |
field(*)(const real *x, void *fdata) | u, | ||
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 -norm of the discretization error.
dc | tri2p1 object describing the trial space. |
u | Function. |
fdata | Additional data for f . |
xs | Coefficients of discrete function. |