XLPack 7.0
Python API Reference Manual
Loading...
Searching...
No Matches

◆ fem2p()

def fem2p ( n  ,
ne  ,
x  ,
y  ,
knc  ,
p  ,
q  ,
f  ,
nb1  ,
ib  ,
bv  ,
nb2  ,
ks2  ,
alpha  ,
beta  ,
val  ,
rowptr  ,
colind  ,
rhs  ,
base  = 0 
)

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
Returns
info (int)
= 0: Successful exit.
= 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 a[] and/or ja[].
= 17: Internal error occurred in assembling matrix.
Parameters
[in]nNumber of nodes. (n > 0)
[in]neNumber of elements. (ne > 0)
[in]xNumpy ndarray (1-dimensional, float, n)
x coordinates of the nodes.
[in]yNumpy ndarray (1-dimensional, float, n)
y 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]kncNumpy ndarray (2-dimensional, int32, ldknc x ne) (ldknc = nn + 1 (where nn is the number of nodes in the element))
Connection matrix: knc[k, 0] is the type of element k, knc[k, 1], ..., knc[k, 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]pNumpy ndarray (1-dimensional, float, n)
Coefficient p(x, y) at each node.
[in]qNumpy ndarray (1-dimensional, float, n)
Coefficient q(x, y) at each node.
[in]fNumpy ndarray (1-dimensional, float, n)
Coefficient f(x, y) at each node.
[in]nb1Number of boundary nodes of the Dirichlet boundary condition. (nb1 >= 0)
[in]ibNumpy ndarray (1-dimensional, int32, nb1)
Node numbers of the boundary nodes of the Dirichlet boundary conditions.
[in]bvNumpy ndarray (1-dimensional, float, nb1)
Boundary value at each boundary node.
[in]nb2Number of boundary sides of the natural boundary conditions. (nb2 >= 0)
[in]ks2Numpy ndarray (2-dimensional, int32, ldks2 x nb2) (ldks2 = nns + 1 (where nn is the number of nodes in the boundary element))
Connection matrix of boundary sides: [k, 0] is the type of boundary element k, [k, 1], ..., [k, 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]alphaNumpy ndarray (2-dimensional, float, nns x nb2) Array alpha[ldalpha*lalpha] (lalpha >= nb2)
Coefficient alpha of the natural boundary condition at the boundary node.
[in]betaNumpy ndarray (2-dimensional, float, nns x nb2) Coefficient beta of the natural boundary condition at the boundary node.
[out]valNumpy ndarray (1-dimensional, float, nnz)
Assembled coefficient matrix of the finite element equation (values). (nnz is the number of nonzero elements)
[out]rowptrNumpy ndarray (1-dimensional, int32, n + 1)
Assembled coefficient matrix of the finite element equation (row pointers).
[out]colindNumpy ndarray (1-dimensional, int32, nnz)
Assembled coefficient matrix of the finite element equation (column indices). (nnz is the number of nonzero elements)
[out]rhsNumpy ndarray (1-dimensional, float, n)
Right-hand side vector of the finite element equation.

element).