v0.15.0
Loading...
Searching...
No Matches
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::InterfacemField
 
int approxOrder = 2
 
int geomOrder = 2
 
PetscBool largeStrain = PETSC_FALSE
 Large strain flag.
 
FieldApproximationBase approxBase = AINSWORTH_LEGENDRE_BASE
 
boost::shared_ptr< ClosestPointProjectioncpPtr
 

Detailed Description

Examples
adolc_plasticity.cpp.

Definition at line 130 of file adolc_plasticity.cpp.

Constructor & Destructor Documentation

◆ PlasticProblem()

PlasticProblem::PlasticProblem ( MoFEM::Interface & m_field)
inline
Examples
adolc_plasticity.cpp.

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
adolc_plasticity.cpp.

Definition at line 518 of file adolc_plasticity.cpp.

518 {
520 auto *simple = mField.getInterface<Simple>();
521 auto *pipeline_mng = mField.getInterface<PipelineManager>();
522
523 // assemble operator to the right hand side
524 auto add_domain_ops_lhs = [&](auto &pip) {
526 // push forward finite element bases from reference to physical element
528 "GEOMETRY");
529 // create local common data
530 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
531
532 if (largeStrain) {
533 CHKERR
535 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
536 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
537 PETSC>::template BiLinearForm<GAUSS>;
538
539 using OpKPiola =
540 typename B::template OpGradTensorGrad<1, SPACE_DIM, SPACE_DIM, 1>;
541
542 pip.push_back(
543 new OpKPiola("U", "U", common_data_ptr->getMatTangentPtr()));
544 } else {
546 "U", common_data_ptr->getGradAtGaussPtsPtr()));
548 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
549 }
550
552 };
553
554 auto add_domain_ops_rhs = [&](auto &pip) {
556 // push forward finite element bases from reference to physical element
558 "GEOMETRY");
559 // create local common data
560 auto common_data_ptr = boost::make_shared<ADOLCPlasticity::CommonData>();
561
562 if (largeStrain) {
563 CHKERR
565 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
566 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
567 PETSC>::template LinearForm<GAUSS>;
570 pip.push_back(
571 new OpInternalForcePiola("U", common_data_ptr->getStressMatrixPtr()));
572 } else {
574 "U", common_data_ptr->getGradAtGaussPtsPtr()));
576 mField, "U", pip, "ADOLCMAT", common_data_ptr, cpPtr);
577 }
578
579#ifdef ADD_CONTACT
581 pip, "SIGMA", "U");
582#endif // ADD_CONTACT
584 };
585
586 // Push operators to the left hand side pipeline. Indicate that domain (i.e.
587 // volume/interior) element is used.
588 CHKERR add_domain_ops_lhs(pipeline_mng->getOpDomainLhsPipeline());
589 // Push operators to the right hand side pipeline.
590 CHKERR add_domain_ops_rhs(pipeline_mng->getOpDomainRhsPipeline());
591
593}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
@ 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.
MoFEMErrorCode opFactoryDomainHenckyStrainLhs(MoFEM::Interface &m_field, std::string field_name, Pip &pip, std::string block_name, boost::shared_ptr< ADOLCPlasticity::CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
MoFEMErrorCode opFactoryDomainHenckyStrainRhs(MoFEM::Interface &m_field, std::string field_name, Pip &pip, std::string block_name, boost::shared_ptr< ADOLCPlasticity::CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
MoFEMErrorCode opFactoryDomainRhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
MoFEMErrorCode opFactoryDomainLhs(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string field_name, boost::shared_ptr< HenckyOps::CommonData > common_ptr, Sev sev)
MoFEMErrorCode opFactoryDomainRhs(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string field_name, boost::shared_ptr< HenckyOps::CommonData > common_ptr, Sev sev)
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, 1 > OpKPiola
[Only used for dynamics]
Definition seepage.cpp:62
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForcePiola
Definition seepage.cpp:64
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.
Simple interface for fast problem set-up.
Definition Simple.hpp:27
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
adolc_plasticity.cpp.

Definition at line 435 of file adolc_plasticity.cpp.

435 {
437 auto *pipeline_mng = mField.getInterface<PipelineManager>();
439 auto bc_mng = mField.getInterface<BcManager>();
440 auto time_scale = boost::make_shared<TimeScale>();
441
442 auto rule = [](int, int, int p) { return 2 * p; };
443 CHKERR pipeline_mng->setDomainRhsIntegrationRule(cpPtr->integrationRule);
444 CHKERR pipeline_mng->setDomainLhsIntegrationRule(cpPtr->integrationRule);
445 CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(rule);
446 CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(rule);
447
449 pipeline_mng->getOpBoundaryLhsPipeline(), {HDIV}, "GEOMETRY");
450 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
452
454 pipeline_mng->getOpBoundaryRhsPipeline(), {HDIV}, "GEOMETRY");
455 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
457
458 // Add Natural BCs to RHS
460 pipeline_mng->getOpBoundaryRhsPipeline(), mField, "U", {time_scale},
461 Sev::inform);
462 // Add Natural BCs to LHS
464 pipeline_mng->getOpBoundaryLhsPipeline(), mField, "U", Sev::inform);
465
466#ifdef ADD_CONTACT
467 CHKERR
469 pipeline_mng->getOpBoundaryLhsPipeline(), "SIGMA", "U");
470 CHKERR
472 mField, pipeline_mng->getOpBoundaryLhsPipeline(),
473 simple->getDomainFEName(), "SIGMA", "U", "GEOMETRY",
474 cpPtr->integrationRule);
475
476 CHKERR
478 pipeline_mng->getOpBoundaryRhsPipeline(), "SIGMA", "U");
479#endif // ADD_CONTACT
480
481 //! Add body froces
483 pipeline_mng->getOpDomainRhsPipeline(), mField, "U", {time_scale},
484 "BODY_FORCE", Sev::inform);
485
486 // Essential BC
487 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
488 "U", 0, 0);
489 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
490 "U", 1, 1);
491 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
492 "U", 2, 2);
493#ifdef ADD_CONTACT
494 for (auto b : {"FIX_X", "REMOVE_X"})
495 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
496 "SIGMA", 0, 0, false, true);
497 for (auto b : {"FIX_Y", "REMOVE_Y"})
498 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
499 "SIGMA", 1, 1, false, true);
500 for (auto b : {"FIX_Z", "REMOVE_Z"})
501 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
502 "SIGMA", 2, 2, false, true);
503 for (auto b : {"FIX_ALL", "REMOVE_ALL"})
504 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), b,
505 "SIGMA", 0, 3, false, true);
506 CHKERR bc_mng->removeBlockDOFsOnEntities(
507 simple->getProblemName(), "NO_CONTACT", "SIGMA", 0, 3, false, true);
508#endif
509
510 CHKERR bc_mng->pushMarkDOFsOnEntities<DisplacementCubitBcData>(
511 simple->getProblemName(), "U");
512
514}
MoFEMErrorCode opFactoryBoundaryToDomainLhs(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string fe_domain_name, std::string sigma, std::string u, std::string geom, ForcesAndSourcesCore::RuleHookFun rule, bool is_axisymmetric=false)
MoFEMErrorCode opFactoryBoundaryRhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
MoFEMErrorCode opFactoryBoundaryLhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
Simple interface for fast problem set-up.
Definition BcManager.hpp:29
Definition of the displacement bc data structure.
Definition BCData.hpp:72

◆ checkResults()

MoFEMErrorCode PlasticProblem::checkResults ( )
private

[Postprocessing results]

[Check]

Examples
adolc_plasticity.cpp.

Definition at line 1333 of file adolc_plasticity.cpp.

1333 {
1335#ifdef ADD_CONTACT
1337#endif
1339}
static SmartPetscObj< Vec > totalTraction

◆ gettingNorms()

MoFEMErrorCode PlasticProblem::gettingNorms ( )
private

[Solve]

[Getting norms]

Examples
adolc_plasticity.cpp.

Definition at line 1250 of file adolc_plasticity.cpp.

1250 {
1252
1253 auto simple = mField.getInterface<Simple>();
1254 auto dm = simple->getDM();
1255
1256 auto T = createDMVector(simple->getDM());
1257 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
1258 SCATTER_FORWARD);
1259 double nrm2;
1260 CHKERR VecNorm(T, NORM_2, &nrm2);
1261 MOFEM_LOG("PlasticPrb", Sev::inform) << "Solution norm " << nrm2;
1262
1263 auto post_proc_norm_fe = boost::make_shared<DomainEle>(mField);
1264
1265 post_proc_norm_fe->getRuleHook = cpPtr->integrationRule;
1266
1268 post_proc_norm_fe->getOpPtrVector(), {H1});
1269
1270 enum NORMS { U_NORM_L2 = 0, PIOLA_NORM, LAST_NORM };
1271 auto norms_vec =
1273 (mField.get_comm_rank() == 0) ? LAST_NORM : 0, LAST_NORM);
1274 CHKERR VecZeroEntries(norms_vec);
1275
1276 auto u_ptr = boost::make_shared<MatrixDouble>();
1277 post_proc_norm_fe->getOpPtrVector().push_back(
1279
1280 post_proc_norm_fe->getOpPtrVector().push_back(
1281 new OpCalcNormL2Tensor1<SPACE_DIM>(u_ptr, norms_vec, U_NORM_L2));
1282
1283 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
1284 post_proc_norm_fe);
1285
1286 CHKERR VecAssemblyBegin(norms_vec);
1287 CHKERR VecAssemblyEnd(norms_vec);
1288
1289 MOFEM_LOG_CHANNEL("SELF"); // Clear channel from old tags
1290 if (mField.get_comm_rank() == 0) {
1291 const double *norms;
1292 CHKERR VecGetArrayRead(norms_vec, &norms);
1293 MOFEM_TAG_AND_LOG("SELF", Sev::inform, "example")
1294 << "norm_u: " << std::scientific << std::sqrt(norms[U_NORM_L2]);
1295 CHKERR VecRestoreArrayRead(norms_vec, &norms);
1296 }
1297
1299}
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
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:514
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition DMMoFEM.cpp:576
auto createDMVector(DM dm)
Get smart vector from DM.
Definition DMMoFEM.hpp:1102
#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.
Get values at integration pts for tensor field rank 1, i.e. vector field.
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition Simple.cpp:800

◆ outputResults()

MoFEMErrorCode PlasticProblem::outputResults ( )
private

[Getting norms]

[Postprocessing results]

Examples
adolc_plasticity.cpp.

Definition at line 1303 of file adolc_plasticity.cpp.

1303 {
1305 PetscInt test_nb = 0;
1306 PetscBool test_flg = PETSC_FALSE;
1307 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-test", &test_nb, &test_flg);
1308
1309 if (test_flg) {
1310 auto simple = mField.getInterface<Simple>();
1311 auto T = createDMVector(simple->getDM());
1312 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
1313 SCATTER_FORWARD);
1314 double nrm2;
1315 CHKERR VecNorm(T, NORM_2, &nrm2);
1316 MOFEM_LOG("PlasticPrb", Sev::verbose) << "Regression norm " << nrm2;
1317 double regression_value = 0;
1318 switch (test_nb) {
1319 default:
1320 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID, "Wrong test number.");
1321 break;
1322 }
1323 if (fabs(nrm2 - regression_value) > 1e-2)
1324 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
1325 "Regression test field; wrong norm value. %6.4e != %6.4e", nrm2,
1326 regression_value);
1327 }
1329}
@ 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
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}
constexpr int SPACE_DIM
@ 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
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
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, PETSC_NULLPTR);
268 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-geom_order", &geomOrder,
269 PETSC_NULLPTR);
270 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-large_strain", &largeStrain,
271 PETSC_NULLPTR);
272
273 switch (choice_base_value) {
274 case AINSWORTH:
276 MOFEM_LOG("WORLD", Sev::inform)
277 << "Set AINSWORTH_LEGENDRE_BASE for displacements";
278 break;
279 case DEMKOWICZ:
281 MOFEM_LOG("WORLD", Sev::inform)
282 << "Set DEMKOWICZ_JACOBI_BASE for displacements";
283 break;
284 default:
286 break;
287 }
288
289 // Add field
290 CHKERR simple->addDomainField("U", H1, approxBase, SPACE_DIM);
291 CHKERR simple->addBoundaryField("U", H1, approxBase, SPACE_DIM);
292 CHKERR simple->addDataField("GEOMETRY", H1, approxBase, SPACE_DIM);
293
294#ifdef ADD_CONTACT
295 CHKERR simple->addDomainField("SIGMA", CONTACT_SPACE, DEMKOWICZ_JACOBI_BASE,
296 SPACE_DIM);
297 CHKERR simple->addBoundaryField("SIGMA", CONTACT_SPACE, DEMKOWICZ_JACOBI_BASE,
298 SPACE_DIM);
299 auto get_skin = [&]() {
300 Range body_ents;
301 CHKERR mField.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents);
302 Skinner skin(&mField.get_moab());
303 Range skin_ents;
304 CHKERR skin.find_skin(0, body_ents, false, skin_ents);
305 return skin_ents;
306 };
307
308 auto filter_blocks = [&](auto skin) {
309 bool is_contact_block = false;
310 Range contact_range;
311 for (auto m :
313
314 (boost::format("%s(.*)") % "CONTACT").str()
315
316 ))
317
318 ) {
319 is_contact_block =
320 true; ///< bloks interation is collectibe, so that is set irrespective
321 ///< if there are enerities in given rank or not in the block
322 MOFEM_LOG("CONTACT", Sev::inform)
323 << "Find contact block set: " << m->getName();
324 auto meshset = m->getMeshset();
325 Range contact_meshset_range;
326 CHKERR mField.get_moab().get_entities_by_dimension(
327 meshset, SPACE_DIM - 1, contact_meshset_range, true);
328
329 CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(
330 contact_meshset_range);
331 contact_range.merge(contact_meshset_range);
332 }
333 if (is_contact_block) {
334 MOFEM_LOG("SYNC", Sev::inform)
335 << "Nb entities in contact surface: " << contact_range.size();
337 skin = intersect(skin, contact_range);
338 }
339 return skin;
340 };
341
342 auto filter_true_skin = [&](auto skin) {
343 Range boundary_ents;
344 ParallelComm *pcomm =
345 ParallelComm::get_pcomm(&mField.get_moab(), MYPCOMM_INDEX);
346 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
347 PSTATUS_NOT, -1, &boundary_ents);
348 return boundary_ents;
349 };
350
351 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
352#ifdef ADD_CONTACT
353 CHKERR simple->setFieldOrder("SIGMA", 0);
354 CHKERR simple->setFieldOrder("SIGMA", approxOrder - 1, &boundary_ents);
355 CHKERR PetscOptionsGetScalar(PETSC_NULLPTR, "", "-cn_contact",
356 &ContactOps::cn_contact, PETSC_NULLPTR);
357 MOFEM_LOG("CONTACT", Sev::inform) << "cn_contact " << ContactOps::cn_contact;
358
359#endif
360
361#ifdef ENABLE_PYTHON_BINDING
362 sdfPythonPtr = boost::make_shared<ContactOps::SDFPython>();
363 CHKERR sdfPythonPtr->sdfInit("sdf.py");
364 ContactOps::sdfPythonWeakPtr = sdfPythonPtr;
365#endif
366#endif
367
368 CHKERR simple->setFieldOrder("U", approxOrder);
369 CHKERR simple->setFieldOrder("GEOMETRY", geomOrder);
370 CHKERR simple->setUp();
371
372 auto project_ho_geometry = [&]() {
373 Projection10NodeCoordsOnField ent_method(mField, "GEOMETRY");
374 return mField.loop_dofs("GEOMETRY", ent_method);
375 };
376 PetscBool project_geometry = PETSC_TRUE;
377 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-project_geometry",
378 &project_geometry, PETSC_NULLPTR);
379 if (project_geometry) {
380 CHKERR project_ho_geometry();
381 }
382
383 //! [Material models selection]
384
385 /**
386 * FIXME: Here only array of material models is initalized. Each model has
387 * unique set of the ADOL-C tags. Pointer is attached based on block name to
388 * which entity belongs. That will enable heterogeneity of the model, in
389 * addition of heterogeneity of the material properties.
390 */
391
392 enum MaterialModel {
393 VonMisses,
394 VonMissesPlaneStress,
395 Paraboloidal,
396 HeterogeneousParaboloidal,
397 LastModel
398 };
399 const char *list_materials[LastModel] = {"VonMisses", "VonMissesPlaneStress",
400 "Paraboloidal","HeterogeneousParaboloidal"};
401 PetscInt choice_material = VonMisses;
402 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-material", list_materials,
403 LastModel, &choice_material, PETSC_NULLPTR);
404
405 switch (choice_material) {
406 case VonMisses:
408 break;
409 case VonMissesPlaneStress:
410 if (SPACE_DIM != 2)
411 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
412 "VonMissesPlaneStrain is only for 2D case");
414 break;
415 case Paraboloidal:
417 break;
418 case HeterogeneousParaboloidal:
420 break;
421 default:
422 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Wrong material model");
423 }
424
426 cpPtr->integrationRule = [](int, int, int p) { return 2 * (p - 2); };
427
428 //! [Material models selection]
429
431}
static auto filter_true_skin(MoFEM::Interface &m_field, Range &&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 nme:nme847.
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.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
auto createMaterial(std::array< int, ClosestPointProjection::LAST_TAPE > tapes_tags={0, 1, 2})
double cn_contact
Definition contact.cpp:99
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
adolc_plasticity.cpp.

Definition at line 795 of file adolc_plasticity.cpp.

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

Definition at line 151 of file adolc_plasticity.cpp.

◆ approxOrder

int PlasticProblem::approxOrder = 2
private
Examples
adolc_plasticity.cpp.

Definition at line 148 of file adolc_plasticity.cpp.

◆ cpPtr

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

Closest point projection

Examples
adolc_plasticity.cpp.

Definition at line 152 of file adolc_plasticity.cpp.

◆ geomOrder

int PlasticProblem::geomOrder = 2
private
Examples
adolc_plasticity.cpp.

Definition at line 149 of file adolc_plasticity.cpp.

◆ largeStrain

PetscBool PlasticProblem::largeStrain = PETSC_FALSE
private

Large strain flag.

Examples
adolc_plasticity.cpp.

Definition at line 150 of file adolc_plasticity.cpp.

◆ mField

MoFEM::Interface& PlasticProblem::mField
private
Examples
adolc_plasticity.cpp.

Definition at line 137 of file adolc_plasticity.cpp.


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