XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ fem3p()

void fem3p ( int  n,
int  ne,
double  x[],
double  y[],
double  z[],
int  ldknc,
int  knc[],
double  p[],
double  q[],
double  f[],
int  nb1,
int  ib[],
double  bv[],
int  nb2,
int  ldks2,
int  ks2[],
int  ldalpha,
double  alpha[],
int  ldbeta,
double  beta[],
int  asize,
double  val[],
int  rowptr[],
int  colind[],
int  base,
double  b[],
int  iwork[],
int *  info 
)

Assemble finite element matrix of Poisson equation (3D) in CSR sparse matrix format

Purpose
This routine assembles the finite element matrix of the generalized two dimensional Poisson equation as shown below.
-div(p(x,y,z) grad u(x,y,z)) + q(x,y,z)u(x,y,z) = f(x,y,z)
Dirichlet boundary condition: u(x,y,z) = g
Natural boundary condition: p(x,y,z)*du/dn + α(k,l)*u(x,y,z) + β(k,l) = 0
The output matrix is in CSR aparse matrix format.
Parameters
[in]nNumber of nodes. (n > 0)
[in]neNumber of elements. (ne > 0)
[in]x[]Array x[lx] (lx >= n)
x coordinates of the nodes.
[in]y[]Array y[ly] (ly >= n)
y coordinates of the nodes.
[in]z[]Array z(lz - 1) (lz >= n)
z coordinates of the nodes.
[in]ldkncLeading dimension of the two dimensional array knc[]. (ldknc >= nn + 1, where nn is the number of nodes in the element)
[in]knc[]Array knc[ldknc*lknc] (lknc >= ne)
Connection matrix: knc[(k-1)*ldknc] is the type of element k, knc[(k-1)*ldknc + 1], ..., knc[(k-1)*ldknc + nn] point to the nodes of element k.
The type of element value is as follows:
= 4: 4-node tetrahedron.
= 5: 8-node hexahedron.
= 6: 6-node prism.
= 7: 5-node pyramid.
[in]p[]Array p[lp] (lp >= n)
Coefficient p(x, y, z) at each node.
[in]q[]Array q[lq] (lq >= n)
Coefficient q(x, y, z) at each node.
[in]f[]Array f[lf] (lf >= n)
Coefficient f(x, y, z) at each node.
[in]nb1Number of boundary nodes of the Dirichlet boundary condition. (nb1 >= 0)
[in]ib[]Array ib[lib] (lib >= nb1)
Node numbers of the boundary nodes of the Dirichlet boundary conditions.
[in]bv[]Array bv[lbv] (lbv >= nb1)
Boundary value at each boundary node.
[in]nb2Number of boundary sides of the natural boundary conditions. (nb2 >= 0)
[in]ldks2Leading dimension of the two dimensional array ks2[]. (ldks2 >= nns + 1, where nn is the number of nodes in the boundary element)
[in]ks2[]Array ks2[ldks2*lks2] (lks2 >= nb2)
Connection matrix of boundary sides: [(k-1)*ldks2] is the type of boundary element k, [(k-1)*ldks2 + 1], ..., [(k-1)*ldks2 + nns] point to the nodes of boundary element k of the natural boundary conditions.
The type of element value is as follows:
= 2: 3-node triangle.
= 3: 4-node quadrangle.
[in]ldalphaLeading dimension of the two dimensional array alpha[]. (ldalpha >= nns)
[in]alpha[]Array alpha[ldalpha*lalpha] (lalpha >= nb2)
Coefficient alpha of the natural boundary condition at the boundary node.
[in]ldbetaLeading dimension of the two dimensional array beta[]. (ldbeta >= nns)
[in]beta[]Array beta[ldbeta*lbeta] (lbeta >= nb2)
Coefficient beta of the natural boundary condition at the boundary node.
[in]asizeSize of arrays val[] and colind[]. It must be severalfold larger than the actual number of non-zero elements of assembled coefficient matrix of the finite element equation. (asize > 0)
[out]val[]Array val[lval] (lval >= asize)
Assembled coefficient matrix of the finite element equation (values).
[out]rowptr[]Array rowptr[lrowptr] (lrowptr >= n + 1)
Assembled coefficient matrix of the finite element equation (row pointers).
[out]colind[]Array colind[lcolind] (lcolind >= asize)
Assembled coefficient matrix of the finite element equation (column indices).
[in]baseIndexing of rowptr[] and colind[].
= 0: Zero-based (C style) indexing: Starting index is 0.
= 1: One-based (Fortran style) indexing: Starting index is 1.
[out]b[]Array b[lb] (lb >= n)
Right-hand side vector of the finite element equation.
[out]iwork[]Array iwork[liwork] (liwork >= 2*n)
Work array.
[out]infoReturn code.
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid or has an illegal value.
= 11: Invalid element type in knc[].
= 12: Volume of a tetrahedron element is zero or negative.
= 13: Invalid boundary element type in ks2[].
= 14: Invalid node number in ks2[].
= 15: Area of boundary element is zero or negative.
= 16: Insufficient size of val[] and/or colind[].
= 17: Internal error occurred in assembling matrix.