NonlinearElasticityAssembler< DIM > Class Template Reference

#include <NonlinearElasticityAssembler.hpp>

Inherits AbstractNonlinearElasticityAssembler< DIM >.

Inherited by AbstractCardiacMechanicsAssembler< DIM >.

Collaboration diagram for NonlinearElasticityAssembler< DIM >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NonlinearElasticityAssembler (QuadraticMesh< DIM > *pQuadMesh, AbstractIncompressibleMaterialLaw< DIM > *pMaterialLaw, c_vector< double, DIM > bodyForce, double density, std::string outputDirectory, std::vector< unsigned > &fixedNodes, std::vector< c_vector< double, DIM > > *pFixedNodeLocations=NULL)
 NonlinearElasticityAssembler (QuadraticMesh< DIM > *pQuadMesh, std::vector< AbstractIncompressibleMaterialLaw< DIM > * > &rMaterialLaws, c_vector< double, DIM > bodyForce, double density, std::string outputDirectory, std::vector< unsigned > &fixedNodes, std::vector< c_vector< double, DIM > > *pFixedNodeLocations=NULL)
 ~NonlinearElasticityAssembler ()
void SetSurfaceTractionBoundaryConditions (std::vector< BoundaryElement< DIM-1, DIM > * > &rBoundaryElements, std::vector< c_vector< double, DIM > > &rSurfaceTractions)
void SetFunctionalTractionBoundaryCondition (std::vector< BoundaryElement< DIM-1, DIM > * > rBoundaryElements, c_vector< double, DIM >(*pFunction)(c_vector< double, DIM > &))
std::vector< double > & rGetPressures ()
std::vector< c_vector< double,
DIM > > & 
rGetDeformedPosition ()

Protected Member Functions

virtual void AssembleOnElement (Element< DIM, DIM > &rElement, c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > &rAElem, c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > &rAElemPrecond, c_vector< double, STENCIL_SIZE > &rBElem, bool assembleResidual, bool assembleJacobian)
virtual void AssembleOnBoundaryElement (BoundaryElement< DIM-1, DIM > &rBoundaryElement, c_matrix< double, BOUNDARY_STENCIL_SIZE, BOUNDARY_STENCIL_SIZE > &rAelem, c_vector< double, BOUNDARY_STENCIL_SIZE > &rBelem, c_vector< double, DIM > &rTraction, bool assembleResidual, bool assembleJacobian)
void FormInitialGuess ()
void AssembleSystem (bool assembleResidual, bool assembleJacobian)
void Initialise (std::vector< c_vector< double, DIM > > *pFixedNodeLocations)
void AllocateMatrixMemory ()

Protected Attributes

QuadraticMesh< DIM > * mpQuadMesh
std::vector< BoundaryElement
< DIM-1, DIM > * > 
mBoundaryElements
GaussianQuadratureRule< DIM > * mpQuadratureRule
GaussianQuadratureRule< DIM-1 > * mpBoundaryQuadratureRule

Static Protected Attributes

static const size_t NUM_VERTICES_PER_ELEMENT = DIM+1
static const size_t NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2
static const size_t STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT
static const size_t NUM_NODES_PER_BOUNDARY_ELEMENT = DIM*(DIM+1)/2
static const size_t BOUNDARY_STENCIL_SIZE = DIM*NUM_NODES_PER_BOUNDARY_ELEMENT + DIM

Friends

class TestNonlinearElasticityAssembler

Detailed Description

template<size_t DIM>
class NonlinearElasticityAssembler< DIM >

Todo:
: factor out Dof handling?

Finite elasticity assembler. Solves static incompressible nonlinear elasticity problems with arbitrary material laws and a body force.

Uses quadratic-linear bases (for displacement and pressure), and is therefore outside the assembler hierachy.

Currently only works with fixed nodes BCs (ie zerodisplacement) and zero-surface tractions on the rest of the boundary.

Definition at line 61 of file NonlinearElasticityAssembler.hpp.


Constructor & Destructor Documentation

template<size_t DIM>
NonlinearElasticityAssembler< DIM >::NonlinearElasticityAssembler ( QuadraticMesh< DIM > *  pQuadMesh,
AbstractIncompressibleMaterialLaw< DIM > *  pMaterialLaw,
c_vector< double, DIM >  bodyForce,
double  density,
std::string  outputDirectory,
std::vector< unsigned > &  fixedNodes,
std::vector< c_vector< double, DIM > > *  pFixedNodeLocations = NULL 
) [inline]

Constructor taking in mesh, material law (assuming homogeniety at the moment) body force, density, the fixed nodes (all the fixed nodes, including non-vertices), and the output directory.

Parameters:
pQuadMesh 
pMaterialLaw 
bodyForce 
density 
outputDirectory 
fixedNodes 
pFixedNodeLocations (defaults to NULL)

Definition at line 737 of file NonlinearElasticityAssembler.cpp.

References NonlinearElasticityAssembler< DIM >::Initialise().

template<size_t DIM>
NonlinearElasticityAssembler< DIM >::NonlinearElasticityAssembler ( QuadraticMesh< DIM > *  pQuadMesh,
std::vector< AbstractIncompressibleMaterialLaw< DIM > * > &  rMaterialLaws,
c_vector< double, DIM >  bodyForce,
double  density,
std::string  outputDirectory,
std::vector< unsigned > &  fixedNodes,
std::vector< c_vector< double, DIM > > *  pFixedNodeLocations = NULL 
) [inline]

Variant constructor taking a vector of material laws.

Parameters:
pQuadMesh 
rMaterialLaws 
bodyForce 
density 
outputDirectory 
fixedNodes 
pFixedNodeLocations (defaults to NULL)

Definition at line 755 of file NonlinearElasticityAssembler.cpp.

References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), and NonlinearElasticityAssembler< DIM >::Initialise().

template<size_t DIM>
NonlinearElasticityAssembler< DIM >::~NonlinearElasticityAssembler (  )  [inline]

Member Function Documentation

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::AllocateMatrixMemory (  )  [inline, protected]
template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::AssembleOnBoundaryElement ( BoundaryElement< DIM-1, DIM > &  rBoundaryElement,
c_matrix< double, BOUNDARY_STENCIL_SIZE, BOUNDARY_STENCIL_SIZE > &  rAelem,
c_vector< double, BOUNDARY_STENCIL_SIZE > &  rBelem,
c_vector< double, DIM > &  rTraction,
bool  assembleResidual,
bool  assembleJacobian 
) [inline, protected, virtual]

Compute the term from the surface integral of s*phi, where s is a specified non-zero surface traction (ie Neumann boundary condition) to be added to the Rhs vector.

Parameters:
rBoundaryElement 
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.
rTraction 
assembleResidual A bool stating whether to assemble the residual vector.
assembleJacobian A bool stating whether to assemble the Jacobian matrix.

Definition at line 514 of file NonlinearElasticityAssembler.cpp.

References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), GaussianQuadratureRule< ELEMENT_DIM >::GetNumQuadPoints(), GaussianQuadratureRule< ELEMENT_DIM >::GetWeight(), NonlinearElasticityAssembler< DIM >::mpBoundaryQuadratureRule, NonlinearElasticityAssembler< DIM >::mpQuadMesh, AbstractNonlinearElasticityAssembler< DIM >::mpTractionBoundaryConditionFunction, AbstractNonlinearElasticityAssembler< DIM >::mUsingTractionBoundaryConditionFunction, NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_BOUNDARY_ELEMENT, and GaussianQuadratureRule< ELEMENT_DIM >::rGetQuadPoint().

Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem().

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::AssembleOnElement ( Element< DIM, DIM > &  rElement,
c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > &  rAElem,
c_matrix< double, STENCIL_SIZE, STENCIL_SIZE > &  rAElemPrecond,
c_vector< double, STENCIL_SIZE > &  rBElem,
bool  assembleResidual,
bool  assembleJacobian 
) [inline, protected, virtual]

Assemble residual or jacobian on an element, using the current solution stored in mCurrrentSolution. The ordering assumed is (in 2d) rBElem = [u0 v0 u1 v1 .. u5 v5 p0 p1 p2].

Parameters:
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.
rAElemPrecond The element's contribution to the matrix passed to PetSC in creating a preconditioner
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.
assembleResidual A bool stating whether to assemble the residual vector.
assembleJacobian A bool stating whether to assemble the Jacobian matrix.

Reimplemented in AbstractCardiacMechanicsAssembler< DIM >.

Definition at line 191 of file NonlinearElasticityAssembler.cpp.

References AbstractIncompressibleMaterialLaw< DIM >::ComputeStressAndStressDerivative(), AbstractNonlinearElasticityAssembler< DIM >::dTdE, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), GaussianQuadratureRule< ELEMENT_DIM >::GetNumQuadPoints(), GaussianQuadratureRule< ELEMENT_DIM >::GetWeight(), AbstractNonlinearElasticityAssembler< DIM >::mBodyForce, AbstractNonlinearElasticityAssembler< DIM >::mCurrentSolution, AbstractNonlinearElasticityAssembler< DIM >::mDensity, AbstractNonlinearElasticityAssembler< DIM >::mMaterialLaws, AbstractNonlinearElasticityAssembler< DIM >::mpBodyForceFunction, NonlinearElasticityAssembler< DIM >::mpQuadMesh, NonlinearElasticityAssembler< DIM >::mpQuadratureRule, AbstractNonlinearElasticityAssembler< DIM >::mUsingBodyForceFunction, NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_ELEMENT, NonlinearElasticityAssembler< DIM >::NUM_VERTICES_PER_ELEMENT, GaussianQuadratureRule< ELEMENT_DIM >::rGetQuadPoint(), FourthOrderTensor< DIM >::SetAsProduct(), and NonlinearElasticityAssembler< DIM >::STENCIL_SIZE.

Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem().

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::AssembleSystem ( bool  assembleResidual,
bool  assembleJacobian 
) [inline, protected, virtual]

Assemble the residual vector (using the current solution stored in mCurrentSolution, output going to mpLinearSystem->rGetRhsVector), or Jacobian matrix (using the current solution stored in mCurrentSolution, output going to mpLinearSystem->rGetLhsMatrix).

Parameters:
assembleResidual A bool stating whether to assemble the residual vector.
assembleJacobian A bool stating whether to assemble the Jacobian matrix.

Implements AbstractNonlinearElasticityAssembler< DIM >.

Definition at line 47 of file NonlinearElasticityAssembler.cpp.

References LinearSystem::AddLhsMultipleValues(), LinearSystem::AddRhsMultipleValues(), AbstractNonlinearElasticityAssembler< DIM >::ApplyBoundaryConditions(), LinearSystem::AssembleFinalLhsMatrix(), LinearSystem::AssembleIntermediateLhsMatrix(), NonlinearElasticityAssembler< DIM >::AssembleOnBoundaryElement(), NonlinearElasticityAssembler< DIM >::AssembleOnElement(), LinearSystem::AssembleRhsVector(), NonlinearElasticityAssembler< DIM >::BOUNDARY_STENCIL_SIZE, PetscTools::GetMyRank(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetOwnership(), NonlinearElasticityAssembler< DIM >::mBoundaryElements, AbstractNonlinearElasticityAssembler< DIM >::mCurrentSolution, AbstractNonlinearElasticityAssembler< DIM >::mNumDofs, AbstractNonlinearElasticityAssembler< DIM >::mpLinearSystem, AbstractNonlinearElasticityAssembler< DIM >::mpPreconditionMatrixLinearSystem, NonlinearElasticityAssembler< DIM >::mpQuadMesh, AbstractNonlinearElasticityAssembler< DIM >::mSurfaceTractions, NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_BOUNDARY_ELEMENT, NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_ELEMENT, NonlinearElasticityAssembler< DIM >::NUM_VERTICES_PER_ELEMENT, NonlinearElasticityAssembler< DIM >::STENCIL_SIZE, LinearSystem::ZeroLhsMatrix(), and LinearSystem::ZeroRhsVector().

Referenced by ImplicitCardiacMechanicsAssembler< DIM >::Solve(), and ExplicitCardiacMechanicsAssembler< DIM >::Solve().

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::FormInitialGuess (  )  [inline, protected, virtual]

Set up the current guess to be the solution given no displacement. The current solution (in 2d) is order as [u1 v1 u2 v2 ... uN vN p1 p2 .. pM] (where there are N total nodes and M vertices) so the initial guess is [0 0 0 0 ... 0 0 p1 p2 .. pM] where p_i are such that T is zero (depends on material law).

In a homogeneous problem, all p_i are the same. In a heterogeneous problem, p for a given vertex is the zero-strain-pressure for ONE of the elements containing that vertex (which element containing the vertex is reached LAST). In this case the initial guess will be close but not exactly the solution given zero body force.

Implements AbstractNonlinearElasticityAssembler< DIM >.

Definition at line 578 of file NonlinearElasticityAssembler.cpp.

References AbstractNonlinearElasticityAssembler< DIM >::mCurrentSolution, AbstractNonlinearElasticityAssembler< DIM >::mMaterialLaws, AbstractNonlinearElasticityAssembler< DIM >::mNumDofs, NonlinearElasticityAssembler< DIM >::mpQuadMesh, and NonlinearElasticityAssembler< DIM >::NUM_VERTICES_PER_ELEMENT.

Referenced by NonlinearElasticityAssembler< DIM >::Initialise().

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::Initialise ( std::vector< c_vector< double, DIM > > *  pFixedNodeLocations  )  [inline, protected]
template<size_t DIM>
std::vector< c_vector< double, DIM > > & NonlinearElasticityAssembler< DIM >::rGetDeformedPosition (  )  [inline, virtual]
template<size_t DIM>
std::vector< double > & NonlinearElasticityAssembler< DIM >::rGetPressures (  )  [inline]
template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::SetFunctionalTractionBoundaryCondition ( std::vector< BoundaryElement< DIM-1, DIM > * >  rBoundaryElements,
c_vector< double, DIM >(*)(c_vector< double, DIM > &)  pFunction 
) [inline]

Set a function which gives the surface traction as a function of X (undeformed position), together with the surface elements which make up the Neumann part of the boundary.

Parameters:
rBoundaryElements 
pFunction 

Definition at line 791 of file NonlinearElasticityAssembler.cpp.

References NonlinearElasticityAssembler< DIM >::mBoundaryElements, AbstractNonlinearElasticityAssembler< DIM >::mpTractionBoundaryConditionFunction, and AbstractNonlinearElasticityAssembler< DIM >::mUsingTractionBoundaryConditionFunction.

template<size_t DIM>
void NonlinearElasticityAssembler< DIM >::SetSurfaceTractionBoundaryConditions ( std::vector< BoundaryElement< DIM-1, DIM > * > &  rBoundaryElements,
std::vector< c_vector< double, DIM > > &  rSurfaceTractions 
) [inline]

Specify traction boundary conditions (if this is not called zero surface tractions are assumed. This method takes in a list of boundary elements and a corresponding list of surface tractions.

Parameters:
rBoundaryElements 
rSurfaceTractions 

Definition at line 781 of file NonlinearElasticityAssembler.cpp.

References NonlinearElasticityAssembler< DIM >::mBoundaryElements, and AbstractNonlinearElasticityAssembler< DIM >::mSurfaceTractions.


Member Data Documentation

template<size_t DIM>
const size_t NonlinearElasticityAssembler< DIM >::BOUNDARY_STENCIL_SIZE = DIM*NUM_NODES_PER_BOUNDARY_ELEMENT + DIM [static, protected]

Boundary stencil size

Definition at line 76 of file NonlinearElasticityAssembler.hpp.

Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem().

template<size_t DIM>
std::vector<BoundaryElement<DIM-1,DIM>*> NonlinearElasticityAssembler< DIM >::mBoundaryElements [protected]
template<size_t DIM>
GaussianQuadratureRule<DIM-1>* NonlinearElasticityAssembler< DIM >::mpBoundaryQuadratureRule [protected]
template<size_t DIM>
QuadraticMesh<DIM>* NonlinearElasticityAssembler< DIM >::mpQuadMesh [protected]
template<size_t DIM>
GaussianQuadratureRule<DIM>* NonlinearElasticityAssembler< DIM >::mpQuadratureRule [protected]
template<size_t DIM>
const size_t NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_BOUNDARY_ELEMENT = DIM*(DIM+1)/2 [static, protected]
template<size_t DIM>
const size_t NonlinearElasticityAssembler< DIM >::NUM_NODES_PER_ELEMENT = (DIM+1)*(DIM+2)/2 [static, protected]
template<size_t DIM>
const size_t NonlinearElasticityAssembler< DIM >::NUM_VERTICES_PER_ELEMENT = DIM+1 [static, protected]
template<size_t DIM>
const size_t NonlinearElasticityAssembler< DIM >::STENCIL_SIZE = DIM*NUM_NODES_PER_ELEMENT + NUM_VERTICES_PER_ELEMENT [static, protected]

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

Generated by  doxygen 1.6.2