12#ifndef EXECUTABLE_DIMENSION
13#define EXECUTABLE_DIMENSION 3
45 (SCHUR_ASSEMBLE) ? AssemblyType::SCHUR
46 : AssemblyType::PETSC;
48 IntegrationType::GAUSS;
75 return MatSetValues<AssemblyTypeSelector<AT>>(
76 op_ptr->
getKSPA(), row_data, col_data,
m, ADD_VALUES);
85 return MatSetValues<AssemblyTypeSelector<AT>>(
86 op_ptr->
getKSPA(), row_data, col_data,
m, ADD_VALUES);
94 using BoundaryEleOp::BoundaryEleOp;
108 return MatSetValues<AssemblyTypeSelector<AT>>(
109 op_ptr->
getKSPB(), row_data, col_data,
m, ADD_VALUES);
116 std::max(
static_cast<double>(std::numeric_limits<float>::min_exponent10),
130 auto r = [&](
auto tau) {
133 constexpr double eps = 1e-12;
134 return std::max(r(tau),
eps * r(0));
140template <
typename T,
int DIM>
147 t_alpha(
i,
j) =
C1_k * t_plastic_strain(
i,
j);
196#include <boost/python.hpp>
197#include <boost/python/def.hpp>
198namespace bp = boost::python;
207#include <ContactOps.hpp>
252 boost::shared_ptr<ContactOps::SDFPython> sdfPythonPtr;
277 auto get_ents_by_dim = [&](
const auto dim) {
290 auto get_base = [&]() {
291 auto domain_ents = get_ents_by_dim(
SPACE_DIM);
292 if (domain_ents.empty())
310 const auto base = get_base();
321 PetscBool order_edge = PETSC_FALSE;
324 PetscBool order_face = PETSC_FALSE;
327 PetscBool order_volume = PETSC_FALSE;
331 if (order_edge || order_face || order_volume) {
333 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order edge " << order_edge
336 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order face " << order_face
339 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Order volume " << order_volume
343 auto ents = get_ents_by_dim(0);
345 ents.merge(get_ents_by_dim(1));
347 ents.merge(get_ents_by_dim(2));
349 ents.merge(get_ents_by_dim(3));
365 auto get_skin = [&]() {
370 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
374 auto filter_blocks = [&](
auto skin) {
379 (boost::format(
"%s(.*)") %
"CONTACT").str()
385 <<
"Find contact block set: " <<
m->getName();
386 auto meshset =
m->getMeshset();
388 contact_range,
true);
391 <<
"Nb entities in contact surface: " << contact_range.size();
395 skin = intersect(skin, contact_range);
400 auto filter_true_skin = [&](
auto skin) {
402 ParallelComm *pcomm =
404 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
405 PSTATUS_NOT, -1, &boundary_ents);
406 return boundary_ents;
409 auto boundary_ents = filter_true_skin(filter_blocks(get_skin()));
417 auto project_ho_geometry = [&]() {
421 CHKERR project_ho_geometry();
431 auto get_command_line_parameters = [&]() {
456 PetscBool tau_order_is_set;
459 PetscBool ep_order_is_set;
472 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Hardening " <<
H;
473 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Viscous hardening " <<
visH;
474 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Saturation yield stress " <<
Qinf;
475 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Saturation exponent " <<
b_iso;
476 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Kinematic hardening " <<
C1_k;
481 if (tau_order_is_set == PETSC_FALSE)
483 if (ep_order_is_set == PETSC_FALSE)
486 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Approximation order " <<
order;
488 <<
"Ep approximation order " <<
ep_order;
490 <<
"Tau approximation order " <<
tau_order;
492 <<
"Geometry approximation order " <<
geom_order;
494 MOFEM_LOG(
"PLASTICITY", Sev::inform) <<
"Density " <<
rho;
497 PetscBool is_scale = PETSC_TRUE;
521 CHKERR get_command_line_parameters();
525 sdfPythonPtr = boost::make_shared<ContactOps::SDFPython>();
526 CHKERR sdfPythonPtr->sdfInit(
"sdf.py");
527 ContactOps::sdfPythonWeakPtr = sdfPythonPtr;
543 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_X",
545 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_Y",
547 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
"REMOVE_Z",
549 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(),
550 "REMOVE_ALL",
"U", 0, 3);
553 for (
auto b : {
"FIX_X",
"REMOVE_X"})
554 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
555 "SIGMA", 0, 0,
false,
true);
556 for (
auto b : {
"FIX_Y",
"REMOVE_Y"})
557 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
558 "SIGMA", 1, 1,
false,
true);
559 for (
auto b : {
"FIX_Z",
"REMOVE_Z"})
560 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
561 "SIGMA", 2, 2,
false,
true);
562 for (
auto b : {
"FIX_ALL",
"REMOVE_ALL"})
563 CHKERR bc_mng->removeBlockDOFsOnEntities(
simple->getProblemName(), b,
564 "SIGMA", 0, 3,
false,
true);
565 CHKERR bc_mng->removeBlockDOFsOnEntities(
566 simple->getProblemName(),
"NO_CONTACT",
"SIGMA", 0, 3,
false,
true);
570 simple->getProblemName(),
"U");
572 auto &bc_map = bc_mng->getBcMapByBlockName();
573 for (
auto bc : bc_map)
574 MOFEM_LOG(
"PLASTICITY", Sev::verbose) <<
"Marker " << bc.first;
587 auto integration_rule_bc = [](int, int,
int ao) {
return 2 * ao; };
589 auto vol_rule = [](int, int,
int ao) {
return 2 * ao +
geom_order - 1; };
591 auto add_boundary_ops_lhs_mechanical = [&](
auto &pip) {
600 pip,
mField,
"U", Sev::inform);
604 ContactOps::opFactoryBoundaryLhs<SPACE_DIM, AT, GAUSS, BoundaryEleOp>(
607 ContactOps::opFactoryBoundaryToDomainLhs<SPACE_DIM, AT, IT, DomainEle>(
608 mField, pip,
simple->getDomainFEName(),
"SIGMA",
"U",
"GEOMETRY",
615 auto add_boundary_ops_rhs_mechanical = [&](
auto &pip) {
624 pip,
mField,
"U", {boost::make_shared<ScaledTimeScale>()}, Sev::inform);
627 CHKERR ContactOps::opFactoryBoundaryRhs<SPACE_DIM, AT, IT, BoundaryEleOp>(
634 auto add_domain_ops_lhs = [
this](
auto &pip) {
646 auto get_inertia_and_mass_damping = [
this](
const double,
const double,
650 return (
rho /
scale) * fe_domain_lhs->ts_aa +
653 pip.push_back(
new OpMass(
"U",
"U", get_inertia_and_mass_damping));
656 CHKERR PlasticOps::opFactoryDomainLhs<SPACE_DIM, AT, IT, DomainEleOp>(
657 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
662 auto add_domain_ops_rhs = [
this](
auto &pip) {
670 {boost::make_shared<ScaledTimeScale>(
"body_force_hist.txt")},
681 auto mat_acceleration = boost::make_shared<MatrixDouble>();
683 "U", mat_acceleration));
685 new OpInertiaForce(
"U", mat_acceleration, [](
double,
double,
double) {
689 auto mat_velocity = boost::make_shared<MatrixDouble>();
693 new OpInertiaForce(
"U", mat_velocity, [](
double,
double,
double) {
699 CHKERR PlasticOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
700 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
703 CHKERR ContactOps::opFactoryDomainRhs<SPACE_DIM, AT, IT, DomainEleOp>(
710 CHKERR add_domain_ops_lhs(pip_mng->getOpDomainLhsPipeline());
711 CHKERR add_domain_ops_rhs(pip_mng->getOpDomainRhsPipeline());
714 CHKERR add_boundary_ops_lhs_mechanical(pip_mng->getOpBoundaryLhsPipeline());
715 CHKERR add_boundary_ops_rhs_mechanical(pip_mng->getOpBoundaryRhsPipeline());
717 CHKERR pip_mng->setDomainRhsIntegrationRule(vol_rule);
718 CHKERR pip_mng->setDomainLhsIntegrationRule(vol_rule);
720 CHKERR pip_mng->setBoundaryLhsIntegrationRule(integration_rule_bc);
721 CHKERR pip_mng->setBoundaryRhsIntegrationRule(integration_rule_bc);
723 auto create_reaction_pipeline = [&](
auto &pip) {
727 CHKERR PlasticOps::opFactoryDomainReactions<SPACE_DIM, AT, IT, DomainEleOp>(
728 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU");
775 auto set_section_monitor = [&](
auto solver) {
778 CHKERR TSGetSNES(solver, &snes);
779 CHKERR SNESMonitorSet(snes,
782 (
void *)(snes_ctx_ptr.get()),
nullptr);
786 auto create_post_process_elements = [&]() {
787 auto pp_fe = boost::make_shared<PostProcEle>(
mField);
788 auto &pip = pp_fe->getOpPtrVector();
790 auto push_vol_ops = [
this](
auto &pip) {
794 auto [common_plastic_ptr, common_henky_ptr] =
795 PlasticOps::createCommonPlasticOps<SPACE_DIM, IT, DomainEleOp>(
796 mField,
"MAT_PLASTIC", pip,
"U",
"EP",
"TAU", 1., Sev::inform);
798 if (common_henky_ptr) {
799 if (common_plastic_ptr->mGradPtr != common_henky_ptr->matGradPtr)
803 return std::make_pair(common_plastic_ptr, common_henky_ptr);
806 auto push_vol_post_proc_ops = [
this](
auto &pp_fe,
auto &&
p) {
809 auto &pip = pp_fe->getOpPtrVector();
811 auto [common_plastic_ptr, common_henky_ptr] =
p;
815 auto x_ptr = boost::make_shared<MatrixDouble>();
818 auto u_ptr = boost::make_shared<MatrixDouble>();
827 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
830 common_plastic_ptr->getPlasticSurfacePtr()},
831 {
"PLASTIC_MULTIPLIER",
832 common_plastic_ptr->getPlasticTauPtr()}},
834 {{
"U", u_ptr}, {
"GEOMETRY", x_ptr}},
836 {{
"GRAD", common_henky_ptr->matGradPtr},
837 {
"FIRST_PIOLA", common_henky_ptr->getMatFirstPiolaStress()}},
839 {{
"PLASTIC_STRAIN", common_plastic_ptr->getPlasticStrainPtr()},
840 {
"PLASTIC_FLOW", common_plastic_ptr->getPlasticFlowPtr()}}
852 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
855 common_plastic_ptr->getPlasticSurfacePtr()},
856 {
"PLASTIC_MULTIPLIER",
857 common_plastic_ptr->getPlasticTauPtr()}},
859 {{
"U", u_ptr}, {
"GEOMETRY", x_ptr}},
863 {{
"STRAIN", common_plastic_ptr->mStrainPtr},
864 {
"STRESS", common_plastic_ptr->mStressPtr},
865 {
"PLASTIC_STRAIN", common_plastic_ptr->getPlasticStrainPtr()},
866 {
"PLASTIC_FLOW", common_plastic_ptr->getPlasticFlowPtr()}}
876 auto vol_post_proc = [
this, push_vol_post_proc_ops, push_vol_ops]() {
877 PetscBool post_proc_vol = PETSC_FALSE;
879 &post_proc_vol, PETSC_NULL);
880 if (post_proc_vol == PETSC_FALSE)
881 return boost::shared_ptr<PostProcEle>();
882 auto pp_fe = boost::make_shared<PostProcEle>(mField);
884 push_vol_post_proc_ops(pp_fe, push_vol_ops(pp_fe->getOpPtrVector())),
885 "push_vol_post_proc_ops");
889 auto skin_post_proc = [
this, push_vol_post_proc_ops, push_vol_ops]() {
890 PetscBool post_proc_skin = PETSC_TRUE;
892 &post_proc_skin, PETSC_NULL);
893 if (post_proc_skin == PETSC_FALSE)
894 return boost::shared_ptr<SkinPostProcEle>();
897 auto pp_fe = boost::make_shared<SkinPostProcEle>(mField);
900 pp_fe->getOpPtrVector().push_back(op_side);
902 pp_fe, push_vol_ops(op_side->getOpPtrVector())),
903 "push_vol_post_proc_ops");
907 return std::make_pair(vol_post_proc(), skin_post_proc());
910 auto scatter_create = [&](
auto D,
auto coeff) {
912 CHKERR is_manager->isCreateProblemFieldAndRank(
simple->getProblemName(),
913 ROW,
"U", coeff, coeff, is);
915 CHKERR ISGetLocalSize(is, &loc_size);
917 CHKERR VecCreateMPI(mField.get_comm(), loc_size, PETSC_DETERMINE, &
v);
919 CHKERR VecScatterCreate(
D, is,
v, PETSC_NULL, &scatter);
924 auto set_time_monitor = [&](
auto dm,
auto solver) {
926 boost::shared_ptr<Monitor> monitor_ptr(
927 new Monitor(dm, create_post_process_elements(), reactionFe, uXScatter,
928 uYScatter, uZScatter));
929 boost::shared_ptr<ForcesAndSourcesCore> null;
931 monitor_ptr, null, null);
935 auto set_schur_pc = [&](
auto solver,
936 boost::shared_ptr<SetUpSchur> &schur_ptr) {
939 auto bc_mng = mField.getInterface<
BcManager>();
940 auto name_prb =
simple->getProblemName();
946 dm_sub =
createDM(mField.get_comm(),
"DMMOFEM");
951 for (
auto f : {
"U"}) {
961 if constexpr (
AT == AssemblyType::SCHUR) {
970 CHKERR ISExpand(is_epp, is_tau, &is_union_raw);
974 auto add_sigma_to_is = [&](
auto is_union) {
976 auto add_sigma_to_is_impl = [&]() {
982 IS is_union_raw_sigma;
983 CHKERR ISExpand(is_union, is_sigma, &is_union_raw_sigma);
988 return is_union_sigma;
990 is_union = add_sigma_to_is(is_union);
1002 CHKERR schur_ptr->setUp(solver);
1008 auto dm =
simple->getDM();
1011 uXScatter = scatter_create(
D, 0);
1012 uYScatter = scatter_create(
D, 1);
1014 uZScatter = scatter_create(
D, 2);
1016 auto create_solver = [pip_mng]() {
1018 return pip_mng->createTSIM();
1020 return pip_mng->createTSIM2();
1023 auto solver = create_solver();
1025 auto active_pre_lhs = []() {
1032 auto active_post_lhs = [&]() {
1034 auto get_iter = [&]() {
1039 "Can not get iter");
1043 auto iter = get_iter();
1046 std::array<int, 5> activity_data;
1047 std::fill(activity_data.begin(), activity_data.end(), 0);
1049 activity_data.data(), activity_data.size(), MPI_INT,
1050 MPI_SUM, mField.get_comm());
1052 int &active_points = activity_data[0];
1053 int &avtive_full_elems = activity_data[1];
1054 int &avtive_elems = activity_data[2];
1055 int &nb_points = activity_data[3];
1056 int &nb_elements = activity_data[4];
1060 double proc_nb_points =
1061 100 *
static_cast<double>(active_points) / nb_points;
1062 double proc_nb_active =
1063 100 *
static_cast<double>(avtive_elems) / nb_elements;
1064 double proc_nb_full_active = 100;
1066 proc_nb_full_active =
1067 100 *
static_cast<double>(avtive_full_elems) / avtive_elems;
1070 "Iter %d nb pts %d nb avtive pts %d (%3.3f\%) nb active "
1072 "(%3.3f\%) nb full active elems %d (%3.3f\%)",
1073 iter, nb_points, active_points, proc_nb_points,
1074 avtive_elems, proc_nb_active, avtive_full_elems,
1075 proc_nb_full_active, iter);
1082 auto add_active_dofs_elem = [&](
auto dm) {
1084 auto fe_pre_proc = boost::make_shared<FEMethod>();
1085 fe_pre_proc->preProcessHook = active_pre_lhs;
1086 auto fe_post_proc = boost::make_shared<FEMethod>();
1087 fe_post_proc->postProcessHook = active_post_lhs;
1089 ts_ctx_ptr->getPreProcessIJacobian().push_front(fe_pre_proc);
1090 ts_ctx_ptr->getPostProcessIJacobian().push_back(fe_post_proc);
1094 auto set_essential_bc = [&](
auto dm,
auto solver) {
1098 auto pre_proc_ptr = boost::make_shared<FEMethod>();
1099 auto post_proc_rhs_ptr = boost::make_shared<FEMethod>();
1100 auto post_proc_lhs_ptr = boost::make_shared<FEMethod>();
1103 auto disp_time_scale = boost::make_shared<TimeScale>();
1105 auto get_bc_hook_rhs = [
this, pre_proc_ptr, disp_time_scale]() {
1107 {disp_time_scale},
false);
1110 pre_proc_ptr->preProcessHook = get_bc_hook_rhs();
1112 auto get_post_proc_hook_rhs = [
this, post_proc_rhs_ptr]() {
1115 mField, post_proc_rhs_ptr,
nullptr, Sev::verbose)();
1117 mField, post_proc_rhs_ptr, 1.)();
1120 auto get_post_proc_hook_lhs = [
this, post_proc_lhs_ptr]() {
1122 mField, post_proc_lhs_ptr, 1.);
1124 post_proc_rhs_ptr->postProcessHook = get_post_proc_hook_rhs;
1127 ts_ctx_ptr->getPreProcessIFunction().push_front(pre_proc_ptr);
1128 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_ptr);
1129 ts_ctx_ptr->getPostProcessIFunction().push_back(post_proc_rhs_ptr);
1132 CHKERR TSGetSNES(solver, &snes);
1134 CHKERR SNESGetKSP(snes, &ksp);
1136 CHKERR KSPGetPC(ksp, &pc);
1137 PetscBool is_pcfs = PETSC_FALSE;
1138 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1140 if (is_pcfs == PETSC_FALSE) {
1141 post_proc_lhs_ptr->postProcessHook = get_post_proc_hook_lhs();
1142 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_lhs_ptr);
1148 CHKERR TSSetSolution(solver,
D);
1150 CHKERR TS2SetSolution(solver,
D, DD);
1153 CHKERR set_section_monitor(solver);
1154 CHKERR set_time_monitor(dm, solver);
1155 CHKERR TSSetFromOptions(solver);
1158 CHKERR add_active_dofs_elem(dm);
1159 boost::shared_ptr<SetUpSchur> schur_ptr;
1160 CHKERR set_schur_pc(solver, schur_ptr);
1161 CHKERR set_essential_bc(dm, solver);
1166 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
1167 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSetUp";
1169 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSetUp <= done";
1170 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSolve";
1171 CHKERR TSSolve(solver, NULL);
1172 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"TSSolve <= done";
1189 const char param_file[] =
"param_file.petsc";
1193 auto core_log = logging::core::get();
1211 DMType dm_name =
"DMMOFEM";
1216 moab::Core mb_instance;
1217 moab::Interface &moab = mb_instance;
1242 if (Py_FinalizeEx() < 0) {
1260 "Is expected that schur matrix is not allocated. This is "
1261 "possible only is PC is set up twice");
1295 CHKERR TSGetSNES(solver, &snes);
1297 CHKERR SNESGetKSP(snes, &ksp);
1298 CHKERR KSPSetFromOptions(ksp);
1301 CHKERR KSPSetFromOptions(ksp);
1302 CHKERR KSPGetPC(ksp, &pc);
1303 PetscBool is_pcfs = PETSC_FALSE;
1304 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1309 "Is expected that schur matrix is not allocated. This is "
1310 "possible only is PC is set up twice");
1322 auto set_ops = [&]() {
1328 pip_mng->getOpBoundaryLhsPipeline().push_front(
1330 pip_mng->getOpBoundaryLhsPipeline().push_back(
1339 pip_mng->getOpDomainLhsPipeline().push_back(
1348 double eps_stab = 1e-4;
1354 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1357 pip_mng->getOpBoundaryLhsPipeline().push_front(
1359 pip_mng->getOpBoundaryLhsPipeline().push_back(
1360 new OpMassStab(
"SIGMA",
"SIGMA", [eps_stab](
double,
double,
double) {
1363 pip_mng->getOpBoundaryLhsPipeline().push_back(
1366 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
1369 {
false,
false,
false}
1374 pip_mng->getOpDomainLhsPipeline().push_back(
1377 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
1380 {
false,
false,
false}
1387 auto set_assemble_elems = [&]() {
1389 auto schur_asmb_pre_proc = boost::make_shared<FEMethod>();
1390 schur_asmb_pre_proc->preProcessHook = [
this]() {
1397 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble Begin";
1400 auto schur_asmb_post_proc = boost::make_shared<FEMethod>();
1402 schur_asmb_post_proc->postProcessHook = [
this, schur_asmb_post_proc]() {
1404 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble End";
1408 mField, schur_asmb_post_proc, 1)();
1410 CHKERR MatAssemblyBegin(
A, MAT_FINAL_ASSEMBLY);
1411 CHKERR MatAssemblyEnd(
A, MAT_FINAL_ASSEMBLY);
1414 mField, schur_asmb_post_proc, 1,
A)();
1415 CHKERR MatAssemblyBegin(
P, MAT_FINAL_ASSEMBLY);
1416 CHKERR MatAssemblyEnd(
P, MAT_FINAL_ASSEMBLY);
1417 CHKERR MatAXPY(
P, 1,
A, SAME_NONZERO_PATTERN);
1421 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1422 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1429 ts_ctx_ptr->getPreProcessIJacobian().push_front(schur_asmb_pre_proc);
1430 ts_ctx_ptr->getPostProcessIJacobian().push_front(schur_asmb_post_proc);
1434 auto set_pc = [&]() {
1437 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
1443 CHKERR set_assemble_elems();
1447 pip_mng->getOpBoundaryLhsPipeline().push_back(
1450 pip_mng->getOpDomainLhsPipeline().push_back(
1461boost::shared_ptr<SetUpSchur>
1465 return boost::shared_ptr<SetUpSchur>(
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
#define MOFEM_LOG_C(channel, severity, format,...)
void simple(double P1[], double P2[], double P3[], double c[], const int N)
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
Kronecker Delta class symmetric.
#define CATCH_ERRORS
Catch errors.
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#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()
FieldSpace
approximation spaces
@ L2
field with C-1 continuity
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
static const char *const ApproximationBaseNames[]
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr int SPACE_DIM
[Define dimension]
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, SPACE_DIM > OpMass
FTensor::Index< 'm', SPACE_DIM > m
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
auto createDMVector(DM dm)
Get smart vector from DM.
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
auto createDMMatrix(DM dm)
Get smart matrix from DM.
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 MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
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
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
FormsIntegrators< DomainEleOp >::Assembly< USER_ASSEMBLE >::LinearForm< GAUSS >::OpBaseTimesVector< 1, 3, 1 > OpInertiaForce
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto type_from_handle(const EntityHandle h)
get type from entity handle
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.
PetscErrorCode TsSetIJacobian(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Set function evaluating jacobina in TS solver.
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
MoFEMErrorCode MoFEMSNESMonitorFields(SNES snes, PetscInt its, PetscReal fgnorm, SnesCtx *snes_ctx)
Sens monitor printing residual field by field.
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)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
auto getDMSubData(DM dm)
Get sub problem data structure.
auto createAOMappingIS(IS isapp, IS ispetsc)
Creates an application mapping using two index sets.
SmartPetscObj< Mat > matDuplicate(Mat mat, MatDuplicateOption op)
auto getDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
double young_modulus
Young modulus.
constexpr AssemblyType AT
double C1_k
Kinematic hardening.
double Qinf
Saturation yield stress.
constexpr IntegrationType IT
static char help[]
[Solve]
#define EXECUTABLE_DIMENSION
PetscBool is_quasi_static
double visH
Viscous hardening.
double poisson_ratio
Poisson ratio.
auto kinematic_hardening(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain, double C1_k)
PetscBool set_timer
Set timer.
double iso_hardening_dtau(double tau, double H, double Qinf, double b_iso)
double zeta
Viscous hardening.
int tau_order
Order of tau files.
double iso_hardening_exp(double tau, double b_iso)
int order
Order displacement.
double b_iso
Saturation exponent.
PetscBool is_large_strains
Large strains.
int geom_order
Order if fixed.
double sigmaY
Yield stress.
double iso_hardening(double tau, double H, double Qinf, double b_iso, double sigmaY)
auto kinematic_hardening_dplastic_strain(double C1_k)
ElementsAndOps< SPACE_DIM >::SideEle SideEle
int ep_order
Order of ep files.
constexpr FieldSpace CONTACT_SPACE
FTensor::Index< 'm', 3 > m
Element used to specialise assembly.
PipelineManager::ElementsAndOpsByDim< 2 >::FaceSideEle SideEle
PipelineManager::ElementsAndOpsByDim< 3 >::FaceSideEle SideEle
double getScale(const double time)
Get scaling at a given time.
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uZScatter
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uXScatter
FieldApproximationBase base
MoFEMErrorCode createCommonData()
[Set up problem]
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uYScatter
Example(MoFEM::Interface &m_field)
MoFEMErrorCode OPs()
[Boundary condition]
MoFEMErrorCode runProblem()
[Run problem]
MoFEM::Interface & mField
MoFEMErrorCode setupProblem()
[Run problem]
MoFEMErrorCode bC()
[Create common data]
boost::shared_ptr< DomainEle > reactionFe
Add operators pushing bases from local to physical configuration.
Simple interface for fast problem set-up.
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
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.
Data on single entity (This is passed as argument to DataOperator::doWork)
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.
Class (Function) to calculate residual side diagonal.
default operator for TRI element
Section manager is used to create indexes and sections.
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.
Interface for managing meshsets containing materials and boundary conditions.
boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)> MatSetValuesHook
Approximate field values for given petsc vector.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Element used to execute operators on side of the element.
Post post-proc data at points from hash maps.
Clear Schur complement internal data.
Assemble Schur complement.
PipelineManager interface.
MoFEM::VolumeElementForcesAndSourcesCore VolEle
boost::shared_ptr< FEMethod > & getDomainLhsFE()
MoFEM::FaceElementForcesAndSourcesCore FaceEle
MoFEM::EdgeElementForcesAndSourcesCore EdgeEle
Problem manager is used to build and partition problems.
Projection of edge entities with one mid-node on hierarchical basis.
Simple interface for fast problem set-up.
intrusive_ptr for managing petsc objects
Force scale operator for reading two columns.
double getScale(const double time)
Get scaling at a given time.
TimeScale(std::string file_name="", bool error_if_file_not_given=false)
TimeScale constructor.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Volume finite element base.
static std::array< int, 5 > activityData
[Push operators to pipeline]
static boost::shared_ptr< SetUpSchur > createSetUpSchur(MoFEM::Interface &m_field, SmartPetscObj< DM > sub_dm, SmartPetscObj< IS > field_split_it, SmartPetscObj< AO > ao_map)
Create data structure for handling Schur complement.
virtual MoFEMErrorCode setUp(TS solver)=0
SmartPetscObj< DM > subDM
field split sub dm
MoFEMErrorCode setUp(KSP solver)
SetUpSchurImpl(MoFEM::Interface &m_field, SmartPetscObj< DM > sub_dm, SmartPetscObj< IS > field_split_is, SmartPetscObj< AO > ao_up)
SmartPetscObj< IS > fieldSplitIS
IS for split Schur block.
virtual ~SetUpSchurImpl()
MoFEMErrorCode postProc()
MoFEM::Interface & mField