Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX > Class Template Referenceabstract

#include <AbstractContinuumMechanicsAssembler.hpp>

+ Inheritance diagram for AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >:
+ Collaboration diagram for AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >:

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 Member Functions

void DoAssemble ()
 
virtual c_matrix< double, SPATIAL_BLOCK_SIZE_ELEMENTAL, SPATIAL_BLOCK_SIZE_ELEMENTALComputeSpatialSpatialMatrixTerm (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)
 
virtual c_matrix< double, SPATIAL_BLOCK_SIZE_ELEMENTAL, PRESSURE_BLOCK_SIZE_ELEMENTALComputeSpatialPressureMatrixTerm (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)
 
virtual c_matrix< double, PRESSURE_BLOCK_SIZE_ELEMENTAL, PRESSURE_BLOCK_SIZE_ELEMENTALComputePressurePressureMatrixTerm (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)
 
virtual c_vector< double, SPATIAL_BLOCK_SIZE_ELEMENTALComputeSpatialVectorTerm (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)=0
 
virtual c_vector< double, PRESSURE_BLOCK_SIZE_ELEMENTALComputePressureVectorTerm (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)
 
void AssembleOnElement (Element< DIM, DIM > &rElement, c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > &rAElem, c_vector< double, STENCIL_SIZE > &rBElem)
 

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
 

Detailed Description

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
class AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >

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.

Constructor & Destructor Documentation

◆ AbstractContinuumMechanicsAssembler()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::AbstractContinuumMechanicsAssembler ( AbstractTetrahedralMesh< DIM, DIM > *  pMesh)
inline

Constructor

Parameters
pMeshPointer to the mesh

Definition at line 294 of file AbstractContinuumMechanicsAssembler.hpp.

References EXCEPTION, and AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpQuadRule.

◆ ~AbstractContinuumMechanicsAssembler()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
virtual AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::~AbstractContinuumMechanicsAssembler ( )
inlinevirtual

Member Function Documentation

◆ AssembleOnElement()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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.

Parameters
rElementThe element to assemble on.
rAElemThe 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.
rBElemThe 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.

◆ ComputePressurePressureMatrixTerm()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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 
)
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

Parameters
rLinearPhiAll the linear basis functions on this element, evaluated at the current quad point
rGradLinearPhiGradients of all the linear basis functions on this element, evaluated at the current quad point
rXCurrent location (physical position)
pElementCurrent element
Returns
stencil matrix

Reimplemented in StokesFlowPreconditionerAssembler< DIM >.

Definition at line 205 of file AbstractContinuumMechanicsAssembler.hpp.

References AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::PRESSURE_BLOCK_SIZE_ELEMENTAL.

◆ ComputePressureVectorTerm()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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 
)
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

Parameters
rLinearPhiAll the linear basis functions on this element, evaluated at the current quad point
rGradLinearPhiGradients of all the linear basis functions on this element, evaluated at the current quad point
rXCurrent location (physical position)
pElementCurrent element
Returns
stencil vector

Definition at line 266 of file AbstractContinuumMechanicsAssembler.hpp.

References AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::PRESSURE_BLOCK_SIZE_ELEMENTAL.

◆ ComputeSpatialPressureMatrixTerm()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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 
)
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

Parameters
rQuadPhiAll the quadratic basis functions on this element, evaluated at the current quad point
rGradQuadPhiGradients of all the quadratic basis functions on this element, evaluated at the current quad point
rLinearPhiAll the linear basis functions on this element, evaluated at the current quad point
rGradLinearPhiGradients of all the linear basis functions on this element, evaluated at the current quad point
rXCurrent location (physical position corresponding to quad point)
pElementCurrent element
Returns
stencil matrix

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.

◆ ComputeSpatialSpatialMatrixTerm()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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 
)
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

Parameters
rQuadPhiAll the quadratic basis functions on this element, evaluated at the current quad point
rGradQuadPhiGradients of all the quadratic basis functions on this element, evaluated at the current quad point
rXCurrent location (physical position)
pElementCurrent element
Returns
stencil matrix

Reimplemented in StokesFlowAssembler< DIM >.

Definition at line 143 of file AbstractContinuumMechanicsAssembler.hpp.

References AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::SPATIAL_BLOCK_SIZE_ELEMENTAL.

◆ ComputeSpatialVectorTerm()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
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 
)
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

Parameters
rQuadPhiAll the quadratic basis functions on this element, evaluated at the current quad point
rGradQuadPhiGradients of all the quadratic basis functions on this element, evaluated at the current quad point
rXCurrent location (physical position)
pElementCurrent element
Returns
stencil vector

Implemented in StokesFlowAssembler< DIM >.

◆ DoAssemble()

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
void AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::DoAssemble ( )
protectedvirtual

Member Data Documentation

◆ BLOCK_SYMMETRIC_MATRIX

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const bool AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::BLOCK_SYMMETRIC_MATRIX = true
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.

◆ mpMesh

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
AbstractTetrahedralMesh<DIM,DIM>* AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::mpMesh
protected

The quadratic mesh

Definition at line 110 of file AbstractContinuumMechanicsAssembler.hpp.

◆ mpQuadRule

◆ NUM_NODES_PER_ELEMENT

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2
staticprotected

Number of nodes per element.

Definition at line 99 of file AbstractContinuumMechanicsAssembler.hpp.

◆ NUM_VERTICES_PER_ELEMENT

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::NUM_VERTICES_PER_ELEMENT = DIM+1
staticprotected

Number of vertices per element.

Definition at line 96 of file AbstractContinuumMechanicsAssembler.hpp.

◆ PRESSURE_BLOCK_SIZE_ELEMENTAL

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::PRESSURE_BLOCK_SIZE_ELEMENTAL = NUM_VERTICES_PER_ELEMENT
staticprotected

◆ SPATIAL_BLOCK_SIZE_ELEMENTAL

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::SPATIAL_BLOCK_SIZE_ELEMENTAL = DIM*NUM_NODES_PER_ELEMENT
staticprotected

◆ STENCIL_SIZE

template<unsigned DIM, bool CAN_ASSEMBLE_VECTOR, bool CAN_ASSEMBLE_MATRIX>
const unsigned AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT
staticprotected

Stencil size.

Definition at line 107 of file AbstractContinuumMechanicsAssembler.hpp.


The documentation for this class was generated from the following file: