v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PlasticProblem Struct Reference
Collaboration diagram for PlasticProblem:
[legend]

Public Member Functions

 PlasticProblem (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Run problem]
 

Private Member Functions

MoFEMErrorCode readMesh ()
 [Run problem]
 
MoFEMErrorCode setupProblem ()
 [Read mesh]
 
MoFEMErrorCode boundaryCondition ()
 [Set up problem]
 
MoFEMErrorCode assembleSystem ()
 [Boundary condition]
 
MoFEMErrorCode solveSystem ()
 [Solve]
 
MoFEMErrorCode gettingNorms ()
 [Solve]
 
MoFEMErrorCode outputResults ()
 [Getting norms]
 
MoFEMErrorCode checkResults ()
 [Postprocessing results]
 

Private Attributes

MoFEM::Interface & mField
 
int approxOrder = 2
 
int geomOrder = 2
 
PetscBool largeStrain = PETSC_FALSE
 Large strain flag.
 
FieldApproximationBase approxBase = AINSWORTH_LEGENDRE_BASE
 
boost::shared_ptr< ClosestPointProjection > cpPtr
 

Detailed Description

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 130 of file adolc_plasticity.cpp.

Constructor & Destructor Documentation

◆ PlasticProblem()

PlasticProblem::PlasticProblem ( MoFEM::Interface &  m_field)
inline

Definition at line 132 of file adolc_plasticity.cpp.

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

Member Function Documentation

◆ assembleSystem()

MoFEMErrorCode PlasticProblem::assembleSystem ( )
private

[Boundary condition]

[Push operators to pipeline]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 520 of file adolc_plasticity.cpp.

520 {
522 auto *pipeline_mng = mField.getInterface<PipelineManager>();
523
524 // assemble operator to the right hand side
525 auto add_domain_ops_lhs = [&](auto &pip) {
527 // push forward finite element bases from reference to physical element
529 "GEOMETRY");
530 // create local common data
531 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
532
533 if (largeStrain) {
534 CHKERR
535 opFactoryDomainHenckyStrainLhs<SPACE_DIM, GAUSS, DomainEleOp>(
536 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
537 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
538 PETSC>::template BiLinearForm<GAUSS>;
539 using OpKPiola =
540 typename B::template OpGradTensorGrad<1, SPACE_DIM, SPACE_DIM, -1>;
541 pip.push_back(
542 new OpKPiola("U", "U", common_data_ptr->getMatTangentPtr()));
543 } else {
545 "U", common_data_ptr->getGradAtGaussPtsPtr()));
546 CHKERR opFactoryDomainLhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
547 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
548 }
549
551 };
552
553 auto add_domain_ops_rhs = [&](auto &pip) {
555 // push forward finite element bases from reference to physical element
557 "GEOMETRY");
558 // create local common data
559 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
560
561 if (largeStrain) {
562 CHKERR
563 opFactoryDomainHenckyStrainRhs<SPACE_DIM, GAUSS, DomainEleOp>(
564 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
565 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
566 PETSC>::template LinearForm<GAUSS>;
569 pip.push_back(
570 new OpInternalForcePiola("U", common_data_ptr->getStressMatrixPtr()));
571 } else {
573 "U", common_data_ptr->getGradAtGaussPtsPtr()));
574 CHKERR opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
575 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
576 }
577
578#ifdef ADD_CONTACT
579 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
580 pip, "SIGMA", "U");
581#endif // ADD_CONTACT
583 };
584
585 // Push operators to the left hand side pipeline. Indicate that domain (i.e.
586 // volume/interior) element is used.
587 CHKERR add_domain_ops_lhs(pipeline_mng->getOpDomainLhsPipeline());
588 // Push operators to the right hand side pipeline.
589 CHKERR add_domain_ops_rhs(pipeline_mng->getOpDomainRhsPipeline());
590
592}
constexpr int SPACE_DIM
@ H1
continuous field
Definition definitions.h:85
@ HDIV
field with continuous normal traction
Definition definitions.h:87
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
@ PETSC
Standard PETSc assembly.
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForcePiola
Definition seepage.cpp:65
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, -1 > OpKPiola
[Only used for dynamics]
Definition seepage.cpp:63
Add operators pushing bases from local to physical configuration.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
PipelineManager interface.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< ClosestPointProjection > cpPtr
PetscBool largeStrain
Large strain flag.

◆ boundaryCondition()

MoFEMErrorCode PlasticProblem::boundaryCondition ( )
private

[Set up problem]

[Boundary condition]

Add body froces

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 437 of file adolc_plasticity.cpp.

437 {
439 auto *pipeline_mng = mField.getInterface<PipelineManager>();
441 auto bc_mng = mField.getInterface<BcManager>();
442 auto time_scale = boost::make_shared<TimeScale>();
443
444 auto rule = [](int, int, int p) { return 2 * p; };
445 CHKERR pipeline_mng->setDomainRhsIntegrationRule(cpPtr->integrationRule);
446 CHKERR pipeline_mng->setDomainLhsIntegrationRule(cpPtr->integrationRule);
447 CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(rule);
448 CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(rule);
449
451 pipeline_mng->getOpBoundaryLhsPipeline(), {HDIV}, "GEOMETRY");
452 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
454
456 pipeline_mng->getOpBoundaryRhsPipeline(), {HDIV}, "GEOMETRY");
457 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
459
460 // Add Natural BCs to RHS
462 pipeline_mng->getOpBoundaryRhsPipeline(), mField, "U", {time_scale},
463 Sev::inform);
464 // Add Natural BCs to LHS
466 pipeline_mng->getOpBoundaryLhsPipeline(), mField, "U", Sev::inform);
467
468#ifdef ADD_CONTACT
469 CHKERR
470 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, PETSC, GAUSS, BoundaryEleOp>(
471 pipeline_mng->getOpBoundaryLhsPipeline(), "SIGMA", "U");
472 CHKERR
473 ContactOps::opFactoryBoundaryToDomainLhs<SPACE_DIM, PETSC, GAUSS, DomainEle>(
474 mField, pipeline_mng->getOpBoundaryLhsPipeline(),
475 simple->getDomainFEName(), "SIGMA", "U", "GEOMETRY",
476 cpPtr->integrationRule);
477
478 CHKERR
479 ContactOps::opFactoryBoundaryRhs<SPACE_DIM, PETSC, GAUSS, BoundaryEleOp>(
480 pipeline_mng->getOpBoundaryRhsPipeline(), "SIGMA", "U");
481#endif // ADD_CONTACT
482
483 //! Add body froces
485 pipeline_mng->getOpDomainRhsPipeline(), mField, "U", {time_scale},
486 "BODY_FORCE", Sev::inform);
487
488 // Essential BC
489 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
490 "U", 0, 0);
491 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
492 "U", 1, 1);
493 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
494 "U", 2, 2);
495#ifdef ADD_CONTACT
496 for (auto b : {"FIX_X", "REMOVE_X"})
497 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
498 "SIGMA", 0, 0, false, true);
499 for (auto b : {"FIX_Y", "REMOVE_Y"})
500 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
501 "SIGMA", 1, 1, false, true);
502 for (auto b : {"FIX_Z", "REMOVE_Z"})
503 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
504 "SIGMA", 2, 2, false, true);
505 for (auto b : {"FIX_ALL", "REMOVE_ALL"})
506 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
507 "SIGMA", 0, 3, false, true);
508 CHKERR bc_mng->removeBlockDOFsOnEntities(
509 simple->getProblemName(), "NO_CONTACT", "SIGMA", 0, 3, false, true);
510#endif
511
512 CHKERR bc_mng->pushMarkDOFsOnEntities<DisplacementCubitBcData>(
513 simple->getProblemName(), "U");
514
516}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
Boundary condition manager for finite element problem setup.
Definition of the displacement bc data structure.
Definition BCData.hpp:72
Simple interface for fast problem set-up.
Definition Simple.hpp:27

◆ checkResults()

MoFEMErrorCode PlasticProblem::checkResults ( )
private

[Postprocessing results]

[Check]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 1324 of file adolc_plasticity.cpp.

1324 {
1326#ifdef ADD_CONTACT
1328#endif
1330}
static SmartPetscObj< Vec > totalTractionAndArea

◆ gettingNorms()

MoFEMErrorCode PlasticProblem::gettingNorms ( )
private

[Solve]

[Getting norms]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 1241 of file adolc_plasticity.cpp.

1241 {
1243
1244 auto simple = mField.getInterface<Simple>();
1245 auto dm = simple->getDM();
1246
1247 auto T = createDMVector(simple->getDM());
1248 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
1249 SCATTER_FORWARD);
1250 double nrm2;
1251 CHKERR VecNorm(T, NORM_2, &nrm2);
1252 MOFEM_LOG("PlasticPrb", Sev::inform) << "Solution norm " << nrm2;
1253
1254 auto post_proc_norm_fe = boost::make_shared<DomainEle>(mField);
1255
1256 post_proc_norm_fe->getRuleHook = cpPtr->integrationRule;
1257
1259 post_proc_norm_fe->getOpPtrVector(), {H1});
1260
1261 enum NORMS { U_NORM_L2 = 0, PIOLA_NORM, LAST_NORM };
1262 auto norms_vec =
1264 (mField.get_comm_rank() == 0) ? LAST_NORM : 0, LAST_NORM);
1265 CHKERR VecZeroEntries(norms_vec);
1266
1267 auto u_ptr = boost::make_shared<MatrixDouble>();
1268 post_proc_norm_fe->getOpPtrVector().push_back(
1270
1271 post_proc_norm_fe->getOpPtrVector().push_back(
1272 new OpCalcNormL2Tensor1<SPACE_DIM>(u_ptr, norms_vec, U_NORM_L2));
1273
1274 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
1275 post_proc_norm_fe);
1276
1277 CHKERR VecAssemblyBegin(norms_vec);
1278 CHKERR VecAssemblyEnd(norms_vec);
1279
1280 MOFEM_LOG_CHANNEL("SELF"); // Clear channel from old tags
1281 if (mField.get_comm_rank() == 0) {
1282 const double *norms;
1283 CHKERR VecGetArrayRead(norms_vec, &norms);
1284 MOFEM_TAG_AND_LOG("SELF", Sev::inform, "example")
1285 << "norm_u: " << std::scientific << std::sqrt(norms[U_NORM_L2]);
1286 CHKERR VecRestoreArrayRead(norms_vec, &norms);
1287 }
1288
1290}
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode, RowColData rc=RowColData::COL)
set local (or ghosted) vector values on mesh for partition only
Definition DMMoFEM.cpp:600
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:662
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
Definition DMMoFEM.hpp:1279
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Get norm of input MatrixDouble for Tensor1.
Specialization for MatrixDouble vector field values calculation.
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition Simple.cpp:802

◆ outputResults()

MoFEMErrorCode PlasticProblem::outputResults ( )
private

[Getting norms]

[Postprocessing results]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 1294 of file adolc_plasticity.cpp.

1294 {
1296 PetscInt test_nb = 0;
1297 PetscBool test_flg = PETSC_FALSE;
1298 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-test", &test_nb, &test_flg);
1299
1300 if (test_flg) {
1301 auto simple = mField.getInterface<Simple>();
1302 auto T = createDMVector(simple->getDM());
1303 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
1304 SCATTER_FORWARD);
1305 double nrm2;
1306 CHKERR VecNorm(T, NORM_2, &nrm2);
1307 MOFEM_LOG("PlasticPrb", Sev::verbose) << "Regression norm " << nrm2;
1308 double regression_value = 0;
1309 switch (test_nb) {
1310 default:
1311 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID, "Wrong test number.");
1312 break;
1313 }
1314 if (fabs(nrm2 - regression_value) > 1e-2)
1315 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
1316 "Regression test field; wrong norm value. %6.4e != %6.4e", nrm2,
1317 regression_value);
1318 }
1320}
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)

◆ readMesh()

MoFEMErrorCode PlasticProblem::readMesh ( )
private

[Run problem]

[Read mesh]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 177 of file adolc_plasticity.cpp.

177 {
181 CHKERR simple->loadFile();
182
183 if (simple->getDim() != SPACE_DIM)
184 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
185 "Wrong dimension of mesh %d != %d", simple->getDim(), SPACE_DIM);
186
187 // Check if mesh has boundary conditions tag and set yield strength as elastic
188 Tag th_boundary_conditions;
189 ErrorCode rval_bc = mField.get_moab().tag_get_handle(
190 "BOUNDARY_CONDITIONS", 1, MB_TYPE_INTEGER, th_boundary_conditions,
191 MB_TAG_SPARSE);
192
193 // Set yield strength as elastic if boundary conditions tag is set
194 if (rval_bc == MB_SUCCESS) {
195
196 auto yield_strength_compressive = std::numeric_limits<double>::max();
197 auto yield_strength_tension = std::numeric_limits<double>::max();
198
199 Tag th_compressive_yield_stress;
200 Tag th_tension_yield_stress;
201
202 ErrorCode rval_compressive = mField.get_moab().tag_get_handle(
203 "Yield_Strength_C", 1, MB_TYPE_DOUBLE, th_compressive_yield_stress,
204 MB_TAG_SPARSE);
205
206 ErrorCode rval_tension = mField.get_moab().tag_get_handle(
207 "Yield_Strength_T", 1, MB_TYPE_DOUBLE, th_tension_yield_stress,
208 MB_TAG_SPARSE);
209
210 Range fe_ents;
211 CHKERR mField.get_moab().get_entities_by_dimension(0, SPACE_DIM, fe_ents);
212
213 for (auto fe_ent : fe_ents) {
214 Range nodes;
215 // get nodes of the element
216 CHKERR mField.get_moab().get_adjacencies(&fe_ent, 1, 0, false, nodes);
217
218 std::vector<double> v_bc_val;
219 for (auto node : nodes) {
220 int bc_val;
221 CHKERR mField.get_moab().tag_get_data(th_boundary_conditions, &node, 1,
222 static_cast<void *>(&bc_val));
223 v_bc_val.push_back(bc_val);
224 }
225
226 // Set yield strength as elastic if boundary conditions is FIX_X or
227 // CONTACT
228 if (std::find_if(v_bc_val.begin(), v_bc_val.end(), [](int val) {
229 return val == 5 || val == 20;
230 }) != v_bc_val.end()) {
231
232 if (rval_compressive == MB_SUCCESS) {
233
234 CHKERR mField.get_moab().tag_set_data(th_compressive_yield_stress,
235 &fe_ent, 1,
236 &yield_strength_compressive);
237 } else {
238 MOFEM_LOG("ADOLCPlasticityWold", Sev::warning)
239 << "Yield_Strength_C tag does not exist using default value";
240 }
241 if (rval_tension == MB_SUCCESS) {
242
243 CHKERR mField.get_moab().tag_set_data(
244 th_tension_yield_stress, &fe_ent, 1, &yield_strength_tension);
245 } else {
246 MOFEM_LOG("ADOLCPlasticityWold", Sev::warning)
247 << "Yield_Strength_T tag does not exist using default value";
248 }
249 }
250 }
251 }
252
254}
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180

◆ runProblem()

MoFEMErrorCode PlasticProblem::runProblem ( )

[Run problem]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 162 of file adolc_plasticity.cpp.

162 {
173}
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEMErrorCode readMesh()
[Run problem]
MoFEMErrorCode outputResults()
[Getting norms]
MoFEMErrorCode checkResults()
[Postprocessing results]
MoFEMErrorCode boundaryCondition()
[Set up problem]
MoFEMErrorCode assembleSystem()
[Boundary condition]
MoFEMErrorCode gettingNorms()
[Solve]
MoFEMErrorCode solveSystem()
[Solve]

◆ setupProblem()

MoFEMErrorCode PlasticProblem::setupProblem ( )
private

[Read mesh]

[Set up problem]

[Material models selection]

FIXME: Here only array of material models is initalized. Each model has unique set of the ADOL-C tags. Pointer is attached based on block name to which entity belongs. That will enable heterogeneity of the model, in addition of heterogeneity of the material properties.

[Material models selection]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 258 of file adolc_plasticity.cpp.

258 {
261
262 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
263 const char *list_bases[LASBASETOPT] = {"ainsworth", "demkowicz"};
264 PetscInt choice_base_value = AINSWORTH;
265 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-base", list_bases,
266 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
267 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-order", &approxOrder,
268 PETSC_NULLPTR);
269 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-geom_order", &geomOrder,
270 PETSC_NULLPTR);
271 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-large_strain", &largeStrain,
272 PETSC_NULLPTR);
273
274 switch (choice_base_value) {
275 case AINSWORTH:
277 MOFEM_LOG("WORLD", Sev::inform)
278 << "Set AINSWORTH_LEGENDRE_BASE for displacements";
279 break;
280 case DEMKOWICZ:
282 MOFEM_LOG("WORLD", Sev::inform)
283 << "Set DEMKOWICZ_JACOBI_BASE for displacements";
284 break;
285 default:
287 break;
288 }
289
290 // Add field
291 CHKERR simple->addDomainField("U", H1, approxBase, SPACE_DIM);
292 CHKERR simple->addBoundaryField("U", H1, approxBase, SPACE_DIM);
293 CHKERR simple->addDataField("GEOMETRY", H1, approxBase, SPACE_DIM);
294
295#ifdef ADD_CONTACT
296 CHKERR simple->addDomainField("SIGMA", CONTACT_SPACE, DEMKOWICZ_JACOBI_BASE,
297 SPACE_DIM);
298 CHKERR simple->addBoundaryField("SIGMA", CONTACT_SPACE, DEMKOWICZ_JACOBI_BASE,
299 SPACE_DIM);
300 auto get_skin = [&]() {
301 Range body_ents;
302 CHKERR mField.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents);
303 Skinner skin(&mField.get_moab());
304 Range skin_ents;
305 CHKERR skin.find_skin(0, body_ents, false, skin_ents);
306 return skin_ents;
307 };
308
309 auto filter_blocks = [&](auto skin) {
310 bool is_contact_block = false;
311 Range contact_range;
312 for (auto m :
313 mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
314
315 (boost::format("%s(.*)") % "CONTACT").str()
316
317 ))
318
319 ) {
320 is_contact_block =
321 true; ///< bloks interation is collectibe, so that is set irrespective
322 ///< if there are enerities in given rank or not in the block
323 MOFEM_LOG("CONTACT", Sev::inform)
324 << "Find contact block set: " << m->getName();
325 auto meshset = m->getMeshset();
326 Range contact_meshset_range;
327 CHKERR mField.get_moab().get_entities_by_dimension(
328 meshset, SPACE_DIM - 1, contact_meshset_range, true);
329
330 CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(
331 contact_meshset_range);
332 contact_range.merge(contact_meshset_range);
333 }
334 if (is_contact_block) {
335 MOFEM_LOG("SYNC", Sev::inform)
336 << "Nb entities in contact surface: " << contact_range.size();
338 skin = intersect(skin, contact_range);
339 }
340 return skin;
341 };
342
343 auto filter_true_skin = [&](auto skin) {
344 Range boundary_ents;
345 ParallelComm *pcomm =
346 ParallelComm::get_pcomm(&mField.get_moab(), MYPCOMM_INDEX);
347 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
348 PSTATUS_NOT, -1, &boundary_ents);
349 return boundary_ents;
350 };
351
352 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
353#ifdef ADD_CONTACT
354 CHKERR simple->setFieldOrder("SIGMA", 0);
355 CHKERR simple->setFieldOrder("SIGMA", approxOrder - 1, &boundary_ents);
356 CHKERR PetscOptionsGetScalar(PETSC_NULLPTR, "", "-cn_contact",
357 &ContactOps::cn_contact, PETSC_NULLPTR);
358 MOFEM_LOG("CONTACT", Sev::inform) << "cn_contact " << ContactOps::cn_contact;
359
360#endif
361
362#ifdef ENABLE_PYTHON_BINDING
363 sdfPythonPtr = boost::make_shared<ContactOps::SDFPython>();
364 CHKERR sdfPythonPtr->sdfInit("sdf.py");
365 ContactOps::sdfPythonWeakPtr = sdfPythonPtr;
366#endif
367#endif
368
369 CHKERR simple->setFieldOrder("U", approxOrder);
370 CHKERR simple->setFieldOrder("GEOMETRY", geomOrder);
371 CHKERR simple->setUp();
372
373 auto project_ho_geometry = [&]() {
374 Projection10NodeCoordsOnField ent_method(mField, "GEOMETRY");
375 return mField.loop_dofs("GEOMETRY", ent_method);
376 };
377 PetscBool project_geometry = PETSC_TRUE;
378 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-project_geometry",
379 &project_geometry, PETSC_NULLPTR);
380 if (project_geometry) {
381 CHKERR project_ho_geometry();
382 }
383
384 //! [Material models selection]
385
386 /**
387 * FIXME: Here only array of material models is initalized. Each model has
388 * unique set of the ADOL-C tags. Pointer is attached based on block name to
389 * which entity belongs. That will enable heterogeneity of the model, in
390 * addition of heterogeneity of the material properties.
391 */
392
393 enum MaterialModel {
394 VonMisses,
395 VonMissesPlaneStress,
396 Paraboloidal,
397 HeterogeneousParaboloidal,
398 LastModel
399 };
400 const char *list_materials[LastModel] = {"VonMisses", "VonMissesPlaneStress",
401 "Paraboloidal",
402 "HeterogeneousParaboloidal"};
403 PetscInt choice_material = VonMisses;
404 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-material", list_materials,
405 LastModel, &choice_material, PETSC_NULLPTR);
406
407 switch (choice_material) {
408 case VonMisses:
409 cpPtr = createMaterial<J2Plasticity<3>>();
410 break;
411 case VonMissesPlaneStress:
412 if (SPACE_DIM != 2)
413 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
414 "VonMissesPlaneStrain is only for 2D case");
415 cpPtr = createMaterial<J2Plasticity<2>>();
416 break;
417 case Paraboloidal:
418 cpPtr = createMaterial<ParaboloidalPlasticity>();
419 break;
420 case HeterogeneousParaboloidal:
421 cpPtr = createMaterial<HeterogeneousParaboloidalPlasticity>();
422 break;
423 default:
424 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Wrong material model");
425 }
426
428 cpPtr->integrationRule = [](int, int, int p) { return 2 * (p - 2); };
429
430 //! [Material models selection]
431
433}
FaceSet skin
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
constexpr FieldSpace CONTACT_SPACE
@ LASTBASE
Definition definitions.h:69
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
#define MYPCOMM_INDEX
default communicator number PCOMM
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
double cn_contact
Definition contact.cpp:88
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
FTensor::Index< 'm', 3 > m
Managing BitRefLevels.
Interface for managing meshsets containing materials and boundary conditions.
Projection of edge entities with one mid-node on hierarchical basis.
FieldApproximationBase approxBase

◆ solveSystem()

MoFEMErrorCode PlasticProblem::solveSystem ( )
private

[Solve]

[DG projection]

[DG projection]

[Set up post-step]

[TS post-step function]

[TS post-step function]

[Set up post-step]

[Create TS]

[Create TS]

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 794 of file adolc_plasticity.cpp.

794 {
796 auto *simple = mField.getInterface<Simple>();
797 auto *pipeline_mng = mField.getInterface<PipelineManager>();
798
799 auto dm = simple->getDM();
800 auto time_scale = boost::make_shared<TimeScale>();
801 auto snes_ctx_ptr = getDMSnesCtx(simple->getDM());
802
803 // Setup postprocessing
804 auto create_post_proc_fe = [dm, this, simple]() {
805 //! [DG projection]
806 // Post-process domain, i.e. volume elements. If 3d case creates stresses
807 // are evaluated at points which are trace of the volume element on boundary
808 auto post_proc_ele_domain = [this](auto &pip_domain, auto &fe_name) {
809 // Push bases on reference element to the phyiscal element
811 pip_domain, {H1, HDIV}, "GEOMETRY");
812
813 // calculate displacement gradients at nodes of post processing mesh. For
814 // gradient DG projection is obsolete, since displacements can be
815 // evaluated at arbitrary points.
816 auto grad_ptr = boost::make_shared<MatrixDouble>();
817 pip_domain.push_back(
819 grad_ptr));
820
821 // Create operator to run (neted) pipeline in operator. InteriorElem
822 // element will have iteration rule and bases as domain element used to
823 // solve problem, and remember history variables.
824 using InteriorElem = DomainEle;
825 auto op_this = new OpLoopThis<InteriorElem>(mField, fe_name, Sev::noisy);
826 // add interior element to post-processing pipeline
827 pip_domain.push_back(op_this);
828
829 // get pointer to interior element, which is in essence pipeline which
830 // pipeline.
831 auto fe_physics = op_this->getThisFEPtr();
832
833 auto evaluate_stress_on_physical_element = [&]() {
834 // evaluate stress and plastic strain at Gauss points
835 fe_physics->getRuleHook = cpPtr->integrationRule;
837 fe_physics->getOpPtrVector(), {H1});
838 auto common_data_ptr =
839 boost::make_shared<ADOLCPlasticity::CommonData>();
840 // note that gradient of displacements is evaluate again, at
841 // physical nodes
842 if (largeStrain) {
843 CHKERR
844 opFactoryDomainHenckyStrainRhs<SPACE_DIM, GAUSS, DomainEleOp>(
845 mField, "U", fe_physics->getOpPtrVector(), "ADOLCMAT",
846 common_data_ptr, cpPtr);
847
848 } else {
849 fe_physics->getOpPtrVector().push_back(
851 "U", common_data_ptr->getGradAtGaussPtsPtr()));
852 CHKERR cpPtr->addMatBlockOps(mField, fe_physics->getOpPtrVector(),
853 "ADOLCMAT", Sev::inform);
854 fe_physics->getOpPtrVector().push_back(
855 getRawPtrOpCalculateStress<SPACE_DIM, SMALL_STRAIN>(
856 mField, common_data_ptr, cpPtr, false));
857 }
858 return common_data_ptr;
859 };
860
861 auto dg_projection_froward_and_back = [&](auto &common_data_ptr) {
862 // here we do actual projection of stress and plastic strain to DG space
863 int dg_order = approxOrder - 1;
864 auto entity_data_l2 =
865 boost::make_shared<EntitiesFieldData>(MBENTITYSET);
866 auto mass_ptr =
867 boost::make_shared<MatrixDouble>(); //< projection operator (mass
868 // matrix)
869 fe_physics->getOpPtrVector().push_back(new OpDGProjectionMassMatrix(
870 dg_order, mass_ptr, entity_data_l2, approxBase, L2));
871
872 auto coeffs_ptr_stress = boost::make_shared<MatrixDouble>();
873 // project stress on DG space on physical element
874 fe_physics->getOpPtrVector().push_back(new OpDGProjectionCoefficients(
875 common_data_ptr->getStressMatrixPtr(), coeffs_ptr_stress, mass_ptr,
876 entity_data_l2, approxBase, L2));
877 // project strains plastic strains DG space on physical element
878 auto coeffs_ptr_plastic_strain = boost::make_shared<MatrixDouble>();
879 fe_physics->getOpPtrVector().push_back(new OpDGProjectionCoefficients(
880 common_data_ptr->getPlasticStrainMatrixPtr(),
881 coeffs_ptr_plastic_strain, mass_ptr, entity_data_l2, approxBase,
882 L2));
883
884 // project stress and plastic strain for DG space on post-process
885 // element
886 pip_domain.push_back(new OpDGProjectionEvaluation(
887 common_data_ptr->getStressMatrixPtr(), coeffs_ptr_stress,
888 entity_data_l2, approxBase, L2));
889 pip_domain.push_back(new OpDGProjectionEvaluation(
890 common_data_ptr->getPlasticStrainMatrixPtr(),
891 coeffs_ptr_plastic_strain, entity_data_l2, approxBase, L2));
892 };
893
894 auto common_data_ptr = evaluate_stress_on_physical_element();
895 dg_projection_froward_and_back(common_data_ptr);
896
897 return boost::make_tuple(grad_ptr, common_data_ptr->getStressMatrixPtr(),
898 common_data_ptr->getPlasticStrainMatrixPtr());
899 };
900 //! [DG projection]
901
902 // Create tags on post-processing mesh, i.e. those tags are visible in
903 // Preview
904 auto add_post_proc_map = [&](auto post_proc_fe, auto u_ptr, auto grad_ptr,
905 auto stress_ptr, auto plastic_strain_ptr,
906 auto contact_stress_ptr, auto X_ptr) {
907 using OpPPMapSpaceDim = OpPostProcMapInMoab<SPACE_DIM, SPACE_DIM>;
908 using DataMapMat = typename OpPPMapSpaceDim::DataMapMat;
909 DataMapMat tensor_data_space_dim = {{"GRAD", grad_ptr},
910 {"SIGMA", contact_stress_ptr}};
911 if (largeStrain)
912 tensor_data_space_dim["PK1"] = stress_ptr;
913
914 post_proc_fe->getOpPtrVector().push_back(
915
916 new OpPPMapSpaceDim(
917
918 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
919
920 {},
921
922 {{"U", u_ptr}, {"GEOMETRY", X_ptr}},
923
924 tensor_data_space_dim,
925
926 {}
927
928 )
929
930 );
931
932 DataMapMat tensor_data_3d = {{"PLASTIC_STRAIN", plastic_strain_ptr}};
933 if (!largeStrain)
934 tensor_data_3d["STRESS"] = stress_ptr;
935
936 using OpPPMap3D = OpPostProcMapInMoab<3, 3>;
937 post_proc_fe->getOpPtrVector().push_back(
938
939 new OpPPMap3D(
940
941 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
942
943 {},
944
945 {},
946
947 {},
948
949 tensor_data_3d
950
951 )
952
953 );
954
955 return post_proc_fe;
956 };
957
958 auto vol_post_proc = [this, simple, post_proc_ele_domain,
959 add_post_proc_map]() {
960 PetscBool post_proc_vol = PETSC_FALSE;
961 if (SPACE_DIM == 2)
962 post_proc_vol = PETSC_TRUE;
963
964 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-post_proc_vol",
965 &post_proc_vol, PETSC_NULLPTR);
966 if (post_proc_vol == PETSC_FALSE)
967 return boost::shared_ptr<PostProcEleDomain>();
968 auto post_proc_fe = boost::make_shared<PostProcEleDomain>(mField);
969 auto u_ptr = boost::make_shared<MatrixDouble>();
970 post_proc_fe->getOpPtrVector().push_back(
972 auto X_ptr = boost::make_shared<MatrixDouble>();
973 post_proc_fe->getOpPtrVector().push_back(
974 new OpCalculateVectorFieldValues<SPACE_DIM>("GEOMETRY", X_ptr));
975 auto contact_stress_ptr = boost::make_shared<MatrixDouble>();
976#ifdef ADD_CONTACT
977 post_proc_fe->getOpPtrVector().push_back(
979 "SIGMA", contact_stress_ptr));
980#else
981 contact_stress_ptr = nullptr;
982#endif
983 auto [grad_ptr, stress_ptr, plastic_strain_ptr] = post_proc_ele_domain(
984 post_proc_fe->getOpPtrVector(), simple->getDomainFEName());
985
986 return add_post_proc_map(post_proc_fe, u_ptr, grad_ptr, stress_ptr,
987 plastic_strain_ptr, contact_stress_ptr, X_ptr);
988 };
989
990 auto skin_post_proc = [this, simple, post_proc_ele_domain,
991 add_post_proc_map]() {
992 // create skin of the volume mesh for post-processing,
993 // i.e. boundary of the volume mesh
994 PetscBool post_proc_skin = PETSC_TRUE;
995 if (SPACE_DIM == 2)
996 post_proc_skin = PETSC_FALSE;
997
998 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-post_proc_skin",
999 &post_proc_skin, PETSC_NULLPTR);
1000
1001 if (post_proc_skin == PETSC_FALSE)
1002 return boost::shared_ptr<PostProcEleBdy>();
1003
1004 auto post_proc_fe = boost::make_shared<PostProcEleBdy>(mField);
1005 auto u_ptr = boost::make_shared<MatrixDouble>();
1006 post_proc_fe->getOpPtrVector().push_back(
1008 auto X_ptr = boost::make_shared<MatrixDouble>();
1009 post_proc_fe->getOpPtrVector().push_back(
1010 new OpCalculateVectorFieldValues<SPACE_DIM>("GEOMETRY", X_ptr));
1011 auto contact_stress_ptr = boost::make_shared<MatrixDouble>();
1012 auto op_loop_side =
1013 new OpLoopSide<SideEle>(mField, simple->getDomainFEName(), SPACE_DIM);
1014 auto [grad_ptr, stress_ptr, plastic_strain_ptr] = post_proc_ele_domain(
1015 op_loop_side->getOpPtrVector(), simple->getDomainFEName());
1016#ifdef ADD_CONTACT
1017 op_loop_side->getOpPtrVector().push_back(
1019 "SIGMA", contact_stress_ptr));
1020#else
1021 contact_stress_ptr = nullptr;
1022#endif
1023 post_proc_fe->getOpPtrVector().push_back(op_loop_side);
1024
1025 return add_post_proc_map(post_proc_fe, u_ptr, grad_ptr, stress_ptr,
1026 plastic_strain_ptr, contact_stress_ptr, X_ptr);
1027 };
1028
1029 return std::make_pair(vol_post_proc(), skin_post_proc());
1030 };
1031
1032 auto create_reaction_fe = [&]() {
1033 auto fe_ptr = boost::make_shared<DomainEle>(mField);
1034 fe_ptr->getRuleHook = cpPtr->integrationRule;
1035
1036 auto &pip = fe_ptr->getOpPtrVector();
1038 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
1039
1040 if (largeStrain) {
1041 CHKERR
1042 opFactoryDomainHenckyStrainRhs<SPACE_DIM, GAUSS, DomainEleOp>(
1043 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
1044 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1045 PETSC>::template LinearForm<GAUSS>;
1046 using OpInternalForcePiola =
1047 typename B::template OpGradTimesTensor<1, SPACE_DIM, SPACE_DIM>;
1048 pip.push_back(
1049 new OpInternalForcePiola("U", common_data_ptr->getStressMatrixPtr()));
1050 } else {
1052 "U", common_data_ptr->getGradAtGaussPtsPtr()));
1053 CHKERR opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
1054 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
1055 }
1056
1057 return fe_ptr;
1058 };
1059
1060 auto add_extra_finite_elements_to_ksp_solver_pipelines = [&]() {
1062
1063 auto pre_proc_ptr = boost::make_shared<FEMethod>();
1064 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
1065 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
1066
1067 auto get_bc_hook_rhs = [this, pre_proc_ptr, time_scale]() {
1070 {time_scale}, false)();
1072 };
1073
1074 pre_proc_ptr->preProcessHook = get_bc_hook_rhs;
1075
1076 auto get_post_proc_hook_rhs = [this, post_proc_rhs_ptr]() {
1079 mField, post_proc_rhs_ptr, nullptr, Sev::verbose)();
1081 mField, post_proc_rhs_ptr, 1.)();
1083 };
1084 auto get_post_proc_hook_lhs = [this, post_proc_lhs_ptr]() {
1087 mField, post_proc_lhs_ptr, 1.)();
1089 };
1090 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs;
1091 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs;
1092
1093 // This is low level pushing finite elements (pipelines) to solver
1094 auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
1095 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
1096 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
1097 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
1098 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
1100 };
1101
1102 // Add extra finite elements to SNES solver pipelines to resolve essential
1103 // boundary conditions
1104 CHKERR add_extra_finite_elements_to_ksp_solver_pipelines();
1105
1106 auto create_monitor_fe = [dm, time_scale](auto &&post_proc_fe,
1107 auto &&reaction_fe) {
1108 return boost::make_shared<Monitor>(
1109 dm, post_proc_fe, reaction_fe,
1110 std::vector<boost::shared_ptr<ScalingMethod>>{time_scale});
1111 };
1112
1113 //! [Set up post-step]
1114 auto set_up_post_step = [&](auto ts) {
1116
1117 // create finite element (pipeline) and populate it with operators to
1118 // update history variables
1119 auto create_update_ptr = [&]() {
1120 auto fe_ptr = boost::make_shared<DomainEle>(mField);
1121 fe_ptr->getRuleHook = cpPtr->integrationRule;
1122 AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(fe_ptr->getOpPtrVector(),
1123 {H1});
1124 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
1125
1126 if (largeStrain) {
1127 CHKERR opFactoryDomainHenckyStrainRhs<SPACE_DIM, GAUSS, DomainEleOp>(
1128 mField, "U", fe_ptr->getOpPtrVector(), "ADOLCMAT", common_data_ptr,
1129 cpPtr);
1130 } else {
1131 fe_ptr->getOpPtrVector().push_back(
1133 "U", common_data_ptr->getGradAtGaussPtsPtr()));
1134 CHKERR cpPtr->addMatBlockOps(mField, fe_ptr->getOpPtrVector(),
1135 "ADOLCMAT", Sev::noisy);
1136 fe_ptr->getOpPtrVector().push_back(
1137 getRawPtrOpCalculateStress<SPACE_DIM, SMALL_STRAIN>(
1138 mField, common_data_ptr, cpPtr, false));
1139 }
1140
1142 opFactoryDomainUpdate<SPACE_DIM>(mField, fe_ptr->getOpPtrVector(),
1143 "ADOLCMAT", common_data_ptr, cpPtr),
1144 "push update ops");
1145 return fe_ptr;
1146 };
1147
1148 // ts_update_ptr is global static variable
1150 createTSUpdate(simple->getDomainFEName(), create_update_ptr());
1151
1152 //! [TS post-step function]
1153 // This is pure "C" function which we can to the TS solver
1154 auto ts_step_post_proc = [](TS ts) {
1156 if (ts_update_ptr)
1157 CHKERR ts_update_ptr->postProcess(ts);
1159 };
1160 //! [TS post-step function]
1161
1162 // finally set up post-step
1163 CHKERR TSSetPostStep(ts, ts_step_post_proc);
1165 };
1166 //! [Set up post-step]
1167
1168 // Set monitor which postprocessing results and saves them to the hard drive
1169 auto set_up_monitor = [&](auto ts) {
1171 boost::shared_ptr<FEMethod> null_fe;
1172 auto monitor_ptr =
1173 create_monitor_fe(create_post_proc_fe(), create_reaction_fe());
1174 CHKERR DMMoFEMTSSetMonitor(dm, ts, simple->getDomainFEName(), null_fe,
1175 null_fe, monitor_ptr);
1177 };
1178
1179 auto set_section_monitor = [&](auto solver) {
1181 SNES snes;
1182 CHKERR TSGetSNES(solver, &snes);
1183 CHKERR SNESMonitorSet(snes,
1184 (MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
1185 void *))MoFEMSNESMonitorFields,
1186 (void *)(snes_ctx_ptr.get()), nullptr);
1188 };
1189
1190 auto set_up_adapt = [&](auto ts) {
1192 CHKERR TSAdaptRegister(TSADAPTMOFEM, TSAdaptCreateMoFEM);
1193 TSAdapt adapt;
1194 CHKERR TSGetAdapt(ts, &adapt);
1196 };
1197
1198 //! [Create TS]
1199 auto ts = pipeline_mng->createTSIM();
1200
1201 // Set time solver
1202 double ftime = 1;
1203 CHKERR TSSetMaxTime(ts, ftime);
1204 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
1205 auto D = createDMVector(simple->getDM());
1206 auto B = createDMMatrix(dm);
1207 CHKERR TSSetIJacobian(ts, B, B, PETSC_NULLPTR, PETSC_NULLPTR);
1208#ifdef ADD_CONTACT
1210#endif
1211 CHKERR TSSetSolution(ts, D);
1212 CHKERR set_section_monitor(ts);
1213
1214 // Set monitor, step adaptivity, and post-step to update history variables
1215 CHKERR set_up_monitor(ts);
1216 CHKERR set_up_post_step(ts);
1217 CHKERR set_up_adapt(ts);
1218 CHKERR TSSetFromOptions(ts);
1219
1220 CHKERR TSSolve(ts, NULL);
1221 //! [Create TS]
1222
1223 CHKERR TSGetTime(ts, &ftime);
1224
1225 PetscInt steps, snesfails, rejects, nonlinits, linits;
1226 CHKERR TSGetStepNumber(ts, &steps);
1227 CHKERR TSGetSNESFailures(ts, &snesfails);
1228 CHKERR TSGetStepRejections(ts, &rejects);
1229 CHKERR TSGetSNESIterations(ts, &nonlinits);
1230 CHKERR TSGetKSPIterations(ts, &linits);
1231 MOFEM_LOG_C("PlasticPrb", Sev::inform,
1232 "steps %d (%d rejected, %d SNES fails), ftime %g, nonlinits "
1233 "%d, linits %d",
1234 steps, rejects, snesfails, ftime, nonlinits, linits);
1235
1237}
#define MOFEM_LOG_C(channel, severity, format,...)
#define TSADAPTMOFEM
Definition TsCtx.hpp:10
static boost::shared_ptr< TSUpdate > ts_update_ptr
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomainEle DomainEle
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
auto createDMMatrix(DM dm)
Get smart matrix from DM.
Definition DMMoFEM.hpp:1236
double D
boost::shared_ptr< TSUpdate > createTSUpdate(std::string fe_name, boost::shared_ptr< FEMethod > fe_ptr)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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:1132
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition DMMoFEM.hpp:1321
MoFEMErrorCode MoFEMSNESMonitorFields(SNES snes, PetscInt its, PetscReal fgnorm, SnesCtx *ctx)
Sens monitor printing residual field by field.
Definition SnesCtx.cpp:600
auto getDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
Definition DMMoFEM.hpp:1307
PetscErrorCode TSAdaptCreateMoFEM(TSAdapt adapt)
Craete MOFEM adapt.
Definition TsCtx.cpp:829
static auto createTotalTraction(MoFEM::Interface &m_field)
Class (Function) to enforce essential constrains on the left hand side diagonal.
Definition Essential.hpp:33
Class (Function) to enforce essential constrains on the right hand side diagonal.
Definition Essential.hpp:41
Class (Function) to calculate residual side diagonal.
Definition Essential.hpp:49
Class (Function) to enforce essential constrains.
Definition Essential.hpp:25
Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl.
Solve a local L2 system for integration-point data.
Evaluate local L2 coefficients, also with no attached field.
Element used to execute operators on side of the element.
Execute "this" element in the operator.
Post post-proc data at points from hash maps.

Member Data Documentation

◆ approxBase

FieldApproximationBase PlasticProblem::approxBase = AINSWORTH_LEGENDRE_BASE
private

◆ approxOrder

int PlasticProblem::approxOrder = 2
private

◆ cpPtr

boost::shared_ptr<ClosestPointProjection> PlasticProblem::cpPtr
private

Closest point projection

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 152 of file adolc_plasticity.cpp.

◆ geomOrder

int PlasticProblem::geomOrder = 2
private

◆ largeStrain

PetscBool PlasticProblem::largeStrain = PETSC_FALSE
private

Large strain flag.

Examples
mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp.

Definition at line 150 of file adolc_plasticity.cpp.

◆ mField

MoFEM::Interface& PlasticProblem::mField
private

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