public class FemMatrixGenerator
extends java.lang.Object
A grid of nx X ny X nz nodes is divided into elements of the
requested FemMatrixGenerator.ElemType, and the matrix pattern is formed from the
resulting node adjacency: nodes i and j are coupled if and
only if they share an element. Each node carries dofsPerNode degrees
of freedom (3 for 3D solid mechanics, 2 for 2D), so each node coupling
expands into a dense dofsPerNode X dofsPerNode block, exactly as in a
real FEM stiffness matrix.
Numeric values are assembled from element matrices of the form
K_e = k (I - 1/m 1 1^T) (X) Awhere
m is the number of element nodes and A is a fixed
random SPD dofsPerNode X dofsPerNode block. Each element matrix is
therefore symmetric positive semi-definite, and adding a positive diagonal
mass term makes the assembled matrix SPD, with every block entry non-zero.
Matrices are returned in the 1-based upper triangular CRS form accepted by
DirectSolver.analyze(double[],int[],int[],int,int). A bordered KKT
form, which is symmetric indefinite, may be produced using addConstraints().
| Modifier and Type | Class and Description |
|---|---|
static class |
FemMatrixGenerator.CRSMatrix
Sparse symmetric matrix in the 1-based upper triangular CRS form used by
DirectSolver. |
static class |
FemMatrixGenerator.ElemType
Element type used to subdivide the grid.
|
| Constructor and Description |
|---|
FemMatrixGenerator() |
| Modifier and Type | Method and Description |
|---|---|
FemMatrixGenerator.CRSMatrix |
addConstraints(FemMatrixGenerator.CRSMatrix M,
int numCons,
int nodesPerCon,
int dofsPerNode)
Creates a bordered KKT matrix
|
FemMatrixGenerator.CRSMatrix |
create(FemMatrixGenerator.ElemType type,
int nx,
int ny,
int nz,
int dofsPerNode)
Creates a matrix for a grid of
nx X ny X nz nodes. |
FemMatrixGenerator.CRSMatrix |
createForSize(FemMatrixGenerator.ElemType type,
int size)
Creates a matrix for a cubic (or square) grid with approximately
size rows. |
int |
numElems()
Returns the number of elements used by the most recent call to
create(). |
int |
numNodes()
Returns the number of grid nodes used by the most recent call to
create(). |
public int numNodes()
create().public int numElems()
create().public FemMatrixGenerator.CRSMatrix createForSize(FemMatrixGenerator.ElemType type, int size)
size rows. The grid resolution is chosen so that the resulting matrix is
as close as possible to the requested size.type - element typesize - desired matrix sizepublic FemMatrixGenerator.CRSMatrix create(FemMatrixGenerator.ElemType type, int nx, int ny, int nz, int dofsPerNode)
nx X ny X nz nodes. For 2D element
types, nz is ignored.type - element typenx - number of nodes along xny - number of nodes along ynz - number of nodes along z (3D only)dofsPerNode - degrees of freedom per nodepublic FemMatrixGenerator.CRSMatrix addConstraints(FemMatrixGenerator.CRSMatrix M, int numCons, int nodesPerCon, int dofsPerNode)
[ M G^T ] [ G 0 ]from a stiffness matrix
M, where G is a sparse constraint
matrix with numCons rows, each coupling all the degrees of
freedom of a small number of randomly selected nodes. The result is
symmetric indefinite, and so has type Matrix.SYMMETRIC.M - stiffness matrix, left unmodifiednumCons - number of constraint rowsnodesPerCon - number of nodes coupled by each constraintdofsPerNode - degrees of freedom per node in M