Chaste Release::3.1
|
#include <AbstractContinuumMechanicsAssembler.hpp>
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 85 of file AbstractContinuumMechanicsAssembler.hpp.
AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::AbstractContinuumMechanicsAssembler | ( | QuadraticMesh< DIM > * | pMesh, |
unsigned | numQuadPoints = 3 |
||
) | [inline] |
Constructor
pMesh | Pointer to the mesh |
numQuadPoints | Number of quadrature points in each direction, defaults to 3 |
Definition at line 292 of file AbstractContinuumMechanicsAssembler.hpp.
virtual AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::~AbstractContinuumMechanicsAssembler | ( | ) | [inline, virtual] |
Destructor.
Definition at line 307 of file AbstractContinuumMechanicsAssembler.hpp.
void AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::AssembleOnElement | ( | Element< DIM, DIM > & | rElement, |
c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > & | rAElem, | ||
c_vector< double, STENCIL_SIZE > & | rBElem | ||
) | [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 431 of file AbstractContinuumMechanicsAssembler.hpp.
References QuadraticBasisFunction< ELEMENT_DIM >::ComputeBasisFunctions(), LinearBasisFunction< 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.
virtual c_matrix<double,PRESSURE_BLOCK_SIZE_ELEMENTAL,PRESSURE_BLOCK_SIZE_ELEMENTAL> AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputePressurePressureMatrixTerm | ( | c_vector< double, NUM_VERTICES_PER_ELEMENT > & | rLinearPhi, |
c_matrix< double, DIM, NUM_VERTICES_PER_ELEMENT > & | rGradLinearPhi, | ||
c_vector< double, DIM > & | rX, | ||
Element< DIM, DIM > * | pElement | ||
) | [inline, protected, 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). 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 200 of file AbstractContinuumMechanicsAssembler.hpp.
virtual c_vector<double,PRESSURE_BLOCK_SIZE_ELEMENTAL> AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputePressureVectorTerm | ( | c_vector< double, NUM_VERTICES_PER_ELEMENT > & | rLinearPhi, |
c_matrix< double, DIM, NUM_VERTICES_PER_ELEMENT > & | rGradLinearPhi, | ||
c_vector< double, DIM > & | rX, | ||
Element< DIM, DIM > * | pElement | ||
) | [inline, protected, 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 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 262 of file AbstractContinuumMechanicsAssembler.hpp.
virtual c_matrix<double,SPATIAL_BLOCK_SIZE_ELEMENTAL,PRESSURE_BLOCK_SIZE_ELEMENTAL> AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialPressureMatrixTerm | ( | c_vector< double, NUM_NODES_PER_ELEMENT > & | rQuadPhi, |
c_matrix< double, DIM, NUM_NODES_PER_ELEMENT > & | rGradQuadPhi, | ||
c_vector< double, NUM_VERTICES_PER_ELEMENT > & | rLinearPhi, | ||
c_matrix< double, DIM, NUM_VERTICES_PER_ELEMENT > & | rGradLinearPhi, | ||
c_vector< double, DIM > & | rX, | ||
Element< DIM, DIM > * | pElement | ||
) | [inline, protected, 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). 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 170 of file AbstractContinuumMechanicsAssembler.hpp.
virtual c_matrix<double,SPATIAL_BLOCK_SIZE_ELEMENTAL,SPATIAL_BLOCK_SIZE_ELEMENTAL> AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialSpatialMatrixTerm | ( | c_vector< double, NUM_NODES_PER_ELEMENT > & | rQuadPhi, |
c_matrix< double, DIM, NUM_NODES_PER_ELEMENT > & | rGradQuadPhi, | ||
c_vector< double, DIM > & | rX, | ||
Element< DIM, DIM > * | pElement | ||
) | [inline, protected, 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). 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 140 of file AbstractContinuumMechanicsAssembler.hpp.
virtual c_vector<double,SPATIAL_BLOCK_SIZE_ELEMENTAL> AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::ComputeSpatialVectorTerm | ( | c_vector< double, NUM_NODES_PER_ELEMENT > & | rQuadPhi, |
c_matrix< double, DIM, NUM_NODES_PER_ELEMENT > & | rGradQuadPhi, | ||
c_vector< double, DIM > & | rX, | ||
Element< DIM, DIM > * | pElement | ||
) | [inline, protected, 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).
Default implementation returns a zero vector - 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 231 of file AbstractContinuumMechanicsAssembler.hpp.
void AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::DoAssemble | ( | ) | [protected, virtual] |
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 332 of file AbstractContinuumMechanicsAssembler.hpp.
References EXCEPTION, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), PetscTools::GetMyRank(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetOwnership(), PetscVecTools::GetSize(), PetscMatTools::GetSize(), CommandLineArguments::Instance(), CommandLineArguments::OptionExists(), PetscMatTools::Zero(), and PetscVecTools::Zero().
const bool AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::BLOCK_SYMMETRIC_MATRIX = true [static, private] |
Whether the matrix is block symmetric (B1=B2). Currently fixed to true, in the future this may become a template.
Definition at line 90 of file AbstractContinuumMechanicsAssembler.hpp.
QuadraticMesh<DIM>* AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpMesh [protected] |
The quadratic mesh
Definition at line 108 of file AbstractContinuumMechanicsAssembler.hpp.
GaussianQuadratureRule<DIM>* AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpQuadRule [protected] |
Quadrature rule for volume integrals
Definition at line 111 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, true, true >::AbstractContinuumMechanicsAssembler(), and AbstractContinuumMechanicsAssembler< DIM, true, true >::~AbstractContinuumMechanicsAssembler().
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2 [static, private] |
Number of nodes per element.
Reimplemented in StokesFlowAssembler< DIM >.
Definition at line 96 of file AbstractContinuumMechanicsAssembler.hpp.
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::NUM_VERTICES_PER_ELEMENT = DIM+1 [static, private] |
Number of vertices per element.
Reimplemented in StokesFlowAssembler< DIM >, and StokesFlowPreconditionerAssembler< DIM >.
Definition at line 93 of file AbstractContinuumMechanicsAssembler.hpp.
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::PRESSURE_BLOCK_SIZE_ELEMENTAL = NUM_VERTICES_PER_ELEMENT [static, private] |
Size of the pressure-block (the number of rows or columns in the submatrix C), restricted to one element
Reimplemented in StokesFlowAssembler< DIM >, and StokesFlowPreconditionerAssembler< DIM >.
Definition at line 101 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputePressurePressureMatrixTerm(), AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputePressureVectorTerm(), and AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputeSpatialPressureMatrixTerm().
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::SPATIAL_BLOCK_SIZE_ELEMENTAL = DIM*NUM_NODES_PER_ELEMENT [static, private] |
Size of the spatial-block (the number or rows or columns in the submatrix A), restricted to one element
Reimplemented in StokesFlowAssembler< DIM >.
Definition at line 99 of file AbstractContinuumMechanicsAssembler.hpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputeSpatialPressureMatrixTerm(), AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputeSpatialSpatialMatrixTerm(), and AbstractContinuumMechanicsAssembler< DIM, true, true >::ComputeSpatialVectorTerm().
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT [static, private] |
Stencil size.
Definition at line 104 of file AbstractContinuumMechanicsAssembler.hpp.