25#include <ArcLengthTools.hpp>
27#include <HookeOps.hpp>
31using namespace boost::numeric;
34 -my_file mesh file name\n\
35 -my_sr reduction of step size\n\
36 -my_its_d desired number of steps\n\
37 -my_ms maximal number of steps\n\
38 -gamma arc-length step adaptation exponent\n\
39 -min_arc_length_step minimum arc-length step\n\
40 -max_arc_length_step maximum arc-length step\n\
41 -field_eval_coords x,y,z coordinates where displacement and stress are evaluated\n\n";
47 boost::shared_ptr<ArcLengthCtx>
arcPtr;
60 CHKERR VecGhostUpdateBegin(
snes_f, INSERT_VALUES, SCATTER_FORWARD);
61 CHKERR VecGhostUpdateEnd(
snes_f, INSERT_VALUES, SCATTER_FORWARD);
77 CHKERR VecGhostUpdateBegin(
snes_f, ADD_VALUES, SCATTER_REVERSE);
78 CHKERR VecGhostUpdateEnd(
snes_f, ADD_VALUES, SCATTER_REVERSE);
83 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tlambda = %6.4e",
88 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tpre-essential fnorm = %6.4e",
130 boost::ptr_vector<CohesiveInterfaceElement::PhysicalEquation>
141 boost::scoped_ptr<ArcLengthMatShell>
matCtx;
142 boost::scoped_ptr<PCArcLengthCtx>
pcCtx;
186 PetscBool flg = PETSC_TRUE;
187 char mesh_file_name[PETSC_MAX_PATH_LEN] =
"";
189 mesh_file_name,
sizeof(mesh_file_name), &flg);
190 if (flg != PETSC_TRUE) {
192 mesh_file_name,
sizeof(mesh_file_name), &flg);
193 if (flg != PETSC_TRUE)
195 "*** ERROR -my_file or -file_name (MESH FILE NEEDED)");
201 CHKERR mOab.load_file(mesh_file_name, 0, option);
204 Tag th_step_size, th_step;
205 double def_step_size = 1;
206 rval =
mOab.tag_get_handle(
"_STEPSIZE", 1, MB_TYPE_DOUBLE, th_step_size,
207 MB_TAG_CREAT | MB_TAG_MESH, &def_step_size);
208 if (
rval == MB_ALREADY_ALLOCATED)
212 rval =
mOab.tag_get_handle(
"_STEP", 1, MB_TYPE_INTEGER, th_step,
213 MB_TAG_CREAT | MB_TAG_MESH, &def_step);
214 if (
rval == MB_ALREADY_ALLOCATED)
217 const void *tag_data_step_size[1];
218 EntityHandle root = 0;
219 CHKERR mOab.tag_get_by_ptr(th_step_size, &root, 1, tag_data_step_size);
220 double &step_size = *(
double *)tag_data_step_size[0];
221 const void *tag_data_step[1];
222 CHKERR mOab.tag_get_by_ptr(th_step, &root, 1, tag_data_step);
223 int &step = *(
int *)tag_data_step[0];
225 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"Start step %d and step_size = %6.4e",
229 stepPtr = (
int *)tag_data_step[0];
245 PetscBool flg = PETSC_FALSE;
252 if (flg != PETSC_TRUE) {
258 if (flg != PETSC_TRUE) {
264 if (flg != PETSC_TRUE) {
270 if (flg != PETSC_TRUE) {
283 CHKERR m_field.get_moab().tag_get_handle(
284 "_MY_REFINEMENT_LEVEL",
sizeof(
BitRefLevel), MB_TYPE_OPAQUE,
285 th_my_ref_level, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES,
287 const EntityHandle root_meshset = m_field.get_moab().get_root_set();
289 CHKERR m_field.get_moab().tag_get_by_ptr(th_my_ref_level, &root_meshset, 1,
290 (
const void **)&ptr_bit_level0);
300 std::vector<BitRefLevel> bit_levels;
305 auto split_interface = [&](
const EntityHandle cubit_meshset,
308 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"Insert Interface %d", meshset_id);
311 EntityHandle ref_level_meshset = 0;
312 CHKERR mOab.create_meshset(MESHSET_SET, ref_level_meshset);
314 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
318 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
321 Range ref_level_tets;
322 CHKERR mOab.get_entities_by_handle(ref_level_meshset, ref_level_tets,
325 CHKERR interface_ptr->
getSides(cubit_meshset, bit_levels.back(),
true,
331 cubit_meshset,
true,
true, 0);
333 CHKERR mOab.delete_entities(&ref_level_meshset, 1);
337 EntityHandle cubit_meshset = ciit->meshset;
339 ->updateMeshsetByEntitiesChildren(cubit_meshset, bit_levels.back(),
340 cubit_meshset, MBMAXTYPE,
true);
348 std::set<int> split_interface_ids;
349 bool split_from_sideset =
false;
352 if (split_interface_ids.insert(cit->getMeshsetId()).second) {
353 CHKERR split_interface(cit->getMeshset(), cit->getMeshsetId());
354 split_from_sideset =
true;
357 if (!split_from_sideset) {
358 const std::string block_name =
"MAT_INTERF";
360 std::regex((boost::format(
"%s(.*)") % block_name).str()))) {
361 if (split_interface_ids.insert(
m->getMeshsetId()).second)
362 CHKERR split_interface(
m->getMeshset(),
m->getMeshsetId());
366 bit_level0 = bit_levels.back();
367 problem_bit_level = bit_level0;
384 CHKERR m_field.add_finite_element(
"ELASTIC");
387 CHKERR m_field.modify_finite_element_add_field_row(
"ELASTIC",
389 CHKERR m_field.modify_finite_element_add_field_col(
"ELASTIC",
391 CHKERR m_field.modify_finite_element_add_field_data(
"ELASTIC",
394 m_field.modify_finite_element_add_field_data(
"ELASTIC",
"GEOMETRY");
395 CHKERR m_field.modify_finite_element_add_field_row(
"ELASTIC",
"LAMBDA");
396 CHKERR m_field.modify_finite_element_add_field_col(
"ELASTIC",
"LAMBDA");
398 CHKERR m_field.modify_finite_element_add_field_data(
"ELASTIC",
"LAMBDA");
401 CHKERR m_field.add_finite_element(
"INTERFACE");
402 CHKERR m_field.modify_finite_element_add_field_row(
"INTERFACE",
404 CHKERR m_field.modify_finite_element_add_field_col(
"INTERFACE",
406 CHKERR m_field.modify_finite_element_add_field_data(
"INTERFACE",
409 m_field.modify_finite_element_add_field_data(
"INTERFACE",
"GEOMETRY");
412 CHKERR m_field.add_finite_element(
"ARC_LENGTH");
415 CHKERR m_field.modify_finite_element_add_field_row(
"ARC_LENGTH",
"LAMBDA");
416 CHKERR m_field.modify_finite_element_add_field_col(
"ARC_LENGTH",
"LAMBDA");
420 m_field.modify_finite_element_add_field_data(
"ARC_LENGTH",
"LAMBDA");
423 CHKERR m_field.add_problem(
"ELASTIC_MECHANICS");
426 CHKERR m_field.modify_problem_add_finite_element(
"ELASTIC_MECHANICS",
428 CHKERR m_field.modify_problem_add_finite_element(
"ELASTIC_MECHANICS",
430 CHKERR m_field.modify_problem_add_finite_element(
"ELASTIC_MECHANICS",
433 CHKERR m_field.modify_problem_ref_level_add_bit(
"ELASTIC_MECHANICS",
440 CHKERR m_field.add_ents_to_field_by_type(0, MBTET,
"DISPLACEMENT");
441 CHKERR m_field.add_ents_to_field_by_type(0, MBTET,
"X0_DISPLACEMENT");
442 CHKERR m_field.add_ents_to_field_by_type(0, MBTET,
"GEOMETRY");
445 CHKERR m_field.add_ents_to_finite_element_by_bit_ref(
446 problem_bit_level,
BitRefLevel().set(),
"ELASTIC", MBTET);
447 CHKERR m_field.add_ents_to_finite_element_by_bit_ref(
448 problem_bit_level,
BitRefLevel().set(),
"INTERFACE", MBPRISM);
453 EntityHandle no_field_vertex;
455 const double coords[] = {0, 0, 0};
456 CHKERR m_field.get_moab().create_vertex(coords, no_field_vertex);
457 Range range_no_field_vertex;
458 range_no_field_vertex.insert(no_field_vertex);
462 EntityHandle lambda_meshset = m_field.get_field_meshset(
"LAMBDA");
463 CHKERR m_field.get_moab().add_entities(lambda_meshset,
464 range_no_field_vertex);
467 EntityHandle meshset_fe_arc_length;
469 CHKERR mOab.create_meshset(MESHSET_SET, meshset_fe_arc_length);
470 CHKERR mOab.add_entities(meshset_fe_arc_length, &no_field_vertex, 1);
475 CHKERR m_field.add_ents_to_finite_element_by_MESHSET(
476 meshset_fe_arc_length,
"ARC_LENGTH",
false);
482 CHKERR m_field.set_field_order(0, MBTET,
"DISPLACEMENT",
order);
483 CHKERR m_field.set_field_order(0, MBTRI,
"DISPLACEMENT",
order);
484 CHKERR m_field.set_field_order(0, MBEDGE,
"DISPLACEMENT",
order);
485 CHKERR m_field.set_field_order(0, MBVERTEX,
"DISPLACEMENT", 1);
487 CHKERR m_field.set_field_order(0, MBTET,
"X0_DISPLACEMENT",
order);
488 CHKERR m_field.set_field_order(0, MBTRI,
"X0_DISPLACEMENT",
order);
489 CHKERR m_field.set_field_order(0, MBEDGE,
"X0_DISPLACEMENT",
order);
490 CHKERR m_field.set_field_order(0, MBVERTEX,
"X0_DISPLACEMENT", 1);
492 CHKERR m_field.set_field_order(0, MBTET,
"GEOMETRY", 2);
493 CHKERR m_field.set_field_order(0, MBTRI,
"GEOMETRY", 2);
494 CHKERR m_field.set_field_order(0, MBEDGE,
"GEOMETRY", 2);
495 CHKERR m_field.set_field_order(0, MBVERTEX,
"GEOMETRY", 1);
508 CHKERR m_field.modify_problem_add_finite_element(
"ELASTIC_MECHANICS",
511 Range natural_bc_faces;
514 CHKERR mOab.get_entities_by_type(
m->getMeshset(), MBTRI, natural_bc_faces,
518 CHKERR mOab.get_entities_by_type(
m->getMeshset(), MBTRI, natural_bc_faces,
521 for (
auto m : meshsets_manager->getCubitMeshsetPtr(
522 std::regex(
"(FORCE|PRESSURE)(.*)"))) {
523 CHKERR mOab.get_entities_by_type(
m->getMeshset(), MBTRI, natural_bc_faces,
526 CHKERR m_field.add_ents_to_finite_element_by_type(natural_bc_faces, MBTRI,
534 CHKERR m_field.build_fields();
536 CHKERR m_field.loop_dofs(
"GEOMETRY", ent_method_material);
539 CHKERR m_field.build_finite_elements();
542 CHKERR m_field.build_adjacencies(problem_bit_level);
552 m_field.get_comm_size());
567 "ELASTIC_MECHANICS",
"DISPLACEMENT");
572 CHKERR mmanager_ptr->printDisplacementSet();
573 CHKERR mmanager_ptr->printForceSet();
575 CHKERR mmanager_ptr->printMaterialsSet();
589 CHKERR m_field.getInterface<
VecManager>()->vecCreateGhost(
"ELASTIC_MECHANICS",
594 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"ELASTIC_MECHANICS",
aij);
597 const std::string interface_block_name =
"MAT_INTERF";
598 for (
auto m : meshsets_manager->getCubitMeshsetPtr(std::regex(
599 (boost::format(
"%s(.*)") % interface_block_name).str()))) {
602 CHKERR m->getAttributeDataStructure(mydata);
603 MOFEM_LOG(
"ARC_LENGTH", Sev::inform) << mydata;
613 EntityHandle meshset =
m->getMeshset();
615 CHKERR mOab.get_entities_by_type(meshset, MBTRI, tris,
true);
617 CHKERR mOab.get_adjacencies(tris, 3,
false, ents3d, moab::Interface::UNION);
621 arcCtx = boost::make_shared<ArcLengthCtx>(m_field,
"ELASTIC_MECHANICS");
623 boost::make_shared<ArcLengthIntElemFEMethod>(m_field.get_moab(),
arcCtx);
624 snesCtxPtr = boost::make_shared<ArcLengthSnesCtx>(
625 m_field,
"ELASTIC_MECHANICS",
arcCtx);
630 auto essential_pre_proc_zero_rhs = boost::make_shared<FEMethod>();
631 auto essential_pre_proc_lhs = boost::make_shared<FEMethod>();
632 auto essential_post_proc_rhs = boost::make_shared<FEMethod>();
633 auto essential_post_proc_lhs = boost::make_shared<FEMethod>();
636 boost::shared_ptr<ArcLengthCtx> arcCtx;
638 ArcScale(boost::shared_ptr<ArcLengthCtx> arc_ctx) : arcCtx(arc_ctx) {}
640 double getScale(
const double time)
override {
641 return arcCtx->getFieldData();
644 auto arc_scale = boost::make_shared<ArcScale>(
arcCtx);
647 double getScale(
const double time)
override {
651 auto arc_zero = boost::make_shared<ArcZero>();
653 auto get_essential_pre_proc_zero =
654 [&m_field, essential_pre_proc_zero_rhs, arc_zero]() {
656 m_field, essential_pre_proc_zero_rhs, {arc_zero});
658 essential_pre_proc_zero_rhs->preProcessHook =
659 get_essential_pre_proc_zero();
660 auto get_essential_pre_proc_lhs =
661 [&m_field, essential_pre_proc_lhs, arc_scale]() {
663 m_field, essential_pre_proc_lhs, {arc_scale});
665 essential_pre_proc_lhs->preProcessHook = get_essential_pre_proc_lhs();
667 essential_post_proc_rhs->postProcessHook =
668 [&m_field, essential_post_proc_rhs, arc_scale]() {
671 m_field, essential_post_proc_rhs, {arc_scale})();
673 m_field, essential_post_proc_rhs, 1.)();
679 essential_post_proc_lhs->postProcessHook =
681 m_field, essential_post_proc_lhs, 1.);
685 auto elastic_integration_rule = [](int, int,
int approx_order) {
695 CHKERR HookeOps::opFactoryDomainRhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
696 m_field,
elasticRhsFe->getOpPtrVector(),
"DISPLACEMENT",
"MAT_ELASTIC",
698 CHKERR HookeOps::opFactoryDomainLhs<SPACE_DIM, PETSC, GAUSS, DomainEleOp>(
699 m_field,
elasticLhsFe->getOpPtrVector(),
"DISPLACEMENT",
"MAT_ELASTIC",
722 naturalBcFe = boost::make_shared<BoundaryEle>(m_field);
729 naturalBcFe->getOpPtrVector(), m_field,
"DISPLACEMENT", Sev::inform);
732 CHKERR SNESSetApplicationContext(
snes, &snes_ctx);
740 CHKERR KSPGetPC(ksp, &pc);
742 CHKERR PCSetType(pc, PCSHELL);
749 snes_ctx.getPreProcComputeRhs().push_back(essential_pre_proc_zero_rhs);
750 snes_ctx.getPreProcComputeRhs().push_back(&pre_post_proc_fe);
751 loops_to_do_Rhs.push_back(
753 loops_to_do_Rhs.push_back(
755 loops_to_do_Rhs.push_back(
759 snes_ctx.getPostProcComputeRhs().push_back(&pre_post_proc_fe);
760 snes_ctx.getPostProcComputeRhs().push_back(essential_post_proc_rhs);
764 snes_ctx.getPreProcSetOperators().push_back(essential_pre_proc_lhs);
765 loops_to_do_Mat.push_back(
767 loops_to_do_Mat.push_back(
769 loops_to_do_Mat.push_back(
771 snes_ctx.getPostProcSetOperators().push_back(essential_post_proc_lhs);
781 auto f_lambda_on_essential_bc = boost::make_shared<FEMethod>();
782 f_lambda_on_essential_bc->preProcessHook =
784 m_field, f_lambda_on_essential_bc, {},
false);
787 f_lambda_on_essential_bc->postProcessHook =
789 m_field, f_lambda_on_essential_bc, -1.,
arcCtx->F_lambda);
792 CHKERR VecGhostUpdateBegin(
arcCtx->F_lambda, INSERT_VALUES, SCATTER_FORWARD);
793 CHKERR VecGhostUpdateEnd(
arcCtx->F_lambda, INSERT_VALUES, SCATTER_FORWARD);
794 CHKERR m_field.problem_basic_method_preProcess(
"ELASTIC_MECHANICS",
795 *f_lambda_on_essential_bc);
797 CHKERR m_field.loop_finite_elements(
"ELASTIC_MECHANICS",
"ELASTIC",
802 CHKERR m_field.problem_basic_method_postProcess(
"ELASTIC_MECHANICS",
803 *f_lambda_on_essential_bc);
804 CHKERR VecGhostUpdateBegin(
arcCtx->F_lambda, ADD_VALUES, SCATTER_REVERSE);
805 CHKERR VecGhostUpdateEnd(
arcCtx->F_lambda, ADD_VALUES, SCATTER_REVERSE);
811 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"\tFlambda2 = %6.4e",
816 "ELASTIC_MECHANICS",
COL,
d, INSERT_VALUES, SCATTER_FORWARD);
818 "ELASTIC_MECHANICS",
"DISPLACEMENT",
"X0_DISPLACEMENT",
COL,
arcCtx->x0,
819 INSERT_VALUES, SCATTER_FORWARD);
823 "\tRead x0_nrm = %6.4e dlambda = %6.4e", x0_nrm,
832 postProcPtr = boost::make_shared<PostProcEle>(m_field);
834 auto disp_ptr = boost::make_shared<MatrixDouble>();
836 post_proc.getOpPtrVector(), {H1},
"GEOMETRY");
837 auto hooke_common_ptr =
838 HookeOps::commonDataFactory<SPACE_DIM, GAUSS, DomainEleOp>(
839 m_field, post_proc.getOpPtrVector(),
"DISPLACEMENT",
"MAT_ELASTIC",
841 post_proc.getOpPtrVector().push_back(
844 post_proc.getOpPtrVector().push_back(
845 new OpPPMap(post_proc.getPostProcMesh(), post_proc.getMapGaussPts(), {},
846 {{
"DISPLACEMENT", disp_ptr}},
847 {{
"DISPLACEMENT_GRAD", hooke_common_ptr->matGradPtr}},
848 {{
"STRAIN", hooke_common_ptr->getMatStrain()},
849 {
"STRESS", hooke_common_ptr->getMatCauchyStress()}}));
853 "-field_eval_coords", fieldEvalCoords.data(),
857 "-field_eval_coords requires exactly three coordinates");
863 ->buildTree<SPACE_DIM>(fieldEvalData,
"ELASTIC");
864 fieldEvalData->setEvalPoints(fieldEvalCoords.data(), 1);
866 auto field_eval_fe = fieldEvalData->feMethodPtr;
867 field_eval_fe->getRuleHook = [](
int,
int,
int) {
return -1; };
869 field_eval_fe->getOpPtrVector(), {H1},
"GEOMETRY");
871 auto field_eval_hooke_common_ptr =
872 HookeOps::commonDataFactory<SPACE_DIM, GAUSS, DomainEleOp>(
873 m_field, field_eval_fe->getOpPtrVector(),
"DISPLACEMENT",
874 "MAT_ELASTIC", Sev::verbose);
875 fieldEvalStressPtr = field_eval_hooke_common_ptr->getMatCauchyStress();
876 fieldEvalDispPtr = boost::make_shared<MatrixDouble>();
877 field_eval_fe->getOpPtrVector().push_back(
895 ->evalFEAtThePoint<SPACE_DIM>(
897 fieldEvalData, m_field.get_comm_rank(), m_field.get_comm_rank(),
901 int global_point_found = 0;
902 MPI_Allreduce(&point_found, &global_point_found, 1, MPI_INT, MPI_SUM,
909 "FieldEvaluator step %d lambda %6.4e point [%6.4e, %6.4e, "
914 "FieldEvaluator displacement [Ux, Uy, Uz] = [%6.4e, "
916 t_disp(0), t_disp(1), t_disp(2));
918 "FieldEvaluator Cauchy stress [Sxx, Syy, Szz, Sxy, Syz, Sxz] "
919 "= [%6.4e, %6.4e, %6.4e, %6.4e, %6.4e, %6.4e]",
920 t_stress(0, 0), t_stress(1, 1), t_stress(2, 2), t_stress(0, 1),
921 t_stress(1, 2), t_stress(0, 2));
922 }
else if (!global_point_found && !m_field.get_comm_rank()) {
924 "FieldEvaluator did not find point [%6.4e, %6.4e, %6.4e] in "
925 "the ELASTIC domain",
937 double min_arc_length_step = std::numeric_limits<double>::epsilon();
938 double max_arc_length_step = std::numeric_limits<double>::max();
942 "-min_arc_length_step", &min_arc_length_step,
945 "-max_arc_length_step", &max_arc_length_step,
948 if (min_arc_length_step <= 0.)
950 "-min_arc_length_step must be positive");
951 if (max_arc_length_step <= 0.)
953 "-max_arc_length_step must be positive");
954 if (min_arc_length_step > max_arc_length_step)
956 "-min_arc_length_step must not exceed -max_arc_length_step");
965 bool converged_state =
false;
969 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"Load Step %d step_size = %6.4e",
977 }
else if (step == 2) {
982 double dlambda =
arcCtx->dLambda;
986 "Load Step %d step_size = %6.4e dlambda0 = %6.4e "
987 "dx_nrm = %6.4e dx2 = %6.4e",
988 step, step_size, dlambda, dx_nrm,
arcCtx->dx2);
1004 "Load Step %d step_size = %6.4e dlambda0 = %6.4e "
1005 "dx_nrm = %6.4e dx2 = %6.4e",
1006 step, step_size, dlambda, dx_nrm,
arcCtx->dx2);
1016 "ELASTIC_MECHANICS",
COL,
d, INSERT_VALUES, SCATTER_REVERSE);
1017 CHKERR m_field.loop_finite_elements(
"ELASTIC_MECHANICS",
"INTERFACE",
1018 cohesive_elements.getFeHistory(), 0,
1019 m_field.get_comm_size());
1025 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"number of Newton iterations = %d",
1028 SNESConvergedReason reason;
1029 CHKERR SNESGetConvergedReason(
snes, &reason);
1034 converged_state =
false;
1037 if (step > 1 && converged_state) {
1040 std::clamp(
reduction, min_arc_length_step / std::abs(step_size),
1041 max_arc_length_step / std::abs(step_size));
1042 MOFEM_LOG_C(
"ARC_LENGTH", Sev::inform,
"reduction step_size = %6.4e",
1048 "ELASTIC_MECHANICS",
COL,
d, INSERT_VALUES, SCATTER_REVERSE);
1050 "ELASTIC_MECHANICS",
"DISPLACEMENT",
"X0_DISPLACEMENT",
COL,
1051 arcCtx->x0, INSERT_VALUES, SCATTER_REVERSE);
1052 converged_state =
true;
1059 if (step % 1 == 0) {
1061 CHKERR m_field.loop_finite_elements(
"ELASTIC_MECHANICS",
"ELASTIC",
1063 std::ostringstream ss;
1064 ss <<
"out_values_" << step <<
".h5m";
1065 CHKERR post_proc.writeFile(ss.str().c_str());
1089 const string default_options =
"-ksp_type fgmres \n"
1091 "-pc_factor_mat_solver_type mumps\n"
1092 "-mat_mumps_icntl_20 0\n"
1094 "-ksp_atol 1e-10 \n"
1095 "-ksp_rtol 1e-10 \n"
1097 "-snes_type newtonls \n"
1098 "-snes_linesearch_type l2 \n"
1099 "-snes_linesearch_monitor \n"
1100 "-snes_max_it 16 \n"
1101 "-snes_atol 1e-8 \n"
1102 "-snes_rtol 1e-8 \n"
1103 "-snes_converged_reason \n";
1105 string param_file =
"param_file.petsc";
1106 if (!
static_cast<bool>(ifstream(param_file))) {
1107 std::ofstream file(param_file.c_str(), std::ios::ate);
1108 if (file.is_open()) {
1109 file << default_options;
1115 auto core_log = logging::core::get();
1122 moab::Core mb_instance;
1123 moab::Interface &moab = mb_instance;
Implementation of linear interface element.
Natural force and pressure boundary conditions.
Implementation of arc-length control for cohesive elements.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
#define MOFEM_LOG_C(channel, severity, format,...)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ NOFIELD
scalar or vector of scalars describe (no true field)
#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.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
MoFEMErrorCode partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
MoFEMErrorCode pushMarkDOFsOnEntities(const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true)
Mark DOFs on block entities for boundary conditions.
const double n
refractive index of diffusive medium
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
auto createSNES(MPI_Comm comm)
PetscErrorCode SnesMat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
PetscErrorCode SnesRhs(SNES snes, Vec x, Vec f, void *ctx)
This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static constexpr int approx_order
FTensor::Index< 'm', 3 > m
MoFEMErrorCode boundaryCondition()
[Set up problem]
boost::shared_ptr< ArcLengthIntElemFEMethod > arcMethodPtr
MoFEM::Interface * mField
MoFEMErrorCode checkResults()
[Postprocess results]
MoFEMErrorCode readMesh()
[Run problem]
boost::shared_ptr< MatrixDouble > fieldEvalStressPtr
boost::ptr_vector< CohesiveInterfaceElement::PhysicalEquation > interfaceMaterials
boost::scoped_ptr< PCArcLengthCtx > pcCtx
SmartPetscObj< Mat > shellAij
boost::shared_ptr< MoFEM::Core > corePtr
boost::shared_ptr< PostProcEle > postProcPtr
PetscScalar stepSizeReduction
boost::shared_ptr< CohesiveInterfaceElement > cohesiveElementsPtr
const std::string naturalBcFeName
SmartPetscObj< SNES > snes
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEMErrorCode assembleSystem()
[Boundary condition]
MoFEMErrorCode solveSystem()
[Solve]
MoFEMErrorCode outputResults()
[Solve]
boost::shared_ptr< AssembleRhsVectors > prePostProcFePtr
MoFEMErrorCode runProblem()
[Run problem]
boost::shared_ptr< ArcLengthCtx > arcCtx
boost::shared_ptr< MatrixDouble > fieldEvalDispPtr
MoFEMErrorCode evaluateFieldAtPoint(const int load_step)
[Assemble system]
boost::shared_ptr< FieldEvaluatorInterface::SetPtsData > fieldEvalData
boost::scoped_ptr< ArcLengthMatShell > matCtx
std::array< double, SPACE_DIM > fieldEvalCoords
boost::shared_ptr< ArcLengthSnesCtx > snesCtxPtr
boost::shared_ptr< DomainEle > elasticLhsFe
ArcLengthInterfaceExample(moab::Interface &moab)
boost::shared_ptr< BoundaryEle > naturalBcFe
boost::shared_ptr< DomainEle > elasticRhsFe
shell matrix for arc-length method
Boundary conditions marker.
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
AssembleRhsVectors(boost::shared_ptr< ArcLengthCtx > &arc_ptr)
boost::shared_ptr< ArcLengthCtx > arcPtr
MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
Constitutive (physical) equation for interface.
Add operators pushing bases from local to physical configuration.
Boundary condition manager for finite element problem setup.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Definition of the displacement bc data structure.
Class (Function) to enforce essential constrains on the left hand side diagonal.
Class (Function) to enforce essential constrains on the right hand side diagonal.
Class (Function) to enforce essential constrains.
Structure for user loop methods on finite elements.
Field evaluator interface.
static MoFEMErrorCode setMeshFileFromJson()
Set -file_name from JSON before Core is available.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Linear interface data structure.
Matrix manager is used to build and partition problems.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
Specialization for MatrixDouble vector field values calculation.
Post post-proc data at points from hash maps.
Template struct for dimension-specific finite element types.
Create interface from given surface and insert flat prisms in-between.
MoFEMErrorCode getSides(const int msId, const CubitBCType cubit_bc_type, const BitRefLevel mesh_bit_level, const bool recursive, int verb=QUIET)
Store tetrahedra from each side of the interface separately in two child meshsets of the parent meshs...
MoFEMErrorCode splitSides(const EntityHandle meshset, const BitRefLevel &bit, const int msId, const CubitBCType cubit_bc_type, const bool add_interface_entities, const bool recursive=false, int verb=QUIET)
Split nodes and other entities of tetrahedra on both sides of the interface and insert flat prisms in...
Problem manager is used to build and partition problems.
Projection of edge entities with one mid-node on hierarchical basis.
intrusive_ptr for managing petsc objects
MoFEM::FEMethodsSequence FEMethodsSequence
@ CTX_SNESSETFUNCTION
Setting up nonlinear function evaluation.
@ CTX_SNESNONE
No specific SNES context.
Vec & snes_f
Reference to residual vector.
SNESContext snes_ctx
Current SNES computation context.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.
structure for Arc Length pre-conditioner