XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Fem3p()

Sub Fem3p ( N As  Long,
Ne As  Long,
X() As  Double,
Y() As  Double,
Z() As  Double,
Knc() As  Long,
P() As  Double,
Q() As  Double,
F() As  Double,
Nb1 As  Long,
Ib() As  Long,
Bv() As  Double,
Nb2 As  Long,
Ks2() As  Long,
Alpha() As  Double,
Beta() As  Double,
Val() As  Double,
Rowptr() As  Long,
Colind() As  Long,
B() As  Double,
Info As  Long,
Optional Base As  Long = 0 
)

Assemble finite element matrix of Poisson equation (3D) in CSR sparse matrix format [Experimental version]

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 - 1) (LX >= N)
X coordinates of the nodes.
[in]Y()Array Y(LY - 1) (LY >= N)
Y coordinates of the nodes.
[in]Z()Array Z(LZ - 1) (LZ >= N)
Z coordinates of the nodes.
[in]Knc()Array Knc(LKnc1 - 1, LKnc2 - 1) (LKnc1 >= Nn + 1, LKnc2 >= Ne)
Connection matrix: Knc(0, K-1) is the type of element K, Knc(1, K-1), ..., Knc(Nn, K-1) point to the nodes of element K (Nn is the number of nodes in the element).
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()P(LP - 1) As Double (LP >= N) Coefficient p(x,y) at each node
[in]Q()Q(LQ - 1) As Double (LQ >= N) Coefficient q(x,y) at each node
[in]F()F(LF - 1) As Double (LF >= N) Coefficient f(x,y) at each node
[in]Nb1Number of boundary nodes of the 1-st kind boundary condition. (Nb1 >= 0)
[in]Ib()Array Ib(LIb - 1) (LIb >= Nb1)
Node numbers of the boundary nodes of the first kind boundary conditions.
[in]Bv()Array Bv(LBv - 1) (LBv >= Nb1)
Boundary value at each boundary node.
[in]Nb2Number of boundary sides of the natural boundary conditions. (Nb2 >= 0)
[in]Ks2()Array Ks2(LKs21 - 1, LKs22 - 1) (LKs21 >= Nns + 1, LKs22 >= Nb2)
Connection matrix of boundary sides: Ks2(0, K-1) is the type of boundary element K, Ks(1, K-1), ..., Ks(Nns, K-1) point to the nodes of boundary element K of the natural boundary conditions (Nns is the number of nodes in the boundary element).
The type of element value is as follows:
= 2: 3-node triangle.
= 3: 4-node quadrangle.
[in]Alpha()Alpha(LAlpha1 - 1, LAlpha2 - 1) As Double (LAlpha1 >= Nns, LAlpha2 >= Nb2) Coefficient alpha of the natural boundary condition at the boundary node
[in]Beta()Beta(LBeta1 - 1, LBeta2 - 1) As Double (LBeta1 >= Nns, LBeta2 >= Nb2) Coefficient beta of the natural boundary condition at the boundary node
[out]Val()Array Val(LVal - 1) (LVal >= Nnz (Nnz must be severalfold larger than the actual number of non-zero elements of assembled coefficient matrix of the finite element equation))
Assembled coefficient matrix of the finite element equation (values).
[out]Rowptr()Array Rowptr(LRowptr - 1) (LRowptr >= N + 1)
Assembled coefficient matrix of the finite element equation (pointers).
[out]Colind()Array Colind(LColind - 1) (LColind >= Nnz)
Assembled coefficient matrix of the finite element equation (column indices).
[out]B()Array B(LB - 1) (LB >= N)
Right-hand side vector of the finite element equation.
[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.
[in]Base(Optional)
Indexing of Rowind() and Colind(). (default = 0)
= 0: Zero-based (C style) indexing: Starting index is 0.
= 1: One-based (Fortran style) indexing: Starting index is 1.