v0.16.3
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
UmatExample Struct Reference

#include "users_modules/um_ageing_umat/src/UmatExample.hpp"

Inheritance diagram for UmatExample:
[legend]
Collaboration diagram for UmatExample:
[legend]

Classes

struct  TSElasticPostStep
 

Public Member Functions

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

Protected Member Functions

MoFEMErrorCode readMesh ()
 [Run problem]
 
MoFEMErrorCode tagTransfer ()
 [Read mesh]
 
MoFEMErrorCode setupProblem ()
 [Set up problem]
 
MoFEMErrorCode boundaryCondition ()
 [Set up problem]
 
MoFEMErrorCode assembleSystemAdolc ()
 
MoFEMErrorCode opTest ()
 [Boundary condition]
 
MoFEMErrorCode TsSolve ()
 [TS Solve]
 
MoFEMErrorCode gettingNorms ()
 [TS Solve]
 
MoFEMErrorCode select_statev_tags (MatOps::StateTags &statev_tags)
 

Static Protected Member Functions

static PetscInt get_statev_index (const std::string &name)
 
static auto get_skin (MoFEM::Interface &m_field, Range body_ents)
 
static auto filter_true_skin (MoFEM::Interface &m_field, Range &&skin)
 

Protected Attributes

MoFEM::Interface & mField
 
boost::shared_ptr< DomainEle > updateFe
 
boost::shared_ptr< PostProcEleDomain > postProcDomainFe
 
boost::shared_ptr< PostProcEleBdy > postProcBdyFe
 
FieldApproximationBase approximationBase = AINSWORTH_LEGENDRE_BASE
 
PetscReal acceptedTime = 0
 
PetscReal acceptedDt = 0
 
PetscInt acceptedStep = 0
 
std::vector< Tag > listTagsToTransfer
 list of tags to transfer to postprocessor
 
boost::shared_ptr< MatOps::PhysicalEquations > physicalEquationsPtr
 
MatOps::StateTags postProcStateTags
 

Static Protected Attributes

static constexpr int modelType
 

Detailed Description

Definition at line 23 of file UmatExample.hpp.

Constructor & Destructor Documentation

◆ UmatExample()

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

Definition at line 25 of file UmatExample.hpp.

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

Member Function Documentation

◆ assembleSystemAdolc()

MoFEMErrorCode UmatExample::assembleSystemAdolc ( )
protected

Definition at line 482 of file UmatExample.hpp.

482 {
484
485 auto *pipeline_mng = mField.getInterface<PipelineManager>();
486
487 auto integration_rule = [](int approx_order, int, int ) {
488 return 2 * (approx_order - 1) ;
489 };
490
491 CHKERR pipeline_mng->setDomainRhsIntegrationRule(integration_rule);
492 CHKERR pipeline_mng->setDomainLhsIntegrationRule(integration_rule);
493 CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(integration_rule);
494 CHKERR pipeline_mng->setEvaluationIntegrationRule(integration_rule);
495
496 auto mat_ops_data_ptr = MatOps::createMatOpsDataPtr();
497
499 MatOps::createMatOpsPhysicalEquationsPtr<MatOps::AMENTUM_UMAT, modelType>(
500 mat_ops_data_ptr,
502 CHKERR physicalEquationsPtr->getOptions(&mField);
503 CHKERR physicalEquationsPtr->recordTape();
504
505 auto add_domain_ops_lhs = [&](auto &pip) {
507 CHKERR AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(pip, {H1},
508 "GEOMETRY");
511 template opLhsFactory<PETSC, GAUSS, DomainEleOp>(
512 mField, pip, "U", physicalEquationsPtr);
513 }
515 };
516
517 auto add_domain_ops_rhs = [&](auto &pip) {
519 CHKERR AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(pip, {H1},
520 "GEOMETRY");
523 template opRhsFactory<PETSC, GAUSS, DomainEleOp>(
524 mField, pip, "U", physicalEquationsPtr);
525 }
527 };
528
529 auto add_domain_ops_update = [&](auto &pip) {
531 CHKERR AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(pip, {H1},
532 "GEOMETRY");
535 MatOps::PIOLA_RESPONSE, modelType>::opUpdateFactory(mField, pip, "U",
537 }
539 };
540
541 CHKERR add_domain_ops_lhs(pipeline_mng->getOpDomainLhsPipeline());
542 CHKERR add_domain_ops_rhs(pipeline_mng->getOpDomainRhsPipeline());
543
544 updateFe = boost::make_shared<DomainEle>(mField);
545 updateFe->getRuleHook = integration_rule;
546 CHKERR add_domain_ops_update(updateFe->getOpPtrVector());
547
548 CHKERR add_domain_ops_rhs(pipeline_mng->getOpEvaluationPipeline());
549 auto &domain_reaction_fe = pipeline_mng->getEvaluationFE();
550 domain_reaction_fe->postProcessHook =
551 EssentialPreProcReaction<DisplacementCubitBcData>(mField,
552 domain_reaction_fe);
553
554 PetscBool post_proc_vol;
555 PetscBool post_proc_skin;
556
557 if constexpr (SPACE_DIM == 2) {
558 post_proc_vol = PETSC_TRUE;
559 post_proc_skin = PETSC_FALSE;
560 } else {
561 post_proc_vol = PETSC_FALSE;
562 post_proc_skin = PETSC_TRUE;
563 }
564
565 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-post_proc_vol",
566 &post_proc_vol, PETSC_NULLPTR);
567 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-post_proc_skin",
568 &post_proc_skin, PETSC_NULLPTR);
569
570 // Setup postprocessing
571 auto select_post_proc_state_tags = [&]() {
573 postProcStateTags.clear();
576
577 const auto state_tags = physicalEquationsPtr->matOpsDataPtr->getStateTags();
578 MatOps::StateTags statev_tags;
579 postProcStateTags.reserve(state_tags.size());
580 statev_tags.reserve(state_tags.size());
581
582 constexpr auto statev_prefix = "UMAT_STATEV_";
583 for (const auto &state_tag : state_tags) {
584 const auto &name = state_tag.name;
585 if (name == "AMENTUM_FIELD_IRRA" ||
586 name == "AMENTUM_FIELD_PREDEF_TEMP" ||
587 name == "AMENTUM_FIELD_CORR" || name == "AMENTUM_TEMP" ||
588 name == "AMENTUM_DTEMP" || name == "FIRST_PIOLA_TAG" ||
589 name == "AMENTUM_DEBUG" || name == "UMAT_STRESS" ||
590 name == "UMAT_DFGRD0") {
591 postProcStateTags.push_back(state_tag);
592 } else if (name.rfind(statev_prefix, 0) == 0) {
593 statev_tags.push_back(state_tag);
594 }
595 }
596
597 std::sort(statev_tags.begin(), statev_tags.end(),
598 [](const auto &lhs, const auto &rhs) {
599 return get_statev_index(lhs.name) < get_statev_index(rhs.name);
600 });
601 if (!state_tags.empty()) {
602 CHKERR select_statev_tags(statev_tags);
603 std::ostringstream output_sdv_log;
604 bool first_output_sdv = true;
605 for (const auto &state_tag : statev_tags) {
606 if (!first_output_sdv)
607 output_sdv_log << ',';
608 output_sdv_log << get_statev_index(state_tag.name);
609 first_output_sdv = false;
610 }
611 MOFEM_LOG("EXAMPLE", Sev::inform)
612 << "Output UMAT SDV indices: " << output_sdv_log.str();
613 }
614 postProcStateTags.insert(postProcStateTags.end(), statev_tags.begin(),
615 statev_tags.end());
617 };
618 CHKERR select_post_proc_state_tags();
619
620 auto create_post_proc_fe = [&]() {
621 using OpPPMap = OpPostProcMapInMoab<SPACE_DIM, SPACE_DIM>;
622
623 auto post_proc_ele_domain = [&](auto &pip_domain) {
625 CHKERR AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(pip_domain, {H1},
626 "GEOMETRY");
628 // Plotting points have no UMAT history. Project accepted state below;
629 // evaluate only kinematics at these points.
632 pip_domain, "U",
633 physicalEquationsPtr->matOpsDataPtr->getCommonDataPtr("grad"));
634 }
636 };
637
638 auto post_proc_map = [&](auto &pip, auto u_ptr) {
641 OpPPMap::DataMapMat post_proc_fields_map;
642 auto grad_ptr =
643 physicalEquationsPtr->matOpsDataPtr->getCommonDataPtr("grad");
644 post_proc_fields_map["GRAD"] = grad_ptr;
645 pip->getOpPtrVector().push_back(
646 new OpPPMap(pip->getPostProcMesh(), pip->getMapGaussPts(), {},
647 {{"U", u_ptr}}, post_proc_fields_map, {}));
648 }
650 };
651
652 auto post_proc_state = [&](auto &pip, auto &post_proc_fe) {
654 if (!postProcStateTags.empty()) {
655 auto simple = mField.getInterface<Simple>();
656 int state_projection_order = 0;
657 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-state_projection_order",
658 &state_projection_order, PETSC_NULLPTR);
659 auto op_loop_this = new OpLoopThis<DomainEle>(
660 mField, simple->getDomainFEName(), Sev::noisy);
661 op_loop_this->getThisFEPtr()->getRuleHook = integration_rule;
662 pip.push_back(op_loop_this);
663 CHKERR addTagDGProjectionOps<SPACE_DIM, SPACE_DIM>(
664 mField.get_moab(), pip,
665 op_loop_this->getThisFEPtr()->getOpPtrVector(),
666 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
667 postProcStateTags, state_projection_order, approximationBase);
668 }
670 };
671
672 auto push_post_proc_bdy = [&](auto &pip_bdy) {
673 if (post_proc_skin == PETSC_FALSE)
674 return boost::shared_ptr<PostProcEleBdy>();
675 auto simple = mField.getInterface<Simple>();
676 auto domain_fe_name = simple->getDomainFEName();
677 auto u_ptr = boost::make_shared<MatrixDouble>();
678 pip_bdy->getOpPtrVector().push_back(
679 new OpCalculateVectorFieldValues<SPACE_DIM>("U", u_ptr));
680 auto op_loop_side =
681 new OpLoopSide<SideEle>(mField, domain_fe_name, SPACE_DIM);
682 CHKERR post_proc_ele_domain(op_loop_side->getOpPtrVector());
683 CHKERR post_proc_state(op_loop_side->getOpPtrVector(), pip_bdy);
684 pip_bdy->getOpPtrVector().push_back(op_loop_side);
685 CHKERR post_proc_map(pip_bdy, u_ptr);
686 return pip_bdy;
687 };
688
689 auto push_post_proc_domain = [&](auto &pip_domain) {
690 if (post_proc_vol == PETSC_FALSE)
691 return boost::shared_ptr<PostProcEleDomain>();
692 auto u_ptr = boost::make_shared<MatrixDouble>();
693 pip_domain->getOpPtrVector().push_back(
694 new OpCalculateVectorFieldValues<SPACE_DIM>("U", u_ptr));
695 CHKERR post_proc_ele_domain(pip_domain->getOpPtrVector());
696
697 CHKERR post_proc_state(pip_domain->getOpPtrVector(), pip_domain);
698
699 CHKERR post_proc_map(pip_domain, u_ptr);
700
701 return pip_domain;
702 };
703
704 auto post_proc_fe_domain = boost::make_shared<PostProcEleDomain>(mField);
705 auto post_proc_fe_bdy = boost::make_shared<PostProcEleBdy>(mField);
706
707 return std::make_pair(push_post_proc_domain(post_proc_fe_domain),
708 push_post_proc_bdy(post_proc_fe_bdy));
709 };
710
711 auto post_proc_pair = create_post_proc_fe();
712 postProcDomainFe = post_proc_pair.first;
713 postProcBdyFe = post_proc_pair.second;
714
716}
std::string name
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
constexpr int SPACE_DIM
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ H1
continuous field
Definition definitions.h:85
#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.
auto integration_rule
#define MOFEM_LOG(channel, severity)
Log.
std::vector< StateTag > StateTags
Definition MatOps.hpp:21
boost::shared_ptr< MatOpsData > createMatOpsDataPtr()
Definition MatOps.cpp:709
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static constexpr int approx_order
static int setTagName(std::string name, int tag=-1)
Definition MatOps.cpp:29
virtual moab::Interface & get_moab()=0
Post post-proc data at points from hash maps.
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static PetscInt get_statev_index(const std::string &name)
MoFEMErrorCode select_statev_tags(MatOps::StateTags &statev_tags)
MatOps::StateTags postProcStateTags
boost::shared_ptr< PostProcEleBdy > postProcBdyFe
static constexpr int modelType
FieldApproximationBase approximationBase
boost::shared_ptr< MatOps::PhysicalEquations > physicalEquationsPtr
boost::shared_ptr< PostProcEleDomain > postProcDomainFe
boost::shared_ptr< DomainEle > updateFe

◆ boundaryCondition()

MoFEMErrorCode UmatExample::boundaryCondition ( )
protected

[Set up problem]

[Boundary condition]

[Define gravity vector]

Definition at line 318 of file UmatExample.hpp.

318 {
320 auto *pipeline_mng = mField.getInterface<PipelineManager>();
321 auto simple = mField.getInterface<Simple>();
322 auto bc_mng = mField.getInterface<BcManager>();
323 auto time_scale = boost::make_shared<ExampleTimeScale>();
324
326 pipeline_mng->getOpBoundaryRhsPipeline(), mField, "U", {time_scale},
327 "FORCE", "PRESSURE", Sev::inform);
328
329 //! [Define gravity vector]
331 pipeline_mng->getOpDomainRhsPipeline(), mField, "U", {time_scale},
332 "BODY_FORCE", Sev::inform);
333
334 // Essential BC
335 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
336 "U", 0, 0);
337 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
338 "U", 1, 1);
339 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
340 "U", 2, 2);
341 CHKERR bc_mng->pushMarkDOFsOnEntities<DisplacementCubitBcData>(
342 simple->getProblemName(), "U");
343
345}

◆ filter_true_skin()

static auto UmatExample::filter_true_skin ( MoFEM::Interface &  m_field,
Range &&  skin 
)
inlinestaticprotected
Examples
mofem/tutorials/adv-0_plasticity/plastic.cpp.

Definition at line 116 of file UmatExample.hpp.

116 {
117 Range boundary_ents;
118 ParallelComm *pcomm =
119 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
120 CHK_MOAB_THROW(pcomm->filter_pstatus(skin,
121 PSTATUS_SHARED | PSTATUS_MULTISHARED,
122 PSTATUS_NOT, -1, &boundary_ents),
123 "filter_pstatus");
124 return boundary_ents;
125 };
FaceSet skin
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.

◆ get_skin()

static auto UmatExample::get_skin ( MoFEM::Interface &  m_field,
Range  body_ents 
)
inlinestaticprotected

Definition at line 109 of file UmatExample.hpp.

109 {
110 Skinner skin(&m_field.get_moab());
111 Range skin_ents;
112 CHK_MOAB_THROW(skin.find_skin(0, body_ents, false, skin_ents), "find_skin");
113 return skin_ents;
114 };

◆ get_statev_index()

static PetscInt UmatExample::get_statev_index ( const std::string &  name)
inlinestaticprotected

Definition at line 50 of file UmatExample.hpp.

50 {
51 constexpr auto statev_prefix_len = sizeof("UMAT_STATEV_") - 1;
52 return std::stoi(name.substr(statev_prefix_len));
53 }

◆ gettingNorms()

MoFEMErrorCode UmatExample::gettingNorms ( )
protected

[TS Solve]

[Getting norms]

Definition at line 937 of file UmatExample.hpp.

937 {
939
940 auto simple = mField.getInterface<Simple>();
941 auto dm = simple->getDM();
942
943 auto T = createDMVector(simple->getDM());
944 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
945 SCATTER_FORWARD);
946 double nrm2;
947 CHKERR VecNorm(T, NORM_2, &nrm2);
948 MOFEM_LOG("EXAMPLE", Sev::inform) << "Solution norm " << nrm2;
949
950 auto post_proc_norm_fe = boost::make_shared<DomainEle>(mField);
951 post_proc_norm_fe->ts_t = acceptedTime;
952 post_proc_norm_fe->ts_dt = acceptedDt;
953 post_proc_norm_fe->ts_step = acceptedStep;
954
955 auto post_proc_norm_rule_hook = [](int, int, int p) -> int { return 2 * p; };
956 post_proc_norm_fe->getRuleHook = post_proc_norm_rule_hook;
957
958 CHKERR AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
959 post_proc_norm_fe->getOpPtrVector(), {H1}, "GEOMETRY");
960
961 enum NORMS { U_NORM_L2 = 0, PIOLA_NORM, LAST_NORM };
962 auto norms_vec =
964 (mField.get_comm_rank() == 0) ? LAST_NORM : 0, LAST_NORM);
965 CHKERR VecZeroEntries(norms_vec);
966
967 auto u_ptr = boost::make_shared<MatrixDouble>();
968 post_proc_norm_fe->getOpPtrVector().push_back(
969 new OpCalculateVectorFieldValues<SPACE_DIM>("U", u_ptr));
970
971 post_proc_norm_fe->getOpPtrVector().push_back(
972 new OpCalcNormL2Tensor1<SPACE_DIM>(u_ptr, norms_vec, U_NORM_L2));
973
976 opPostProcFactory(mField, post_proc_norm_fe->getOpPtrVector(), "U",
978 struct OpGetFirstPiolaTag : public DomainEleOp {
979 OpGetFirstPiolaTag(moab::Interface &mesh,
980 MatOps::StateTag first_piola_tag,
981 boost::shared_ptr<MatrixDouble> first_piola_ptr)
982 : DomainEleOp(NOSPACE, DomainEleOp::OPSPACE), meshRef(mesh),
983 firstPiolaTag(first_piola_tag), firstPiolaPtr(first_piola_ptr) {}
984
985 MoFEMErrorCode doWork(int, EntityType,
986 EntitiesFieldData::EntData &) override {
988 const auto nb_gauss_pts = this->getGaussPts().size2();
989 firstPiolaPtr->resize(nb_gauss_pts, SPACE_DIM * SPACE_DIM, false);
990 std::fill(firstPiolaPtr->data().begin(), firstPiolaPtr->data().end(),
991 0.);
992
993 const auto ent = this->getFEEntityHandle();
994 double *tag_data = nullptr;
995 int tag_size = 0;
996 CHKERR meshRef.tag_get_by_ptr(firstPiolaTag.tag, &ent, 1,
997 (const void **)&tag_data, &tag_size);
998
999 if (!tag_data ||
1000 tag_size < static_cast<int>(nb_gauss_pts *
1001 firstPiolaTag.numComponents)) {
1002 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1003 "Missing FIRST_PIOLA_TAG data for Piola norm");
1004 }
1005
1006 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1007 for (int dd = 0; dd != firstPiolaTag.numComponents; ++dd)
1008 (*firstPiolaPtr)(gg, dd) =
1009 tag_data[gg * firstPiolaTag.numComponents + dd];
1010 }
1011
1013 }
1014
1015 moab::Interface &meshRef;
1016 MatOps::StateTag firstPiolaTag;
1017 boost::shared_ptr<MatrixDouble> firstPiolaPtr;
1018 };
1019
1020 auto state_tags = physicalEquationsPtr->matOpsDataPtr->getStateTags();
1021 auto first_piola_tag_it = std::find_if(
1022 state_tags.begin(), state_tags.end(), [](const auto &state_tag) {
1023 return state_tag.name == "FIRST_PIOLA_TAG";
1024 });
1025 if (first_piola_tag_it == state_tags.end()) {
1026 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1027 "FIRST_PIOLA_TAG is not available for Piola norm");
1028 }
1029 if (first_piola_tag_it->numComponents != SPACE_DIM * SPACE_DIM) {
1030 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
1031 "FIRST_PIOLA_TAG has inconsistent size for Piola norm");
1032 }
1033
1034 post_proc_norm_fe->getRuleHook = [](int p, int, int) -> int {
1035 return 2 * (p - 1);
1036 };
1037 auto first_piola_ptr = boost::make_shared<MatrixDouble>();
1038 post_proc_norm_fe->getOpPtrVector().push_back(new OpGetFirstPiolaTag(
1039 mField.get_moab(), *first_piola_tag_it, first_piola_ptr));
1040 post_proc_norm_fe->getOpPtrVector().push_back(
1041 new OpCalcNormL2Tensor2<SPACE_DIM, SPACE_DIM>(first_piola_ptr,
1042 norms_vec, PIOLA_NORM));
1043 }
1044
1045 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
1046 post_proc_norm_fe);
1047
1048 CHKERR VecAssemblyBegin(norms_vec);
1049 CHKERR VecAssemblyEnd(norms_vec);
1050
1051 MOFEM_LOG_CHANNEL("SELF"); // Clear channel from old tags
1052 if (mField.get_comm_rank() == 0) {
1053 const double *norms;
1054 CHKERR VecGetArrayRead(norms_vec, &norms);
1055 MOFEM_TAG_AND_LOG("SELF", Sev::inform, "example")
1056 << "norm_u: " << std::scientific << std::sqrt(norms[U_NORM_L2]);
1057 MOFEM_TAG_AND_LOG("SELF", Sev::inform, "example")
1058 << "norm_piola: " << std::scientific << std::sqrt(norms[PIOLA_NORM]);
1059 CHKERR VecRestoreArrayRead(norms_vec, &norms);
1060 }
1061
1063}
WorkMesh mesh
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
@ NOSPACE
Definition definitions.h:83
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
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(channel)
Set and reset channel.
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition ddTensor0.hpp:33
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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
PetscReal acceptedDt
PetscInt acceptedStep
PetscReal acceptedTime

◆ opTest()

MoFEMErrorCode UmatExample::opTest ( )
protected

[Boundary condition]

Definition at line 348 of file UmatExample.hpp.

348 {
350
351 // get operators tester
352 auto simple = mField.getInterface<Simple>();
353 auto opt = mField.getInterface<OperatorsTester>(); // get interface to
354 // OperatorsTester
355 auto pip = mField.getInterface<PipelineManager>(); // get interface to
356 // pipeline manager
357
358 constexpr double eps = 1e-9;
359
360 auto x = opt->setRandomFields(simple->getDM(), {
361
362 {"U", {-1e-6, 1e-6}}
363
364 });
365
366 auto dot_x = opt->setRandomFields(simple->getDM(), {
367
368 {"U", {-1, 1}}
369
370 });
371
372 auto diff_x = opt->setRandomFields(simple->getDM(), {
373
374 {"U", {-1, 1}}
375
376 });
377
378 auto test_domain_ops = [&](auto fe_name, auto lhs_pipeline,
379 auto rhs_pipeline) {
381
382 auto diff_res = opt->checkCentralFiniteDifference(
383 simple->getDM(), fe_name, rhs_pipeline, lhs_pipeline, x, dot_x,
384 SmartPetscObj<Vec>(), diff_x, 0, 0.5, eps);
385
386 // Calculate norm of difference between directional derivative calculated
387 // from finite difference, and tangent matrix.
388 double fnorm;
389 CHKERR VecNorm(diff_res, NORM_2, &fnorm);
390 MOFEM_LOG_C("EXAMPLE", Sev::inform,
391 "Test consistency of tangent matrix %3.4e", fnorm);
392
393 constexpr double err = 1e-5;
394 if (fnorm > err)
395 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
396 "Norm of directional derivative too large err = %3.4e", fnorm);
397
399 };
400
401 MOFEM_LOG("EXAMPLE", Sev::inform)
402 << "Test operators with finite difference of directional "
403 "derivative";
404 CHKERR test_domain_ops(simple->getDomainFEName(), pip->getDomainLhsFE(),
405 pip->getDomainRhsFE());
406
408}
#define MOFEM_LOG_C(channel, severity, format,...)
static const double eps
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40

◆ readMesh()

MoFEMErrorCode UmatExample::readMesh ( )
protected

[Run problem]

[Read mesh]

Definition at line 152 of file UmatExample.hpp.

152 {
154 auto simple = mField.getInterface<Simple>();
155 CHKERR simple->getOptions();
156 CHKERR simple->loadFile();
157 CHKERR mField.getInterface<MeshsetsManager>()->setMeshsetFromFile();
159}

◆ runProblem()

MoFEMErrorCode UmatExample::runProblem ( )

[Run problem]

Definition at line 129 of file UmatExample.hpp.

129 {
135
136 PetscBool test_op = PETSC_FALSE;
137 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, "", "-test_op", &test_op,
138 PETSC_NULLPTR);
139
141
142 if (test_op == PETSC_TRUE) {
143 CHKERR opTest();
144 }
145 CHKERR TsSolve();
148}
MoFEMErrorCode TsSolve()
[TS Solve]
MoFEMErrorCode assembleSystemAdolc()
MoFEMErrorCode gettingNorms()
[TS Solve]
MoFEMErrorCode setupProblem()
[Set up problem]
MoFEMErrorCode readMesh()
[Run problem]
MoFEMErrorCode tagTransfer()
[Read mesh]
MoFEMErrorCode opTest()
[Boundary condition]
MoFEMErrorCode boundaryCondition()
[Set up problem]

◆ select_statev_tags()

MoFEMErrorCode UmatExample::select_statev_tags ( MatOps::StateTags &  statev_tags)
protected

Definition at line 410 of file UmatExample.hpp.

411 {
413
414 char output_sdv[PETSC_MAX_PATH_LEN];
415 PetscBool output_sdv_flg = PETSC_FALSE;
416 CHKERR PetscOptionsGetString(PETSC_NULLPTR, "", "-output_sdv", output_sdv,
417 sizeof(output_sdv), &output_sdv_flg);
418
419 if (output_sdv_flg == PETSC_TRUE) {
420 std::set<PetscInt> selected_sdv_indices;
421 auto parse_sdv_index = [](const std::string &str, PetscInt &index) {
422 std::istringstream stream(str);
423 std::string remainder;
424 return (stream >> index) && !(stream >> remainder);
425 };
426 std::istringstream output_sdv_stream(output_sdv);
427 std::string output_sdv_item;
428 while (std::getline(output_sdv_stream, output_sdv_item, ',')) {
429 const auto range_separator = output_sdv_item.find('-');
430 PetscInt first_index;
431 PetscInt last_index;
432 if (range_separator == std::string::npos) {
433 if (!parse_sdv_index(output_sdv_item, first_index) || first_index < 0)
434 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
435 "Invalid -output_sdv index %s", output_sdv_item.c_str());
436 selected_sdv_indices.insert(first_index);
437 } else {
438 if (!parse_sdv_index(output_sdv_item.substr(0, range_separator),
439 first_index) ||
440 !parse_sdv_index(output_sdv_item.substr(range_separator + 1),
441 last_index) ||
442 first_index < 0 || last_index < 0 || first_index > last_index)
443 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
444 "Invalid -output_sdv range %s", output_sdv_item.c_str());
445 for (auto index = first_index;; ++index) {
446 selected_sdv_indices.insert(index);
447 if (index == last_index)
448 break;
449 }
450 }
451 }
452 MatOps::StateTags output_statev_tags;
453 output_statev_tags.reserve(selected_sdv_indices.size());
454 for (const auto &state_tag : statev_tags) {
455 const auto statev_index = get_statev_index(state_tag.name);
456 if (selected_sdv_indices.erase(statev_index) != 0)
457 output_statev_tags.push_back(state_tag);
458 }
459
460 if (!selected_sdv_indices.empty())
461 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
462 "Requested -output_sdv index %" PetscInt_FMT
463 " does not correspond to an available UMAT state variable",
464 *selected_sdv_indices.begin());
465
466 statev_tags.swap(output_statev_tags);
467 } else if (statev_tags.size() > 30) {
468 MatOps::StateTags output_statev_tags;
469 output_statev_tags.reserve(33);
470 for (const auto &state_tag : statev_tags) {
471 const auto statev_index = get_statev_index(state_tag.name);
472 if (output_statev_tags.size() < 30 || statev_index == 35 ||
473 statev_index == 41 || statev_index == 50)
474 output_statev_tags.push_back(state_tag);
475 }
476 statev_tags.swap(output_statev_tags);
477 }
478
480}
std::map< EntityHandle, int > index
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)

◆ setupProblem()

MoFEMErrorCode UmatExample::setupProblem ( )
protected

[Set up problem]

Definition at line 182 of file UmatExample.hpp.

182 {
184 Simple *simple = mField.getInterface<Simple>();
185
186 enum bases { AINSWORTH, DEMKOWICZ, LASBASETOPT };
187 const char *list_bases[LASBASETOPT] = {"ainsworth", "demkowicz"};
188 PetscInt choice_base_value = AINSWORTH;
189 CHKERR PetscOptionsGetEList(PETSC_NULLPTR, NULL, "-base", list_bases,
190 LASBASETOPT, &choice_base_value, PETSC_NULLPTR);
191
192 switch (choice_base_value) {
193 case AINSWORTH:
195 MOFEM_LOG("WORLD", Sev::inform)
196 << "Set AINSWORTH_LEGENDRE_BASE for displacements";
197 break;
198 case DEMKOWICZ:
200 MOFEM_LOG("WORLD", Sev::inform)
201 << "Set DEMKOWICZ_JACOBI_BASE for displacements";
202 break;
203 default:
205 break;
206 }
207
208 // Add field
209 CHKERR simple->addDomainField("U", H1, approximationBase, SPACE_DIM);
210 CHKERR simple->addBoundaryField("U", H1, approximationBase, SPACE_DIM);
211 CHKERR simple->addDataField("GEOMETRY", H1, approximationBase, SPACE_DIM);
212 int order = 2;
213 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-order", &order, PETSC_NULLPTR);
214 CHKERR simple->setFieldOrder("U", order);
215 CHKERR simple->setFieldOrder("GEOMETRY", 2);
216 CHKERR simple->setUp();
217
218 auto project_ho_geometry = [&]() {
219 Projection10NodeCoordsOnField ent_method(mField, "GEOMETRY");
220 return mField.loop_dofs("GEOMETRY", ent_method);
221 };
222 CHKERR project_ho_geometry();
223
224 MOFEM_LOG("WORLD", Sev::inform) << "Use ageing UMAT material model";
225
226 auto tag_meshest = [&]() {
228
229 auto set_block = [&](auto name, int dim) {
230 std::map<int, Range> map;
231 auto set_tag_impl = [&](auto name) {
233 auto mesh_mng = mField.getInterface<MeshsetsManager>();
234 auto bcs = mesh_mng->getCubitMeshsetPtr(
235
236 std::regex((boost::format("%s(.*)") % name).str())
237
238 );
239 std::map<int, int> ids_map;
240 int bit_id = 1;
241 for (auto bc : bcs) {
242 int id = bc->getMeshsetId();
243 ids_map[id] = bit_id;
244 bit_id <<= 1;
245 }
246 for (auto bc : bcs) {
247 Range r;
248 CHKERR bc->getMeshsetIdEntitiesByDimension(mField.get_moab(), dim, r,
249 true);
250 map[ids_map[bc->getMeshsetId()]] = r;
251 MOFEM_LOG("EXAMPLE", Sev::inform)
252 << "Block " << name << " id " << bc->getMeshsetId() << " : "
253 << ids_map[bc->getMeshsetId()] << " has " << r.size()
254 << " entities";
255 }
257 };
258
259 CHKERR set_tag_impl(name);
260
261 return std::make_pair(name, map);
262 };
263
264 auto set_skin = [&](auto &&map) {
265 for (auto &m : map.second) {
266 auto s = filter_true_skin(mField, get_skin(mField, m.second));
267 m.second.swap(s);
268 MOFEM_LOG("EXAMPLE", Sev::inform)
269 << "Skin for block " << map.first << " id " << m.first << " has "
270 << m.second.size() << " entities";
271 }
272 return map;
273 };
274
275 auto set_tag = [&](auto &&map) {
276 Tag th;
277 auto name = map.first;
278 int def_val[] = {-1};
279 CHK_MOAB_THROW(mField.get_moab().tag_get_handle(
280 name, 1, MB_TYPE_INTEGER, th,
281 MB_TAG_SPARSE | MB_TAG_CREAT, def_val),
282 "create tag");
283 for (auto &m : map.second) {
284 int id = m.first;
285 for (auto ent : m.second) {
286 int current_id;
288 mField.get_moab().tag_get_data(th, &ent, 1, &current_id),
289 "get tag data");
290 if (current_id != -1) {
291 id |= current_id;
292 }
293 CHK_MOAB_THROW(mField.get_moab().tag_set_data(th, &ent, 1, &id),
294 "set tag data");
295 }
296 }
297 return th;
298 };
299
300 if (SPACE_DIM == 3) {
301 listTagsToTransfer.push_back(set_tag(set_block("MAT_", 3)));
302 listTagsToTransfer.push_back(set_tag(set_skin(set_block("MAT_", 3))));
303 } else {
304 listTagsToTransfer.push_back(set_tag(set_block("MAT_", 2)));
305 }
306
308 };
309
310 CHKERR tag_meshest();
311
313}
@ LASTBASE
Definition definitions.h:69
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
constexpr int order
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.
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
int r
Definition sdf.py:205
FTensor::Index< 'm', 3 > m
static auto get_skin(MoFEM::Interface &m_field, Range body_ents)
std::vector< Tag > listTagsToTransfer
list of tags to transfer to postprocessor
static auto filter_true_skin(MoFEM::Interface &m_field, Range &&skin)

◆ tagTransfer()

MoFEMErrorCode UmatExample::tagTransfer ( )
protected

[Read mesh]

Transfer environmental snapshots when a source file is supplied.

Definition at line 163 of file UmatExample.hpp.

163 {
165 char source_file[PETSC_MAX_PATH_LEN] = "";
166 PetscBool supplied = PETSC_FALSE;
167 CHKERR PetscOptionsGetString(nullptr, nullptr, "-tag_transfer_file",
168 source_file, sizeof(source_file), &supplied);
169 if (!supplied)
171
172 auto simple = mField.getInterface<Simple>();
173 Range target_elements;
174 CHKERR mField.get_moab().get_entities_by_dimension(
175 simple->getMeshset(), 3, target_elements, true);
176 AgingTagTransfer transfer(mField);
177 CHKERR transfer.transfer(source_file, target_elements);
179}

◆ TsSolve()

MoFEMErrorCode UmatExample::TsSolve ( )
protected

[TS Solve]

Definition at line 719 of file UmatExample.hpp.

719 {
721 auto *simple = mField.getInterface<Simple>();
722 auto *pipeline_mng = mField.getInterface<PipelineManager>();
723
724 auto dm = simple->getDM();
725 auto ts = pipeline_mng->createTSIM();
726
727 auto add_extra_finite_elements_to_solver_pipelines = [&]() {
729
730 auto pre_proc_ptr = boost::make_shared<FEMethod>();
731 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
732 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
733
734 auto time_scale = boost::make_shared<ExampleTimeScale>();
735
736 auto get_bc_hook_rhs = [this, pre_proc_ptr, time_scale]() {
738 CHKERR EssentialPreProc<DisplacementCubitBcData>(mField, pre_proc_ptr,
739 {time_scale}, false)();
741 };
742
743 pre_proc_ptr->preProcessHook = get_bc_hook_rhs;
744
745 auto get_post_proc_hook_rhs = [this, post_proc_rhs_ptr]() {
747 CHKERR EssentialPreProcReaction<DisplacementCubitBcData>(
748 mField, post_proc_rhs_ptr, nullptr, Sev::verbose)();
749 CHKERR EssentialPostProcRhs<DisplacementCubitBcData>(
750 mField, post_proc_rhs_ptr, 1.)();
752 };
753 auto get_post_proc_hook_lhs = [this, post_proc_lhs_ptr]() {
755 CHKERR EssentialPostProcLhs<DisplacementCubitBcData>(
756 mField, post_proc_lhs_ptr, 1.)();
758 };
759 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs;
760 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs;
761
762 // This is low level pushing finite elements (pipelines) to solver
763 auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
764 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
765 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
766 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
767 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
769 };
770
771 // Add extra finite elements to SNES solver pipelines to resolve essential
772 // boundary conditions
773 CHKERR add_extra_finite_elements_to_solver_pipelines();
774
775 auto create_vertex_post_proc = [&]() {
776 using VertexStateTags = std::vector<std::tuple<std::string, Tag, int>>;
777 auto moab_vert_post_proc_ptr = boost::make_shared<moab::Core>();
778 auto fe_post_proc_ptr = boost::make_shared<DomainEle>(mField);
779 // Stored state and output vertices must use the same integration points.
780 auto source_fe_ptr =
781 updateFe ? updateFe : boost::dynamic_pointer_cast<DomainEle>(
782 pipeline_mng->getDomainRhsFE());
783 if (!source_fe_ptr) {
785 "Missing domain integration rule for vertex output");
786 }
787 fe_post_proc_ptr->getRuleHook = source_fe_ptr->getRuleHook;
788
789 struct OpMoabVertPostProc : public DomainEleOp {
790 OpMoabVertPostProc(boost::shared_ptr<moab::Core> moab_ptr,
791 moab::Interface &source_mesh, int partition,
792 VertexStateTags state_tags)
793 : DomainEleOp(NOSPACE, DomainEleOp::OPSPACE), moabPtr(moab_ptr),
794 sourceMesh(source_mesh), partitionId(partition),
795 stateTags(std::move(state_tags)) {}
796
797 MoFEMErrorCode doWork(int, EntityType, EntData &) override {
799
800 const int nb_gauss_pts = getGaussPts().size2();
801 if (!nb_gauss_pts)
803
804 const auto &coords = getCoordsAtGaussPts();
805#ifndef NDEBUG
806 if (coords.size1() != nb_gauss_pts || coords.size2() != 3) {
807 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
808 "Invalid integration-point coordinates for vertex output");
809 }
810#endif
812 CHKERR moabPtr->create_vertices(coords.data().data(), nb_gauss_pts,
813 vertices);
814
815 Tag partition_tag = 0;
816 const int default_partition = -1;
817 CHKERR moabPtr->tag_get_handle(
818 "PARALLEL_PARTITION", 1, MB_TYPE_INTEGER, partition_tag,
819 MB_TAG_CREAT | MB_TAG_SPARSE, &default_partition);
820 CHKERR moabPtr->tag_clear_data(partition_tag, vertices, &partitionId);
821
822 const auto entity = getFEEntityHandle();
823 for (const auto &[name, tag, num_components] : stateTags) {
824 Tag output_tag = 0;
825 const std::vector<double> default_values(num_components, 0.0);
826 CHKERR moabPtr->tag_get_handle(
827 name.c_str(), num_components, MB_TYPE_DOUBLE, output_tag,
828 MB_TAG_CREAT | MB_TAG_SPARSE, default_values.data());
829
830 const void *state_data = nullptr;
831 int state_size = 0;
832 const auto rval = sourceMesh.tag_get_by_ptr(
833 tag, &entity, 1, &state_data, &state_size);
834 if (rval == MB_TAG_NOT_FOUND)
835 continue;
836 CHKERR rval;
837 if (!state_data || !state_size)
838 continue;
839 if (state_size < 0 || state_size % num_components != 0) {
840 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
841 "Inconsistent state tag size for %s", name.c_str());
842 }
843 // State components are contiguous for each integration point.
844 const int required_size = nb_gauss_pts * num_components;
845 if (state_size < required_size) {
846 // Initial output can precede the first complete state update.
847 std::vector<double> values(required_size, 0.0);
848 std::copy_n(static_cast<const double *>(state_data), state_size,
849 values.data());
850 CHKERR moabPtr->tag_set_data(output_tag, vertices, values.data());
851 } else {
852 // Other postprocessors can leave additional Gauss-point entries.
853 CHKERR moabPtr->tag_set_data(output_tag, vertices, state_data);
854 }
855 }
856
858 }
859
860 private:
861 boost::shared_ptr<moab::Core> moabPtr;
862 moab::Interface &sourceMesh;
863 int partitionId;
864 VertexStateTags stateTags;
865 };
866
867 VertexStateTags state_tags;
868 for (const auto &[name, tag, num_components] : postProcStateTags)
869 state_tags.emplace_back(name, tag, num_components);
870 auto &pip = fe_post_proc_ptr->getOpPtrVector();
872 (AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(pip, {H1}, "GEOMETRY")),
873 "Cannot set geometry for integration-point output");
874 pip.push_back(new OpMoabVertPostProc(moab_vert_post_proc_ptr,
876 std::move(state_tags)));
877
878 return std::make_pair(moab_vert_post_proc_ptr, fe_post_proc_ptr);
879 };
880
881 auto create_monitor_fe = [this, dm](auto &&post_proc_fe,
882 auto &&post_proc_vert) {
883 return boost::make_shared<Monitor>(dm.get(), post_proc_fe, post_proc_vert,
885 };
886
887 // Set monitor which postprocessing results and saves them to the hard drive
888 boost::shared_ptr<FEMethod> null_fe;
890 CHKERR postProcDomainFe->setTagsToTransfer(
891 std::vector<Tag>(listTagsToTransfer));
892 if (postProcBdyFe)
893 CHKERR postProcBdyFe->setTagsToTransfer(
894 std::vector<Tag>(listTagsToTransfer));
895 auto monitor_ptr = create_monitor_fe(
896 std::make_pair(postProcDomainFe, postProcBdyFe), create_vertex_post_proc());
897 CHKERR DMMoFEMTSSetMonitor(dm, ts, simple->getDomainFEName(), null_fe,
898 null_fe, monitor_ptr);
899
901
902 // Set time solver
903 double ftime = 1;
904 CHKERR TSSetMaxTime(ts, ftime);
905 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
906
907 auto B = createDMMatrix(dm);
908 CHKERR TSSetI2Jacobian(ts, B, B, PETSC_NULLPTR, PETSC_NULLPTR);
909 auto D = createDMVector(simple->getDM());
910 CHKERR TSSetSolution(ts, D);
911 CHKERR TSSetFromOptions(ts);
912
914 CHKERR TSSetPreStep(ts, TSElasticPostStep::preStepFun);
915 CHKERR TSSetPostStep(ts, TSElasticPostStep::postStepFun);
916 CHKERR TSSolve(ts, NULL);
918
919 CHKERR TSGetTime(ts, &ftime);
920
921 PetscInt steps, snesfails, rejects, nonlinits, linits;
922 CHKERR TSGetStepNumber(ts, &steps);
923 CHKERR TSGetSNESFailures(ts, &snesfails);
924 CHKERR TSGetStepRejections(ts, &rejects);
925 CHKERR TSGetSNESIterations(ts, &nonlinits);
926 CHKERR TSGetKSPIterations(ts, &linits);
927 MOFEM_LOG_C("EXAMPLE", Sev::inform,
928 "steps %d (%d rejected, %d SNES fails), ftime %g, nonlinits "
929 "%d, linits %d",
930 steps, rejects, snesfails, ftime, nonlinits, linits);
931
933}
bool move
std::vector< int > vertices
Tag tag
PetscErrorCode TSAdaptCreateAmentum(TSAdapt adapt)
#define TSADAPTAMENTUM
SmartPetscObj< Vec > values
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#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
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
Data on single entity (This is passed as argument to DataOperator::doWork)
static MoFEMErrorCode preStepFun(TS ts)
static MoFEMErrorCode postStepDestroy()
static MoFEMErrorCode postStepInitialise(UmatExample *example_ptr)
static MoFEMErrorCode postStepFun(TS ts)

Member Data Documentation

◆ acceptedDt

PetscReal UmatExample::acceptedDt = 0
protected

Definition at line 36 of file UmatExample.hpp.

◆ acceptedStep

PetscInt UmatExample::acceptedStep = 0
protected

Definition at line 37 of file UmatExample.hpp.

◆ acceptedTime

PetscReal UmatExample::acceptedTime = 0
protected

Definition at line 35 of file UmatExample.hpp.

◆ approximationBase

FieldApproximationBase UmatExample::approximationBase = AINSWORTH_LEGENDRE_BASE
protected

Definition at line 34 of file UmatExample.hpp.

◆ listTagsToTransfer

std::vector<Tag> UmatExample::listTagsToTransfer
protected

list of tags to transfer to postprocessor

Definition at line 102 of file UmatExample.hpp.

◆ mField

MoFEM::Interface& UmatExample::mField
protected

Definition at line 30 of file UmatExample.hpp.

◆ modelType

constexpr int UmatExample::modelType
inlinestaticconstexprprotected
Initial value:
=
(SPACE_DIM == 3) ? MatOps::MODEL_3D : MatOps::MODEL_2D_PLANE_STRAIN
@ MODEL_3D
Definition MatOps.hpp:234

Definition at line 104 of file UmatExample.hpp.

◆ physicalEquationsPtr

boost::shared_ptr<MatOps::PhysicalEquations> UmatExample::physicalEquationsPtr
protected

Definition at line 106 of file UmatExample.hpp.

◆ postProcBdyFe

boost::shared_ptr<PostProcEleBdy> UmatExample::postProcBdyFe
protected

Definition at line 33 of file UmatExample.hpp.

◆ postProcDomainFe

boost::shared_ptr<PostProcEleDomain> UmatExample::postProcDomainFe
protected

Definition at line 32 of file UmatExample.hpp.

◆ postProcStateTags

MatOps::StateTags UmatExample::postProcStateTags
protected

Definition at line 107 of file UmatExample.hpp.

◆ updateFe

boost::shared_ptr<DomainEle> UmatExample::updateFe
protected

Definition at line 31 of file UmatExample.hpp.


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