v0.14.0
adolc_plasticity.cpp
Go to the documentation of this file.
1 /**
2  * \file adolc_plasticity.cpp
3  * \ingroup adoc_plasticity
4  * \example adolc_plasticity.cpp
5  *
6  * \brife Implementation of plasticity problem using ADOLC-C
7  *
8  */
9 
10 #include <MoFEM.hpp>
11 #include <MatrixFunction.hpp>
12 
13 using namespace MoFEM;
14 
15 constexpr int SPACE_DIM =
16  EXECUTABLE_DIMENSION; //< Space dimension of problem, mesh
17 
19 
20 /** Select finite element type for integration on domain based on problem
21  * dimension
22  */
24 
25 /** Select finite element type for integrate on boundary based on problem
26  * dimension
27  */
28 using BoundaryEle =
30 /** Operators used to assemble domain integrals
31  */
33 
34 /** Operators used to assemble boundary integrals
35  */
37 
38 /** Linear forms used to integrate body forces
39  */
40 using DomainNaturalBC =
42 
43 /** Select linear froms reading data from blockest (e.g. "BODY_FORCE") and
44  * applying body force.
45  */
46 using OpBodyForce =
48 
49 // Select natural BC boundary condition
50 
51 // Use natural boundary conditions implemented with adv-1 example which includes
52 // spring BC
53 #include <ContactNaturalBC.hpp>
54 
55 /** Use Gauss quadrature rule and PETSc assembly to integrate neural boundary
56  * conditions. Select linear forms operators.
57  */
58 using BoundaryRhsBCs =
60 
61 /* Use specialization from adv-1 integrating boundary conditions on forces and
62  * with springs. OP is used to integrate the right hand side
63  */
64 using OpBoundaryRhsBCs =
66 
67 /** Use Gauss quadrature rule and PETSc assembly to integrate neural boundary
68  * conditions. Select bi-linear forms operators.
69  */
70 using BoundaryLhsBCs =
72 
73 /** Use specialization from adv-1 integrating boundary conditions on forces and
74  * with springs
75  */
76 using OpBoundaryLhsBCs =
78 
79 // Note: We create only skin post-processing mesh.
80 
81 template <int DIM>
82 struct PostProcEleByDim; //< Select finite elements and operators used for
83  // postprocessing
84 
85 template <> struct PostProcEleByDim<2> {
89 };
90 
91 template <> struct PostProcEleByDim<3> {
95 };
96 
100 
101 #include <ADOLCPlasticity.hpp>
103 using namespace ADOLCPlasticity;
104 
106 
107  PlasticProblem(MoFEM::Interface &m_field) : mField(m_field) {}
108 
109  MoFEMErrorCode runProblem();
110 
111 private:
113 
114  MoFEMErrorCode readMesh();
115  MoFEMErrorCode setupProblem();
116  MoFEMErrorCode boundaryCondition();
117  MoFEMErrorCode assembleSystem();
118  MoFEMErrorCode solveSystem();
119  MoFEMErrorCode gettingNorms();
120  MoFEMErrorCode outputResults();
121  MoFEMErrorCode checkResults();
122 
123  int approxOrder = 2;
125  boost::shared_ptr<ClosestPointProjection> cpPtr; ///< Closest point
126  ///< projection
127 };
128 
129 //! [Run problem]
132  CHKERR readMesh();
133  CHKERR setupProblem();
134  CHKERR boundaryCondition();
135  CHKERR assembleSystem();
136  CHKERR solveSystem();
137  CHKERR gettingNorms();
138  CHKERR outputResults();
139  CHKERR checkResults();
141 }
142 //! [Run problem]
143 
144 //! [Read mesh]
147  auto simple = mField.getInterface<Simple>();
148  CHKERR simple->getOptions();
149  CHKERR simple->loadFile();
150 
151  if (simple->getDim() != SPACE_DIM)
152  SETERRQ2(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
153  "Wrong dimension of mesh %d != %d", simple->getDim(), SPACE_DIM);
154 
156 }
157 //! [Read mesh]
158 
159 //! [Set up problem]
162  Simple *simple = mField.getInterface<Simple>();
163 
164  enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
165  const char *list_bases[LASBASETOPT] = {"ainsworth", "demkowicz"};
166  PetscInt choice_base_value = AINSWORTH;
167  CHKERR PetscOptionsGetEList(PETSC_NULL, NULL, "-base", list_bases,
168  LASBASETOPT, &choice_base_value, PETSC_NULL);
169 
170  switch (choice_base_value) {
171  case AINSWORTH:
172  approxBase = AINSWORTH_LEGENDRE_BASE;
173  MOFEM_LOG("WORLD", Sev::inform)
174  << "Set AINSWORTH_LEGENDRE_BASE for displacements";
175  break;
176  case DEMKOWICZ:
177  approxBase = DEMKOWICZ_JACOBI_BASE;
178  MOFEM_LOG("WORLD", Sev::inform)
179  << "Set DEMKOWICZ_JACOBI_BASE for displacements";
180  break;
181  default:
182  approxBase = LASTBASE;
183  break;
184  }
185 
186  // Add field
187  CHKERR simple->addDomainField("U", H1, approxBase, SPACE_DIM);
188  CHKERR simple->addBoundaryField("U", H1, approxBase, SPACE_DIM);
189  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &approxOrder, PETSC_NULL);
190  CHKERR simple->setFieldOrder("U", approxOrder);
191  CHKERR simple->setUp();
192 
193  //! [Material models selection]
194 
195  /**
196  * FIXME: Here only array of material models is initalized. Each model has
197  * unique set of the ADOL-C tags. Pointer is attached based on block name to
198  * which entity belongs. That will enable heterogeneity of the model, in
199  * addition of heterogeneity of the material properties.
200  */
201 
202  enum MaterialModel {
203  VonMisses,
204  VonMissesPlaneStress,
205  Paraboloidal,
206  LastModel
207  };
208  const char *list_materials[LastModel] = {"VonMisses", "VonMissesPlaneStress",
209  "Paraboloidal"};
210  PetscInt choice_material = VonMisses;
211  CHKERR PetscOptionsGetEList(PETSC_NULL, NULL, "-material", list_materials,
212  LastModel, &choice_material, PETSC_NULL);
213 
214  switch (choice_material) {
215  case VonMisses:
216  cpPtr = createMaterial<J2Plasticity<3>>();
217  break;
218  case VonMissesPlaneStress:
219  if (SPACE_DIM != 2)
220  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
221  "VonMissesPlaneStrain is only for 2D case");
222  cpPtr = createMaterial<J2Plasticity<2>>();
223  break;
224  case Paraboloidal:
225  cpPtr = createMaterial<ParaboloidalPlasticity>();
226  break;
227  default:
228  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Wrong material model");
229  }
230 
231  if (approxBase == DEMKOWICZ_JACOBI_BASE && SPACE_DIM == 2)
232  cpPtr->integrationRule = [](int, int, int p) { return 2 * (p - 2); };
233 
234  //! [Material models selection]
235 
237 }
238 //! [Set up problem]
239 
240 //! [Boundary condition]
243  auto *pipeline_mng = mField.getInterface<PipelineManager>();
244  auto simple = mField.getInterface<Simple>();
245  auto bc_mng = mField.getInterface<BcManager>();
246  auto time_scale = boost::make_shared<TimeScale>();
247 
248  auto rule = [](int, int, int p) { return 2 * p; };
249  CHKERR pipeline_mng->setDomainRhsIntegrationRule(cpPtr->integrationRule);
250  CHKERR pipeline_mng->setDomainLhsIntegrationRule(cpPtr->integrationRule);
251  CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(rule);
252 
253  // Add Natural BCs to RHS
255  pipeline_mng->getOpBoundaryRhsPipeline(), mField, "U", {time_scale},
256  Sev::inform);
257  // Add Natural BCs to LHS
259  pipeline_mng->getOpBoundaryRhsPipeline(), mField, "U", Sev::inform);
260 
261  //! Add body froces
263  pipeline_mng->getOpDomainRhsPipeline(), mField, "U", {time_scale},
264  "BODY_FORCE", Sev::inform);
265 
266  // Essential BC
267  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
268  "U", 0, 0);
269  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
270  "U", 1, 1);
271  CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
272  "U", 2, 2);
273  CHKERR bc_mng->pushMarkDOFsOnEntities<DisplacementCubitBcData>(
274  simple->getProblemName(), "U");
275 
277 }
278 //! [Boundary condition]
279 
280 //! [Push operators to pipeline]
283  auto *simple = mField.getInterface<Simple>();
284  auto *pipeline_mng = mField.getInterface<PipelineManager>();
285 
286  // assemble operator to the right hand side
287  auto add_domain_ops_lhs = [&](auto &pip) {
289  // push forward finite element bases from reference to physical element
291  // create local common data
292  auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
293  // calculate displacement gradients at integration points
295  "U", common_data_ptr->getGardAtGaussPtsPtr()));
296  // assemble tangent operator
297  CHKERR opFactoryDomainLhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
298  mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
300  };
301 
302  auto add_domain_ops_rhs = [&](auto &pip) {
304  // push forward finite element bases from reference to physical element
306  // create local common data
307  auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
308  // calculate displacement gradients at integration points
310  "U", common_data_ptr->getGardAtGaussPtsPtr()));
311  // assemble residual
312  CHKERR opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
313  mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr, Sev::inform);
315  };
316 
317  // Push operators to the left hand side pipeline. Indicate that domain (i.e.
318  // volume/interior) element is used.
319  CHKERR add_domain_ops_lhs(pipeline_mng->getOpDomainLhsPipeline());
320  // Push operators to the right hand side pipeline.
321  CHKERR add_domain_ops_rhs(pipeline_mng->getOpDomainRhsPipeline());
322 
324 }
325 //! [Push operators to pipeline]
326 
327 /**
328  * @brief Monitor solution
329  *
330  * This functions is called by TS solver at the end of each step. It is used
331  * to output results to the hard drive.
332  */
333 struct Monitor : public FEMethod {
335  std::pair<boost::shared_ptr<PostProcEleDomain>,
336  boost::shared_ptr<PostProcEleBdy>>
337  pair_post_proc_fe,
338  boost::shared_ptr<DomainEle> reaction_fe,
339  std::vector<boost::shared_ptr<ScalingMethod>> smv)
340  : dM(dm), reactionFE(reaction_fe), vecOfTimeScalingMethods(smv) {
341  fRes = createDMVector(dM);
342  domainPostProcFe = pair_post_proc_fe.first;
343  skinPostProcFe = pair_post_proc_fe.second;
344  }
347  int save_every_nth_step = 1;
348  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-save_every_nth_step",
349  &save_every_nth_step, PETSC_NULL);
350  auto make_vtk = [&]() {
352  if (domainPostProcFe) {
353  CHKERR DMoFEMLoopFiniteElements(dM, "dFE", domainPostProcFe,
354  getCacheWeakPtr());
355  CHKERR domainPostProcFe->writeFile(
356  "out_plastic_" + boost::lexical_cast<std::string>(ts_step) +
357  ".h5m");
358  }
359  if (skinPostProcFe) {
360  CHKERR DMoFEMLoopFiniteElements(dM, "bFE", skinPostProcFe,
361  getCacheWeakPtr());
362  CHKERR skinPostProcFe->writeFile(
363  "out_skin_plastic_" + boost::lexical_cast<std::string>(ts_step) +
364  ".h5m");
365  }
367  };
368 
369  if (!(ts_step % save_every_nth_step)) {
370  CHKERR make_vtk();
371  }
372  if (reactionFE) {
373  CHKERR VecZeroEntries(fRes);
374  reactionFE->f = fRes;
375  CHKERR DMoFEMLoopFiniteElements(dM, "dFE", reactionFE, getCacheWeakPtr());
376  CHKERR VecAssemblyBegin(fRes);
377  CHKERR VecAssemblyEnd(fRes);
378  CHKERR VecGhostUpdateBegin(fRes, ADD_VALUES, SCATTER_REVERSE);
379  CHKERR VecGhostUpdateEnd(fRes, ADD_VALUES, SCATTER_REVERSE);
380 
381  MoFEM::Interface *m_field_ptr;
382  CHKERR DMoFEMGetInterfacePtr(dM, &m_field_ptr);
384  *m_field_ptr, reactionFE, fRes)();
385 
386  double nrm;
387  CHKERR VecNorm(fRes, NORM_2, &nrm);
388  MOFEM_LOG("PlasticPrb", Sev::verbose)
389  << "Residual norm " << nrm << " at time step " << ts_step;
390  }
391 
392  auto get_min_max_displacement = [&]() {
394  MoFEM::Interface *m_field_ptr;
395  CHKERR DMoFEMGetInterfacePtr(dM, &m_field_ptr);
396 
397  std::array<double, 4> a_min = {DBL_MAX, DBL_MAX, DBL_MAX, 0};
398  std::array<double, 4> a_max = {-DBL_MAX, -DBL_MAX, -DBL_MAX, 0};
399 
400  auto get_min_max = [&](boost::shared_ptr<FieldEntity> field_entity_ptr) {
402  int d = 0;
403  for (auto v : field_entity_ptr->getEntFieldData()) {
404  a_min[d] = std::min(a_min[d], v);
405  a_max[d] = std::max(a_max[d], v);
406  ++d;
407  }
409  };
410 
411  a_min[SPACE_DIM] = 0;
412  a_max[SPACE_DIM] = 0;
413 
414  Range verts;
415  CHKERR m_field_ptr->get_field_entities_by_type("U", MBVERTEX, verts);
416  CHKERR m_field_ptr->getInterface<FieldBlas>()->fieldLambdaOnEntities(
417  get_min_max, "U", &verts);
418 
419  auto mpi_reduce = [&](auto &a, auto op) {
420  std::array<double, 3> a_mpi = {0, 0, 0};
421  MPI_Allreduce(a.data(), a_mpi.data(), 3, MPI_DOUBLE, op,
422  m_field_ptr->get_comm());
423  return a_mpi;
424  };
425 
426  auto a_min_mpi = mpi_reduce(a_min, MPI_MIN);
427  auto a_max_mpi = mpi_reduce(a_max, MPI_MAX);
428 
429  MOFEM_LOG("PlasticPrb", Sev::inform)
430  << "Min displacement " << a_min_mpi[0] << " " << a_min_mpi[1] << " "
431  << a_min_mpi[2];
432  MOFEM_LOG("PlasticPrb", Sev::inform)
433  << "Max displacement " << a_max_mpi[0] << " " << a_max_mpi[1] << " "
434  << a_max_mpi[2];
436  };
437 
438  CHKERR get_min_max_displacement();
439 
440  double scale = 1;
441  for (auto s : vecOfTimeScalingMethods) {
442  scale *= s->getScale(this->ts_t);
443  }
444 
445  MOFEM_LOG("PlasticPrb", Sev::inform)
446  << "Time: " << this->ts_t << " scale: " << scale;
447 
449  }
450 
451 private:
453  boost::shared_ptr<PostProcEleDomain> domainPostProcFe;
454  boost::shared_ptr<PostProcEleBdy> skinPostProcFe;
455  boost::shared_ptr<FEMethod> reactionFE;
458 };
459 
460 static boost::shared_ptr<TSUpdate> ts_update_ptr = nullptr;
461 
462 //! [Solve]
465  auto *simple = mField.getInterface<Simple>();
466  auto *pipeline_mng = mField.getInterface<PipelineManager>();
467 
468  auto dm = simple->getDM();
469  auto time_scale = boost::make_shared<TimeScale>();
470 
471  // Setup postprocessing
472  auto create_post_proc_fe = [dm, this, simple]() {
473  //! [DG projection]
474  // Post-process domain, i.e. volume elements. If 3d case creates stresses
475  // are evaluated at points which are trace of the volume element on boundary
476  auto post_proc_ele_domain = [this](auto &pip_domain, auto &fe_name) {
477  // Push bases on reference element to the phyiscal element
479 
480  // calculate displacement gradients at nodes of post processing mesh. For
481  // gradient DG projection is obsolete, since displacements can be
482  // evaluated at arbitrary points.
483  auto grad_ptr = boost::make_shared<MatrixDouble>();
484  pip_domain.push_back(
486  grad_ptr));
487 
488  // Create operator to run (neted) pipeline in operator. InteriorElem
489  // element will have iteration rule and bases as domain element used to
490  // solve problem, and remember history variables.
491  using InteriorElem = DomainEle;
492  auto op_this = new OpLoopThis<InteriorElem>(mField, fe_name, Sev::noisy);
493  // add interior element to post-processing pipeline
494  pip_domain.push_back(op_this);
495 
496  // get pointer to interior element, which is in essence pipeline which
497  // pipeline.
498  auto fe_physics = op_this->getThisFEPtr();
499 
500  auto evaluate_stress_on_physical_element = [&]() {
501  // evaluate stress and plastic strain at Gauss points
502  fe_physics->getRuleHook = cpPtr->integrationRule;
504  fe_physics->getOpPtrVector(), {H1});
505  auto common_data_ptr =
506  boost::make_shared<ADOLCPlasticity::CommonData>();
507  // note that gradient of displacements is evaluate again, at
508  // physical nodes
509  fe_physics->getOpPtrVector().push_back(
511  "U", common_data_ptr->getGardAtGaussPtsPtr()));
512 
513  CHKERR cpPtr->addMatBlockOps(mField, fe_physics->getOpPtrVector(),
514  "ADOLCMAT", Sev::noisy);
515  fe_physics->getOpPtrVector().push_back(
516  getRawPtrOpCalculateStress<SPACE_DIM>(mField, common_data_ptr,
517  cpPtr, false));
518  return common_data_ptr;
519  };
520 
521  auto dg_projection_froward_and_back = [&](auto &common_data_ptr) {
522  // here we do actual projection of stress and plastic strain to DG space
523  int dg_order = approxOrder - 1;
524  auto entity_data_l2 =
525  boost::make_shared<EntitiesFieldData>(MBENTITYSET);
526  auto mass_ptr =
527  boost::make_shared<MatrixDouble>(); //< projection operator (mass
528  // matrix)
529  fe_physics->getOpPtrVector().push_back(new OpDGProjectionMassMatrix(
530  dg_order, mass_ptr, entity_data_l2, approxBase, L2));
531 
532  auto coeffs_ptr_stress = boost::make_shared<MatrixDouble>();
533  // project stress on DG space on physical element
534  fe_physics->getOpPtrVector().push_back(new OpDGProjectionCoefficients(
535  common_data_ptr->getStressMatrixPtr(), coeffs_ptr_stress, mass_ptr,
536  entity_data_l2, approxBase, L2));
537  // project strains plastic strains DG space on physical element
538  auto coeffs_ptr_plastic_strain = boost::make_shared<MatrixDouble>();
539  fe_physics->getOpPtrVector().push_back(new OpDGProjectionCoefficients(
540  common_data_ptr->getPlasticStrainMatrixPtr(),
541  coeffs_ptr_plastic_strain, mass_ptr, entity_data_l2, approxBase,
542  L2));
543 
544  // project stress and plastic strain for DG space on post-process
545  // element
546  pip_domain.push_back(new OpDGProjectionEvaluation(
547  common_data_ptr->getStressMatrixPtr(), coeffs_ptr_stress,
548  entity_data_l2, approxBase, L2));
549  pip_domain.push_back(new OpDGProjectionEvaluation(
550  common_data_ptr->getPlasticStrainMatrixPtr(),
551  coeffs_ptr_plastic_strain, entity_data_l2, approxBase, L2));
552  };
553 
554  auto common_data_ptr = evaluate_stress_on_physical_element();
555  dg_projection_froward_and_back(common_data_ptr);
556 
557  return boost::make_tuple(grad_ptr, common_data_ptr->getStressMatrixPtr(),
558  common_data_ptr->getPlasticStrainMatrixPtr());
559  };
560  //! [DG projection]
561 
562  // Create tags on post-processing mesh, i.e. those tags are visible in
563  // Preview
564  auto add_post_proc_map = [&](auto post_proc_fe, auto u_ptr, auto grad_ptr,
565  auto stress_ptr, auto plastic_strain_ptr) {
566  using OpPPMapSPACE_DIM = OpPostProcMapInMoab<SPACE_DIM, SPACE_DIM>;
567  post_proc_fe->getOpPtrVector().push_back(
568 
569  new OpPPMapSPACE_DIM(
570 
571  post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
572 
573  {},
574 
575  {{"U", u_ptr}},
576 
577  {{"GRAD", grad_ptr}},
578 
579  {}
580 
581  )
582 
583  );
584 
585  using OpPPMap3D = OpPostProcMapInMoab<3, 3>;
586  post_proc_fe->getOpPtrVector().push_back(
587 
588  new OpPPMap3D(
589 
590  post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
591 
592  {},
593 
594  {},
595 
596  {},
597 
598  {{"STRESS", stress_ptr}, {"PLASTIC_STRAIN", plastic_strain_ptr}}
599 
600  )
601 
602  );
603 
604  return post_proc_fe;
605  };
606 
607  auto vol_post_proc = [this, simple, post_proc_ele_domain,
608  add_post_proc_map]() {
609  PetscBool post_proc_vol = PETSC_FALSE;
610  if (SPACE_DIM == 2)
611  post_proc_vol = PETSC_TRUE;
612 
613  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-post_proc_vol",
614  &post_proc_vol, PETSC_NULL);
615  if (post_proc_vol == PETSC_FALSE)
616  return boost::shared_ptr<PostProcEleDomain>();
617  auto post_proc_fe = boost::make_shared<PostProcEleDomain>(mField);
618  auto u_ptr = boost::make_shared<MatrixDouble>();
619  post_proc_fe->getOpPtrVector().push_back(
621  auto [grad_ptr, stress_ptr, plastic_strain_ptr] = post_proc_ele_domain(
622  post_proc_fe->getOpPtrVector(), simple->getDomainFEName());
623  return add_post_proc_map(post_proc_fe, u_ptr, grad_ptr, stress_ptr,
624  plastic_strain_ptr);
625  };
626 
627  auto skin_post_proc = [this, simple, post_proc_ele_domain,
628  add_post_proc_map]() {
629  // create skin of the volume mesh for post-processing,
630  // i.e. boundary of the volume mesh
631  PetscBool post_proc_skin = PETSC_TRUE;
632  if (SPACE_DIM == 2)
633  post_proc_skin = PETSC_FALSE;
634 
635  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-post_proc_skin",
636  &post_proc_skin, PETSC_NULL);
637 
638  if (post_proc_skin == PETSC_FALSE)
639  return boost::shared_ptr<PostProcEleBdy>();
640 
641  auto post_proc_fe = boost::make_shared<PostProcEleBdy>(mField);
642  auto u_ptr = boost::make_shared<MatrixDouble>();
643  post_proc_fe->getOpPtrVector().push_back(
645  auto op_loop_side =
646  new OpLoopSide<SideEle>(mField, simple->getDomainFEName(), SPACE_DIM);
647  auto [grad_ptr, stress_ptr, plastic_strain_ptr] = post_proc_ele_domain(
648  op_loop_side->getOpPtrVector(), simple->getDomainFEName());
649  post_proc_fe->getOpPtrVector().push_back(op_loop_side);
650  return add_post_proc_map(post_proc_fe, u_ptr, grad_ptr, stress_ptr,
651  plastic_strain_ptr);
652  };
653 
654  return std::make_pair(vol_post_proc(), skin_post_proc());
655  };
656 
657  auto create_reaction_fe = [&]() {
658  auto fe_ptr = boost::make_shared<DomainEle>(mField);
659  fe_ptr->getRuleHook = cpPtr->integrationRule;
660 
661  auto &pip = fe_ptr->getOpPtrVector();
663  auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
665  "U", common_data_ptr->getGardAtGaussPtsPtr()));
666  CHKERR opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
667  mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr, Sev::noisy);
668 
669  return fe_ptr;
670  };
671 
672  auto add_extra_finite_elements_to_ksp_solver_pipelines = [&]() {
674 
675  auto pre_proc_ptr = boost::make_shared<FEMethod>();
676  auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
677  auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
678 
679  auto get_bc_hook_rhs = [this, pre_proc_ptr, time_scale]() {
682  {time_scale}, false)();
684  };
685 
686  pre_proc_ptr->preProcessHook = get_bc_hook_rhs;
687 
688  auto get_post_proc_hook_rhs = [this, post_proc_rhs_ptr]() {
691  mField, post_proc_rhs_ptr, nullptr, Sev::verbose)();
693  mField, post_proc_rhs_ptr, 1.)();
695  };
696  auto get_post_proc_hook_lhs = [this, post_proc_lhs_ptr]() {
699  mField, post_proc_lhs_ptr, 1.)();
701  };
702  post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs;
703  post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs;
704 
705  // This is low level pushing finite elements (pipelines) to solver
706  auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
707  ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
708  ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
709  ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
710  ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
712  };
713 
714  // Add extra finite elements to SNES solver pipelines to resolve essential
715  // boundary conditions
716  CHKERR add_extra_finite_elements_to_ksp_solver_pipelines();
717 
718  auto create_monitor_fe = [dm, time_scale](auto &&post_proc_fe,
719  auto &&reaction_fe) {
720  return boost::make_shared<Monitor>(
721  dm, post_proc_fe, reaction_fe,
722  std::vector<boost::shared_ptr<ScalingMethod>>{time_scale});
723  };
724 
725  //! [Set up post-step]
726  auto set_up_post_step = [&](auto ts) {
728 
729  // create finite element (pipeline) and populate it with operators to
730  // update history variables
731  auto create_update_ptr = [&]() {
732  auto fe_ptr = boost::make_shared<DomainEle>(mField);
733  fe_ptr->getRuleHook = cpPtr->integrationRule;
734  AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(fe_ptr->getOpPtrVector(),
735  {H1});
736  auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
737  fe_ptr->getOpPtrVector().push_back(
739  "U", common_data_ptr->getGardAtGaussPtsPtr()));
741  opFactoryDomainUpdate<SPACE_DIM>(mField, fe_ptr->getOpPtrVector(),
742  "ADOLCMAT", common_data_ptr, cpPtr),
743  "push update ops");
744  return fe_ptr;
745  };
746 
747  // ts_update_ptr is global static variable
748  ts_update_ptr =
749  createTSUpdate(simple->getDomainFEName(), create_update_ptr());
750 
751  //! [TS post-step function]
752  // This is pure "C" function which we can to the TS solver
753  auto ts_step_post_proc = [](TS ts) {
755  if (ts_update_ptr)
756  CHKERR ts_update_ptr->postProcess(ts);
758  };
759  //! [TS post-step function]
760 
761  // finally set up post-step
762  CHKERR TSSetPostStep(ts, ts_step_post_proc);
764  };
765  //! [Set up post-step]
766 
767  // Set monitor which postprocessing results and saves them to the hard drive
768  auto set_up_monitor = [&](auto ts) {
770  boost::shared_ptr<FEMethod> null_fe;
771  auto monitor_ptr =
772  create_monitor_fe(create_post_proc_fe(), create_reaction_fe());
773  CHKERR DMMoFEMTSSetMonitor(dm, ts, simple->getDomainFEName(), null_fe,
774  null_fe, monitor_ptr);
776  };
777 
778  auto set_up_adapt = [&](auto ts) {
780  CHKERR TSAdaptRegister(TSADAPTMOFEM, TSAdaptCreateMoFEM);
781  TSAdapt adapt;
782  CHKERR TSGetAdapt(ts, &adapt);
784  };
785 
786  //! [Create TS]
787  auto ts = pipeline_mng->createTSIM();
788 
789  // Set time solver
790  double ftime = 1;
791  CHKERR TSSetMaxTime(ts, ftime);
792  CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
793  auto D = createDMVector(simple->getDM());
794  CHKERR TSSetSolution(ts, D);
795 
796  // Set monitor, step adaptivity, and post-step to update history variables
797  CHKERR set_up_monitor(ts);
798  CHKERR set_up_post_step(ts);
799  CHKERR set_up_adapt(ts);
800  CHKERR TSSetFromOptions(ts);
801 
802  CHKERR TSSolve(ts, NULL);
803  //! [Create TS]
804 
805  CHKERR TSGetTime(ts, &ftime);
806 
807  PetscInt steps, snesfails, rejects, nonlinits, linits;
808  CHKERR TSGetStepNumber(ts, &steps);
809  CHKERR TSGetSNESFailures(ts, &snesfails);
810  CHKERR TSGetStepRejections(ts, &rejects);
811  CHKERR TSGetSNESIterations(ts, &nonlinits);
812  CHKERR TSGetKSPIterations(ts, &linits);
813  MOFEM_LOG_C("PlasticPrb", Sev::inform,
814  "steps %d (%d rejected, %d SNES fails), ftime %g, nonlinits "
815  "%d, linits %d",
816  steps, rejects, snesfails, ftime, nonlinits, linits);
817 
819 }
820 //! [Solve]
821 
822 //! [Getting norms]
825 
826  auto simple = mField.getInterface<Simple>();
827  auto dm = simple->getDM();
828 
829  auto T = createDMVector(simple->getDM());
830  CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
831  SCATTER_FORWARD);
832  double nrm2;
833  CHKERR VecNorm(T, NORM_2, &nrm2);
834  MOFEM_LOG("PlasticPrb", Sev::inform) << "Solution norm " << nrm2;
835 
836  auto post_proc_norm_fe = boost::make_shared<DomainEle>(mField);
837 
838  post_proc_norm_fe->getRuleHook = cpPtr->integrationRule;
839 
841  post_proc_norm_fe->getOpPtrVector(), {H1});
842 
843  enum NORMS { U_NORM_L2 = 0, PIOLA_NORM, LAST_NORM };
844  auto norms_vec =
846  (mField.get_comm_rank() == 0) ? LAST_NORM : 0, LAST_NORM);
847  CHKERR VecZeroEntries(norms_vec);
848 
849  auto u_ptr = boost::make_shared<MatrixDouble>();
850  post_proc_norm_fe->getOpPtrVector().push_back(
852 
853  post_proc_norm_fe->getOpPtrVector().push_back(
854  new OpCalcNormL2Tensor1<SPACE_DIM>(u_ptr, norms_vec, U_NORM_L2));
855 
856  CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
857  post_proc_norm_fe);
858 
859  CHKERR VecAssemblyBegin(norms_vec);
860  CHKERR VecAssemblyEnd(norms_vec);
861 
862  MOFEM_LOG_CHANNEL("SELF"); // Clear channel from old tags
863  if (mField.get_comm_rank() == 0) {
864  const double *norms;
865  CHKERR VecGetArrayRead(norms_vec, &norms);
866  MOFEM_TAG_AND_LOG("SELF", Sev::inform, "example")
867  << "norm_u: " << std::scientific << std::sqrt(norms[U_NORM_L2]);
868  CHKERR VecRestoreArrayRead(norms_vec, &norms);
869  }
870 
872 }
873 //! [Getting norms]
874 
875 //! [Postprocessing results]
878  PetscInt test_nb = 0;
879  PetscBool test_flg = PETSC_FALSE;
880  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-test", &test_nb, &test_flg);
881 
882  if (test_flg) {
883  auto simple = mField.getInterface<Simple>();
884  auto T = createDMVector(simple->getDM());
885  CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
886  SCATTER_FORWARD);
887  double nrm2;
888  CHKERR VecNorm(T, NORM_2, &nrm2);
889  MOFEM_LOG("PlasticPrb", Sev::verbose) << "Regression norm " << nrm2;
890  double regression_value = 0;
891  switch (test_nb) {
892  default:
893  SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID, "Wrong test number.");
894  break;
895  }
896  if (fabs(nrm2 - regression_value) > 1e-2)
897  SETERRQ2(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
898  "Regression test field; wrong norm value. %6.4e != %6.4e", nrm2,
899  regression_value);
900  }
902 }
903 //! [Postprocessing results]
904 
905 //! [Check]
909 }
910 //! [Check]
911 
912 static char help[] = "...\n\n";
913 
914 int main(int argc, char *argv[]) {
915 
916  // Initialisation of MoFEM/PETSc and MOAB data structures
917  const char param_file[] = "param_file.petsc";
918  MoFEM::Core::Initialize(&argc, &argv, param_file, help);
919 
920  // Add logging channel for example
921  auto core_log = logging::core::get();
922  core_log->add_sink(
923  LogManager::createSink(LogManager::getStrmWorld(), "PlasticPrb"));
924  LogManager::setLog("PlasticPrb");
925  MOFEM_LOG_TAG("PlasticPrb", "PlasticPrb");
926  MOFEM_LOG("PlasticPrb", Sev::inform) << "SPACE_DIM " << SPACE_DIM;
927 
928  try {
929 
930  //! [Register MoFEM discrete manager in PETSc]
931  DMType dm_name = "DMMOFEM";
932  CHKERR DMRegister_MoFEM(dm_name);
933  //! [Register MoFEM discrete manager in PETSc
934 
935  //! [Create MoAB]
936  moab::Core mb_instance; ///< mesh database
937  moab::Interface &moab = mb_instance; ///< mesh database interface
938  //! [Create MoAB]
939 
940  //! [Create MoFEM]
941  MoFEM::Core core(moab); ///< finite element database
942  MoFEM::Interface &m_field = core; ///< finite element database interface
943  //! [Create MoFEM]
944 
945  //! [PlasticProblem]
946  PlasticProblem ex(m_field);
947  CHKERR ex.runProblem();
948  //! [PlasticProblem]
949  }
950  CATCH_ERRORS;
951 
953 }
PostProcEleDomain
PostProcEleByDim< SPACE_DIM >::PostProcEleDomain PostProcEleDomain
Definition: adolc_plasticity.cpp:97
MoFEM::NaturalBC::Assembly::LinearForm
Definition: Natural.hpp:67
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
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:127
EXECUTABLE_DIMENSION
#define EXECUTABLE_DIMENSION
Definition: plastic.cpp:13
SPACE_DIM
constexpr int SPACE_DIM
Definition: adolc_plasticity.cpp:15
BoundaryEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
Definition: child_and_parent.cpp:39
Monitor::vecOfTimeScalingMethods
VecOfTimeScalingMethods vecOfTimeScalingMethods
Definition: adolc_plasticity.cpp:457
PlasticProblem::solveSystem
MoFEMErrorCode solveSystem()
[Solve]
Definition: adolc_plasticity.cpp:463
MoFEM::EssentialPreProcReaction< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:151
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
sdf_hertz.d
float d
Definition: sdf_hertz.py:5
LASTBASE
@ LASTBASE
Definition: definitions.h:69
MoFEM::OpLoopThis
Execute "this" element in the operator.
Definition: DGProjection.hpp:68
MOFEM_LOG_CHANNEL
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
ADOLCPlasticity::createTSUpdate
boost::shared_ptr< TSUpdate > createTSUpdate(std::string fe_name, boost::shared_ptr< FEMethod > fe_ptr)
MoFEM::FEMethod
structure for User Loop Methods on finite elements
Definition: LoopMethods.hpp:369
MoFEM::OpFluxRhsImpl
Definition: Natural.hpp:39
MoFEM::PipelineManager::ElementsAndOpsByDim
Definition: PipelineManager.hpp:38
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:130
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
MoFEM::NaturalBC::Assembly::BiLinearForm
Definition: Natural.hpp:74
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:596
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::OpCalculateVectorFieldValues
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:466
PostProcEleByDim< 2 >::SideEle
PipelineManager::ElementsAndOpsByDim< 2 >::FaceSideEle SideEle
Definition: adolc_plasticity.cpp:88
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
ts_update_ptr
static boost::shared_ptr< TSUpdate > ts_update_ptr
Definition: adolc_plasticity.cpp:460
MoFEM::EssentialPostProcRhs< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:111
MoFEM::PETSC
@ PETSC
Definition: FormsIntegrators.hpp:104
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
MoFEM.hpp
MoFEM::OpDGProjectionCoefficients
Definition: DGProjection.hpp:119
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:527
MoFEM::DisplacementCubitBcData
Definition of the displacement bc data structure.
Definition: BCData.hpp:76
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
help
static char help[]
[Check]
Definition: adolc_plasticity.cpp:912
SideEle
PostProcEleByDim< SPACE_DIM >::SideEle SideEle
Definition: adolc_plasticity.cpp:98
Monitor::postProcess
MoFEMErrorCode postProcess()
function is run at the end of loop
Definition: adolc_plasticity.cpp:345
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::OpFluxLhsImpl
Definition: Natural.hpp:43
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
PostProcEleBdy
PostProcEleByDim< SPACE_DIM >::PostProcEleBdy PostProcEleBdy
Definition: adolc_plasticity.cpp:99
PlasticProblem
Definition: adolc_plasticity.cpp:105
PlasticProblem::outputResults
MoFEMErrorCode outputResults()
[Getting norms]
Definition: adolc_plasticity.cpp:876
PostProcEleByDim
Definition: adolc_plasticity.cpp:82
Monitor::reactionFE
boost::shared_ptr< FEMethod > reactionFE
Definition: adolc_plasticity.cpp:455
PlasticProblem::gettingNorms
MoFEMErrorCode gettingNorms()
[Solve]
Definition: adolc_plasticity.cpp:823
save_every_nth_step
int save_every_nth_step
Definition: photon_diffusion.cpp:67
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1018
MoFEM::EssentialPreProc< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:91
Monitor::skinPostProcFe
boost::shared_ptr< PostProcEleBdy > skinPostProcFe
Definition: adolc_plasticity.cpp:454
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
Monitor::domainPostProcFe
boost::shared_ptr< PostProcEleDomain > domainPostProcFe
Definition: adolc_plasticity.cpp:453
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::BcManager
Simple interface for fast problem set-up.
Definition: BcManager.hpp:25
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
default operator for TRI element
Definition: FaceElementForcesAndSourcesCore.hpp:94
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
PlasticProblem::setupProblem
MoFEMErrorCode setupProblem()
[Read mesh]
Definition: adolc_plasticity.cpp:160
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
Monitor::Monitor
Monitor(SmartPetscObj< DM > dm, std::pair< boost::shared_ptr< PostProcEleDomain >, boost::shared_ptr< PostProcEleBdy >> pair_post_proc_fe, boost::shared_ptr< DomainEle > reaction_fe, std::vector< boost::shared_ptr< ScalingMethod >> smv)
Definition: adolc_plasticity.cpp:334
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:47
MatrixFunction.hpp
MoFEM::AddFluxToLhsPipelineImpl
Definition: Natural.hpp:49
Monitor::dM
SmartPetscObj< DM > dM
Definition: adolc_plasticity.cpp:452
MoFEM::OpCalcNormL2Tensor1
Get norm of input MatrixDouble for Tensor1.
Definition: NormsOperators.hpp:42
TSADAPTMOFEM
#define TSADAPTMOFEM
Definition: TsCtx.hpp:10
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
MoFEM::AddFluxToRhsPipelineImpl
Definition: Natural.hpp:46
ADOLCPlasticity
Definition: ADOLCPlasticity.hpp:24
PlasticProblem::readMesh
MoFEMErrorCode readMesh()
[Run problem]
Definition: adolc_plasticity.cpp:145
BiLinearForm
MoFEM::PostProcBrokenMeshInMoabBase
Definition: PostProcBrokenMeshInMoabBase.hpp:94
PlasticProblem::boundaryCondition
MoFEMErrorCode boundaryCondition()
[Set up problem]
Definition: adolc_plasticity.cpp:241
PlasticProblem::assembleSystem
MoFEMErrorCode assembleSystem()
[Boundary condition]
Definition: adolc_plasticity.cpp:281
MoFEM::AddHOOps
Add operators pushing bases from local to physical configuration.
Definition: HODataOperators.hpp:503
MoFEM::OpCalculateVectorFieldGradient
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Definition: UserDataOperators.hpp:1536
PlasticProblem::checkResults
MoFEMErrorCode checkResults()
[Postprocessing results]
Definition: adolc_plasticity.cpp:906
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
DomainEle
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomainEle DomainEle
Definition: adolc_plasticity.cpp:23
Range
DomainEleOp
Monitor::fRes
SmartPetscObj< Vec > fRes
Definition: adolc_plasticity.cpp:456
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
EntData
EntitiesFieldData::EntData EntData
Definition: adolc_plasticity.cpp:18
MOFEM_TAG_AND_LOG
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
Definition: LogManager.hpp:362
main
int main(int argc, char *argv[])
Definition: adolc_plasticity.cpp:914
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::NaturalBC::Assembly
Assembly methods.
Definition: Natural.hpp:65
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
DEMKOWICZ_JACOBI_BASE
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:66
MoFEM::OpDGProjectionEvaluation
Definition: DGProjection.hpp:136
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1094
MoFEM::DMoFEMGetInterfacePtr
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
Definition: DMMoFEM.cpp:418
ADOLCPlasticityMaterialModels.hpp
Matetial models for plasticity.
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
ADOLCPlasticity.hpp
Monitor
[Push operators to pipeline]
Definition: adolc_plasticity.cpp:333
MoFEM::VecOfTimeScalingMethods
std::vector< boost::shared_ptr< ScalingMethod > > VecOfTimeScalingMethods
Vector of time scaling methods.
Definition: Natural.hpp:20
MoFEM::DMMoFEMTSSetMonitor
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: DMMoFEM.cpp:1060
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::PetscOptionsGetEList
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
Definition: DeprecatedPetsc.hpp:203
MoFEM::createVectorMPI
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
Definition: PetscSmartObj.hpp:198
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
PlasticProblem::cpPtr
boost::shared_ptr< ClosestPointProjection > cpPtr
Definition: adolc_plasticity.cpp:125
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
ContactNaturalBC.hpp
PlasticProblem::PlasticProblem
PlasticProblem(MoFEM::Interface &m_field)
Definition: adolc_plasticity.cpp:107
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
DomainEle
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
Definition: child_and_parent.cpp:34
MoFEM::SmartPetscObj< DM >
PlasticProblem::runProblem
MoFEMErrorCode runProblem()
[Run problem]
Definition: adolc_plasticity.cpp:130
MoFEM::CoreInterface::get_field_entities_by_type
virtual MoFEMErrorCode get_field_entities_by_type(const std::string name, EntityType type, Range &ents) const =0
get entities in the field by type
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
convert.int
int
Definition: convert.py:64
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::FieldBlas
Basic algebra on fields.
Definition: FieldBlas.hpp:21
MoFEM::getDMTsCtx
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition: DMMoFEM.hpp:1060
PostProcEleByDim< 3 >::SideEle
PipelineManager::ElementsAndOpsByDim< 3 >::FaceSideEle SideEle
Definition: adolc_plasticity.cpp:94
MoFEM::OpLoopSide
Element used to execute operators on side of the element.
Definition: ForcesAndSourcesCore.hpp:1289
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
PlasticProblem::mField
MoFEM::Interface & mField
Definition: adolc_plasticity.cpp:112
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182
MoFEM::OpPostProcMapInMoab
Post post-proc data at points from hash maps.
Definition: PostProcBrokenMeshInMoabBase.hpp:698
MoFEM::TSAdaptCreateMoFEM
PetscErrorCode TSAdaptCreateMoFEM(TSAdapt adapt)
Craete MOFEM adapt.
Definition: TsCtx.cpp:797
MoFEM::OpDGProjectionMassMatrix
Definition: DGProjection.hpp:106