Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <AbstractContinuumMechanicsAssembler.hpp>
Public Member Functions | |
AbstractContinuumMechanicsAssembler (AbstractTetrahedralMesh< DIM, DIM > *pMesh) | |
virtual | ~AbstractContinuumMechanicsAssembler () |
Public Member Functions inherited from AbstractFeAssemblerInterface< CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX > | |
AbstractFeAssemblerInterface () | |
void | SetMatrixToAssemble (Mat &rMatToAssemble, bool zeroMatrixBeforeAssembly=true) |
void | SetVectorToAssemble (Vec &rVecToAssemble, bool zeroVectorBeforeAssembly) |
void | Assemble () |
void | AssembleMatrix () |
void | AssembleVector () |
virtual | ~AbstractFeAssemblerInterface () |
Protected Attributes | |
AbstractTetrahedralMesh< DIM, DIM > * | mpMesh |
GaussianQuadratureRule< DIM > * | mpQuadRule |
Protected Attributes inherited from AbstractFeAssemblerInterface< CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX > | |
Vec | mVectorToAssemble |
Mat | mMatrixToAssemble |
bool | mAssembleMatrix |
bool | mAssembleVector |
bool | mZeroMatrixBeforeAssembly |
bool | mZeroVectorBeforeAssembly |
PetscInt | mOwnershipRangeLo |
PetscInt | mOwnershipRangeHi |
Static Protected Attributes | |
static const bool | BLOCK_SYMMETRIC_MATRIX = true |
static const unsigned | NUM_VERTICES_PER_ELEMENT = DIM+1 |
static const unsigned | NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2 |
static const unsigned | SPATIAL_BLOCK_SIZE_ELEMENTAL = DIM*NUM_NODES_PER_ELEMENT |
static const unsigned | PRESSURE_BLOCK_SIZE_ELEMENTAL = NUM_VERTICES_PER_ELEMENT |
static const unsigned | STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT |
Abstract class for assembling volume-integral parts of matrices and vectors in continuum mechanics problems.
For such problems, the matrix has, essentially, the form [A B1] [B2^T C ] (where often B1=B2 and C=0) and the vector has the form [b1] [b2] A is the spatial-spatial part, B1 the spatial-pressure part, etc.
Currently B1=B2 is assumed, this can be changed in the future.
This class works in the same way as the volume assembler in pde (AbstractFeVolumeIntegralAssembler), except the concrete class has to provide up to 6 methods, for each of the blocks A,B1,B2 and for b1 and b2.
The assembler is main used for fluids - currently it is used for assembling the matrix for Stokes flow [A B ; B^T 0], and the preconditioner for Stokes flow [A, B; B^T M], and will be useful for further fluids assemblies, and could be used for mixed-problem incompressible linear elasticity. We DON'T use this assembler in the incompressible nonlinear elasticity solver, because even though the matrix is of the right form, things like stress and stress-derivative need to be computed at the AssembleOnElement level and the assembly is in general too complex for this class to be used.
NOTE: The elemental matrix and vector is as above. The full matrix and vector uses a completely different ordering: for parallelisation reasons the pressure variables are interleaved with the spatial variables and dummy pressure variables are used for internal nodes. For example, in 2d, the ordering is [U1 V1 P1 , .. , Un Vn, Pn] where n is the total number of nodes.
Definition at line 87 of file AbstractContinuumMechanicsAssembler.hpp.
|
inline |
Constructor
pMesh | Pointer to the mesh |
Definition at line 294 of file AbstractContinuumMechanicsAssembler.hpp.
References EXCEPTION, and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpQuadRule.
|
inlinevirtual |
Destructor.
Definition at line 319 of file AbstractContinuumMechanicsAssembler.hpp.
References AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpQuadRule.
|
protected |
Calculate the contribution of a single element to the linear system.
rElement | The element to assemble on. |
rAElem | The element's contribution to the LHS matrix is returned in this n by n matrix, where n is the no. of nodes in this element. There is no need to zero this matrix before calling. |
rBElem | The element's contribution to the RHS vector is returned in this vector of length n, the no. of nodes in this element. There is no need to zero this vector before calling. |
Definition at line 442 of file AbstractContinuumMechanicsAssembler.hpp.
References LinearBasisFunction< ELEMENT_DIM >::ComputeBasisFunctions(), QuadraticBasisFunction< ELEMENT_DIM >::ComputeBasisFunctions(), LinearBasisFunction< ELEMENT_DIM >::ComputeTransformedBasisFunctionDerivatives(), QuadraticBasisFunction< ELEMENT_DIM >::ComputeTransformedBasisFunctionDerivatives(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), and NEVER_REACHED.
|
inlineprotectedvirtual |
For a continuum mechanics problem in mixed form (displacement-pressure or velocity-pressure), the matrix has the form (except see comments about ordering above) [A B1] [B2^T C ] (where often B1=B2 and C=0). The function is related to the pressure-pressure block, ie matrix C.
For the contribution to A from a given element, this method should return the INTEGRAND in the definition of C. See concrete classes for examples. Needed to be implemented (overridden) if the concrete class is going to assemble matrices (ie if CAN_ASSEMBLE_MATRIX is true).
Default implementation returns a zero matrix - ie the block will be zero if this is not over-ridden
rLinearPhi | All the linear basis functions on this element, evaluated at the current quad point |
rGradLinearPhi | Gradients of all the linear basis functions on this element, evaluated at the current quad point |
rX | Current location (physical position) |
pElement | Current element |
Reimplemented in StokesFlowPreconditionerAssembler< DIM >.
Definition at line 205 of file AbstractContinuumMechanicsAssembler.hpp.
|
inlineprotectedvirtual |
For a continuum mechanics problem in mixed form (displacement-pressure or velocity-pressure), the matrix has the form (except see comments about ordering above) [A B1] [B2^T C ] (where often B1=B2 and C=0) and the vector has the form [b1] [b2] The function is related to the pressure-block in the vector, ie b2.
For the contribution to b1 from a given element, this method should return the INTEGRAND in the definition of b2. See concrete classes for examples. Needed to be implemented (overridden) if the concrete class is going to assemble vectors (ie if CAN_ASSEMBLE_VECTOR is true).
Default implementation returns a zero vector - ie the block will be zero if this is not over-ridden
rLinearPhi | All the linear basis functions on this element, evaluated at the current quad point |
rGradLinearPhi | Gradients of all the linear basis functions on this element, evaluated at the current quad point |
rX | Current location (physical position) |
pElement | Current element |
Definition at line 266 of file AbstractContinuumMechanicsAssembler.hpp.
|
inlineprotectedvirtual |
For a continuum mechanics problem in mixed form (displacement-pressure or velocity-pressure), the matrix has the form (except see comments about ordering above) [A B1] [B2^T C ] (where often B1=B2 and C=0). The function is related to the spatial-pressure block, ie matrix B1. If BLOCK_SYMMETRIC_MATRIX is true, B1=B2 is assumed, so it also relates to B2.
For the contribution to A from a given element, this method should return the INTEGRAND in the definition of B. See concrete classes for examples. Needed to be implemented (overridden) if the concrete class is going to assemble matrices (ie if CAN_ASSEMBLE_MATRIX is true).
Default implementation returns a zero matrix - ie the block will be zero if this is not over-ridden
rQuadPhi | All the quadratic basis functions on this element, evaluated at the current quad point |
rGradQuadPhi | Gradients of all the quadratic basis functions on this element, evaluated at the current quad point |
rLinearPhi | All the linear basis functions on this element, evaluated at the current quad point |
rGradLinearPhi | Gradients of all the linear basis functions on this element, evaluated at the current quad point |
rX | Current location (physical position corresponding to quad point) |
pElement | Current element |
Reimplemented in StokesFlowAssembler< DIM >.
Definition at line 174 of file AbstractContinuumMechanicsAssembler.hpp.
References AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::PRESSURE_BLOCK_SIZE_ELEMENTAL, and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::SPATIAL_BLOCK_SIZE_ELEMENTAL.
|
inlineprotectedvirtual |
For a continuum mechanics problem in mixed form (displacement-pressure or velocity-pressure), the matrix has the form (except see comments about ordering above) [A B1] [B2^T C ] (where often B1=B2 and C=0). The function is related to the spatial-spatial block, ie matrix A.
For the contribution to A from a given element, this method should return the INTEGRAND in the definition of A. See concrete classes for examples. Needed to be implemented (overridden) if the concrete class is going to assemble matrices (ie if CAN_ASSEMBLE_MATRIX is true).
Default implementation returns a zero matrix - ie the block will be zero if this is not over-ridden
rQuadPhi | All the quadratic basis functions on this element, evaluated at the current quad point |
rGradQuadPhi | Gradients of all the quadratic basis functions on this element, evaluated at the current quad point |
rX | Current location (physical position) |
pElement | Current element |
Reimplemented in StokesFlowAssembler< DIM >.
Definition at line 143 of file AbstractContinuumMechanicsAssembler.hpp.
|
protectedpure virtual |
For a continuum mechanics problem in mixed form (displacement-pressure or velocity-pressure), the matrix has the form (except see comments about ordering above) [A B1] [B2^T C ] (where often B1=B2 and C=0) and the vector has the form [b1] [b2] The function is related to the spatial-block in the vector, ie b1.
For the contribution to b1 from a given element, this method should return the INTEGRAND in the definition of b1. See concrete classes for examples. Needed to be implemented (overridden) if the concrete class is going to assemble vectors (ie if CAN_ASSEMBLE_VECTOR is true).
No default implementation - this method must be over-ridden
rQuadPhi | All the quadratic basis functions on this element, evaluated at the current quad point |
rGradQuadPhi | Gradients of all the quadratic basis functions on this element, evaluated at the current quad point |
rX | Current location (physical position) |
pElement | Current element |
Implemented in StokesFlowAssembler< DIM >.
|
protectedvirtual |
The main assembly method. Protected, should only be called through Assemble(), AssembleMatrix() or AssembleVector() which set mAssembleMatrix, mAssembleVector accordingly. Involves looping over elements, and computing integrals and adding them to the vector or matrix
Implements AbstractFeAssemblerInterface< CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >.
Definition at line 344 of file AbstractContinuumMechanicsAssembler.hpp.
References EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), PetscTools::GetMyRank(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetOwnership(), PetscMatTools::GetSize(), PetscVecTools::GetSize(), CommandLineArguments::Instance(), CommandLineArguments::OptionExists(), PetscMatTools::Zero(), and PetscVecTools::Zero().
|
staticprotected |
Whether the matrix is block symmetric (B1=B2). Currently fixed to true, in the future this may become a template.
Definition at line 93 of file AbstractContinuumMechanicsAssembler.hpp.
|
protected |
The quadratic mesh
Definition at line 110 of file AbstractContinuumMechanicsAssembler.hpp.
|
protected |
Quadrature rule for volume integrals
Definition at line 113 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::AbstractContinuumMechanicsAssembler(), and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::~AbstractContinuumMechanicsAssembler().
|
staticprotected |
Number of nodes per element.
Definition at line 99 of file AbstractContinuumMechanicsAssembler.hpp.
|
staticprotected |
Number of vertices per element.
Definition at line 96 of file AbstractContinuumMechanicsAssembler.hpp.
|
staticprotected |
Size of the pressure-block (the number of rows or columns in the submatrix C), restricted to one element
Definition at line 104 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputePressurePressureMatrixTerm(), AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputePressureVectorTerm(), and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialPressureMatrixTerm().
|
staticprotected |
Size of the spatial-block (the number or rows or columns in the submatrix A), restricted to one element
Definition at line 102 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialPressureMatrixTerm(), and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialSpatialMatrixTerm().
|
staticprotected |
Stencil size.
Definition at line 107 of file AbstractContinuumMechanicsAssembler.hpp.