v0.12.1
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Example Struct Reference

[Example] More...

Collaboration diagram for Example:
[legend]

Classes

struct  BcTempFun
 
struct  CommonData
 [Example] More...
 
struct  OpCalcSurfaceAverageTemperature
 
struct  OpError
 
struct  OpError< 1 >
 
struct  OpFirst
 
struct  OpFluxRhs
 
struct  OpRadiationLhs
 
struct  OpRadiationRhs
 
struct  OpRhs
 
struct  OpSecond
 [Operator] More...
 
struct  OpZero
 [Common data] More...
 

Public Member Functions

 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Create common data] More...
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 

Private Member Functions

MoFEMErrorCode readMesh ()
 [Run problem] More...
 
MoFEMErrorCode setupProblem ()
 [Read mesh] More...
 
MoFEMErrorCode createCommonData ()
 [Create common data] More...
 
MoFEMErrorCode boundaryCondition ()
 [Set up problem] More...
 
MoFEMErrorCode assembleSystem ()
 [Boundary condition] More...
 
MoFEMErrorCode solveSystem ()
 [Solve] More...
 
MoFEMErrorCode outputResults ()
 [Solve] More...
 
MoFEMErrorCode checkResults ()
 [Postprocess results] More...
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 [Create common data] More...
 
MoFEMErrorCode OPs ()
 [Boundary condition] More...
 
MoFEMErrorCode tsSolve ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 
MoFEMErrorCode OPs ()
 
MoFEMErrorCode tsSolve ()
 
MoFEMErrorCode postProcess ()
 [Solve] More...
 
MoFEMErrorCode checkResults ()
 
template<int DIM>
Range getEntsOnMeshSkin ()
 [Check] More...
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 
MoFEMErrorCode OPs ()
 
MoFEMErrorCode tsSolve ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode setUp ()
 [Run all] More...
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode setFieldValues ()
 [Create common data] More...
 
MoFEMErrorCode pushOperators ()
 [Set density distribution] More...
 
MoFEMErrorCode integrateElements ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode postProcess ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 [Set up problem] More...
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 
MoFEMErrorCode OPs ()
 
MoFEMErrorCode kspSolve ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode postProcess ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 

Static Private Member Functions

static int integrationRule (int, int, int p_data)
 

Private Attributes

MoFEM::InterfacemField
 
boost::shared_ptr< MatrixDouble > matGradPtr
 
boost::shared_ptr< MatrixDouble > matStrainPtr
 
boost::shared_ptr< MatrixDouble > matStressPtr
 
boost::shared_ptr< MatrixDouble > matAccelerationPtr
 
boost::shared_ptr< MatrixDouble > matInertiaPtr
 
boost::shared_ptr< MatrixDouble > matDPtr
 
boost::shared_ptr< MatrixDouble > matTangentPtr
 
boost::shared_ptr< PlasticOps::CommonDatacommonPlasticDataPtr
 
boost::shared_ptr< HenckyOps::CommonDatacommonHenckyDataPtr
 
boost::shared_ptr< PostProcElepostProcFe
 
boost::shared_ptr< DomainElereactionFe
 
boost::shared_ptr< DomainElefeAxiatorRhs
 
boost::shared_ptr< DomainElefeAxiatorLhs
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uXScatter
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uYScatter
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uZScatter
 
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
 
boost::shared_ptr< std::vector< unsigned char > > reactionMarker
 
std::vector< FTensor::Tensor1< double, 3 > > bodyForces
 
boost::shared_ptr< ContactOps::CommonDatacommonDataPtr
 
boost::shared_ptr< PlasticThermalOps::CommonDatacommonPlasticDataPtr
 
boost::shared_ptr< DomainElefeThermalRhs
 
boost::shared_ptr< DomainElefeThermalLhs
 
std::vector< BcTempFunbcTemperatureFunctions
 
SimplesimpleInterface
 
boost::shared_ptr< CommonDatacommonDataPtr
 
FieldApproximationBase base
 
FieldSpace space
 
boost::shared_ptr< VectorDouble > approxVals
 
boost::shared_ptr< MatrixDouble > approxGradVals
 
Range pinchNodes
 
boost::shared_ptr< MatrixDouble > bodyForceMatPtr
 
SmartPetscObj< Mat > M
 
SmartPetscObj< Mat > K
 
SmartPetscObj< EPS > ePS
 
std::array< SmartPetscObj< Vec >, 6 > rigidBodyMotion
 
boost::shared_ptr< FEMethoddomianLhsFEPtr
 
boost::shared_ptr< FEMethoddomianRhsFEPtr
 

Static Private Attributes

static ApproxFieldFunction< FIELD_DIMapproxFunction
 

Detailed Description

[Example]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plastic.cpp, plot_base.cpp, shallow_wave.cpp, and thermo_plastic.cpp.

Definition at line 71 of file cornea_elastic.cpp.

Constructor & Destructor Documentation

◆ Example() [1/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 73 of file cornea_elastic.cpp.

73 : mField(m_field) {}
MoFEM::Interface & mField

◆ Example() [2/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 132 of file plastic.cpp.

132 : mField(m_field) {}

◆ Example() [3/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 150 of file contact.cpp.

150 : mField(m_field) {}

◆ Example() [4/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 209 of file thermo_plastic.cpp.

209 : mField(m_field) {}

◆ Example() [5/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 47 of file helmholtz.cpp.

47 : mField(m_field) {}

◆ Example() [6/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 39 of file integration.cpp.

39 : mField(m_field) {}

◆ Example() [7/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 65 of file plot_base.cpp.

65 : mField(m_field) {}

◆ Example() [8/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 69 of file approximaton.cpp.

69 : mField(m_field) {}

◆ Example() [9/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 57 of file radiation.cpp.

57 : mField(m_field) {}

◆ Example() [10/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 58 of file heat_method.cpp.

58 : mField(m_field) {}

◆ Example() [11/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 73 of file elastic.cpp.

73 : mField(m_field) {}

◆ Example() [12/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 70 of file eigen_elastic.cpp.

70 : mField(m_field) {}

◆ Example() [13/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 76 of file nonlinear_elastic.cpp.

76 : mField(m_field) {}

◆ Example() [14/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 78 of file nonlinear_dynamic_elastic.cpp.

78 : mField(m_field) {}

◆ Example() [15/15]

Example::Example ( MoFEM::Interface m_field)

Definition at line 354 of file shallow_wave.cpp.

354 : mField(m_field) {}

Member Function Documentation

◆ assembleSystem() [1/10]

MoFEMErrorCode Example::assembleSystem ( )
private

[Boundary condition]

[Applying essential BC]

[Push operators to pipeline]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 200 of file cornea_elastic.cpp.

200  {
202  auto *simple = mField.getInterface<Simple>();
203  auto *pipeline_mng = mField.getInterface<PipelineManager>();
204 
205  if (SPACE_DIM == 2) {
206  auto det_ptr = boost::make_shared<VectorDouble>();
207  auto jac_ptr = boost::make_shared<MatrixDouble>();
208  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
209  pipeline_mng->getOpDomainLhsPipeline().push_back(
210  new OpCalculateHOJacForFace(jac_ptr));
211  pipeline_mng->getOpDomainLhsPipeline().push_back(
212  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
213  pipeline_mng->getOpDomainLhsPipeline().push_back(
214  new OpSetInvJacH1ForFace(inv_jac_ptr));
215  pipeline_mng->getOpDomainRhsPipeline().push_back(
216  new OpCalculateHOJacForFace(jac_ptr));
217  pipeline_mng->getOpDomainRhsPipeline().push_back(
218  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
219  pipeline_mng->getOpDomainRhsPipeline().push_back(
220  new OpSetInvJacH1ForFace(inv_jac_ptr));
221  }
222 
223  // Get pointer to U_tt shift in domain element
224  auto get_rho = [this](const double, const double, const double) {
225  auto *pipeline_mng = mField.getInterface<PipelineManager>();
226  auto &fe_domain_lhs = pipeline_mng->getDomainLhsFE();
227  return rho * fe_domain_lhs->ts_aa;
228  };
229 
230  auto get_body_force = [this](const double, const double, const double) {
231  auto *pipeline_mng = mField.getInterface<PipelineManager>();
232  auto fe_domain_rhs = pipeline_mng->getDomainRhsFE();
235  t_source(i) = 0.;
236  t_source(0) = 0.1;
237  t_source(1) = 1.;
238  const auto time = fe_domain_rhs->ts_t;
239  t_source(i) *= sin(time * omega * M_PI);
240  return t_source;
241  };
242 
243  auto henky_common_data_ptr = boost::make_shared<HenckyOps::CommonData>();
244  henky_common_data_ptr->matGradPtr = matGradPtr;
245  henky_common_data_ptr->matDPtr = matDPtr;
246 
247  pipeline_mng->getOpDomainLhsPipeline().push_back(
249  matGradPtr));
250 
251  pipeline_mng->getOpDomainLhsPipeline().push_back(
252  new OpCalculateEigenVals<SPACE_DIM>("U", henky_common_data_ptr));
253  pipeline_mng->getOpDomainLhsPipeline().push_back(
254  new OpCalculateLogC<SPACE_DIM>("U", henky_common_data_ptr));
255  pipeline_mng->getOpDomainLhsPipeline().push_back(
256  new OpCalculateLogC_dC<SPACE_DIM>("U", henky_common_data_ptr));
257  pipeline_mng->getOpDomainLhsPipeline().push_back(
258  new OpCalculateHenckyStress<SPACE_DIM>("U", henky_common_data_ptr));
259  pipeline_mng->getOpDomainLhsPipeline().push_back(
260  new OpCalculatePiolaStress<SPACE_DIM>("U", henky_common_data_ptr));
261  pipeline_mng->getOpDomainLhsPipeline().push_back(
262  new OpHenckyTangent<SPACE_DIM>("U", henky_common_data_ptr));
263  pipeline_mng->getOpDomainLhsPipeline().push_back(
264  new OpK("U", "U", henky_common_data_ptr->getMatTangent()));
265 
266  if (!is_quasi_static)
267  pipeline_mng->getOpDomainLhsPipeline().push_back(
268  new OpMass("U", "U", get_rho));
269 
270  pipeline_mng->getOpDomainRhsPipeline().push_back(
271  new OpBodyForce("U", get_body_force));
272  pipeline_mng->getOpDomainRhsPipeline().push_back(
274  matGradPtr));
275 
276  pipeline_mng->getOpDomainRhsPipeline().push_back(
277  new OpCalculateEigenVals<SPACE_DIM>("U", henky_common_data_ptr));
278  pipeline_mng->getOpDomainRhsPipeline().push_back(
279  new OpCalculateLogC<SPACE_DIM>("U", henky_common_data_ptr));
280  pipeline_mng->getOpDomainRhsPipeline().push_back(
281  new OpCalculateLogC_dC<SPACE_DIM>("U", henky_common_data_ptr));
282  pipeline_mng->getOpDomainRhsPipeline().push_back(
283  new OpCalculateHenckyStress<SPACE_DIM>("U", henky_common_data_ptr));
284  pipeline_mng->getOpDomainRhsPipeline().push_back(
285  new OpCalculatePiolaStress<SPACE_DIM>("U", henky_common_data_ptr));
286 
287  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpInternalForce(
288  "U", henky_common_data_ptr->getMatFirstPiolaStress()));
289  if (!is_quasi_static) {
290  pipeline_mng->getOpDomainRhsPipeline().push_back(
293  pipeline_mng->getOpDomainRhsPipeline().push_back(
295  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpInertiaForce(
296  "U", matInertiaPtr, [](double, double, double) { return 1.; }));
297  }
298 
299  auto integration_rule = [](int, int, int approx_order) {
300  return 2 * approx_order;
301  };
302  CHKERR pipeline_mng->setDomainRhsIntegrationRule(integration_rule);
303  CHKERR pipeline_mng->setDomainLhsIntegrationRule(integration_rule);
304 
306 }
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
constexpr double rho
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForce
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, 1 > OpK
constexpr int SPACE_DIM
constexpr double omega
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, SPACE_DIM > OpBodyForce
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, 1 > OpInertiaForce
constexpr bool is_quasi_static
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
auto integration_rule
FTensor::Index< 'i', SPACE_DIM > i
OpCalculateHOJacForFaceImpl< 2 > OpCalculateHOJacForFace
static constexpr int approx_order
boost::shared_ptr< MatrixDouble > matAccelerationPtr
boost::shared_ptr< MatrixDouble > matInertiaPtr
boost::shared_ptr< MatrixDouble > matGradPtr
boost::shared_ptr< MatrixDouble > matDPtr
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Approximate field valuse for given petsc vector.
PipelineManager interface.
Simple interface for fast problem set-up.
Definition: Simple.hpp:33
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

◆ assembleSystem() [2/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [3/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [4/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [5/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [6/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [7/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [8/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [9/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [10/10]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ bC() [1/4]

MoFEMErrorCode Example::bC ( )
private

[Create common data]

[Boundary condition]

Examples
contact.cpp, plastic.cpp, and thermo_plastic.cpp.

Definition at line 319 of file plastic.cpp.

319  {
321 
322  auto simple = mField.getInterface<Simple>();
323  auto bc_mng = mField.getInterface<BcManager>();
324  auto prb_mng = mField.getInterface<ProblemsManager>();
325 
326  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
327  "U", 0, 0);
328  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
329  "U", 1, 1);
330  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
331  "U", 2, 2);
332  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(),
333  "REMOVE_ALL", "U", 0, 3);
334 
335  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "FIX_X", "U",
336  0, 0);
337  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "FIX_Y", "U",
338  1, 1);
339  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "FIX_Z", "U",
340  2, 2);
341  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "FIX_ALL",
342  "U", 0, 3);
343 
344  auto &bc_map = bc_mng->getBcMapByBlockName();
345  boundaryMarker = bc_mng->getMergedBlocksMarker(vector<string>{"FIX_"});
346 
347  CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "REACTION",
348  "U", 0, 3);
349 
350  for (auto bc : bc_map)
351  MOFEM_LOG("EXAMPLE", Sev::verbose) << "Marker " << bc.first;
352 
353  // OK. We have problem with GMesh, it adding empty characters at the end of
354  // block. So first block is search by regexp. popMarkDOFsOnEntities should
355  // work with regexp.
356  std::string reaction_block_set;
357  for (auto bc : bc_map) {
358  if (bc_mng->checkBlock(bc, "REACTION")) {
359  reaction_block_set = bc.first;
360  break;
361  }
362  }
363 
364  if (auto bc = bc_mng->popMarkDOFsOnEntities(reaction_block_set)) {
365  reactionMarker = bc->getBcMarkersPtr();
366 
367  // Only take reaction from nodes
368  Range nodes;
369  CHKERR mField.get_moab().get_entities_by_type(0, MBVERTEX, nodes, true);
370  CHKERR prb_mng->markDofs(simple->getProblemName(), ROW,
371  ProblemsManager::MarkOP::AND, nodes,
372  *reactionMarker);
373 
374  } else {
375  MOFEM_LOG("EXAMPLE", Sev::warning) << "REACTION blockset does not exist";
376  }
377 
378  if (!reactionMarker) {
379  MOFEM_LOG("EXAMPLE", Sev::warning) << "REACTION blockset does not exist";
380  }
381 
383 }
@ ROW
Definition: definitions.h:136
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:309
boost::shared_ptr< std::vector< unsigned char > > reactionMarker
Definition: plastic.cpp:157
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
Definition: plastic.cpp:156
Simple interface for fast problem set-up.
Definition: BcManager.hpp:27
virtual moab::Interface & get_moab()=0
Problem manager is used to build and partition problems.

◆ bC() [2/4]

MoFEMErrorCode Example::bC ( )
private

◆ bC() [3/4]

MoFEMErrorCode Example::bC ( )
private

◆ bC() [4/4]

MoFEMErrorCode Example::bC ( )
private

◆ boundaryCondition() [1/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

[Set up problem]

[Create common data]

[Boundary condition]

[Applying essential BC]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 180 of file cornea_elastic.cpp.

180  {
182 
183  auto simple = mField.getInterface<Simple>();
184  auto bc_mng = mField.getInterface<BcManager>();
185 
186  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "FIX_X",
187  "U", 0, 0);
188  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "FIX_Y",
189  "U", 1, 1);
190  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "FIX_Z",
191  "U", 2, 2);
192  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(),
193  "FIX_ALL", "U", 0, 3);
194 
196 }

◆ boundaryCondition() [2/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [3/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [4/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [5/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [6/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [7/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [8/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [9/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [10/10]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ checkResults() [1/13]

MoFEMErrorCode Example::checkResults ( )
private

[Postprocess results]

[Print results]

[Check]

[Check results]

[Test example]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 441 of file cornea_elastic.cpp.

441  {
444 }

◆ checkResults() [2/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [3/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [4/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [5/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [6/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [7/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [8/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [9/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [10/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [11/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [12/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [13/13]

MoFEMErrorCode Example::checkResults ( )
private

◆ createCommonData() [1/14]

MoFEMErrorCode Example::createCommonData ( )
private

[Create common data]

[Set integration rule]

[Set up problem]

[Create common data]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, nonlinear_elastic.cpp, plastic.cpp, plot_base.cpp, shallow_wave.cpp, and thermo_plastic.cpp.

Definition at line 100 of file cornea_elastic.cpp.

100  {
102 
103  auto set_matrial_stiffness = [&]() {
110  constexpr double A =
111  (SPACE_DIM == 2) ? 2 * shear_modulus_G /
112  (bulk_modulus_K + (4. / 3.) * shear_modulus_G)
113  : 1;
114  auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*matDPtr);
115  t_D(i, j, k, l) = 2 * shear_modulus_G * ((t_kd(i, k) ^ t_kd(j, l)) / 4.) +
116  A * (bulk_modulus_K - (2. / 3.) * shear_modulus_G) *
117  t_kd(i, j) * t_kd(k, l);
119  };
120 
121  matGradPtr = boost::make_shared<MatrixDouble>();
122  matStrainPtr = boost::make_shared<MatrixDouble>();
123  matStressPtr = boost::make_shared<MatrixDouble>();
124  matAccelerationPtr = boost::make_shared<MatrixDouble>();
125  matInertiaPtr = boost::make_shared<MatrixDouble>();
126  matDPtr = boost::make_shared<MatrixDouble>();
127 
128  matTangentPtr = boost::make_shared<MatrixDouble>();
129 
130  constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
131  matDPtr->resize(size_symm * size_symm, 1);
132 
133  CHKERR set_matrial_stiffness();
134 
136 }
Kronecker Delta class symmetric.
constexpr double shear_modulus_G
constexpr double bulk_modulus_K
constexpr auto t_kd
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
double A
boost::shared_ptr< MatrixDouble > matTangentPtr
boost::shared_ptr< MatrixDouble > matStressPtr
boost::shared_ptr< MatrixDouble > matStrainPtr

◆ createCommonData() [2/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [3/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [4/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [5/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [6/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [7/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [8/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [9/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [10/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [11/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [12/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [13/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [14/14]

MoFEMErrorCode Example::createCommonData ( )
private

◆ getEntsOnMeshSkin()

template<int DIM>
Range Example::getEntsOnMeshSkin
private

[Check]

Examples
contact.cpp.

Definition at line 703 of file contact.cpp.

703  {
704  Range body_ents;
705  CHKERR mField.get_moab().get_entities_by_dimension(0, DIM, body_ents);
706  Skinner skin(&mField.get_moab());
707  Range skin_ents;
708  CHKERR skin.find_skin(0, body_ents, false, skin_ents);
709 
710  return skin_ents;
711 };

◆ integrateElements()

MoFEMErrorCode Example::integrateElements ( )
private

[Push operators to pipeline]

[Integrate]

Definition at line 232 of file integration.cpp.

232  {
234  // Zero global vector
235  CHKERR VecZeroEntries(commonDataPtr->petscVec);
236 
237  // Integrate elements by executing operators in the pipeline
239  CHKERR pipeline_mng->loopFiniteElements();
240 
241  // Assemble MPI vector
242  CHKERR VecAssemblyBegin(commonDataPtr->petscVec);
243  CHKERR VecAssemblyEnd(commonDataPtr->petscVec);
245 }
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
Definition: contact.cpp:165

◆ integrationRule()

static int Example::integrationRule ( int  ,
int  ,
int  p_data 
)
staticprivate

Definition at line 64 of file radiation.cpp.

64 { return 2 * p_data; };

◆ kspSolve()

MoFEMErrorCode Example::kspSolve ( )
private

[Push operators to pipeline]

[Solve]

Definition at line 239 of file radiation.cpp.

239  {
243  auto ts = pipeline_mng->createTSIM();
244 
245  double ftime = 1;
246  CHKERR TSSetDuration(ts, PETSC_DEFAULT, ftime);
247  CHKERR TSSetFromOptions(ts);
248  CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
249 
250  auto T = smartCreateDMVector(simple->getDM());
251  CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
252  SCATTER_FORWARD);
253 
254  CHKERR TSSolve(ts, T);
255  CHKERR TSGetTime(ts, &ftime);
256 
257  PetscInt steps, snesfails, rejects, nonlinits, linits;
258  CHKERR TSGetTimeStepNumber(ts, &steps);
259  CHKERR TSGetSNESFailures(ts, &snesfails);
260  CHKERR TSGetStepRejections(ts, &rejects);
261  CHKERR TSGetSNESIterations(ts, &nonlinits);
262  CHKERR TSGetKSPIterations(ts, &linits);
263  MOFEM_LOG_C("EXAMPLE", Sev::inform,
264  "steps %d (%d rejected, %d SNES fails), ftime %g, nonlinits "
265  "%d, linits %d",
266  steps, rejects, snesfails, ftime, nonlinits, linits);
267 
269 }
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:312
auto smartCreateDMVector
Get smart vector from DM.
Definition: DMMoFEM.hpp:956
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMMoFEM.cpp:478
SmartPetscObj< TS > createTSIM(SmartPetscObj< DM > dm=nullptr)
Create TS (time) implicit solver.
const double T

◆ OPs() [1/4]

MoFEMErrorCode Example::OPs ( )
private

[Boundary condition]

[Push operators to pipeline]

Examples
contact.cpp, plastic.cpp, and thermo_plastic.cpp.

Definition at line 387 of file plastic.cpp.

387  {
389  auto pipeline_mng = mField.getInterface<PipelineManager>();
390  auto simple = mField.getInterface<Simple>();
391  auto bc_mng = mField.getInterface<BcManager>();
392 
393  feAxiatorLhs = boost::make_shared<DomainEle>(mField);
394  feAxiatorRhs = boost::make_shared<DomainEle>(mField);
395  auto integration_rule_axiator = [](int, int, int approx_order) {
396  return 2 * (approx_order - 1);
397  };
398  feAxiatorLhs->getRuleHook = integration_rule_axiator;
399  feAxiatorRhs->getRuleHook = integration_rule_axiator;
400 
401  auto integration_rule_deviator = [](int o_row, int o_col, int approx_order) {
402  return 2 * (approx_order - 1);
403  };
404  auto integration_rule_bc = [](int, int, int approx_order) {
405  return 2 * approx_order;
406  };
407 
408  auto add_domain_base_ops = [&](auto &pipeline) {
410 
411  if (SPACE_DIM == 2) {
412  auto det_ptr = boost::make_shared<VectorDouble>();
413  auto jac_ptr = boost::make_shared<MatrixDouble>();
414  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
415  pipeline.push_back(new OpCalculateHOJacForFace(jac_ptr));
416  pipeline.push_back(new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
417  pipeline.push_back(new OpSetInvJacH1ForFace(inv_jac_ptr));
418  }
419 
420  pipeline.push_back(new OpCalculateScalarFieldValuesDot(
421  "TAU", commonPlasticDataPtr->getPlasticTauDotPtr()));
423  "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
425  "EP", commonPlasticDataPtr->getPlasticStrainDotPtr()));
427  "U", commonPlasticDataPtr->mGradPtr));
428  pipeline.push_back(new OpCalculateScalarFieldValues(
429  "TAU", commonPlasticDataPtr->getPlasticTauPtr()));
430 
432  };
433 
434  auto add_domain_stress_ops = [&](auto &pipeline, auto m_D_ptr) {
436 
437  if (is_large_strains) {
438 
439  if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
440  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
441  "Wrong pointer for grad");
442 
443  pipeline.push_back(
445  pipeline.push_back(
447  pipeline.push_back(
449  pipeline.push_back(new OpCalculateHenckyPlasticStress<SPACE_DIM>(
450  "U", commonHenckyDataPtr, m_D_ptr));
451  pipeline.push_back(
453 
454  } else {
455  pipeline.push_back(
457  commonPlasticDataPtr->mStrainPtr));
458  pipeline.push_back(
459  new OpPlasticStress("U", commonPlasticDataPtr, m_D_ptr, 1));
460  }
461 
462  if (m_D_ptr != commonPlasticDataPtr->mDPtr_Axiator)
463  pipeline.push_back(
465 
467  };
468 
469  auto add_domain_ops_lhs_mechanical = [&](auto &pipeline, auto m_D_ptr) {
471  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
472 
473  if (is_large_strains) {
474  pipeline.push_back(
476  pipeline.push_back(
477  new OpKPiola("U", "U", commonHenckyDataPtr->getMatTangent()));
479  "U", "EP", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
480  } else {
481  pipeline.push_back(new OpKCauchy("U", "U", m_D_ptr));
482  pipeline.push_back(new OpCalculatePlasticInternalForceLhs_dEP(
483  "U", "EP", commonPlasticDataPtr, m_D_ptr));
484  }
485 
486  pipeline.push_back(new OpUnSetBc("U"));
488  };
489 
490  auto add_domain_ops_rhs_mechanical = [&](auto &pipeline) {
492  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
493 
495  const std::string block_name = "BODY_FORCE";
496  if (it->getName().compare(0, block_name.size(), block_name) == 0) {
497  std::vector<double> attr;
498  CHKERR it->getAttributes(attr);
499  if (attr.size() == 3) {
500  bodyForces.push_back(
501  FTensor::Tensor1<double, 3>{attr[0], attr[1], attr[2]});
502  } else {
503  SETERRQ1(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
504  "Should be three atributes in BODYFORCE blockset, but is %d",
505  attr.size());
506  }
507  }
508  }
509 
510  auto get_body_force = [this](const double, const double, const double) {
511  auto *pipeline_mng = mField.getInterface<PipelineManager>();
514  t_source(i) = 0;
515  auto fe_domain_rhs = pipeline_mng->getDomainRhsFE();
516  const auto time = fe_domain_rhs->ts_t;
517  // hardcoded gravity load
518  for (auto &t_b : bodyForces)
519  t_source(i) += (scale * t_b(i)) * time;
520  return t_source;
521  };
522 
523  pipeline.push_back(new OpBodyForce("U", get_body_force));
524 
525  // Calculate internal forece
526  if (is_large_strains) {
527  pipeline.push_back(new OpInternalForcePiola(
528  "U", commonHenckyDataPtr->getMatFirstPiolaStress()));
529  } else {
530  pipeline.push_back(
531  new OpInternalForceCauchy("U", commonPlasticDataPtr->mStressPtr));
532  }
533 
534  pipeline.push_back(new OpUnSetBc("U"));
536  };
537 
538  auto add_domain_ops_lhs_constrain = [&](auto &pipeline, auto m_D_ptr) {
540  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
541 
542  if (is_large_strains) {
543  pipeline.push_back(
545  pipeline.push_back(new OpCalculateContrainsLhs_LogStrain_dU(
546  "TAU", "U", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
547  pipeline.push_back(new OpCalculatePlasticFlowLhs_LogStrain_dU(
548  "EP", "U", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
549  } else {
550  pipeline.push_back(new OpCalculatePlasticFlowLhs_dU(
551  "EP", "U", commonPlasticDataPtr, m_D_ptr));
552  pipeline.push_back(new OpCalculateContrainsLhs_dU(
553  "TAU", "U", commonPlasticDataPtr, m_D_ptr));
554  }
555 
556  pipeline.push_back(new OpCalculatePlasticFlowLhs_dEP(
557  "EP", "EP", commonPlasticDataPtr, m_D_ptr));
558  pipeline.push_back(
560  pipeline.push_back(new OpCalculateContrainsLhs_dEP(
561  "TAU", "EP", commonPlasticDataPtr, m_D_ptr));
562  pipeline.push_back(
564 
565  pipeline.push_back(new OpUnSetBc("U"));
567  };
568 
569  auto add_domain_ops_rhs_constrain = [&](auto &pipeline) {
571  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
572 
573 
574  pipeline.push_back(
576  pipeline.push_back(
578 
580  };
581 
582  auto add_boundary_ops_lhs_mechanical = [&](auto &pipeline) {
584  auto &bc_map = mField.getInterface<BcManager>()->getBcMapByBlockName();
585  for (auto bc : bc_map) {
586  if (bc_mng->checkBlock(bc, "FIX_")){
587  pipeline.push_back(
588  new OpSetBc("U", false, bc.second->getBcMarkersPtr()));
589  pipeline.push_back(new OpBoundaryMass(
590  "U", "U", [](double, double, double) { return 1.; },
591  bc.second->getBcEntsPtr()));
592  pipeline.push_back(new OpUnSetBc("U"));
593  }
594  }
596  };
597 
598  auto add_boundary_ops_rhs_mechanical = [&](auto &pipeline) {
600 
601  auto get_time = [&](double, double, double) {
602  auto *pipeline_mng = mField.getInterface<PipelineManager>();
603  auto &fe_domain_rhs = pipeline_mng->getBoundaryRhsFE();
604  return fe_domain_rhs->ts_t;
605  };
606 
607  auto get_time_scaled = [&](double, double, double) {
608  auto *pipeline_mng = mField.getInterface<PipelineManager>();
609  auto &fe_domain_rhs = pipeline_mng->getBoundaryRhsFE();
610  return fe_domain_rhs->ts_t * scale;
611  };
612 
613  auto get_minus_time = [&](double, double, double) {
614  auto *pipeline_mng = mField.getInterface<PipelineManager>();
615  auto &fe_domain_rhs = pipeline_mng->getBoundaryRhsFE();
616  return -fe_domain_rhs->ts_t;
617  };
618 
619  auto time_scaled = [&](double, double, double) {
620  auto *pipeline_mng = mField.getInterface<PipelineManager>();
621  auto &fe_domain_rhs = pipeline_mng->getBoundaryRhsFE();
622  return -fe_domain_rhs->ts_t;
623  };
624 
625  pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
626 
628  if (it->getName().compare(0, 5, "FORCE") == 0) {
629  Range force_edges;
630  std::vector<double> attr_vec;
631  CHKERR it->getMeshsetIdEntitiesByDimension(
632  mField.get_moab(), SPACE_DIM - 1, force_edges, true);
633  it->getAttributes(attr_vec);
634  if (attr_vec.size() < SPACE_DIM)
635  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
636  "Wrong size of boundary attributes vector. Set right block "
637  "size attributes.");
638  auto force_vec_ptr = boost::make_shared<MatrixDouble>(SPACE_DIM, 1);
639  std::copy(&attr_vec[0], &attr_vec[SPACE_DIM],
640  force_vec_ptr->data().begin());
641  pipeline.push_back(
642  new OpBoundaryVec("U", force_vec_ptr, get_time_scaled,
643  boost::make_shared<Range>(force_edges)));
644  }
645  }
646 
647  pipeline.push_back(new OpUnSetBc("U"));
648 
649  auto u_mat_ptr = boost::make_shared<MatrixDouble>();
650  pipeline.push_back(
651  new OpCalculateVectorFieldValues<SPACE_DIM>("U", u_mat_ptr));
652 
653  for (auto &bc : mField.getInterface<BcManager>()->getBcMapByBlockName()) {
654  if (bc_mng->checkBlock(bc, "FIX_")) {
655  pipeline.push_back(
656  new OpSetBc("U", false, bc.second->getBcMarkersPtr()));
657  auto attr_vec = boost::make_shared<MatrixDouble>(SPACE_DIM, 1);
658  attr_vec->clear();
659  if (bc.second->bcAttributes.size() < SPACE_DIM)
660  SETERRQ1(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
661  "Wrong size of boundary attributes vector. Set right block "
662  "size attributes. Size of attributes %d",
663  bc.second->bcAttributes.size());
664  std::copy(&bc.second->bcAttributes[0],
665  &bc.second->bcAttributes[SPACE_DIM],
666  attr_vec->data().begin());
667 
668  pipeline.push_back(new OpBoundaryVec("U", attr_vec, time_scaled,
669  bc.second->getBcEntsPtr()));
670  pipeline.push_back(new OpBoundaryInternal(
671  "U", u_mat_ptr, [](double, double, double) { return 1.; },
672  bc.second->getBcEntsPtr()));
673 
674  pipeline.push_back(new OpUnSetBc("U"));
675  }
676  }
677 
679  };
680 
681  // Axiator
682  CHKERR add_domain_base_ops(pipeline_mng->getOpDomainLhsPipeline());
683  CHKERR add_domain_stress_ops(pipeline_mng->getOpDomainLhsPipeline(),
684  commonPlasticDataPtr->mDPtr_Deviator);
685  CHKERR add_domain_ops_lhs_mechanical(pipeline_mng->getOpDomainLhsPipeline(),
686  commonPlasticDataPtr->mDPtr_Deviator);
687  CHKERR add_domain_ops_lhs_constrain(pipeline_mng->getOpDomainLhsPipeline(),
688  commonPlasticDataPtr->mDPtr_Deviator);
689  CHKERR add_boundary_ops_lhs_mechanical(
690  pipeline_mng->getOpBoundaryLhsPipeline());
691 
692  CHKERR add_domain_base_ops(feAxiatorLhs->getOpPtrVector());
693  CHKERR add_domain_stress_ops(feAxiatorLhs->getOpPtrVector(),
694  commonPlasticDataPtr->mDPtr_Axiator);
695  CHKERR add_domain_ops_lhs_mechanical(feAxiatorLhs->getOpPtrVector(),
696  commonPlasticDataPtr->mDPtr_Axiator);
697 
698  CHKERR add_domain_base_ops(pipeline_mng->getOpDomainRhsPipeline());
699  CHKERR add_domain_stress_ops(pipeline_mng->getOpDomainRhsPipeline(),
700  commonPlasticDataPtr->mDPtr_Deviator);
701  CHKERR add_domain_ops_rhs_mechanical(pipeline_mng->getOpDomainRhsPipeline());
702  CHKERR add_domain_ops_rhs_constrain(pipeline_mng->getOpDomainRhsPipeline());
703  CHKERR add_boundary_ops_rhs_mechanical(
704  pipeline_mng->getOpBoundaryRhsPipeline());
705 
706  CHKERR add_domain_base_ops(feAxiatorRhs->getOpPtrVector());
707  CHKERR add_domain_stress_ops(feAxiatorRhs->getOpPtrVector(),
708  commonPlasticDataPtr->mDPtr_Axiator);
709  CHKERR add_domain_ops_rhs_mechanical(feAxiatorRhs->getOpPtrVector());
710 
711  CHKERR pipeline_mng->setDomainRhsIntegrationRule(integration_rule_deviator);
712  CHKERR pipeline_mng->setDomainLhsIntegrationRule(integration_rule_deviator);
713 
714  CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(integration_rule_bc);
715  CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(integration_rule_bc);
716 
717  auto create_reaction_pipeline = [&](auto &pipeline) {
719 
720  if (reactionMarker) {
721 
722  if (SPACE_DIM == 2) {
723  auto det_ptr = boost::make_shared<VectorDouble>();
724  auto jac_ptr = boost::make_shared<MatrixDouble>();
725  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
726  pipeline.push_back(new OpCalculateHOJacForFace(jac_ptr));
727  pipeline.push_back(
728  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
729  pipeline.push_back(new OpSetInvJacH1ForFace(inv_jac_ptr));
730  }
731 
732  pipeline.push_back(
734  "U", commonPlasticDataPtr->mGradPtr));
736  "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
737 
738  if (is_large_strains) {
739 
740  if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
741  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
742  "Wrong pointer for grad");
743 
744  pipeline.push_back(
746  pipeline.push_back(
748  pipeline.push_back(
750  pipeline.push_back(new OpCalculateHenckyPlasticStress<SPACE_DIM>(
752  pipeline.push_back(
754 
755  } else {
756  pipeline.push_back(new OpSymmetrizeTensor<SPACE_DIM>(
757  "U", commonPlasticDataPtr->mGradPtr,
758  commonPlasticDataPtr->mStrainPtr));
759  pipeline.push_back(new OpPlasticStress("U", commonPlasticDataPtr,
760  commonPlasticDataPtr->mDPtr, 1));
761  }
762 
763  pipeline.push_back(new OpSetBc("U", false, reactionMarker));
764  // Calculate internal forece
765  if (is_large_strains) {
766  pipeline.push_back(new OpInternalForcePiola(
767  "U", commonHenckyDataPtr->getMatFirstPiolaStress()));
768  } else {
769  pipeline.push_back(
770  new OpInternalForceCauchy("U", commonPlasticDataPtr->mStressPtr));
771  }
772  pipeline.push_back(new OpUnSetBc("U"));
773  }
774 
776  };
777 
778  reactionFe = boost::make_shared<DomainEle>(mField);
779  reactionFe->getRuleHook = integration_rule_deviator;
780 
781  CHKERR create_reaction_pipeline(reactionFe->getOpPtrVector());
782 
784 }
@ BLOCKSET
Definition: definitions.h:161
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
@ MOFEM_INVALID_DATA
Definition: definitions.h:49
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForcePiola
Definition: plastic.cpp:88
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, 1 > OpKPiola
[Only used for dynamics]
Definition: plastic.cpp:86
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesSymTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForceCauchy
Definition: plastic.cpp:74
constexpr int SPACE_DIM
Definition: plastic.cpp:51
double scale
Definition: plastic.cpp:103
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, 0 > OpBoundaryVec
Definition: plastic.cpp:95
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradSymTensorGrad< 1, SPACE_DIM, SPACE_DIM, 0 > OpKCauchy
[Body force]
Definition: plastic.cpp:72
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 1, SPACE_DIM, 1 > OpBoundaryInternal
Definition: plastic.cpp:97
PetscBool is_large_strains
Definition: plastic.cpp:101
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpBoundaryMass
[Only used with Hencky/nonlinear material]
Definition: plastic.cpp:93
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, SPACE_DIM > OpBodyForce
[Body force]
Definition: plastic.cpp:67
boost::shared_ptr< DomainEle > feAxiatorRhs
Definition: plastic.cpp:149
boost::shared_ptr< DomainEle > reactionFe
Definition: plastic.cpp:148
boost::shared_ptr< DomainEle > feAxiatorLhs
Definition: plastic.cpp:150
std::vector< FTensor::Tensor1< double, 3 > > bodyForces
Definition: plastic.cpp:159
boost::shared_ptr< PlasticOps::CommonData > commonPlasticDataPtr
Definition: plastic.cpp:145
boost::shared_ptr< HenckyOps::CommonData > commonHenckyDataPtr
Definition: plastic.cpp:146
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
Definition: BcManager.hpp:131
Get value at integration points for scalar field.
Calculate symmetric tensor field rates ant integratio pts.
Calculate symmetric tensor field values at integration pts.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Set indices on entities on finite element.
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()

◆ OPs() [2/4]

MoFEMErrorCode Example::OPs ( )
private

◆ OPs() [3/4]

MoFEMErrorCode Example::OPs ( )
private

◆ OPs() [4/4]

MoFEMErrorCode Example::OPs ( )
private

◆ outputResults() [1/10]

MoFEMErrorCode Example::outputResults ( )
private

[Solve]

[Postprocess results]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 419 of file cornea_elastic.cpp.

419  {
421  PetscBool test_flg = PETSC_FALSE;
422  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-test", &test_flg, PETSC_NULL);
423  if (test_flg) {
424  auto *simple = mField.getInterface<Simple>();
425  auto T = smartCreateDMVector(simple->getDM());
426  CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
427  SCATTER_FORWARD);
428  double nrm2;
429  CHKERR VecNorm(T, NORM_2, &nrm2);
430  MOFEM_LOG("EXAMPLE", Sev::inform) << "Regression norm " << nrm2;
431  constexpr double regression_value = 1.09572;
432  if (fabs(nrm2 - regression_value) > 1e-2)
433  SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
434  "Regression test faileed; wrong norm value.");
435  }
437 }
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:53
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)

◆ outputResults() [2/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [3/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [4/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [5/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [6/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [7/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [8/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [9/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [10/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ postProcess() [1/3]

MoFEMErrorCode Example::postProcess ( )
private

[Solve]

[Integrate]

[Postprocess results]

[Print results]

Examples
contact.cpp.

Definition at line 696 of file contact.cpp.

696 { return 0; }

◆ postProcess() [2/3]

MoFEMErrorCode Example::postProcess ( )
private

◆ postProcess() [3/3]

MoFEMErrorCode Example::postProcess ( )
private

◆ pushOperators()

MoFEMErrorCode Example::pushOperators ( )
private

[Set density distribution]

[Push operators to pipeline]

Definition at line 202 of file integration.cpp.

202  {
205 
206  // Push an operator which calculates values of density at integration points
207  pipeline_mng->getOpDomainRhsPipeline().push_back(
209  "rho", commonDataPtr->getRhoAtIntegrationPtsPtr()));
210 
211  // Push an operator to pipeline to calculate zero moment of inertia (mass)
212  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpZero(commonDataPtr));
213 
214  // Push an operator to the pipeline to calculate first moment of inertaia
215  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpFirst(commonDataPtr));
216 
217  // Push an operator to the pipeline to calculate second moment of inertaia
218  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpSecond(commonDataPtr));
219 
220  // Set integration rule. Integration rule is equal to the polynomial order of
221  // the density field plus 2, since under the integral of the second moment of
222  // inertia term x*x is present
223  auto integration_rule = [](int, int, int p_data) { return p_data + 2; };
224 
225  // Add integration rule to the element
228 }
boost::ptr_vector< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)

◆ readMesh() [1/10]

MoFEMErrorCode Example::readMesh ( )
private

[Run problem]

[Run programme]

[run problem]

[Read mesh]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 155 of file cornea_elastic.cpp.

155  {
157  auto simple = mField.getInterface<Simple>();
158  CHKERR simple->getOptions();
159  CHKERR simple->loadFile();
161 }

◆ readMesh() [2/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [3/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [4/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [5/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [6/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [7/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [8/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [9/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [10/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ runProblem() [1/15]

MoFEMErrorCode Example::runProblem ( )

[Create common data]

[Run programme]

[Operator]

[run problem]

[Run problem]

[Run all]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plastic.cpp, plot_base.cpp, shallow_wave.cpp, and thermo_plastic.cpp.

Definition at line 140 of file cornea_elastic.cpp.

140  {
142  CHKERR readMesh();
151 }
MoFEMErrorCode boundaryCondition()
[Set up problem]
MoFEMErrorCode assembleSystem()
[Boundary condition]
MoFEMErrorCode readMesh()
[Run problem]
MoFEMErrorCode checkResults()
[Postprocess results]
MoFEMErrorCode solveSystem()
[Solve]
MoFEMErrorCode createCommonData()
[Create common data]
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEMErrorCode outputResults()
[Solve]

◆ runProblem() [2/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [3/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [4/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [5/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [6/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [7/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [8/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [9/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [10/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [11/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [12/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [13/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [14/15]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [15/15]

MoFEMErrorCode Example::runProblem ( )

◆ setFieldValues()

MoFEMErrorCode Example::setFieldValues ( )
private

[Create common data]

[Set density distribution]

Definition at line 186 of file integration.cpp.

186  {
188  auto set_density = [&](VectorAdaptor &&field_data, double *xcoord,
189  double *ycoord, double *zcoord) {
191  field_data[0] = 1;
193  };
194  FieldBlas *field_blas;
195  CHKERR mField.getInterface(field_blas);
196  CHKERR field_blas->setVertexDofs(set_density, "rho");
198 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
VectorShallowArrayAdaptor< double > VectorAdaptor
Definition: Types.hpp:126
Basic algebra on fields.
Definition: FieldBlas.hpp:31
MoFEMErrorCode setVertexDofs(VertexCoordsFunction lambda, const std::string field_name, Range *verts=nullptr)
Set DOFs on vertices using user function.
Definition: FieldBlas.cpp:333

◆ setIntegrationRules() [1/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

[Set up problem]

[Set integration rule]

Examples
heat_method.cpp, and plot_base.cpp.

Definition at line 219 of file plot_base.cpp.

219  {
222 }

◆ setIntegrationRules() [2/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

◆ setIntegrationRules() [3/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

◆ setUp()

MoFEMErrorCode Example::setUp ( )
private

[Run all]

[Set up problem]

Definition at line 151 of file integration.cpp.

151  {
154  CHKERR simple->getOptions();
155  CHKERR simple->loadFile();
156  // Add field
157  CHKERR simple->addDomainField("rho", H1, AINSWORTH_LEGENDRE_BASE, 1);
158  constexpr int order = 1;
159  CHKERR simple->setFieldOrder("rho", order);
160  CHKERR simple->setUp();
162 }
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ H1
continuous field
Definition: definitions.h:98

◆ setupProblem() [1/14]

MoFEMErrorCode Example::setupProblem ( )
private

[Read mesh]

[Run problem]

[Set up problem]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plastic.cpp, plot_base.cpp, shallow_wave.cpp, and thermo_plastic.cpp.

Definition at line 165 of file cornea_elastic.cpp.

165  {
168  // Add field
169  CHKERR simple->addDomainField("U", H1, AINSWORTH_BERNSTEIN_BEZIER_BASE,
170  SPACE_DIM);
171  int order = 2;
172  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &order, PETSC_NULL);
173  CHKERR simple->setFieldOrder("U", order);
174  CHKERR simple->setUp();
176 }
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition: definitions.h:77
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)

◆ setupProblem() [2/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [3/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [4/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [5/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [6/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [7/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [8/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [9/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [10/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [11/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [12/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [13/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [14/14]

MoFEMErrorCode Example::setupProblem ( )
private

◆ solveSystem() [1/10]

MoFEMErrorCode Example::solveSystem ( )
private

[Solve]

[Push operators to pipeline]

[Solve]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 335 of file cornea_elastic.cpp.

335  {
337  auto *simple = mField.getInterface<Simple>();
338  auto *pipeline_mng = mField.getInterface<PipelineManager>();
339 
340  auto dm = simple->getDM();
342  if (is_quasi_static)
343  ts = pipeline_mng->createTSIM();
344  else
345  ts = pipeline_mng->createTSIM2();
346 
347  // Setup postprocessing
348  auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
349  post_proc_fe->generateReferenceElementMesh();
350  if (SPACE_DIM == 2) {
351  auto det_ptr = boost::make_shared<VectorDouble>();
352  auto jac_ptr = boost::make_shared<MatrixDouble>();
353  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
354  post_proc_fe->getOpPtrVector().push_back(
355  new OpCalculateHOJacForFace(jac_ptr));
356  post_proc_fe->getOpPtrVector().push_back(
357  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
358  post_proc_fe->getOpPtrVector().push_back(
359  new OpSetInvJacH1ForFace(inv_jac_ptr));
360  }
361  post_proc_fe->getOpPtrVector().push_back(
363  matGradPtr));
364  post_proc_fe->getOpPtrVector().push_back(
366  post_proc_fe->getOpPtrVector().push_back(
369  post_proc_fe->getOpPtrVector().push_back(new OpPostProcElastic<SPACE_DIM>(
370  "U", post_proc_fe->postProcMesh, post_proc_fe->mapGaussPts, matStrainPtr,
371  matStressPtr));
372  post_proc_fe->addFieldValuesPostProc("U");
373 
374  // Add monitor to time solver
375  boost::shared_ptr<FEMethod> null_fe;
376  auto monitor_ptr = boost::make_shared<Monitor>(dm, post_proc_fe);
377  CHKERR DMMoFEMTSSetMonitor(dm, ts, simple->getDomainFEName(), null_fe,
378  null_fe, monitor_ptr);
379 
380  double ftime = 1;
381  // CHKERR TSSetMaxTime(ts, ftime);
382  CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
383 
384  auto T = smartCreateDMVector(simple->getDM());
385  CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
386  SCATTER_FORWARD);
387  if (is_quasi_static) {
388  CHKERR TSSetSolution(ts, T);
389  CHKERR TSSetFromOptions(ts);
390  } else {
391  auto TT = smartVectorDuplicate(T);
392  CHKERR TS2SetSolution(ts, T, TT);
393  CHKERR TSSetFromOptions(ts);
394  }
395 
396  CHKERR TSSolve(ts, NULL);
397  CHKERR TSGetTime(ts, &ftime);
398 
399  PetscInt steps, snesfails, rejects, nonlinits, linits;
400 #if PETSC_VERSION_GE(3, 8, 0)
401  CHKERR TSGetStepNumber(ts, &steps);
402 #else
403  CHKERR TSGetTimeStepNumber(ts, &steps);
404 #endif
405  CHKERR TSGetSNESFailures(ts, &snesfails);
406  CHKERR TSGetStepRejections(ts, &rejects);
407  CHKERR TSGetSNESIterations(ts, &nonlinits);
408  CHKERR TSGetKSPIterations(ts, &linits);
409  MOFEM_LOG_C("EXAMPLE", Sev::inform,
410  "steps %D (%D rejected, %D SNES fails), ftime %g, nonlinits "
411  "%D, linits %D\n",
412  steps, rejects, snesfails, ftime, nonlinits, linits);
413 
415 }
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, 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 Monitor To TS solver.
Definition: DMMMoFEM.cpp:991
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
[Class definition]

◆ solveSystem() [2/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [3/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [4/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [5/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [6/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [7/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [8/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [9/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [10/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ tsSolve() [1/3]

MoFEMErrorCode Example::tsSolve ( )
private

[Push operators to pipeline]

[Solve]

Examples
contact.cpp, plastic.cpp, and thermo_plastic.cpp.

Definition at line 788 of file plastic.cpp.

788  {
790 
793  ISManager *is_manager = mField.getInterface<ISManager>();
794 
795  auto set_section_monitor = [&](auto solver) {
797  SNES snes;
798  CHKERR TSGetSNES(solver, &snes);
799  PetscViewerAndFormat *vf;
800  CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
801  PETSC_VIEWER_DEFAULT, &vf);
802  CHKERR SNESMonitorSet(
803  snes,
804  (MoFEMErrorCode(*)(SNES, PetscInt, PetscReal, void *))SNESMonitorFields,
805  vf, (MoFEMErrorCode(*)(void **))PetscViewerAndFormatDestroy);
807  };
808 
809  auto create_post_process_element = [&]() {
811  postProcFe = boost::make_shared<PostProcEle>(mField);
812  postProcFe->generateReferenceElementMesh();
813  if (SPACE_DIM == 2) {
814  auto det_ptr = boost::make_shared<VectorDouble>();
815  auto jac_ptr = boost::make_shared<MatrixDouble>();
816  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
817  postProcFe->getOpPtrVector().push_back(
818  new OpCalculateHOJacForFace(jac_ptr));
819  postProcFe->getOpPtrVector().push_back(
820  new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
821  postProcFe->getOpPtrVector().push_back(new OpSetInvJacH1ForFace(inv_jac_ptr));
822  }
823 
824  postProcFe->getOpPtrVector().push_back(
826  "U", commonPlasticDataPtr->mGradPtr));
827  postProcFe->getOpPtrVector().push_back(new OpCalculateScalarFieldValues(
828  "TAU", commonPlasticDataPtr->getPlasticTauPtr()));
829  postProcFe->getOpPtrVector().push_back(
831  "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
832 
833  if (is_large_strains) {
834 
835  if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
836  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
837  "Wrong pointer for grad");
838 
839  postProcFe->getOpPtrVector().push_back(
841  postProcFe->getOpPtrVector().push_back(
843  postProcFe->getOpPtrVector().push_back(
845  postProcFe->getOpPtrVector().push_back(
848  postProcFe->getOpPtrVector().push_back(
850  postProcFe->getOpPtrVector().push_back(new OpPostProcHencky<SPACE_DIM>(
851  "U", postProcFe->postProcMesh, postProcFe->mapGaussPts,
853 
854  } else {
855  postProcFe->getOpPtrVector().push_back(
857  commonPlasticDataPtr->mStrainPtr));
858  postProcFe->getOpPtrVector().push_back(new OpPlasticStress(
860  postProcFe->getOpPtrVector().push_back(
862  "U", postProcFe->postProcMesh, postProcFe->mapGaussPts,
863  commonPlasticDataPtr->mStrainPtr,
864  commonPlasticDataPtr->mStressPtr));
865  }
866 
867  postProcFe->getOpPtrVector().push_back(
869  postProcFe->getOpPtrVector().push_back(
870  new OpPostProcPlastic("U", postProcFe->postProcMesh,
871  postProcFe->mapGaussPts, commonPlasticDataPtr));
872  postProcFe->addFieldValuesPostProc("U");
874  };
875 
876  auto scatter_create = [&](auto D, auto coeff) {
878  CHKERR is_manager->isCreateProblemFieldAndRank(simple->getProblemName(),
879  ROW, "U", coeff, coeff, is);
880  int loc_size;
881  CHKERR ISGetLocalSize(is, &loc_size);
882  Vec v;
883  CHKERR VecCreateMPI(mField.get_comm(), loc_size, PETSC_DETERMINE, &v);
884  VecScatter scatter;
885  CHKERR VecScatterCreate(D, is, v, PETSC_NULL, &scatter);
886  return std::make_tuple(SmartPetscObj<Vec>(v),
887  SmartPetscObj<VecScatter>(scatter));
888  };
889 
890  auto set_time_monitor = [&](auto dm, auto solver) {
892  boost::shared_ptr<Monitor> monitor_ptr(new Monitor(
894  boost::shared_ptr<ForcesAndSourcesCore> null;
895  CHKERR DMMoFEMTSSetMonitor(dm, solver, simple->getDomainFEName(),
896  monitor_ptr, null, null);
898  };
899 
900  auto set_fieldsplit_preconditioner = [&](auto solver) {
902 
903  SNES snes;
904  CHKERR TSGetSNES(solver, &snes);
905  KSP ksp;
906  CHKERR SNESGetKSP(snes, &ksp);
907  PC pc;
908  CHKERR KSPGetPC(ksp, &pc);
909  PetscBool is_pcfs = PETSC_FALSE;
910  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
911 
912  // Setup fieldsplit (block) solver - optional: yes/no
913  if (is_pcfs == PETSC_TRUE) {
914 
915  auto bc_mng = mField.getInterface<BcManager>();
916  auto name_prb = simple->getProblemName();
917  auto is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_X", "U", 0, 0);
918  is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_Y", "U", 1, 1, is_all_bc);
919  is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_Z", "U", 2, 2, is_all_bc);
920  is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_ALL", "U", 0, 2, is_all_bc);
921 
922  int is_all_bc_size;
923  CHKERR ISGetSize(is_all_bc, &is_all_bc_size);
924  MOFEM_LOG("EXAMPLE", Sev::inform)
925  << "Field split block size " << is_all_bc_size;
926 
927  CHKERR PCFieldSplitSetIS(pc, PETSC_NULL,
928  is_all_bc); // boundary block
929  }
930 
932  };
933 
934  auto dm = simple->getDM();
935  auto D = smartCreateDMVector(dm);
936 
937  boost::shared_ptr<FEMethod> null;
938  CHKERR DMMoFEMTSSetIJacobian(dm, simple->getDomainFEName(), feAxiatorLhs,
939  null, null);
940  CHKERR DMMoFEMTSSetIFunction(dm, simple->getDomainFEName(), feAxiatorRhs,
941  null, null);
942 
943  CHKERR create_post_process_element();
944  uXScatter = scatter_create(D, 0);
945  uYScatter = scatter_create(D, 1);
946  if (SPACE_DIM == 3)
947  uZScatter = scatter_create(D, 2);
948 
949  auto solver = pipeline_mng->createTSIM();
950 
951  CHKERR TSSetSolution(solver, D);
952  CHKERR set_section_monitor(solver);
953  CHKERR set_time_monitor(dm, solver);
954  CHKERR TSSetSolution(solver, D);
955  CHKERR TSSetFromOptions(solver);
956  CHKERR set_fieldsplit_preconditioner(solver);
957  CHKERR TSSetUp(solver);
958  CHKERR TSSolve(solver, NULL);
959 
960  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
961  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
962  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
963 
965 }
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: DMMMoFEM.cpp:755
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: DMMMoFEM.cpp:808
double v
phase velocity of light in medium (cm/ns)
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
const double D
diffusivity
boost::shared_ptr< PostProcEle > postProcFe
Definition: plastic.cpp:147
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uYScatter
Definition: plastic.cpp:153
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uZScatter
Definition: plastic.cpp:154
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uXScatter
Definition: plastic.cpp:152
Definition: HenckyOps.hpp:512
virtual MPI_Comm & get_comm() const =0
Section manager is used to create indexes and sections.
Definition: ISManager.hpp:33
Definition: PlasticOps.hpp:279

◆ tsSolve() [2/3]

MoFEMErrorCode Example::tsSolve ( )
private

◆ tsSolve() [3/3]

MoFEMErrorCode Example::tsSolve ( )
private

Member Data Documentation

◆ approxFunction

ApproxFieldFunction< FIELD_DIM > Example::approxFunction
staticprivate
Initial value:

Definition at line 77 of file approximaton.cpp.

◆ approxGradVals

boost::shared_ptr<MatrixDouble> Example::approxGradVals
private

Definition at line 75 of file radiation.cpp.

◆ approxVals

boost::shared_ptr<VectorDouble> Example::approxVals
private

Definition at line 74 of file radiation.cpp.

◆ base

FieldApproximationBase Example::base
private

Definition at line 83 of file plot_base.cpp.

◆ bcTemperatureFunctions

std::vector<BcTempFun> Example::bcTemperatureFunctions
private

Definition at line 250 of file thermo_plastic.cpp.

◆ bodyForceMatPtr

boost::shared_ptr<MatrixDouble> Example::bodyForceMatPtr
private

Definition at line 93 of file elastic.cpp.

◆ bodyForces

std::vector< FTensor::Tensor1< double, 3 > > Example::bodyForces
private

Definition at line 159 of file plastic.cpp.

◆ boundaryMarker

boost::shared_ptr< std::vector< unsigned char > > Example::boundaryMarker
private

Definition at line 156 of file plastic.cpp.

◆ commonDataPtr [1/2]

boost::shared_ptr< CommonData > Example::commonDataPtr
private

Definition at line 165 of file contact.cpp.

◆ commonDataPtr [2/2]

boost::shared_ptr<CommonData> Example::commonDataPtr
private

Definition at line 56 of file integration.cpp.

◆ commonHenckyDataPtr

boost::shared_ptr< HenckyOps::CommonData > Example::commonHenckyDataPtr
private

Definition at line 146 of file plastic.cpp.

◆ commonPlasticDataPtr [1/2]

boost::shared_ptr<PlasticOps::CommonData> Example::commonPlasticDataPtr
private

Definition at line 145 of file plastic.cpp.

◆ commonPlasticDataPtr [2/2]

boost::shared_ptr<PlasticThermalOps::CommonData> Example::commonPlasticDataPtr
private

Definition at line 222 of file thermo_plastic.cpp.

◆ domianLhsFEPtr

boost::shared_ptr<FEMethod> Example::domianLhsFEPtr
private

Definition at line 370 of file shallow_wave.cpp.

◆ domianRhsFEPtr

boost::shared_ptr<FEMethod> Example::domianRhsFEPtr
private

Definition at line 371 of file shallow_wave.cpp.

◆ ePS

SmartPetscObj<EPS> Example::ePS
private

Definition at line 93 of file eigen_elastic.cpp.

◆ feAxiatorLhs

boost::shared_ptr< DomainEle > Example::feAxiatorLhs
private

Definition at line 150 of file plastic.cpp.

◆ feAxiatorRhs

boost::shared_ptr< DomainEle > Example::feAxiatorRhs
private

Definition at line 149 of file plastic.cpp.

◆ feThermalLhs

boost::shared_ptr<DomainEle> Example::feThermalLhs
private

Definition at line 229 of file thermo_plastic.cpp.

◆ feThermalRhs

boost::shared_ptr<DomainEle> Example::feThermalRhs
private

Definition at line 228 of file thermo_plastic.cpp.

◆ K

SmartPetscObj<Mat> Example::K
private

Definition at line 92 of file eigen_elastic.cpp.

◆ M

SmartPetscObj<Mat> Example::M
private

Definition at line 91 of file eigen_elastic.cpp.

◆ matAccelerationPtr

boost::shared_ptr< MatrixDouble > Example::matAccelerationPtr
private

Definition at line 92 of file cornea_elastic.cpp.

◆ matDPtr

boost::shared_ptr< MatrixDouble > Example::matDPtr
private

Definition at line 94 of file cornea_elastic.cpp.

◆ matGradPtr

boost::shared_ptr< MatrixDouble > Example::matGradPtr
private

Definition at line 89 of file cornea_elastic.cpp.

◆ matInertiaPtr

boost::shared_ptr< MatrixDouble > Example::matInertiaPtr
private

Definition at line 93 of file cornea_elastic.cpp.

◆ matStrainPtr

boost::shared_ptr< MatrixDouble > Example::matStrainPtr
private

Definition at line 90 of file cornea_elastic.cpp.

◆ matStressPtr

boost::shared_ptr< MatrixDouble > Example::matStressPtr
private

Definition at line 91 of file cornea_elastic.cpp.

◆ matTangentPtr

boost::shared_ptr< MatrixDouble > Example::matTangentPtr
private

Definition at line 96 of file cornea_elastic.cpp.

◆ mField

MoFEM::Interface & Example::mField
private

Definition at line 78 of file cornea_elastic.cpp.

◆ pinchNodes

Range Example::pinchNodes
private

Definition at line 66 of file heat_method.cpp.

◆ postProcFe

boost::shared_ptr< PostProcEle > Example::postProcFe
private

Definition at line 147 of file plastic.cpp.

◆ reactionFe

boost::shared_ptr< DomainEle > Example::reactionFe
private

Definition at line 148 of file plastic.cpp.

◆ reactionMarker

boost::shared_ptr< std::vector< unsigned char > > Example::reactionMarker
private

Definition at line 157 of file plastic.cpp.

◆ rigidBodyMotion

std::array<SmartPetscObj<Vec>, 6> Example::rigidBodyMotion
private

Definition at line 95 of file eigen_elastic.cpp.

◆ simpleInterface

Simple * Example::simpleInterface
private

Definition at line 53 of file helmholtz.cpp.

◆ space

FieldSpace Example::space
private

Definition at line 84 of file plot_base.cpp.

◆ uXScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uXScatter
private

Definition at line 152 of file plastic.cpp.

◆ uYScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uYScatter
private

Definition at line 153 of file plastic.cpp.

◆ uZScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uZScatter
private

Definition at line 154 of file plastic.cpp.


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