v0.14.0
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< FEMethod > monitor_ptr)
 
virtual BitRefLevel getBitRefLevelMask ()
 

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< PostProcVolumeOnRefinedMeshpostProcMeshPtr
 
string positionField
 
string meshNodeField
 
- Public Attributes inherited from GenericElementInterface
BcMarkerPtr mBoundaryMarker
 
int atomTest
 
int restartRunStep
 
boost::shared_ptr< FEMethodmonitorPtr
 

Additional Inherited Members

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

Detailed Description

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

Examples
mortar_contact.cpp, and 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
Examples
NonlinearElasticElementInterface.hpp.

Definition at line 31 of file NonlinearElasticElementInterface.hpp.

36  : mField(m_field), positionField(postion_field),
37  meshNodeField(mesh_posi_field_name),
38  isDisplacementField(is_displacement_field),
40  oRder = 1;
41  }

◆ ~NonlinearElasticElementInterface()

NonlinearElasticElementInterface::~NonlinearElasticElementInterface ( )
inline

Member Function Documentation

◆ addElementFields()

MoFEMErrorCode NonlinearElasticElementInterface::addElementFields ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 56 of file NonlinearElasticElementInterface.hpp.

56  {
58  auto simple = mField.getInterface<Simple>();
61  3);
62  CHKERR simple->addBoundaryField(positionField, H1,
64  CHKERR simple->setFieldOrder(positionField, oRder);
65  }
68  3);
69  CHKERR simple->setFieldOrder(meshNodeField, 2);
70  }
71 
73  };

◆ addElementsToDM()

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

Implements GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 112 of file NonlinearElasticElementInterface.hpp.

112  {
114  this->dM = dm;
115  CHKERR DMMoFEMAddElement(dM, "ELASTIC");
116  mField.getInterface<Simple>()->getOtherFiniteElements().push_back(
117  "ELASTIC");
118 
120  };

◆ createElements()

MoFEMErrorCode NonlinearElasticElementInterface::createElements ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 75 of file NonlinearElasticElementInterface.hpp.

75  {
77 
78  elasticElementPtr = boost::make_shared<NonlinearElasticElement>(mField, 2);
79  elasticMaterialsPtr = boost::make_shared<ElasticMaterials>(mField, "HOOKE");
80  CHKERR elasticMaterialsPtr->setBlocks(elasticElementPtr->setOfBlocks);
81 
82  CHKERR addHOOpsVol(meshNodeField, elasticElementPtr->getLoopFeRhs(), true,
83  false, false, false);
84  CHKERR addHOOpsVol(meshNodeField, elasticElementPtr->getLoopFeLhs(), true,
85  false, false, false);
87  true, false, false, false);
88  CHKERR elasticElementPtr->addElement("ELASTIC", positionField,
89  meshNodeField, false);
90 
91 
93  };

◆ getBitRefLevel()

BitRefLevel NonlinearElasticElementInterface::getBitRefLevel ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
NonlinearElasticElementInterface.hpp.

Definition at line 111 of file NonlinearElasticElementInterface.hpp.

111 { return bIt; };

◆ getCommandLineParameters()

MoFEMErrorCode NonlinearElasticElementInterface::getCommandLineParameters ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 45 of file NonlinearElasticElementInterface.hpp.

45  {
47  isQuasiStatic = PETSC_FALSE;
48  oRder = 2;
49  CHKERR PetscOptionsGetBool(PETSC_NULL, "-is_quasi_static", &isQuasiStatic,
50  PETSC_NULL);
51  CHKERR PetscOptionsGetInt(PETSC_NULL, "-order", &oRder, PETSC_NULL);
52 
54  };

◆ postProcessElement()

MoFEMErrorCode NonlinearElasticElementInterface::postProcessElement ( int  step)
inlinevirtual

Implements GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 181 of file NonlinearElasticElementInterface.hpp.

181  {
183 
184  if (elasticElementPtr->setOfBlocks.empty())
186 
187  if (!postProcMeshPtr) {
188  postProcMeshPtr = boost::make_shared<PostProcVolumeOnRefinedMesh>(mField);
189 
190  if (mField.check_field("MESH_NODE_POSITIONS"))
191  CHKERR addHOOpsVol("MESH_NODE_POSITIONS", *postProcMeshPtr, true, false,
192  false, false);
193  CHKERR postProcMeshPtr->generateReferenceElementMesh();
194  CHKERR postProcMeshPtr->addFieldValuesPostProc(positionField);
195  CHKERR postProcMeshPtr->addFieldValuesPostProc(meshNodeField);
196  CHKERR postProcMeshPtr->addFieldValuesGradientPostProc(positionField);
197 
198  for (auto &sit : elasticElementPtr->setOfBlocks) {
199  postProcMeshPtr->getOpPtrVector().push_back(new PostProcStress(
200  postProcMeshPtr->postProcMesh, postProcMeshPtr->mapGaussPts,
201  positionField, sit.second, postProcMeshPtr->commonData,
203  }
204  }
205 
206  elasticElementPtr->getLoopFeEnergy().snes_ctx = SnesMethod::CTX_SNESNONE;
207  elasticElementPtr->getLoopFeEnergy().eNergy = 0;
208  // MOFEM_LOG("WORLD", Sev::inform) << "Loop energy\n";
210  &elasticElementPtr->getLoopFeEnergy());
211 
212  auto E = elasticElementPtr->getLoopFeEnergy().eNergy;
213  // Print elastic energy
214  MOFEM_LOG_C("WORLD", Sev::inform, "%d Time %3.2e Elastic energy %3.2e",
215  step, elasticElementPtr->getLoopFeRhs().ts_t, E);
216 
218  auto out_name = "out_vol_" + to_string(step) + ".h5m";
219 
220  CHKERR postProcMeshPtr->writeFile(out_name);
221 
223  };

◆ setOperators()

MoFEMErrorCode NonlinearElasticElementInterface::setOperators ( )
inlinevirtual

Implements GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 95 of file NonlinearElasticElementInterface.hpp.

95  {
97  auto &pipeline_rhs = elasticElementPtr->feRhs.getOpPtrVector();
98  auto &pipeline_lhs = elasticElementPtr->feLhs.getOpPtrVector();
99 
100  pipeline_rhs.push_back(new OpSetBc(positionField, true, mBoundaryMarker));
101  pipeline_lhs.push_back(new OpSetBc(positionField, true, mBoundaryMarker));
102 
103  CHKERR elasticElementPtr->setOperators(positionField, meshNodeField, false,
105 
106  pipeline_rhs.push_back(new OpUnSetBc(positionField));
107  pipeline_lhs.push_back(new OpUnSetBc(positionField));
109  }

◆ setupSolverFunctionSNES()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverFunctionSNES ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 130 of file NonlinearElasticElementInterface.hpp.

130  {
132  CHKERR DMMoFEMSNESSetFunction(dM, "ELASTIC",
133  &elasticElementPtr->getLoopFeRhs(),
134  PETSC_NULL, PETSC_NULL);
136  };

◆ setupSolverFunctionTS()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverFunctionTS ( const TSType  type)
inlinevirtual

Implements GenericElementInterface.

Examples
NonlinearElasticElementInterface.hpp.

Definition at line 159 of file NonlinearElasticElementInterface.hpp.

159  {
161  auto &method = elasticElementPtr->getLoopFeRhs();
162  switch (type) {
163  case IM:
164  CHKERR DMMoFEMTSSetIFunction(dM, "ELASTIC", &method, &method, &method);
165  break;
166  case IM2:
167  CHKERR DMMoFEMTSSetI2Function(dM, "ELASTIC", &method, &method, &method);
168  break;
169  case EX:
170  CHKERR DMMoFEMTSSetRHSFunction(dM, "ELASTIC", &method, &method, &method);
171  break;
172  default:
173  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented");
174  break;
175  }
176 
178  };

◆ setupSolverJacobianSNES()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverJacobianSNES ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
mortar_contact.cpp, and NonlinearElasticElementInterface.hpp.

Definition at line 122 of file NonlinearElasticElementInterface.hpp.

122  {
124 
126  dM, "ELASTIC", &elasticElementPtr->getLoopFeLhs(), NULL, NULL);
127 
129  };

◆ setupSolverJacobianTS()

MoFEMErrorCode NonlinearElasticElementInterface::setupSolverJacobianTS ( const TSType  type)
inlinevirtual

Implements GenericElementInterface.

Examples
NonlinearElasticElementInterface.hpp.

Definition at line 138 of file NonlinearElasticElementInterface.hpp.

138  {
140  auto &method = elasticElementPtr->getLoopFeLhs();
141  switch (type) {
142  case IM:
143  CHKERR DMMoFEMTSSetIJacobian(dM, "ELASTIC", &method, &method, &method);
144  break;
145  case IM2:
146  CHKERR DMMoFEMTSSetI2Jacobian(dM, "ELASTIC", &method, &method, &method);
147  break;
148  case EX:
149  CHKERR DMMoFEMTSSetRHSJacobian(dM, "ELASTIC", &method, &method, &method);
150  break;
151  default:
152  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
153  "This TS is not yet implemented");
154  break;
155  }
157  };

◆ updateElementVariables()

MoFEMErrorCode NonlinearElasticElementInterface::updateElementVariables ( )
inlinevirtual

Reimplemented from GenericElementInterface.

Examples
NonlinearElasticElementInterface.hpp.

Definition at line 180 of file NonlinearElasticElementInterface.hpp.

180 { return 0; };

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<PostProcVolumeOnRefinedMesh> NonlinearElasticElementInterface::postProcMeshPtr

The documentation for this struct was generated from the following file:
GenericElementInterface::EX
@ EX
Definition: GenericElementInterface.hpp:16
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition: UnknownInterface.hpp:93
H1
@ H1
continuous field
Definition: definitions.h:85
NonlinearElasticElementInterface::isDisplacementField
bool isDisplacementField
Definition: NonlinearElasticElementInterface.hpp:22
NonlinearElasticElementInterface::elasticMaterialsPtr
boost::shared_ptr< ElasticMaterials > elasticMaterialsPtr
Definition: NonlinearElasticElementInterface.hpp:25
MoFEM::addHOOpsVol
MoFEMErrorCode addHOOpsVol(const std::string field, E &e, bool h1, bool hcurl, bool hdiv, bool l2)
Definition: HODataOperators.hpp:764
NonlinearElasticElementInterface::bIt
BitRefLevel bIt
Definition: NonlinearElasticElementInterface.hpp:23
E
MoFEM::DMMoFEMTSSetRHSJacobian
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:926
NonlinearElasticElementInterface::dM
SmartPetscObj< DM > dM
Definition: NonlinearElasticElementInterface.hpp:18
NonlinearElasticElementInterface::oRder
PetscInt oRder
Definition: NonlinearElasticElementInterface.hpp:21
MoFEM::DMMoFEMAddElement
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition: DMMoFEM.cpp:501
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
NonlinearElasticElementInterface::mField
MoFEM::Interface & mField
Definition: NonlinearElasticElementInterface.hpp:17
PostProcStress
Definition: PostProcStresses.hpp:17
MoFEM::DMMoFEMTSSetIJacobian
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:857
NonlinearElasticElementInterface::meshNodeField
string meshNodeField
Definition: NonlinearElasticElementInterface.hpp:29
MoFEM::DMMoFEMTSSetI2Jacobian
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:1021
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
MoFEM::DMMoFEMTSSetI2Function
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:979
is_quasi_static
PetscBool is_quasi_static
Definition: plastic.cpp:190
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
convert.type
type
Definition: convert.py:64
NonlinearElasticElementInterface::elasticElementPtr
boost::shared_ptr< NonlinearElasticElement > elasticElementPtr
Definition: NonlinearElasticElementInterface.hpp:24
MoFEM::DMMoFEMSNESSetJacobian
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:763
MoFEM::CoreInterface::check_field
virtual bool check_field(const std::string &name) const =0
check if field is in database
GenericElementInterface::mBoundaryMarker
BcMarkerPtr mBoundaryMarker
Definition: GenericElementInterface.hpp:20
MoFEM::DMMoFEMTSSetRHSFunction
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:886
NonlinearElasticElementInterface::positionField
string positionField
Definition: NonlinearElasticElementInterface.hpp:28
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::DMMoFEMTSSetIFunction
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:804
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEM::DMoFEMLoopFiniteElements
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:590
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
GenericElementInterface::IM2
@ IM2
Definition: GenericElementInterface.hpp:16
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
NonlinearElasticElementInterface::isQuasiStatic
PetscBool isQuasiStatic
Definition: NonlinearElasticElementInterface.hpp:19
NonlinearElasticElementInterface::postProcMeshPtr
boost::shared_ptr< PostProcVolumeOnRefinedMesh > postProcMeshPtr
Definition: NonlinearElasticElementInterface.hpp:26
MoFEM::DMMoFEMSNESSetFunction
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:722
GenericElementInterface::IM
@ IM
Definition: GenericElementInterface.hpp:16
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182