|
IFEM
90A354
|
This class contains data and functions for the assembly of FE matrices. More...
#include <SAM.h>


Public Member Functions | |
| SAM () | |
| The constructor initializes an empty object. | |
| virtual | ~SAM () |
| The destructor frees the dynamically allocated arrays. | |
| void | print (std::ostream &os) const |
| Prints out the key data to the given stream. | |
| template<class T > | |
| void | printVector (T &os, const RealArray &vec, const char *heading=nullptr) const |
| Prints out a nodal DOF vector to the given stream. | |
| int | getNoElms () const |
| Returns the number of elements in the model. | |
| int | getNoNodes (char dofType='A') const |
| Returns the number of FE nodes in the model. More... | |
| int | getNoDOFs () const |
| Returns the total number of DOFs in the model. | |
| int | getNoSpecifiedDOFs () const |
| Returns the number of specified DOFs in the model. | |
| int | getNoConstraints () const |
| Returns the total number of constraint equations in the model. | |
| int | getNoEquations () const |
| Returns the number of equations (free DOFs) in the model. | |
| IntSet | getEquations (char dType, int dof=0) const |
| Returns the equations numbers for a given DOF type. More... | |
| const int * | getMADOF () const |
| Returns the Matrix of Accumulated DOFs. | |
| const int * | getMEQN () const |
| Returns the Matrix of EQuation Numbers. | |
| void | getDofCouplings (IntVec &irow, IntVec &jcol) const |
| Computes the sparse structure (DOF couplings) in the system matrix. More... | |
| void | getDofCouplings (std::vector< IntSet > &dofc) const |
| Finds the set of free DOFs coupled to each free DOF. | |
| bool | assembleSystem (SystemMatrix &sysK, SystemVector &sysRHS, const Matrix &eK, int iel=0, RealArray *reactionForces=nullptr) const |
| Adds an element stiffness matrix into the system stiffness matrix. More... | |
| bool | assembleSystem (SystemMatrix &sysM, const Matrix &eM, int iel=0) const |
| Adds an element matrix into the corresponding system matrix. More... | |
| bool | assembleSystem (SystemVector &sysRHS, const Matrix &eK, int iel=0, RealArray *reactionForces=nullptr) const |
| Adds element stiffness contributions to the system load vector. More... | |
| bool | assembleSystem (SystemVector &sysRHS, const RealArray &eS, int iel=0, RealArray *reactionForces=nullptr) const |
| Adds an element load vector into the system load vector. More... | |
| bool | assembleSystem (SystemVector &sysRHS, const Real *nS, int inod=0, RealArray *reactionForces=nullptr) const |
| Adds a node load vector into the system load vector. More... | |
| bool | assembleSystem (SystemVector &sysRHS, Real S, const std::pair< int, int > &dof) const |
| Adds a node load vector into the system load vector. More... | |
| void | addToRHS (SystemVector &sysRHS, const RealArray &S) const |
| Adds a global load vector into the system load vector. More... | |
| bool | getElmNodes (IntVec &mnpc, int iel) const |
| Finds the matrix of nodal point correspondance for an element. More... | |
| bool | getElmEqns (IntVec &meen, int iel, size_t nedof=0) const |
| Finds the matrix of equation numbers for an element. More... | |
| void | getUniqueEqns (IntSet &meen, int iel) const |
| Finds the set of unique equation numbers for an element. More... | |
| bool | getNodeEqns (IntVec &mnen, int inod) const |
| Finds the matrix of equation numbers for a node. More... | |
| char | getNodeType (int inod) const |
| Returns the DOF classification of a given node. More... | |
| std::pair< int, int > | getNodeDOFs (int inod) const |
| Returns the first and last DOFs for a node. More... | |
| std::pair< int, int > | getNodeAndLocalDof (int idof, bool eqno=false) const |
| Returns the internal node number and local index for a global DOF. More... | |
| int | getEquation (int inod, int ldof) const |
| Finds the equation number corresponding to a local nodal DOF. More... | |
| Real | getDofVal (const RealArray &dofVec, int inod, int ldof) const |
| Returns specified solution component from a global solution vector. More... | |
| virtual bool | expandSolution (const SystemVector &solVec, Vector &dofVec, Real scaleSD=Real(1)) const |
| Expands a solution vector from equation-ordering to DOF-ordering. More... | |
| bool | expandVector (const Vector &solVec, Vector &dofVec) const |
| Expands a solution vector from equation-ordering to DOF-ordering. More... | |
| bool | getSolVec (RealArray &solVec, const RealArray &dofVec) const |
| Extracts equation-ordered solution vector from DOF-ordered vector. More... | |
| bool | applyDirichlet (Vector &dofVec) const |
| Applies the non-homogenous Dirichlet BCs to the given vector. More... | |
| virtual Real | dot (const Vector &x, const Vector &y, char dofType='D') const |
| Computes the dot-product of two vectors of length NDOF. More... | |
| Real | norm2 (const Vector &x, char dofType='D') const |
| Computes the l2-norm of a vector of length NDOF. More... | |
| virtual Real | normL2 (const Vector &x, char dofType='D') const |
| Computes the L2-norm of a vector of length NDOF. More... | |
| virtual Real | normInf (const Vector &x, size_t &comp, char dofType='D') const |
| Computes the L_infinity-norm of a vector of length NDOF. More... | |
| virtual Real | normReact (const RealArray &u, const RealArray &rf) const |
| Computes the energy norm contributions from nodal reaction forces. More... | |
| Real | getReaction (int dir, const RealArray &rf, const IntVec *nodes=nullptr) const |
| Returns the total reaction force in the given coordinate direction. More... | |
| bool | haveReaction (int dir, const IntVec *nodes=nullptr) const |
| Checks for total reaction force in the given coordinate direction. More... | |
| bool | getNodalReactions (int inod, const RealArray &rf, RealArray &nrf) const |
| Returns a vector of reaction forces for a given node. More... | |
| virtual bool | merge (const SAM *, const std::map< int, int > *) |
| Merges the assembly data from another SIM object with this. | |
Protected Member Functions | |
| bool | initSystemEquations () |
| Initializes the DOF-to-equation connectivity array MEQN. | |
| void | assembleRHS (Real *RHS, Real value, int ieq) const |
| Adds a scalar value into a system right hand-side vector. More... | |
| void | assembleReactions (RealArray &rf, const RealArray &eS, int iel) const |
| Assembles reaction forces for the fixed and prescribed DOFs. More... | |
| bool | expandVector (const Real *solVec, Vector &dofVec, Real scaleSD) const |
| Expands a solution vector from equation-ordering to DOF-ordering. More... | |
| void | printStatusCodes (std::ostream &os) const |
| Prints out the DOF status codes to the given stream. | |
| void | printCEQ (std::ostream &os, int iceq) const |
| Prints out a constraint equation to the given stream. | |
| void | printMEQN (std::ostream &os) const |
| Prints out the equation number mapping to the given stream. | |
Protected Attributes | |
| int & | nnod |
| Number of nodes. | |
| int & | nel |
| Number of elements. | |
| int & | ndof |
| Number of DOFs. | |
| int & | nspdof |
| Number of specified DOFs. | |
| int & | nceq |
| Number of constraint equations. | |
| int & | neq |
| Number of system equations. | |
| int & | nmmnpc |
| Number of elements in MMNPC. | |
| int & | nmmceq |
| Number of elements in MMCEQ. | |
| int * | mpmnpc |
| Matrix of pointers to MNPCs in MMNPC. | |
| int * | mmnpc |
| Matrix of matrices of nodal point correspondances. | |
| int * | madof |
| Matrix of accumulated DOFs. | |
| int * | msc |
| Matrix of status codes. | |
| int * | mpmceq |
| Matrix of pointers to MCEQs in MMCEQ. | |
| int * | mmceq |
| Matrix of matrices of constraint equation definitions. | |
| Real * | ttcc |
| Table of tables of constraint equation coefficients. | |
| int * | minex |
| Matrix of internal to external node numbers. | |
| int * | meqn |
| Matrix of equation numbers. | |
| std::vector< char > | nodeType |
| Nodal DOF classification. | |
| std::vector< char > | dof_type |
| Individual DOF classification. | |
Private Attributes | |
| int | mpar [50] |
| Matrix of parameters. | |
Friends | |
| class | DenseMatrix |
| class | SPRMatrix |
| class | SparseMatrix |
| class | DiagMatrix |
| class | PETScMatrix |
This class contains data and functions for the assembly of FE matrices.
The names and meanings of (most of) the data members of this class are adopted from Kolbein Bell's pionering work on the field. See his reports on the SAM library for a thorough elaboration.
The class does not contain methods for initializing the data members. That has to be done by deriving sub-classes specific to the solution methods.
| void SAM::addToRHS | ( | SystemVector & | sysRHS, |
| const RealArray & | S | ||
| ) | const |
Adds a global load vector into the system load vector.
| sysRHS | The right-hand-side system load vector | |
| [in] | S | The global load vector |
References assembleRHS(), SystemVector::getPtr(), meqn, and ndof.
| bool SAM::applyDirichlet | ( | Vector & | dofVec | ) | const |
Assembles reaction forces for the fixed and prescribed DOFs.
| rf | Reaction force container for the entire model | |
| [in] | eS | The element load vector |
| [in] | iel | Identifier for the element that eS belongs to |
References madof, mmnpc, mpmnpc, and msc.
Referenced by assembleSystem().
Adds a scalar value into a system right hand-side vector.
| RHS | The right-hand-side system load vector | |
| [in] | value | The scalar value to add in |
| [in] | ieq | Global equation number for the scalar value |
If ieq is zero, this is a fixed DOF and the value is ignored. If ieq is less than zero, this is a constrained DOF and the value is added to the master DOFs of the governing constraint equation of this DOF.
References meqn, mmceq, mpmceq, and ttcc.
Referenced by addToRHS(), and assembleSystem().
| bool SAM::assembleSystem | ( | SystemMatrix & | sysK, |
| SystemVector & | sysRHS, | ||
| const Matrix & | eK, | ||
| int | iel = 0, |
||
| RealArray * | reactionForces = nullptr |
||
| ) | const |
Adds an element stiffness matrix into the system stiffness matrix.
| sysK | The left-hand-side system stiffness matrix | |
| sysRHS | The right-hand-side system load vector | |
| [in] | eK | The element stiffness matrix |
| [in] | iel | Identifier for the element that eK belongs to |
| reactionForces | Pointer to vector of nodal reaction forces |
When multi-point constraints are present, contributions from these are also added into the right-hand-side system load vector.
References SystemMatrix::assemble(), assembleReactions(), utl::vector< T >::empty(), utl::matrixBase< T >::empty(), getElmEqns(), mpmceq, Real, utl::vector< T >::resize(), utl::matrix< T >::rows(), and ttcc.
Referenced by AlgEqSystem::assemble(), and ReactionsOnly::assemble().
| bool SAM::assembleSystem | ( | SystemMatrix & | sysM, |
| const Matrix & | eM, | ||
| int | iel = 0 |
||
| ) | const |
Adds an element matrix into the corresponding system matrix.
| sysM | The left-hand-side system matrix | |
| [in] | eM | The element matrix |
| [in] | iel | Identifier for the element that eM belongs to |
References SystemMatrix::assemble(), and utl::matrixBase< T >::empty().
| bool SAM::assembleSystem | ( | SystemVector & | sysRHS, |
| const Matrix & | eK, | ||
| int | iel = 0, |
||
| RealArray * | reactionForces = nullptr |
||
| ) | const |
Adds element stiffness contributions to the system load vector.
| sysRHS | The right-hand-side system load vector | |
| [in] | eK | The element stiffness matrix |
| [in] | iel | Identifier for the element that eK belongs to |
| reactionForces | Pointer to vector of nodal reaction forces |
When multi-point constraints are present, contributions from these are added into the right-hand-side system load vector.
References assembleReactions(), assembleRHS(), utl::vector< T >::empty(), utl::matrixBase< T >::empty(), getElmEqns(), SystemVector::getPtr(), mpmceq, Real, utl::vector< T >::resize(), utl::matrix< T >::rows(), and ttcc.
| bool SAM::assembleSystem | ( | SystemVector & | sysRHS, |
| const Real * | nS, | ||
| int | inod = 0, |
||
| RealArray * | reactionForces = nullptr |
||
| ) | const |
Adds a node load vector into the system load vector.
| sysRHS | The right-hand-side system load vector | |
| [in] | nS | The nodal load vector |
| [in] | inod | Identifier for the node that nS belongs to |
| reactionForces | Pointer to vector of nodal reaction forces |
References assembleRHS(), getNodeEqns(), SystemVector::getPtr(), madof, and msc.
| bool SAM::assembleSystem | ( | SystemVector & | sysRHS, |
| const RealArray & | eS, | ||
| int | iel = 0, |
||
| RealArray * | reactionForces = nullptr |
||
| ) | const |
Adds an element load vector into the system load vector.
| sysRHS | The right-hand-side system load vector | |
| [in] | eS | The element load vector |
| [in] | iel | Identifier for the element that eS belongs to |
| reactionForces | Pointer to vector of nodal reaction forces |
References assembleReactions(), assembleRHS(), getElmEqns(), SystemVector::getPtr(), madof, meqn, mmceq, mmnpc, mpar, mpmceq, mpmnpc, and ttcc.
| bool SAM::assembleSystem | ( | SystemVector & | sysRHS, |
| Real | S, | ||
| const std::pair< int, int > & | dof | ||
| ) | const |
Adds a node load vector into the system load vector.
| sysRHS | The right-hand-side system load vector | |
| [in] | S | The nodal load vector |
| [in] | dof | Node and local dof number for the load value S |
References assembleRHS(), SystemVector::getPtr(), madof, meqn, and nnod.
Computes the dot-product of two vectors of length NDOF.
| [in] | x | The first vector of the dot-product |
| [in] | y | The second vector of the dot-product |
| [in] | dofType | Only consider DOFs of this type |
Reimplemented in SAMpatchPETSc.
References dof_type, utl::vector< T >::dot(), madof, nnod, nodeType, Real, and utl::vector< T >::size().
Referenced by SAMpatchPETSc::dot(), SIMbase::iterationNorms(), and norm2().
|
virtual |
Expands a solution vector from equation-ordering to DOF-ordering.
| [in] | solVec | Solution vector, length = NEQ |
| [out] | dofVec | Degrees of freedom vector, length = NDOF |
| [in] | scaleSD | Scaling factor for specified (slave) DOFs |
The size of the solution vector that comes out of the linear equation solver equals the number of free DOFs in the system (=NEQ). That is, all fixed or constrained (slave) DOFs are not present. Before we can compute derived element quantities we therefore need to extract the resulting solution values also for the constrained DOFs.
Reimplemented in SAMpatchPETSc.
References SystemVector::dim(), expandVector(), SystemVector::getRef(), and neq.
Referenced by SAMpatchPETSc::expandSolution(), SIMbase::extractLoadVec(), AlgEqSystem::finalize(), ReactionsOnly::finalize(), and SIMbase::solveEqSystem().
Expands a solution vector from equation-ordering to DOF-ordering.
| [in] | solVec | Pointer to solution vector, length = NEQ |
| [out] | dofVec | Degrees of freedom vector, length = NDOF |
| [in] | scaleSD | Scaling factor for specified (slave) DOFs |
References meqn, mmceq, mpmceq, ndof, neq, utl::vector< T >::ptr(), Real, utl::vector< T >::resize(), and ttcc.
Expands a solution vector from equation-ordering to DOF-ordering.
| [in] | solVec | Solution vector, length = NEQ |
| [out] | dofVec | Degrees of freedom vector, length = NDOF |
This version is typically used to expand eigenvectors.
References neq, utl::vector< T >::ptr(), Real, and utl::vector< T >::size().
Referenced by expandSolution(), AlgEqSystem::recoverInternals(), and SIMbase::systemModes().
Computes the sparse structure (DOF couplings) in the system matrix.
| [out] | irow | start index for each row in jcol |
| [out] | jcol | column indices for non-zero entries |
References neq.
Referenced by ISTLMatrix::initAssembly(), and SparseMatrix::preAssemble().
Returns specified solution component from a global solution vector.
| [in] | dofVec | Solution vector in DOF order |
| [in] | inod | Identifier for the node to get solution component for |
| [in] | ldof | Local index of the DOF within node inod |
| bool SAM::getElmEqns | ( | IntVec & | meen, |
| int | iel, | ||
| size_t | nedof = 0 |
||
| ) | const |
Finds the matrix of equation numbers for an element.
| [out] | meen | Matrix of element equation numbers |
| [in] | iel | Identifier for the element to get the equation numbers for |
| [in] | nedof | Number of degrees of freedom in the element (used for internal consistency checking, unless zero) |
References madof, meqn, mmnpc, mpmceq, mpmnpc, and nel.
Referenced by DenseMatrix::assemble(), DiagMatrix::assemble(), SparseMatrix::assemble(), PETScMatrix::assemble(), assembleSystem(), getDofCouplings(), DomainDecomposition::getSubdomains(), getUniqueEqns(), and ASMs2D::validateThreadGroups().
| bool SAM::getElmNodes | ( | IntVec & | mnpc, |
| int | iel | ||
| ) | const |
Finds the matrix of nodal point correspondance for an element.
| [out] | mnpc | Matrix of nodal point correspondance |
| [in] | iel | Identifier for the element to get the node numbers for |
References mmnpc, mpmnpc, and nel.
Referenced by GlbForceVec::assemble(), SIMbase::getElmNodes(), and DomainDecomposition::getSubdomains().
| int SAM::getEquation | ( | int | inod, |
| int | ldof | ||
| ) | const |
Finds the equation number corresponding to a local nodal DOF.
| [in] | inod | Identifier for the node to get the equation number for |
| [in] | ldof | Local index of the DOF within node inod |
References madof, meqn, and nnod.
Referenced by DomainDecomposition::calcGlobalEqNumbers(), getEquations(), DomainDecomposition::setup(), and SIMbase::updateForNewElements().
| IntSet SAM::getEquations | ( | char | dType, |
| int | dof = 0 |
||
| ) | const |
Returns the equations numbers for a given DOF type.
| [in] | dType | The DOF type to consider |
| [in] | dof | The local DOF in each node to consider (0 = all) |
References dof_type, getEquation(), madof, meqn, nnod, and nodeType.
Referenced by DomainDecomposition::setup().
Returns a vector of reaction forces for a given node.
| [in] | inod | Identifier for the node to get the reaction forces for |
| [in] | rf | Reaction force container for the entire model |
| [out] | nrf | Nodal reaction forces |
References madof, msc, and nnod.
Referenced by SIMoutput::dumpResults(), and SIMoutput::printNRforces().
| std::pair< int, int > SAM::getNodeAndLocalDof | ( | int | idof, |
| bool | eqno = false |
||
| ) | const |
Returns the internal node number and local index for a global DOF.
| [in] | idof | Global DOF-number in the range [1,NDOF] |
| [in] | eqno | If true, idof is the 1-based global equation number |
References madof, meqn, minex, ndof, and nnod.
Referenced by SIMbase::getWorstDofs(), printCEQ(), SPRMatrix::solve(), and ASMs2D::validateThreadGroups().
| std::pair< int, int > SAM::getNodeDOFs | ( | int | inod | ) | const |
Returns the first and last DOFs for a node.
| [in] | inod | Identifier for the node to get the DOF numbers for |
Referenced by GlbForceVec::assemble(), DomainDecomposition::calcGlobalNodeNumbers(), SIMoutput::dumpSolution(), SIMbase::extractLoadVec(), and SIMgeneric::getInterfaceForces().
| bool SAM::getNodeEqns | ( | IntVec & | mnen, |
| int | inod | ||
| ) | const |
Finds the matrix of equation numbers for a node.
| [out] | mnen | Matrix of node equation numbers |
| [in] | inod | Identifier for the node to get the equation numbers for |
References madof, meqn, and nnod.
Referenced by SparseMatrix::assembleCol(), assembleSystem(), SIMbase::dumpEqSys(), DomainDecomposition::getSubdomains(), AlgEqSystem::recoverInternals(), and AlgEqSystem::staticCondensation().
|
inline |
Returns the DOF classification of a given node.
| [in] | inod | Identifier for the node to get the classification for |
References nodeType.
Referenced by SIMbase::getNodeType(), and DomainDecomposition::getSubdomains().
| int SAM::getNoNodes | ( | char | dofType = 'A' | ) | const |
Returns the number of FE nodes in the model.
| [in] | dofType | Only consider nodes of this type (default All) |
References nnod, and nodeType.
Referenced by DomainDecomposition::calcGlobalNodeNumbers(), SIMbase::dumpEqSys(), SIMbase::extractLoadVec(), SIMoutput::extractNodeVec(), SIMbase::extractPatchSolution(), SIMbase::getNoNodes(), GlbForceVec::initNodeMap(), SIMbase::merge(), and SIMoutput::printNRforces().
Returns the total reaction force in the given coordinate direction.
| [in] | dir | 1-based coordinate direction index |
| [in] | rf | Reaction force container for the entire model |
| [in] | nodes | The set of nodes to consider (null means all nodes) |
References madof, msc, nnod, nspdof, and Real.
Referenced by SIMbase::getCurrentReactions().
Extracts equation-ordered solution vector from DOF-ordered vector.
| [out] | solVec | Solution vector in equation order |
| [in] | dofVec | Solution vector in DOF order |
This method is basically doing the opposite transformation as expandVector().
References meqn, ndof, neq, and Real.
Referenced by SIMbase::dumpSolVec().
| void SAM::getUniqueEqns | ( | IntSet & | meen, |
| int | iel | ||
| ) | const |
Finds the set of unique equation numbers for an element.
| [out] | meen | Matrix of unique element equation numbers |
| [in] | iel | Identifier for the element to get equation numbers for |
References getElmEqns(), meqn, mmceq, and mpmceq.
| bool SAM::haveReaction | ( | int | dir, |
| const IntVec * | nodes = nullptr |
||
| ) | const |
Checks for total reaction force in the given coordinate direction.
| [in] | dir | 1-based coordinate direction index |
| [in] | nodes | The set of nodes to consider (null means all nodes) |
References madof, msc, nnod, and nspdof.
Referenced by SIMbase::haveReactions().
Computes the l2-norm of a vector of length NDOF.
| [in] | x | The vector to compute the norm of |
| [in] | dofType | Only consider DOFs of this type |
References dot().
Referenced by SIMbase::iterationNorms().
Computes the L_infinity-norm of a vector of length NDOF.
| [in] | x | The vector to compute the norm of |
| comp | Local nodal DOF on input, index of the largest value on output | |
| [in] | dofType | Only consider DOFs of this type |
Reimplemented in SAMpatchPETSc.
References dof_type, utl::vector< T >::empty(), madof, nnod, nodeType, utl::vector< T >::normInf(), and Real.
Referenced by SAMpatchPETSc::normInf(), and SIMbase::solutionNorms().
Computes the L2-norm of a vector of length NDOF.
| [in] | x | The vector to compute the norm of |
| [in] | dofType | Only consider DOFs of this type |
Reimplemented in SAMpatchPETSc.
References dof_type, utl::vector< T >::empty(), madof, nnod, nodeType, utl::vector< T >::norm2(), Real, and utl::vector< T >::size().
Referenced by SAMpatchPETSc::normL2(), and SIMbase::solutionNorms().
Computes the energy norm contributions from nodal reaction forces.
| [in] | u | The (incremental) nodal displacement vector |
| [in] | rf | Reaction force container for the entire model |
References meqn, mpmceq, msc, ndof, and Real.
Referenced by SIMbase::externalEnergy(), and SIMbase::getCurrentReactions().