v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
NonlinearElasticElementInterface Struct Reference

Set of functions declaring elements and setting operators for generic element interface. More...

#include "users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp"

Inheritance diagram for NonlinearElasticElementInterface:
[legend]
Collaboration diagram for NonlinearElasticElementInterface:
[legend]

Public Member Functions

 NonlinearElasticElementInterface (MoFEM::Interface &m_field, string postion_field, string mesh_posi_field_name="MESH_NODE_POSITIONS", bool is_displacement_field=true, PetscBool is_quasi_static=PETSC_TRUE)
 
 ~NonlinearElasticElementInterface ()
 
MoFEMErrorCode getCommandLineParameters ()
 
MoFEMErrorCode addElementFields ()
 
MoFEMErrorCode createElements ()
 
MoFEMErrorCode setOperators ()
 
BitRefLevel getBitRefLevel ()
 
MoFEMErrorCode addElementsToDM (SmartPetscObj< DM > dm)
 
MoFEMErrorCode setupSolverJacobianSNES ()
 
MoFEMErrorCode setupSolverFunctionSNES ()
 
MoFEMErrorCode setupSolverJacobianTS (const TSType type)
 
MoFEMErrorCode setupSolverFunctionTS (const TSType type)
 
MoFEMErrorCode updateElementVariables ()
 
MoFEMErrorCode postProcessElement (int step)
 
- Public Member Functions inherited from GenericElementInterface
 GenericElementInterface ()
 
virtual ~GenericElementInterface ()
 
virtual MoFEMErrorCode setGlobalBoundaryMarker (BcMarkerPtr mark)
 
virtual BcMarkerPtr getGlobalBoundaryMarker ()
 
virtual MoFEMErrorCode setMonitorPtr (boost::shared_ptr< MoFEM::FEMethod > monitor_ptr)
 
virtual BitRefLevel getBitRefLevelMask ()
 
virtual MoFEMErrorCode opFactoryDomainRhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip)
 
virtual MoFEMErrorCode opFactoryDomainLhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip)
 
virtual MoFEMErrorCode setUpdateElementVariablesOperators ()
 
virtual MoFEMErrorCode updateElementVariables (SmartPetscObj< DM > dm, string fe_name)
 
virtual MoFEMErrorCode postProcessElement (int step, SmartPetscObj< DM > dm, string fe_name)
 
 GenericElementInterface ()
 
virtual ~GenericElementInterface ()
 
virtual MoFEMErrorCode setGlobalBoundaryMarker (BcMarkerPtr mark)
 
virtual BcMarkerPtr getGlobalBoundaryMarker ()
 
virtual MoFEMErrorCode setMonitorPtr (boost::shared_ptr< FEMethod > monitor_ptr)
 
virtual BitRefLevel getBitRefLevelMask ()
 
virtual MoFEMErrorCode opFactoryDomainRhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip)
 
virtual MoFEMErrorCode opFactoryDomainLhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip)
 
virtual MoFEMErrorCode setUpdateElementVariablesOperators ()
 
virtual MoFEMErrorCode updateElementVariables (SmartPetscObj< DM > dm, string fe_name)
 
virtual MoFEMErrorCode postProcessElement (int step, SmartPetscObj< DM > dm, string fe_name)
 

Public Attributes

MoFEM::InterfacemField
 
SmartPetscObj< DM > dM
 
PetscBool isQuasiStatic
 
PetscInt oRder
 
bool isDisplacementField
 
BitRefLevel bIt
 
boost::shared_ptr< NonlinearElasticElementelasticElementPtr
 
boost::shared_ptr< ElasticMaterialselasticMaterialsPtr
 
boost::shared_ptr< PostProcBrokenMeshInMoab< VolumeElementForcesAndSourcesCore > > postProcMeshPtr
 
string positionField
 
string meshNodeField
 
- Public Attributes inherited from GenericElementInterface
BcMarkerPtr mBoundaryMarker
 
int atomTest
 
int restartRunStep
 
boost::shared_ptr< MoFEM::FEMethodmonitorPtr
 
boost::shared_ptr< FEMethodmonitorPtr
 

Additional Inherited Members

- Public Types inherited from GenericElementInterface
enum  TSType {
  EX , IM , IM2 , IMEX ,
  DEFAULT , EX , IM , IM2 ,
  IMEX , DEFAULT
}
 
enum  TSType {
  EX , IM , IM2 , IMEX ,
  DEFAULT , EX , IM , IM2 ,
  IMEX , DEFAULT
}
 
using BcMarkerPtr = boost::shared_ptr< std::vector< char unsigned > >
 
using BcMarkerPtr = boost::shared_ptr< std::vector< char unsigned > >
 

Detailed Description

Set of functions declaring elements and setting operators for generic element interface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 15 of file NonlinearElasticElementInterface.hpp.

Constructor & Destructor Documentation

◆ NonlinearElasticElementInterface()

NonlinearElasticElementInterface::NonlinearElasticElementInterface ( MoFEM::Interface m_field,
string  postion_field,
string  mesh_posi_field_name = "MESH_NODE_POSITIONS",
bool  is_displacement_field = true,
PetscBool  is_quasi_static = PETSC_TRUE 
)
inline

◆ ~NonlinearElasticElementInterface()

NonlinearElasticElementInterface::~NonlinearElasticElementInterface ( )
inline

Member Function Documentation

◆ addElementFields()

MoFEMErrorCode NonlinearElasticElementInterface::addElementFields ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 58 of file NonlinearElasticElementInterface.hpp.

58 {
60 auto simple = mField.getInterface<Simple>();
63 3);
64 CHKERR simple->addBoundaryField(positionField, H1,
66 CHKERR simple->setFieldOrder(positionField, oRder);
67 }
70 3);
71 CHKERR simple->setFieldOrder(meshNodeField, 2);
72 }
73
75 };
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ H1
continuous field
Definition definitions.h:85
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual bool check_field(const std::string &name) const =0
check if field is in database
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ addElementsToDM()

MoFEMErrorCode NonlinearElasticElementInterface::addElementsToDM ( SmartPetscObj< DM >  dm)
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 117 of file NonlinearElasticElementInterface.hpp.

117 {
119 this->dM = dm;
120 CHKERR DMMoFEMAddElement(dM, "ELASTIC");
121 mField.getInterface<Simple>()->getOtherFiniteElements().push_back(
122 "ELASTIC");
123
125 };
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition DMMoFEM.cpp:488

◆ createElements()

MoFEMErrorCode NonlinearElasticElementInterface::createElements ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 77 of file NonlinearElasticElementInterface.hpp.

77 {
79
80 elasticElementPtr = boost::make_shared<NonlinearElasticElement>(mField, 2);
81 elasticMaterialsPtr = boost::make_shared<ElasticMaterials>(mField, "HOOKE");
82 CHKERR elasticMaterialsPtr->setBlocks(elasticElementPtr->setOfBlocks);
83
85 elasticElementPtr->getLoopFeRhs().getOpPtrVector(), {H1},
88 elasticElementPtr->getLoopFeLhs().getOpPtrVector(), {H1},
91 elasticElementPtr->getLoopFeEnergy().getOpPtrVector(), {H1},
93 CHKERR elasticElementPtr->addElement("ELASTIC", positionField,
94 meshNodeField, false);
95
96
98 };
boost::shared_ptr< ElasticMaterials > elasticMaterialsPtr
boost::shared_ptr< NonlinearElasticElement > elasticElementPtr

◆ getBitRefLevel()

BitRefLevel NonlinearElasticElementInterface::getBitRefLevel ( )
inlinevirtual

◆ getCommandLineParameters()

MoFEMErrorCode NonlinearElasticElementInterface::getCommandLineParameters ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 47 of file NonlinearElasticElementInterface.hpp.

47 {
49 isQuasiStatic = PETSC_FALSE;
50 oRder = 2;
51 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "-is_quasi_static", &isQuasiStatic,
52 PETSC_NULLPTR);
53 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "-order", &oRder, PETSC_NULLPTR);
54
56 };
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)

◆ postProcessElement()

MoFEMErrorCode NonlinearElasticElementInterface::postProcessElement ( int  step)
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 186 of file NonlinearElasticElementInterface.hpp.

186 {
188
189 if (elasticElementPtr->setOfBlocks.empty())
191
192 if (!postProcMeshPtr) {
193 postProcMeshPtr = boost::make_shared<
194 PostProcBrokenMeshInMoab<VolumeElementForcesAndSourcesCore>>(mField);
195
196 if (mField.check_field("MESH_NODE_POSITIONS"))
197 CHKERR AddHOOps<3, 3, 3>::add(postProcMeshPtr->getOpPtrVector(), {H1},
198 "MESH_NODE_POSITIONS");
199 auto position_ptr = boost::make_shared<MatrixDouble>();
200 auto mesh_pos_ptr = boost::make_shared<MatrixDouble>();
201 auto position_grad_ptr = boost::make_shared<MatrixDouble>();
202 postProcMeshPtr->getOpPtrVector().push_back(
203 new OpCalculateVectorFieldValues<3>(positionField, position_ptr));
204 postProcMeshPtr->getOpPtrVector().push_back(
205 new OpCalculateVectorFieldValues<3>(meshNodeField, mesh_pos_ptr));
206 postProcMeshPtr->getOpPtrVector().push_back(
207 new OpCalculateVectorFieldGradient<3, 3>(positionField,
208 position_grad_ptr));
209
210 for (auto &sit : elasticElementPtr->setOfBlocks) {
211 postProcMeshPtr->getOpPtrVector().push_back(new PostProcStress(
212 postProcMeshPtr->getPostProcMesh(),
213 postProcMeshPtr->getMapGaussPts(),
214 postProcMeshPtr->getPostProcElements(), positionField, sit.second,
215 position_ptr, mesh_pos_ptr, position_grad_ptr, meshNodeField,
217 }
218 using OpPPMap = OpPostProcMapInMoab<3, 3>;
219 postProcMeshPtr->getOpPtrVector().push_back(new OpPPMap(
220 postProcMeshPtr->getPostProcMesh(),
221 postProcMeshPtr->getMapGaussPts(), {},
222 {{positionField, position_ptr}, {meshNodeField, mesh_pos_ptr}},
223 {{positionField + "_GRAD", position_grad_ptr}}, {}));
224 }
225
226 elasticElementPtr->getLoopFeEnergy().snes_ctx = SnesMethod::CTX_SNESNONE;
227 elasticElementPtr->getLoopFeEnergy().eNergy = 0;
228 // MOFEM_LOG("WORLD", Sev::inform) << "Loop energy\n";
230 &elasticElementPtr->getLoopFeEnergy());
231
232 auto E = elasticElementPtr->getLoopFeEnergy().eNergy;
233 // Print elastic energy
234 MOFEM_LOG_C("WORLD", Sev::inform, "%d Time %3.2e Elastic energy %3.2e",
235 step, elasticElementPtr->getLoopFeRhs().ts_t, E);
236
238 auto out_name = "out_vol_" + to_string(step) + ".h5m";
239
240 CHKERR postProcMeshPtr->writeFile(out_name);
241
243 };
#define MOFEM_LOG_C(channel, severity, format,...)
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition DMMoFEM.cpp:576
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
boost::shared_ptr< PostProcBrokenMeshInMoab< VolumeElementForcesAndSourcesCore > > postProcMeshPtr

◆ setOperators()

MoFEMErrorCode NonlinearElasticElementInterface::setOperators ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 100 of file NonlinearElasticElementInterface.hpp.

100 {
102 auto &pipeline_rhs = elasticElementPtr->feRhs.getOpPtrVector();
103 auto &pipeline_lhs = elasticElementPtr->feLhs.getOpPtrVector();
104
105 pipeline_rhs.push_back(new OpSetBc(positionField, true, mBoundaryMarker));
106 pipeline_lhs.push_back(new OpSetBc(positionField, true, mBoundaryMarker));
107
110
111 pipeline_rhs.push_back(new OpUnSetBc(positionField));
112 pipeline_lhs.push_back(new OpUnSetBc(positionField));
114 }

◆ setupSolverFunctionSNES()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverFunctionSNES ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 135 of file NonlinearElasticElementInterface.hpp.

135 {
138 &elasticElementPtr->getLoopFeRhs(),
139 PETSC_NULLPTR, PETSC_NULLPTR);
141 };
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
Definition DMMoFEM.cpp:708

◆ setupSolverFunctionTS()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverFunctionTS ( const TSType  type)
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 164 of file NonlinearElasticElementInterface.hpp.

164 {
166 auto &method = elasticElementPtr->getLoopFeRhs();
167 switch (type) {
168 case IM:
169 CHKERR DMMoFEMTSSetIFunction(dM, "ELASTIC", &method, &method, &method);
170 break;
171 case IM2:
172 CHKERR DMMoFEMTSSetI2Function(dM, "ELASTIC", &method, &method, &method);
173 break;
174 case EX:
175 CHKERR DMMoFEMTSSetRHSFunction(dM, "ELASTIC", &method, &method, &method);
176 break;
177 default:
178 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented");
179 break;
180 }
181
183 };
std::string type
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
PetscErrorCode DMMoFEMTSSetIFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set TS implicit function evaluation function
Definition DMMoFEM.cpp:790
PetscErrorCode DMMoFEMTSSetI2Function(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS implicit function evaluation function
Definition DMMoFEM.cpp:965
PetscErrorCode DMMoFEMTSSetRHSFunction(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side function
Definition DMMoFEM.cpp:872

◆ setupSolverJacobianSNES()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverJacobianSNES ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 127 of file NonlinearElasticElementInterface.hpp.

127 {
129
131 dM, "ELASTIC", &elasticElementPtr->getLoopFeLhs(), NULL, NULL);
132
134 };
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
Definition DMMoFEM.cpp:749

◆ setupSolverJacobianTS()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverJacobianTS ( const TSType  type)
inlinevirtual

Implements GenericElementInterface.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elastic_materials/src/NonlinearElasticElementInterface.hpp.

Definition at line 143 of file NonlinearElasticElementInterface.hpp.

143 {
145 auto &method = elasticElementPtr->getLoopFeLhs();
146 switch (type) {
147 case IM:
148 CHKERR DMMoFEMTSSetIJacobian(dM, "ELASTIC", &method, &method, &method);
149 break;
150 case IM2:
151 CHKERR DMMoFEMTSSetI2Jacobian(dM, "ELASTIC", &method, &method, &method);
152 break;
153 case EX:
154 CHKERR DMMoFEMTSSetRHSJacobian(dM, "ELASTIC", &method, &method, &method);
155 break;
156 default:
157 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
158 "This TS is not yet implemented");
159 break;
160 }
162 };
PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
Definition DMMoFEM.cpp:843
PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
Definition DMMoFEM.cpp:1007
PetscErrorCode DMMoFEMTSSetRHSJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side jacobian
Definition DMMoFEM.cpp:912

◆ updateElementVariables()

MoFEMErrorCode NonlinearElasticElementInterface::updateElementVariables ( )
inlinevirtual

Member Data Documentation

◆ bIt

BitRefLevel NonlinearElasticElementInterface::bIt

◆ dM

SmartPetscObj<DM> NonlinearElasticElementInterface::dM

◆ elasticElementPtr

boost::shared_ptr<NonlinearElasticElement> NonlinearElasticElementInterface::elasticElementPtr

◆ elasticMaterialsPtr

boost::shared_ptr<ElasticMaterials> NonlinearElasticElementInterface::elasticMaterialsPtr

◆ isDisplacementField

bool NonlinearElasticElementInterface::isDisplacementField

◆ isQuasiStatic

PetscBool NonlinearElasticElementInterface::isQuasiStatic

◆ meshNodeField

string NonlinearElasticElementInterface::meshNodeField

◆ mField

MoFEM::Interface& NonlinearElasticElementInterface::mField

◆ oRder

PetscInt NonlinearElasticElementInterface::oRder

◆ positionField

string NonlinearElasticElementInterface::positionField

◆ postProcMeshPtr

boost::shared_ptr< PostProcBrokenMeshInMoab<VolumeElementForcesAndSourcesCore> > NonlinearElasticElementInterface::postProcMeshPtr

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