|
|
◆ fem2p()
| void fem2p |
( |
int |
n, |
|
|
int |
ne, |
|
|
double |
x[], |
|
|
double |
y[], |
|
|
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 (2D) 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) grad u(x,y)) + q(x,y)u(x,y) = f(x,y)
Dirichlet boundary condition: u(x,y) = g
Natural boundary condition: p(x,y)*du/dn + α(k,l)*u(x,y) + β(k,l) = 0
The output matrix is in CSR aparse matrix format.
- Parameters
-
| [in] | n | Number of nodes. (n > 0) |
| [in] | ne | Number 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] | ldknc | Leading 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:
= 2: 3-node triangle.
= 3: 4-node quadrangle.
= 10: 9-node second order quadrangle. |
| [in] | p[] | Array p[lp] (lp >= n)
Coefficient p(x, y) at each node. |
| [in] | q[] | Array q[lq] (lq >= n)
Coefficient q(x, y) at each node. |
| [in] | f[] | Array f[lf] (lf >= n)
Coefficient f(x, y) at each node. |
| [in] | nb1 | Number 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] | nb2 | Number of boundary sides of the natural boundary conditions. (nb2 >= 0) |
| [in] | ldks2 | Leading 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:
= 1: 2-node line element.
= 2: 3-node second order line element. |
| [in] | ldalpha | Leading 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] | ldbeta | Leading 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] | asize | Size 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] | base | Indexing 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] | info | Return code.
= 0: Normal return.
= i < 0: The (-i)-th argument is invalid or has an illegal value.
= 11: Invalid element type in knc[].
= 12: Area of a triangular element is zero or negative.
= 13: Invalid boundary element type in ks2[].
= 14: Invalid node number in ks2[].
= 16: Insufficient size of val[] and/or colind[].
= 17: Internal error occurred in assembling matrix. |
element).
|