12 #ifndef EXECUTABLE_DIMENSION
13 #define EXECUTABLE_DIMENSION 3
22 using namespace MoFEM;
65 std::max(
static_cast<double>(std::numeric_limits<float>::min_exponent10),
79 auto r = [&](
auto tau) {
82 constexpr
double eps = 1e-12;
83 return std::max(
r(tau),
eps *
r(0));
89 template <
typename T,
int DIM>
96 if (
C1_k < std::numeric_limits<double>::epsilon()) {
100 t_alpha(
i,
j) =
C1_k * t_plastic_strain(
i,
j);
149 #include <boost/python.hpp>
150 #include <boost/python/def.hpp>
151 #include <boost/python/numpy.hpp>
152 namespace bp = boost::python;
153 namespace np = boost::python::numpy;
163 #endif // ADD_CONTACT
207 boost::shared_ptr<ContactOps::SDFPython> sdfPythonPtr;
209 #endif // ADD_CONTACT
215 CHKERR createCommonData();
230 CHKERR mField.get_moab().get_entities_by_dimension(0,
SPACE_DIM, domain_ents,
232 auto get_ents_by_dim = [&](
const auto dim) {
238 CHKERR mField.get_moab().get_connectivity(domain_ents, ents,
true);
240 CHKERR mField.get_moab().get_entities_by_dimension(0, dim, ents,
true);
245 auto get_base = [&]() {
246 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
247 if (domain_ents.empty())
265 const auto base = get_base();
276 PetscBool order_edge = PETSC_FALSE;
279 PetscBool order_face = PETSC_FALSE;
282 PetscBool order_volume = PETSC_FALSE;
286 if (order_edge || order_face || order_volume) {
288 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order edge " << order_edge
291 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order face " << order_face
294 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order volume " << order_volume
298 auto ents = get_ents_by_dim(0);
300 ents.merge(get_ents_by_dim(1));
302 ents.merge(get_ents_by_dim(2));
304 ents.merge(get_ents_by_dim(3));
320 auto get_skin = [&]() {
322 CHKERR mField.get_moab().get_entities_by_dimension(0,
SPACE_DIM, body_ents);
323 Skinner skin(&mField.get_moab());
325 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
329 auto filter_blocks = [&](
auto skin) {
330 bool is_contact_block =
false;
335 (boost::format(
"%s(.*)") %
"CONTACT").str()
344 <<
"Find contact block set: " <<
m->getName();
345 auto meshset =
m->getMeshset();
346 Range contact_meshset_range;
347 CHKERR mField.get_moab().get_entities_by_dimension(
348 meshset,
SPACE_DIM - 1, contact_meshset_range,
true);
351 contact_meshset_range);
352 contact_range.merge(contact_meshset_range);
354 if (is_contact_block) {
356 <<
"Nb entities in contact surface: " << contact_range.size();
358 skin = intersect(skin, contact_range);
363 auto filter_true_skin = [&](
auto skin) {
365 ParallelComm *pcomm =
367 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
368 PSTATUS_NOT, -1, &boundary_ents);
369 return boundary_ents;
372 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
380 auto project_ho_geometry = [&]() {
382 return mField.loop_dofs(
"GEOMETRY", ent_method);
384 PetscBool project_geometry = PETSC_TRUE;
386 &project_geometry, PETSC_NULL);
387 if (project_geometry) {
388 CHKERR project_ho_geometry();
399 auto get_command_line_parameters = [&]() {
424 PetscBool tau_order_is_set;
427 PetscBool ep_order_is_set;
440 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Hardening " <<
H;
441 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Viscous hardening " <<
visH;
442 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Saturation yield stress " <<
Qinf;
443 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Saturation exponent " <<
b_iso;
444 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Kinematic hardening " <<
C1_k;
449 if (tau_order_is_set == PETSC_FALSE)
451 if (ep_order_is_set == PETSC_FALSE)
454 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Approximation order " <<
order;
456 <<
"Ep approximation order " <<
ep_order;
458 <<
"Tau approximation order " <<
tau_order;
460 <<
"Geometry approximation order " <<
geom_order;
462 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Density " <<
rho;
465 PetscBool is_scale = PETSC_TRUE;
479 #endif // ADD_CONTACT
489 CHKERR get_command_line_parameters();
493 sdfPythonPtr = boost::make_shared<ContactOps::SDFPython>();
494 CHKERR sdfPythonPtr->sdfInit(
"sdf.py");
495 ContactOps::sdfPythonWeakPtr = sdfPythonPtr;
497 #endif // ADD_CONTACT
511 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_X",
513 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_Y",
515 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_Z",
517 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
518 "REMOVE_ALL",
"U", 0, 3);
521 for (
auto b : {
"FIX_X",
"REMOVE_X"})
522 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
523 "SIGMA", 0, 0,
false,
true);
524 for (
auto b : {
"FIX_Y",
"REMOVE_Y"})
525 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
526 "SIGMA", 1, 1,
false,
true);
527 for (
auto b : {
"FIX_Z",
"REMOVE_Z"})
528 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
529 "SIGMA", 2, 2,
false,
true);
530 for (
auto b : {
"FIX_ALL",
"REMOVE_ALL"})
531 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
532 "SIGMA", 0, 3,
false,
true);
533 CHKERR bc_mng->removeBlockDOFsOnEntities(
534 simple->getProblemName(),
"NO_CONTACT",
"SIGMA", 0, 3,
false,
true);
538 simple->getProblemName(),
"U");
540 auto &bc_map = bc_mng->getBcMapByBlockName();
541 for (
auto bc : bc_map)
542 MOFEM_LOG(
"PLASTICITY", Sev::verbose) <<
"Marker " << bc.first;
555 auto integration_rule_bc = [](
int,
int,
int ao) {
return 2 * ao; };
559 auto add_boundary_ops_lhs_mechanical = [&](
auto &pip) {
568 pip, mField,
"U", Sev::inform);
572 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
575 ContactOps::opFactoryBoundaryToDomainLhs<SPACE_DIM, AT, IT, DomainEle>(
576 mField, pip,
simple->getDomainFEName(),
"SIGMA",
"U",
"GEOMETRY",
578 #endif // ADD_CONTACT
583 auto add_boundary_ops_rhs_mechanical = [&](
auto &pip) {
592 pip, mField,
"U", {boost::make_shared<ScaledTimeScale>()}, Sev::inform);
595 CHKERR ContactOps::opFactoryBoundaryRhs<SPACE_DIM, AT, IT, BoundaryEleOp>(
597 #endif // ADD_CONTACT
602 auto add_domain_ops_lhs = [
this](
auto &pip) {
614 auto get_inertia_and_mass_damping = [
this](
const double,
const double,
618 return (
rho /
scale) * fe_domain_lhs->ts_aa +
621 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
624 CHKERR PlasticOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
625 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
630 auto add_domain_ops_rhs = [
this](
auto &pip) {
638 {boost::make_shared<ScaledTimeScale>(
"body_force_hist.txt")},
646 AT>::LinearForm<IT>::OpBaseTimesVector<1,
SPACE_DIM, 1>;
649 auto mat_acceleration = boost::make_shared<MatrixDouble>();
651 "U", mat_acceleration));
653 new OpInertiaForce(
"U", mat_acceleration, [](
double,
double,
double) {
657 auto mat_velocity = boost::make_shared<MatrixDouble>();
661 new OpInertiaForce(
"U", mat_velocity, [](
double,
double,
double) {
667 CHKERR PlasticOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
668 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
671 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
673 #endif // ADD_CONTACT
678 CHKERR add_domain_ops_lhs(pip_mng->getOpDomainLhsPipeline());
679 CHKERR add_domain_ops_rhs(pip_mng->getOpDomainRhsPipeline());
682 CHKERR add_boundary_ops_lhs_mechanical(pip_mng->getOpBoundaryLhsPipeline());
683 CHKERR add_boundary_ops_rhs_mechanical(pip_mng->getOpBoundaryRhsPipeline());
685 CHKERR pip_mng->setDomainRhsIntegrationRule(vol_rule);
686 CHKERR pip_mng->setDomainLhsIntegrationRule(vol_rule);
688 CHKERR pip_mng->setBoundaryLhsIntegrationRule(integration_rule_bc);
689 CHKERR pip_mng->setBoundaryRhsIntegrationRule(integration_rule_bc);
691 auto create_reaction_pipeline = [&](
auto &pip) {
695 CHKERR PlasticOps::opFactoryDomainReactions<SPACE_DIM, AT, IT, DomainEleOp>(
696 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
700 reactionFe = boost::make_shared<DomainEle>(mField);
701 reactionFe->getRuleHook = vol_rule;
702 CHKERR create_reaction_pipeline(reactionFe->getOpPtrVector());
703 reactionFe->postProcessHook =
722 static boost::shared_ptr<SetUpSchur> createSetUpSchur(
743 auto set_section_monitor = [&](
auto solver) {
746 CHKERR TSGetSNES(solver, &snes);
747 CHKERR SNESMonitorSet(snes,
750 (
void *)(snes_ctx_ptr.get()),
nullptr);
754 auto create_post_process_elements = [&]() {
755 auto pp_fe = boost::make_shared<PostProcEle>(mField);
756 auto &pip = pp_fe->getOpPtrVector();
758 auto push_vol_ops = [
this](
auto &pip) {
762 auto [common_plastic_ptr, common_henky_ptr] =
763 PlasticOps::createCommonPlasticOps<SPACE_DIM, IT, DomainEleOp>(
764 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU", 1., Sev::inform);
766 if (common_henky_ptr) {
767 if (common_plastic_ptr->mGradPtr != common_henky_ptr->matGradPtr)
771 return std::make_pair(common_plastic_ptr, common_henky_ptr);
774 auto push_vol_post_proc_ops = [
this](
auto &pp_fe,
auto &&p) {
777 auto &pip = pp_fe->getOpPtrVector();
779 auto [common_plastic_ptr, common_henky_ptr] = p;
783 auto x_ptr = boost::make_shared<MatrixDouble>();
786 auto u_ptr = boost::make_shared<MatrixDouble>();
795 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
798 common_plastic_ptr->getPlasticSurfacePtr()},
799 {
"PLASTIC_MULTIPLIER",
800 common_plastic_ptr->getPlasticTauPtr()}},
802 {{
"U", u_ptr}, {
"GEOMETRY", x_ptr}},
804 {{
"GRAD", common_henky_ptr->matGradPtr},
805 {
"FIRST_PIOLA", common_henky_ptr->getMatFirstPiolaStress()}},
807 {{
"PLASTIC_STRAIN", common_plastic_ptr->getPlasticStrainPtr()},
808 {
"PLASTIC_FLOW", common_plastic_ptr->getPlasticFlowPtr()}}
820 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
823 common_plastic_ptr->getPlasticSurfacePtr()},
824 {
"PLASTIC_MULTIPLIER",
825 common_plastic_ptr->getPlasticTauPtr()}},
827 {{
"U", u_ptr}, {
"GEOMETRY", x_ptr}},
831 {{
"STRAIN", common_plastic_ptr->mStrainPtr},
832 {
"STRESS", common_plastic_ptr->mStressPtr},
833 {
"PLASTIC_STRAIN", common_plastic_ptr->getPlasticStrainPtr()},
834 {
"PLASTIC_FLOW", common_plastic_ptr->getPlasticFlowPtr()}}
844 auto vol_post_proc = [
this, push_vol_post_proc_ops, push_vol_ops]() {
845 PetscBool post_proc_vol = PETSC_FALSE;
847 &post_proc_vol, PETSC_NULL);
848 if (post_proc_vol == PETSC_FALSE)
849 return boost::shared_ptr<PostProcEle>();
850 auto pp_fe = boost::make_shared<PostProcEle>(mField);
852 push_vol_post_proc_ops(pp_fe, push_vol_ops(pp_fe->getOpPtrVector())),
853 "push_vol_post_proc_ops");
857 auto skin_post_proc = [
this, push_vol_post_proc_ops, push_vol_ops]() {
858 PetscBool post_proc_skin = PETSC_TRUE;
860 &post_proc_skin, PETSC_NULL);
861 if (post_proc_skin == PETSC_FALSE)
862 return boost::shared_ptr<SkinPostProcEle>();
865 auto pp_fe = boost::make_shared<SkinPostProcEle>(mField);
868 pp_fe->getOpPtrVector().push_back(op_side);
870 pp_fe, push_vol_ops(op_side->getOpPtrVector())),
871 "push_vol_post_proc_ops");
875 return std::make_pair(vol_post_proc(), skin_post_proc());
878 auto scatter_create = [&](
auto D,
auto coeff) {
880 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
881 ROW,
"U", coeff, coeff, is);
883 CHKERR ISGetLocalSize(is, &loc_size);
885 CHKERR VecCreateMPI(mField.get_comm(), loc_size, PETSC_DETERMINE, &
v);
887 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULL, &scatter);
892 auto set_time_monitor = [&](
auto dm,
auto solver) {
894 boost::shared_ptr<Monitor> monitor_ptr(
895 new Monitor(dm, create_post_process_elements(), reactionFe, uXScatter,
896 uYScatter, uZScatter));
897 boost::shared_ptr<ForcesAndSourcesCore>
null;
899 monitor_ptr,
null,
null);
903 auto set_schur_pc = [&](
auto solver,
904 boost::shared_ptr<SetUpSchur> &schur_ptr) {
907 auto bc_mng = mField.getInterface<
BcManager>();
908 auto name_prb =
simple->getProblemName();
914 dm_sub =
createDM(mField.get_comm(),
"DMMOFEM");
919 for (
auto f : {
"U"}) {
931 dm_sub =
createDM(mField.get_comm(),
"DMMOFEM");
937 for (
auto f : {
"SIGMA",
"EP",
"TAU"}) {
942 for (
auto f : {
"EP",
"TAU"}) {
961 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
967 {simple->getDomainFEName(),
983 {simple->getBoundaryFEName(),
985 {{
"SIGMA",
"SIGMA"}, {
"U",
"SIGMA"}, {
"SIGMA",
"U"}
995 {dm_schur, dm_block}, block_mat_data,
997 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr}, true
1004 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
1005 auto block_mat_data =
1008 {{simple->getDomainFEName(),
1025 {dm_schur, dm_block}, block_mat_data,
1027 {
"EP",
"TAU"}, {
nullptr,
nullptr}, false
1034 auto nested_mat_data = get_nested_mat_data(dm_schur, dm_block);
1037 auto block_is =
getDMSubData(dm_block)->getSmartRowIs();
1038 auto ao_schur =
getDMSubData(dm_schur)->getSmartRowMap();
1044 CHKERR schur_ptr->setUp(solver);
1050 auto dm =
simple->getDM();
1053 uXScatter = scatter_create(
D, 0);
1054 uYScatter = scatter_create(
D, 1);
1056 uZScatter = scatter_create(
D, 2);
1058 auto create_solver = [pip_mng]() {
1060 return pip_mng->createTSIM();
1062 return pip_mng->createTSIM2();
1065 auto solver = create_solver();
1067 auto active_pre_lhs = []() {
1074 auto active_post_lhs = [&]() {
1076 auto get_iter = [&]() {
1081 "Can not get iter");
1085 auto iter = get_iter();
1088 std::array<int, 5> activity_data;
1089 std::fill(activity_data.begin(), activity_data.end(), 0);
1091 activity_data.data(), activity_data.size(), MPI_INT,
1092 MPI_SUM, mField.get_comm());
1094 int &active_points = activity_data[0];
1095 int &avtive_full_elems = activity_data[1];
1096 int &avtive_elems = activity_data[2];
1097 int &nb_points = activity_data[3];
1098 int &nb_elements = activity_data[4];
1102 double proc_nb_points =
1103 100 *
static_cast<double>(active_points) / nb_points;
1104 double proc_nb_active =
1105 100 *
static_cast<double>(avtive_elems) / nb_elements;
1106 double proc_nb_full_active = 100;
1108 proc_nb_full_active =
1109 100 *
static_cast<double>(avtive_full_elems) / avtive_elems;
1112 "Iter %d nb pts %d nb avtive pts %d (%3.3f\%) nb active "
1114 "(%3.3f\%) nb full active elems %d (%3.3f\%)",
1115 iter, nb_points, active_points, proc_nb_points,
1116 avtive_elems, proc_nb_active, avtive_full_elems,
1117 proc_nb_full_active, iter);
1124 auto add_active_dofs_elem = [&](
auto dm) {
1126 auto fe_pre_proc = boost::make_shared<FEMethod>();
1127 fe_pre_proc->preProcessHook = active_pre_lhs;
1128 auto fe_post_proc = boost::make_shared<FEMethod>();
1129 fe_post_proc->postProcessHook = active_post_lhs;
1131 ts_ctx_ptr->getPreProcessIJacobian().push_front(fe_pre_proc);
1132 ts_ctx_ptr->getPostProcessIJacobian().push_back(fe_post_proc);
1136 auto set_essential_bc = [&](
auto dm,
auto solver) {
1140 auto pre_proc_ptr = boost::make_shared<FEMethod>();
1141 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
1142 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
1145 auto disp_time_scale = boost::make_shared<TimeScale>();
1147 auto get_bc_hook_rhs = [
this, pre_proc_ptr, disp_time_scale]() {
1149 {disp_time_scale},
false);
1152 pre_proc_ptr->preProcessHook = get_bc_hook_rhs();
1154 auto get_post_proc_hook_rhs = [
this, post_proc_rhs_ptr]() {
1157 mField, post_proc_rhs_ptr,
nullptr, Sev::verbose)();
1159 mField, post_proc_rhs_ptr, 1.)();
1162 auto get_post_proc_hook_lhs = [
this, post_proc_lhs_ptr]() {
1164 mField, post_proc_lhs_ptr, 1.);
1166 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs;
1169 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
1170 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
1171 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
1172 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs();
1173 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
1179 CHKERR TSSetSolution(solver,
D);
1181 CHKERR TS2SetSolution(solver,
D, DD);
1184 CHKERR set_section_monitor(solver);
1185 CHKERR set_time_monitor(dm, solver);
1186 CHKERR TSSetFromOptions(solver);
1189 CHKERR add_active_dofs_elem(dm);
1190 boost::shared_ptr<SetUpSchur> schur_ptr;
1191 CHKERR set_schur_pc(solver, schur_ptr);
1192 CHKERR set_essential_bc(dm, solver);
1197 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
1198 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSetUp";
1200 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSetUp <= done";
1201 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSolve";
1202 CHKERR TSSolve(solver, NULL);
1203 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSolve <= done";
1218 #endif // ADD_CONTACT
1221 const char param_file[] =
"param_file.petsc";
1225 auto core_log = logging::core::get();
1227 LogManager::createSink(LogManager::getStrmWorld(),
"PLASTICITY"));
1229 LogManager::createSink(LogManager::getStrmWorld(),
"TIMER"));
1230 LogManager::setLog(
"PLASTICITY");
1235 LogManager::createSink(LogManager::getStrmWorld(),
"CONTACT"));
1236 LogManager::setLog(
"CONTACT");
1238 #endif // ADD_CONTACT
1243 DMType dm_name =
"DMMOFEM";
1274 if (Py_FinalizeEx() < 0) {
1278 #endif // ADD_CONTACT
1292 "Is expected that schur matrix is not allocated. This is "
1293 "possible only is PC is set up twice");
1317 CHKERR TSGetSNES(solver, &snes);
1319 CHKERR SNESGetKSP(snes, &ksp);
1320 CHKERR KSPSetFromOptions(ksp);
1323 CHKERR KSPGetPC(ksp, &pc);
1324 PetscBool is_pcfs = PETSC_FALSE;
1325 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1330 "Is expected that schur matrix is not allocated. This is "
1331 "possible only is PC is set up twice");
1339 CHKERR TSGetDM(solver, &solver_dm);
1340 CHKERR DMSetMatType(solver_dm, MATSHELL);
1347 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t, PetscReal
a,
1348 Mat
A, Mat B,
void *ctx) {
1351 CHKERR TSSetIJacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1353 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t,
Vec utt,
1354 PetscReal
a, PetscReal aa, Mat
A, Mat B,
1358 CHKERR TSSetI2Jacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1362 auto set_ops = [&]() {
1368 pip_mng->getOpBoundaryLhsPipeline().push_front(
1372 {
"EP",
"TAU"}, {
nullptr,
nullptr},
aoSchur,
S,
false, false
1376 pip_mng->getOpDomainLhsPipeline().push_front(
1380 {
"EP",
"TAU"}, {
nullptr,
nullptr},
aoSchur,
S,
false, false
1385 double eps_stab = 1e-4;
1391 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1394 pip_mng->getOpBoundaryLhsPipeline().push_front(
1396 pip_mng->getOpBoundaryLhsPipeline().push_back(
1397 new OpMassStab(
"SIGMA",
"SIGMA", [eps_stab](
double,
double,
double) {
1402 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
aoSchur,
S,
1407 pip_mng->getOpDomainLhsPipeline().push_front(
1411 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
aoSchur,
S,
1415 #endif // ADD_CONTACT
1419 auto set_assemble_elems = [&]() {
1421 auto schur_asmb_pre_proc = boost::make_shared<FEMethod>();
1422 schur_asmb_pre_proc->preProcessHook = [
this]() {
1425 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble Begin";
1428 auto schur_asmb_post_proc = boost::make_shared<FEMethod>();
1430 schur_asmb_post_proc->postProcessHook = [
this, schur_asmb_post_proc]() {
1432 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble End";
1435 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1436 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1443 ts_ctx_ptr->getPreProcessIJacobian().push_front(schur_asmb_pre_proc);
1444 ts_ctx_ptr->getPostProcessIJacobian().push_front(schur_asmb_post_proc);
1448 auto set_pc = [&]() {
1451 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
1455 auto set_diagonal_pc = [&]() {
1458 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1459 auto get_pc = [](
auto ksp) {
1461 CHKERR KSPGetPC(ksp, &pc_raw);
1465 CHKERR PetscFree(subksp);
1471 CHKERR set_assemble_elems();
1475 CHKERR set_diagonal_pc();
1478 pip_mng->getOpBoundaryLhsPipeline().push_front(
1480 pip_mng->getOpBoundaryLhsPipeline().push_back(
1483 pip_mng->getOpDomainLhsPipeline().push_back(
1492 boost::shared_ptr<SetUpSchur>
1496 return boost::shared_ptr<SetUpSchur>(