Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
SolidMechanicsProblemDefinition< DIM > Class Template Reference

#include <SolidMechanicsProblemDefinition.hpp>

+ Inheritance diagram for SolidMechanicsProblemDefinition< DIM >:
+ Collaboration diagram for SolidMechanicsProblemDefinition< DIM >:

Public Member Functions

 SolidMechanicsProblemDefinition (AbstractTetrahedralMesh< DIM, DIM > &rMesh)
 
virtual ~SolidMechanicsProblemDefinition ()
 
void SetMaterialLaw (CompressibilityType compressibilityType, AbstractMaterialLaw< DIM > *pMaterialLaw)
 
void SetMaterialLaw (CompressibilityType compressibilityType, std::vector< AbstractMaterialLaw< DIM > * > &rMaterialLaws)
 
bool IsHomogeneousMaterial ()
 
CompressibilityType GetCompressibilityType ()
 
AbstractIncompressibleMaterialLaw< DIM > * GetIncompressibleMaterialLaw (unsigned elementIndex)
 
AbstractCompressibleMaterialLaw< DIM > * GetCompressibleMaterialLaw (unsigned elementIndex)
 
void SetZeroDisplacementNodes (std::vector< unsigned > &rFixedNodes)
 
void SetFixedNodes (std::vector< unsigned > &rFixedNodes, std::vector< c_vector< double, DIM > > &rFixedNodeLocation)
 
virtual void Validate ()
 
void SetSolveUsingSnes (bool solveUsingSnes=true)
 
bool GetSolveUsingSnes ()
 
- Public Member Functions inherited from ContinuumMechanicsProblemDefinition< DIM >
 ContinuumMechanicsProblemDefinition (AbstractTetrahedralMesh< DIM, DIM > &rMesh)
 
virtual ~ContinuumMechanicsProblemDefinition ()
 
void SetDensity (double density)
 
double GetDensity ()
 
void SetZeroDirichletNodes (std::vector< unsigned > &rZeroDirichletNodes)
 
std::vector< unsigned > & rGetDirichletNodes ()
 
std::vector< c_vector< double, DIM > > & rGetDirichletNodeValues ()
 
void SetBodyForce (c_vector< double, DIM > bodyForce)
 
void SetBodyForce (c_vector< double, DIM >(*pFunction)(c_vector< double, DIM > &rX, double t))
 
c_vector< double, DIM > GetBodyForce (c_vector< double, DIM > &rX, double t=0.0)
 
BodyForceType GetBodyForceType ()
 
c_vector< double, DIM > GetConstantBodyForce ()
 
c_vector< double, DIM > EvaluateBodyForceFunction (c_vector< double, DIM > &rX, double t)
 
TractionBoundaryConditionType GetTractionBoundaryConditionType ()
 
void SetTractionBoundaryConditions (std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, std::vector< c_vector< double, DIM > > &rElementwiseTractions)
 
void SetTractionBoundaryConditions (std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, c_vector< double, DIM >(*pFunction)(c_vector< double, DIM > &rX, double t))
 
void SetApplyNormalPressureOnDeformedSurface (std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, double normalPressure)
 
void SetApplyNormalPressureOnDeformedSurface (std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, double(*pFunction)(double t))
 
std::vector< BoundaryElement< DIM-1, DIM > * > & rGetTractionBoundaryElements ()
 
std::vector< c_vector< double, DIM > > & rGetElementwiseTractions ()
 
double GetNormalPressure ()
 
void SetPressureScaling (double scaleFactor)
 
c_vector< double, DIM > EvaluateTractionFunction (c_vector< double, DIM > &rX, double t)
 
double EvaluateNormalPressureFunction (double t)
 
void SetVerboseDuringSolve (bool verboseDuringSolve=true)
 
bool GetVerboseDuringSolve ()
 

Private Member Functions

void CheckCastSuccess (CompressibilityType compressibilityType, AbstractMaterialLaw< DIM > *pMaterialLaw)
 

Private Attributes

std::vector< AbstractIncompressibleMaterialLaw< DIM > * > mIncompressibleMaterialLaws
 
std::vector< AbstractCompressibleMaterialLaw< DIM > * > mCompressibleMaterialLaws
 
bool mIsHomogeneousMaterial
 
CompressibilityType mCompressibilityType
 
bool mSolveUsingSnes
 

Additional Inherited Members

- Static Public Attributes inherited from ContinuumMechanicsProblemDefinition< DIM >
static const double FREE = std::numeric_limits<double>::max()
 
- Protected Attributes inherited from ContinuumMechanicsProblemDefinition< DIM >
AbstractTetrahedralMesh< DIM, DIM > & mrMesh
 
double mDensity
 
BodyForceType mBodyForceType
 
c_vector< double, DIM > mConstantBodyForce
 
c_vector< double, DIM >(* mpBodyForceFunction )(c_vector< double, DIM > &rX, double t)
 
TractionBoundaryConditionType mTractionBoundaryConditionType
 
std::vector< BoundaryElement< DIM-1, DIM > * > mTractionBoundaryElements
 
std::vector< c_vector< double, DIM > > mElementwiseTractions
 
double mNormalPressure
 
double mOriginalNormalPressure
 
c_vector< double, DIM >(* mpTractionBoundaryConditionFunction )(c_vector< double, DIM > &rX, double t)
 
double(* mpNormalPressureFunction )(double t)
 
std::vector< unsignedmDirichletNodes
 
std::vector< c_vector< double, DIM > > mDirichletNodeValues
 
bool mVerboseDuringSolve
 

Detailed Description

template<unsigned DIM>
class SolidMechanicsProblemDefinition< DIM >

A class for specifying various parts of a solid mechanics problem, in particular the material laws for the deforming body, and (inheriting functionality from a base class): fixed nodes information, the body force (per unit mass) (usually acceleration due to gravity or zero), the traction boundary conditions, and the density.

Definition at line 50 of file SolidMechanicsProblemDefinition.hpp.

Constructor & Destructor Documentation

◆ SolidMechanicsProblemDefinition()

Constructor. Note body force initialised to zero and density to 1.0

Parameters
rMeshTesh being solved on

Definition at line 42 of file SolidMechanicsProblemDefinition.cpp.

◆ ~SolidMechanicsProblemDefinition()

template<unsigned DIM>
virtual SolidMechanicsProblemDefinition< DIM >::~SolidMechanicsProblemDefinition ( )
inlinevirtual

Destructor

Definition at line 95 of file SolidMechanicsProblemDefinition.hpp.

Member Function Documentation

◆ CheckCastSuccess()

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::CheckCastSuccess ( CompressibilityType  compressibilityType,
AbstractMaterialLaw< DIM > *  pMaterialLaw 
)
private

Helper function for checking whether a dynamic_cast succeeded or not, and throwing an exception if it failed.

Parameters
compressibilityTypecompressibility type
pMaterialLawmaterial law

Definition at line 190 of file SolidMechanicsProblemDefinition.cpp.

References EXCEPTION.

◆ GetCompressibilityType()

template<unsigned DIM>
CompressibilityType SolidMechanicsProblemDefinition< DIM >::GetCompressibilityType ( )
Returns
whether the material is incompressible or compressible. SetMaterialLaw() must be called before calling this. (Which can be checked by calling Validate()).

Definition at line 146 of file SolidMechanicsProblemDefinition.cpp.

Referenced by CompressibleNonlinearElasticitySolver< DIM >::CompressibleNonlinearElasticitySolver(), and IncompressibleNonlinearElasticitySolver< DIM >::IncompressibleNonlinearElasticitySolver().

◆ GetCompressibleMaterialLaw()

template<unsigned DIM>
AbstractCompressibleMaterialLaw< DIM > * SolidMechanicsProblemDefinition< DIM >::GetCompressibleMaterialLaw ( unsigned  elementIndex)
Returns
the material law for a given element, when the body is compressible. An assertion will fail if GetCompressibilityType()!=COMPRESSIBLE. If the material is homogeneous, it doesn't matter what the element index is.
Parameters
elementIndexindex of element

Definition at line 172 of file SolidMechanicsProblemDefinition.cpp.

◆ GetIncompressibleMaterialLaw()

template<unsigned DIM>
AbstractIncompressibleMaterialLaw< DIM > * SolidMechanicsProblemDefinition< DIM >::GetIncompressibleMaterialLaw ( unsigned  elementIndex)
Returns
the material law for a given element, when the body is incompressible. An assertion will fail if GetCompressibilityType()!=INCOMPRESSIBLE. If the material is homogeneous, it doesn't matter what the element index is.
Parameters
elementIndexindex of element

Definition at line 154 of file SolidMechanicsProblemDefinition.cpp.

◆ GetSolveUsingSnes()

template<unsigned DIM>
bool SolidMechanicsProblemDefinition< DIM >::GetSolveUsingSnes ( )
inline
Returns
whether solver should use PETSc SNES nonlinear solver or not

Definition at line 196 of file SolidMechanicsProblemDefinition.hpp.

References SolidMechanicsProblemDefinition< DIM >::mSolveUsingSnes.

◆ IsHomogeneousMaterial()

template<unsigned DIM>
bool SolidMechanicsProblemDefinition< DIM >::IsHomogeneousMaterial ( )
Returns
whether the material is homogeneous or heterogeneous. SetMaterialLaw() must be called before calling this.

Definition at line 138 of file SolidMechanicsProblemDefinition.cpp.

◆ SetFixedNodes()

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::SetFixedNodes ( std::vector< unsigned > &  rFixedNodes,
std::vector< c_vector< double, DIM > > &  rFixedNodeLocation 
)

Set a list of nodes to be fixed, with their corresponding new LOCATIONS (not displacements). (This class will store as displacements though, and it is displacements that will be returned by rGetDirichletNodeValues).

Parameters
rFixedNodesthe fixed node indices
rFixedNodeLocationcorresponding locations

Definition at line 49 of file SolidMechanicsProblemDefinition.cpp.

◆ SetMaterialLaw() [1/2]

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::SetMaterialLaw ( CompressibilityType  compressibilityType,
AbstractMaterialLaw< DIM > *  pMaterialLaw 
)

Set a material law for the entire body (ie the homogeneous case). If compressibilityType==INCOMPRESSIBLE, the material law pointer will be checked at run-time that it is of type `AbstractIncompressibleMaterialLaw`, and similarly for the compressible case. Any previous material information will be deleted.

Parameters
compressibilityTypeeither 'INCOMPRESSIBLE' or 'COMPRESSIBLE'
pMaterialLawThe material law for the entire body

Definition at line 78 of file SolidMechanicsProblemDefinition.cpp.

◆ SetMaterialLaw() [2/2]

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::SetMaterialLaw ( CompressibilityType  compressibilityType,
std::vector< AbstractMaterialLaw< DIM > * > &  rMaterialLaws 
)

Set a vector of material laws for the body, one for each element in the mesh (the heterogeneous case). If compressibilityType==INCOMPRESSIBLE, the material law pointer will be checked at run-time that it is of type `AbstractIncompressibleMaterialLaw`, and similarly for the compressible case. Any previous material information will be deleted.

Parameters
compressibilityTypeeither 'INCOMPRESSIBLE' or 'COMPRESSIBLE'
rMaterialLawsVector of pointers to material laws

Definition at line 104 of file SolidMechanicsProblemDefinition.cpp.

◆ SetSolveUsingSnes()

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::SetSolveUsingSnes ( bool  solveUsingSnes = true)
inline

Tell the solver class whether to use the PETSc SNES solver (the petsc nonlinear solver) or its own nonlinear solve implementation.

Parameters
solveUsingSnessolve using Snes or not

Definition at line 188 of file SolidMechanicsProblemDefinition.hpp.

References SolidMechanicsProblemDefinition< DIM >::mSolveUsingSnes.

◆ SetZeroDisplacementNodes()

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::SetZeroDisplacementNodes ( std::vector< unsigned > &  rFixedNodes)
inline

Set a list of nodes (indices) to be fixed in space with zero displacement

Parameters
rFixedNodesthe fixed nodes

Definition at line 155 of file SolidMechanicsProblemDefinition.hpp.

References ContinuumMechanicsProblemDefinition< DIM >::SetZeroDirichletNodes().

◆ Validate()

template<unsigned DIM>
void SolidMechanicsProblemDefinition< DIM >::Validate ( )
virtual

Check all variables are set appropriately. Exceptions are thrown if any are not. Derived classes can override but should call this version as well.

Reimplemented from ContinuumMechanicsProblemDefinition< DIM >.

Reimplemented in ElectroMechanicsProblemDefinition< DIM >.

Definition at line 207 of file SolidMechanicsProblemDefinition.cpp.

References EXCEPTION, and ContinuumMechanicsProblemDefinition< DIM >::Validate().

Referenced by ElectroMechanicsProblemDefinition< DIM >::Validate().

Member Data Documentation

◆ mCompressibilityType

template<unsigned DIM>
CompressibilityType SolidMechanicsProblemDefinition< DIM >::mCompressibilityType
private

Whether the material is incompressible or compressible. (CompressibilityType is an enumeration).

Definition at line 73 of file SolidMechanicsProblemDefinition.hpp.

◆ mCompressibleMaterialLaws

template<unsigned DIM>
std::vector<AbstractCompressibleMaterialLaw<DIM>*> SolidMechanicsProblemDefinition< DIM >::mCompressibleMaterialLaws
private

The material law, in the case of compressible material laws. This vector is either of size 1, representing a homogeneous material, or of size num_elements, representing a heterogeneous material, with a material law per element. If the material is incompressible, this vector will be of size zero.

Definition at line 67 of file SolidMechanicsProblemDefinition.hpp.

◆ mIncompressibleMaterialLaws

template<unsigned DIM>
std::vector<AbstractIncompressibleMaterialLaw<DIM>*> SolidMechanicsProblemDefinition< DIM >::mIncompressibleMaterialLaws
private

The material law, in the case of incompressible material laws. This vector is either of size 1, representing a homogeneous material, or of size num_elements, representing a heterogeneous material, with a material law per element. If he material is compressible, this vector will be of size zero.

Definition at line 61 of file SolidMechanicsProblemDefinition.hpp.

◆ mIsHomogeneousMaterial

template<unsigned DIM>
bool SolidMechanicsProblemDefinition< DIM >::mIsHomogeneousMaterial
private

Whether the material is homogeneous (same material law everywhere) or heterogeneous

Definition at line 70 of file SolidMechanicsProblemDefinition.hpp.

◆ mSolveUsingSnes

template<unsigned DIM>
bool SolidMechanicsProblemDefinition< DIM >::mSolveUsingSnes
private

Whether the solver will use Petsc SNES or not. See dox for Set method below

Definition at line 76 of file SolidMechanicsProblemDefinition.hpp.

Referenced by SolidMechanicsProblemDefinition< DIM >::GetSolveUsingSnes(), and SolidMechanicsProblemDefinition< DIM >::SetSolveUsingSnes().


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