v0.14.0
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SetUpSchurImpl Struct Reference
Inheritance diagram for SetUpSchurImpl:
[legend]
Collaboration diagram for SetUpSchurImpl:
[legend]

Classes

struct  P_MultiGridData
 

Public Member Functions

 SetUpSchurImpl (MoFEM::Interface &m_field)
 
virtual ~SetUpSchurImpl ()=default
 
MoFEMErrorCode setUp (SmartPetscObj< KSP >)
 
 SetUpSchurImpl (MoFEM::Interface &m_field, SmartPetscObj< DM > sub_dm, SmartPetscObj< IS > field_split_is, SmartPetscObj< AO > ao_up)
 
virtual ~SetUpSchurImpl ()
 
MoFEMErrorCode setUp (TS solver)
 
MoFEMErrorCode preProc ()
 
MoFEMErrorCode postProc ()
 
 SetUpSchurImpl (MoFEM::Interface &m_field)
 
virtual ~SetUpSchurImpl ()
 
MoFEMErrorCode setUp (SmartPetscObj< TS > solver)
 
 SetUpSchurImpl (MoFEM::Interface &m_field)
 
virtual ~SetUpSchurImpl ()
 
MoFEMErrorCode setUp (SmartPetscObj< TS > solver)
 
 SetUpSchurImpl (MoFEM::Interface &m_field)
 
virtual ~SetUpSchurImpl ()=default
 
MoFEMErrorCode setUp (SmartPetscObj< KSP > solver)
 
 SetUpSchurImpl (MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr)
 
virtual ~SetUpSchurImpl ()
 
MoFEMErrorCode setUp (TS ts)
 
MoFEMErrorCode preProc ()
 
MoFEMErrorCode postProc ()
 

Private Member Functions

MoFEMErrorCode createSubDM ()
 
MoFEMErrorCode setOperator ()
 
MoFEMErrorCode setPC (PC pc)
 
MoFEMErrorCode setDiagonalPC (PC pc)
 
MoFEMErrorCode setOperator ()
 
MoFEMErrorCode setPC (PC pc)
 
SmartPetscObj< DM > createSubDM ()
 
MoFEMErrorCode setEntities ()
 
MoFEMErrorCode createSubDM ()
 
MoFEMErrorCode setOperator ()
 
MoFEMErrorCode setPC (PC pc)
 
MoFEMErrorCode setDiagonalPC (PC pc)
 
auto getSchurFields ()
 
auto getA00Fields ()
 

Private Attributes

MoFEM::InterfacemField
 
SmartPetscObj< Mat > S
 
SmartPetscObj< DM > subDM
 field split sub dm More...
 
SmartPetscObj< IS > fieldSplitIS
 IS for split Schur block. More...
 
SmartPetscObj< AO > aoSchur
 
SmartPetscObj< DM > schurDM
 
SmartPetscObj< DM > blockDM
 
Range volEnts
 
Range subEnts
 
EshelbianCoreepCorePtr
 
SmartPetscObj< AO > aoS
 
boost::shared_ptr< std::vector< boost::weak_ptr< NumeredDofEntity > > > piolaZeroDofsVec
 
boost::shared_ptr< std::vector< unsigned char > > piolaZeroDofsMarker
 
boost::shared_ptr< P_MultiGridDatapMGPtr
 

Additional Inherited Members

- Static Public Member Functions inherited from SetUpSchur
static boost::shared_ptr< SetUpSchurcreateSetUpSchur (MoFEM::Interface &m_field)
 
static boost::shared_ptr< SetUpSchurcreateSetUpSchur (MoFEM::Interface &m_field, SmartPetscObj< DM > sub_dm, SmartPetscObj< IS > field_split_it, SmartPetscObj< AO > ao_map)
 Create data structure for handling Schur complement. More...
 
static boost::shared_ptr< SetUpSchurcreateSetUpSchur (MoFEM::Interface &m_field)
 
static boost::shared_ptr< SetUpSchurcreateSetUpSchur (MoFEM::Interface &m_field)
 
static boost::shared_ptr< SetUpSchurcreateSetUpSchur (MoFEM::Interface &m_field)
 
- Protected Member Functions inherited from SetUpSchur
 SetUpSchur ()=default
 
virtual ~SetUpSchur ()=default
 
 SetUpSchur ()=default
 
 SetUpSchur ()=default
 
 SetUpSchur ()=default
 
 SetUpSchur ()=default
 

Detailed Description

Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 519 of file test_broken_space.cpp.

Constructor & Destructor Documentation

◆ SetUpSchurImpl() [1/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field)
inline
Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 521 of file test_broken_space.cpp.

521 : SetUpSchur(), mField(m_field) {}

◆ ~SetUpSchurImpl() [1/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
virtualdefault

◆ SetUpSchurImpl() [2/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field,
SmartPetscObj< DM >  sub_dm,
SmartPetscObj< IS >  field_split_is,
SmartPetscObj< AO >  ao_up 
)
inline

Definition at line 1639 of file plastic.cpp.

1641  : SetUpSchur(), mField(m_field), subDM(sub_dm),
1642  fieldSplitIS(field_split_is), aoSchur(ao_up) {
1643  if (S) {
1645  "Is expected that schur matrix is not "
1646  "allocated. This is "
1647  "possible only is PC is set up twice");
1648  }
1649  }

◆ ~SetUpSchurImpl() [2/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 1650 of file plastic.cpp.

1650 { S.reset(); }

◆ SetUpSchurImpl() [3/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field)
inline

Definition at line 988 of file contact.cpp.

988 : SetUpSchur(), mField(m_field) {}

◆ ~SetUpSchurImpl() [3/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 990 of file contact.cpp.

990 {}

◆ SetUpSchurImpl() [4/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field)
inline

Definition at line 931 of file incompressible_elasticity.cpp.

931 : SetUpSchur(), mField(m_field) {}

◆ ~SetUpSchurImpl() [4/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 932 of file incompressible_elasticity.cpp.

932 { S.reset(); }

◆ SetUpSchurImpl() [5/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field)
inline

Definition at line 924 of file elastic.cpp.

924  : SetUpSchur(), mField(m_field) {
925  if (S) {
928  "Is expected that schur matrix is not allocated. This is "
929  "possible only is PC is set up twice");
930  }
931  }

◆ ~SetUpSchurImpl() [5/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
virtualdefault

◆ SetUpSchurImpl() [6/6]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field,
EshelbianCore ep_core_ptr 
)
inline

Definition at line 11 of file SetUpSchurImpl.cpp.

12  : SetUpSchur(), mField(m_field), epCorePtr(ep_core_ptr) {}

◆ ~SetUpSchurImpl() [6/6]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 13 of file SetUpSchurImpl.cpp.

13 {}

Member Function Documentation

◆ createSubDM() [1/3]

MoFEMErrorCode SetUpSchurImpl::createSubDM ( )
private

◆ createSubDM() [2/3]

SmartPetscObj<DM> SetUpSchurImpl::createSubDM ( )
private

◆ createSubDM() [3/3]

MoFEMErrorCode SetUpSchurImpl::createSubDM ( )
private

Definition at line 1082 of file contact.cpp.

1082  {
1084  auto simple = mField.getInterface<Simple>();
1085 
1086  auto create_dm = [&](const char *name, const char *field_name, auto dm_type) {
1087  auto dm = createDM(mField.get_comm(), dm_type);
1088  auto create_dm_imp = [&]() {
1090  CHKERR DMMoFEMCreateSubDM(dm, simple->getDM(), name);
1091  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_TRUE);
1092  CHKERR DMMoFEMAddElement(dm, simple->getDomainFEName());
1095  CHKERR DMSetUp(dm);
1097  };
1099  create_dm_imp(),
1100  "Error in creating schurDM. It is possible that schurDM is "
1101  "already created");
1102  return dm;
1103  };
1104 
1105  // Note: here we can make block with bubbles of "U" and "SIGMA" fields. See
1106  // vec-0 where bubbles are added.
1107 
1108  schurDM = create_dm("SCHUR", "U", "DMMOFEM_MG");
1109  blockDM = create_dm("BLOCK", "SIGMA", "DMMOFEM");
1110 
1111  if constexpr (AT == AssemblyType::BLOCK_SCHUR) {
1112 
1113  auto get_nested_mat_data = [&](auto schur_dm, auto block_dm) {
1114  auto block_mat_data = createBlockMatStructure(
1115  simple->getDM(),
1116 
1117  {{
1118 
1119  simple->getDomainFEName(),
1120 
1121  {
1122 
1123  {"U", "U"}, {"SIGMA", "U"}, {"U", "SIGMA"}, {"SIGMA", "SIGMA"}
1124 
1125  }}}
1126 
1127  );
1128 
1130 
1131  {schur_dm, block_dm}, block_mat_data,
1132 
1133  {"SIGMA"}, {nullptr}, true
1134 
1135  );
1136  };
1137 
1138  auto nested_mat_data = get_nested_mat_data(schurDM, blockDM);
1139  CHKERR DMMoFEMSetNestSchurData(simple->getDM(), nested_mat_data);
1140 
1141  } else {
1142  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1143  "Only BLOCK_SCHUR is implemented");
1144  }
1145 
1147 }

◆ getA00Fields()

auto SetUpSchurImpl::getA00Fields ( )
inlineprivate

Definition at line 60 of file SetUpSchurImpl.cpp.

60  {
61  std::vector<std::string> a00_field_list{
62 
64 
66 
68 
70 
72 
73  };
74  std::vector<boost::shared_ptr<Range>> range_list_ptr(a00_field_list.size(),
75  nullptr);
76  return std::make_pair(a00_field_list, range_list_ptr);
77  }

◆ getSchurFields()

auto SetUpSchurImpl::getSchurFields ( )
inlineprivate

Definition at line 53 of file SetUpSchurImpl.cpp.

53  {
54  std::vector<std::string> schur_field_list{epCorePtr->hybridSpatialDisp,
56  std::vector<boost::shared_ptr<Range>> dm_range_list{nullptr, nullptr};
57  return std::make_pair(schur_field_list, dm_range_list);
58  };

◆ postProc() [1/2]

MoFEMErrorCode SetUpSchurImpl::postProc ( )

◆ postProc() [2/2]

MoFEMErrorCode SetUpSchurImpl::postProc ( )
Examples
plastic.cpp.

◆ preProc() [1/2]

MoFEMErrorCode SetUpSchurImpl::preProc ( )

◆ preProc() [2/2]

MoFEMErrorCode SetUpSchurImpl::preProc ( )
Examples
plastic.cpp.

◆ setDiagonalPC() [1/2]

MoFEMErrorCode SetUpSchurImpl::setDiagonalPC ( PC  pc)
private

◆ setDiagonalPC() [2/2]

MoFEMErrorCode SetUpSchurImpl::setDiagonalPC ( PC  pc)
private

Definition at line 1233 of file contact.cpp.

1233  {
1235  KSP *subksp;
1236  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1237  auto get_pc = [](auto ksp) {
1238  PC pc_raw;
1239  CHKERR KSPGetPC(ksp, &pc_raw);
1240  return SmartPetscObj<PC>(pc_raw, true); // bump reference
1241  };
1242  CHKERR setSchurA00MatSolvePC(get_pc(subksp[0]));
1243 
1244  auto set_pc_p_mg = [](auto dm, auto pc, auto S) {
1246  CHKERR PCSetDM(pc, dm);
1247  PetscBool same = PETSC_FALSE;
1248  PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
1249  if (same) {
1251  pc, createPCMGSetUpViaApproxOrdersCtx(dm, S, true));
1252  CHKERR PCSetFromOptions(pc);
1253  }
1255  };
1256 
1257  CHKERR set_pc_p_mg(schurDM, get_pc(subksp[1]), S);
1258 
1259  CHKERR PetscFree(subksp);
1261 }

◆ setEntities()

MoFEMErrorCode SetUpSchurImpl::setEntities ( )
private

Definition at line 997 of file elastic.cpp.

997  {
999  auto simple = mField.getInterface<Simple>();
1000  CHKERR mField.get_moab().get_entities_by_dimension(simple->getMeshset(),
1001  SPACE_DIM, volEnts);
1002  CHKERR mField.get_moab().get_entities_by_handle(simple->getMeshset(),
1003  subEnts);
1004  subEnts = subtract(subEnts, volEnts);
1006 };

◆ setOperator() [1/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

◆ setOperator() [2/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

◆ setOperator() [3/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

Definition at line 1149 of file contact.cpp.

1149  {
1151 
1152  double eps_stab = 1e-4;
1153  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-eps_stab", &eps_stab,
1154  PETSC_NULL);
1155 
1158  using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1159 
1160  auto simple = mField.getInterface<Simple>();
1161  auto pip = mField.getInterface<PipelineManager>();
1162 
1163  auto dm_is = getDMSubData(schurDM)->getSmartRowIs();
1164  auto ao_up = createAOMappingIS(dm_is, PETSC_NULL);
1165 
1166  // Boundary
1167  pip->getOpBoundaryLhsPipeline().push_front(createOpSchurAssembleBegin());
1168  pip->getOpBoundaryLhsPipeline().push_back(
1169  new OpMassStab("SIGMA", "SIGMA",
1170  [eps_stab](double, double, double) { return eps_stab; }));
1171  pip->getOpBoundaryLhsPipeline().push_back(
1172 
1173  createOpSchurAssembleEnd({"SIGMA"}, {nullptr}, ao_up, S, false, false)
1174 
1175  );
1176 
1177  // Domain
1178  pip->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1179  pip->getOpDomainLhsPipeline().push_back(
1180 
1181  createOpSchurAssembleEnd({"SIGMA"}, {nullptr}, ao_up, S, false,
1182  false)
1183 
1184  );
1185 
1186  auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1187  auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1188 
1189  pre_proc_schur_lhs_ptr->preProcessHook = [this]() {
1191  CHKERR MatZeroEntries(S);
1192  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble Begin";
1194  };
1195 
1196  post_proc_schur_lhs_ptr->postProcessHook = [this, ao_up,
1197  post_proc_schur_lhs_ptr]() {
1199  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble End";
1200  auto print_mat_norm = [this](auto a, std::string prefix) {
1202  double nrm;
1203  CHKERR MatNorm(a, NORM_FROBENIUS, &nrm);
1204  MOFEM_LOG("CONTACT", Sev::noisy) << prefix << " norm = " << nrm;
1206  };
1207  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
1208  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
1210  mField, post_proc_schur_lhs_ptr, 1, S, ao_up)();
1211 #ifndef NDEBUG
1212  CHKERR print_mat_norm(S, "S");
1213 #endif // NDEBUG
1214  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble Finish";
1216  };
1217 
1218  auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
1219  ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_schur_lhs_ptr);
1220  ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_schur_lhs_ptr);
1221 
1223 }

◆ setPC() [1/3]

MoFEMErrorCode SetUpSchurImpl::setPC ( PC  pc)
private

◆ setPC() [2/3]

MoFEMErrorCode SetUpSchurImpl::setPC ( PC  pc)
private

◆ setPC() [3/3]

MoFEMErrorCode SetUpSchurImpl::setPC ( PC  pc)
private

Definition at line 1225 of file contact.cpp.

1225  {
1227  auto block_is = getDMSubData(blockDM)->getSmartRowIs();
1228  CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
1229  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
1231 }

◆ setUp() [1/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( SmartPetscObj< KSP >  solver)
virtual

Implements SetUpSchur.

◆ setUp() [2/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( SmartPetscObj< KSP >  ksp)
virtual

Implements SetUpSchur.

Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 532 of file test_broken_space.cpp.

532  {
534  auto simple = mField.getInterface<Simple>();
535  auto pip_mng = mField.getInterface<PipelineManager>();
536 
537  CHKERR KSPSetFromOptions(ksp);
538  PC pc;
539  CHKERR KSPGetPC(ksp, &pc);
540 
541  PetscBool is_pcfs = PETSC_FALSE;
542  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
543  if (is_pcfs) {
544 
545  MOFEM_LOG("AT", Sev::inform) << "Setup Schur pc";
546 
547  auto create_sub_dm = [&]() {
548  auto simple = mField.getInterface<Simple>();
549 
550  auto create_dm = [&](
551 
552  std::string problem_name,
553  std::vector<std::string> fe_names,
554  std::vector<std::string> fields,
555 
556  auto dm_type
557 
558  ) {
559  auto dm = createDM(mField.get_comm(), dm_type);
560  auto create_dm_imp = [&]() {
562  CHKERR DMMoFEMCreateSubDM(dm, simple->getDM(), problem_name.c_str());
563  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_TRUE);
564  for (auto fe : fe_names) {
565  CHKERR DMMoFEMAddElement(dm, fe);
566  }
567  CHKERR DMMoFEMAddElement(dm, simple->getSkeletonFEName());
568  for (auto field : fields) {
569  CHKERR DMMoFEMAddSubFieldRow(dm, field);
570  CHKERR DMMoFEMAddSubFieldCol(dm, field);
571  }
572  CHKERR DMSetUp(dm);
574  };
576  create_dm_imp(),
577  "Error in creating schurDM. It is possible that schurDM is "
578  "already created");
579  return dm;
580  };
581 
582  auto schur_dm = create_dm(
583 
584  "SCHUR",
585 
586  {simple->getDomainFEName(), simple->getSkeletonFEName()},
587 
588  {"HYBRID"},
589 
590  "DMMOFEM_MG");
591 
592  auto block_dm = create_dm(
593 
594  "BLOCK",
595 
596  {simple->getDomainFEName(), simple->getSkeletonFEName()},
597 
598  {"BROKEN", "U"},
599 
600  "DMMOFEM");
601 
602  return std::make_tuple(schur_dm, block_dm);
603  };
604 
605  auto get_nested_mat_data = [&](auto schur_dm, auto block_dm) {
606  auto block_mat_data = createBlockMatStructure(
607  simple->getDM(),
608 
609  {
610 
611  {
612 
613  simple->getDomainFEName(),
614 
615  {
616 
617  {"BROKEN", "BROKEN"},
618  {"U", "U"},
619  {"BROKEN", "U"},
620  {"U", "BROKEN"}
621 
622  }
623 
624  },
625 
626  {
627 
628  simple->getSkeletonFEName(),
629 
630  {
631 
632  {"BROKEN", "HYBRID"}, {"HYBRID", "BROKEN"}
633 
634  }
635 
636  }
637 
638  }
639 
640  );
641 
643 
644  {schur_dm, block_dm}, block_mat_data,
645 
646  {"BROKEN", "U"}, {nullptr, nullptr}, true
647 
648  );
649  };
650 
651  auto set_ops = [&](auto schur_dm) {
653  auto dm_is = getDMSubData(schur_dm)->getSmartRowIs();
654  auto ao_up = createAOMappingIS(dm_is, PETSC_NULL);
655 
656  boost::shared_ptr<BlockStructure> block_data;
657  CHKERR DMMoFEMGetBlocMatData(simple->getDM(), block_data);
658 
659  if (AT == BLOCK_SCHUR) {
660  pip_mng->getOpDomainLhsPipeline().push_front(
662  pip_mng->getOpDomainLhsPipeline().push_back(
663 
664  createOpSchurAssembleEnd({"BROKEN", "U"}, {nullptr, nullptr}, ao_up,
665  S, true, true)
666 
667  );
668  }
669 
670  auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
671  auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
672 
673  pre_proc_schur_lhs_ptr->preProcessHook = [this]() {
675  CHKERR MatZeroEntries(S);
676  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble Begin";
678  };
679 
680  post_proc_schur_lhs_ptr->postProcessHook = [this, ao_up,
681  post_proc_schur_lhs_ptr]() {
683  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble End";
684 
685  if (AT == BLOCK_SCHUR) {
686  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
687  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
688  if (1) {
689  auto S_from_block = matDuplicate(S, MAT_SHARE_NONZERO_PATTERN);
690  // Create matrix from block mat
691  CHKERR assembleBlockMatSchur(mField, post_proc_schur_lhs_ptr->B,
692  S_from_block, {"BROKEN", "U"},
693  {nullptr, nullptr}, ao_up);
694  CHKERR MatAssemblyBegin(S_from_block, MAT_FINAL_ASSEMBLY);
695  CHKERR MatAssemblyEnd(S_from_block, MAT_FINAL_ASSEMBLY);
696  CHKERR MatAYPX(S_from_block, -1, S, DIFFERENT_NONZERO_PATTERN);
697  double norm;
698  CHKERR MatNorm(S_from_block, NORM_FROBENIUS, &norm);
699  MOFEM_LOG("AT", Sev::inform) << "Norm of difference: " << norm;
700  if (norm > 1e-6)
701  SETERRQ(
702  PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
703  "Norm of difference between Schur and block matrix is larger "
704  "than accepted");
705  }
706  } else {
707  CHKERR assembleBlockMatSchur(mField, post_proc_schur_lhs_ptr->B, S,
708  {"BROKEN", "U"}, {nullptr, nullptr}, ao_up);
709  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
710  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
711  }
712 
713  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble Finish";
715  };
716 
717  auto ksp_ctx_ptr = getDMKspCtx(simple->getDM());
718  ksp_ctx_ptr->getPreProcSetOperators().push_front(pre_proc_schur_lhs_ptr);
719  ksp_ctx_ptr->getPostProcSetOperators().push_back(post_proc_schur_lhs_ptr);
720 
722  };
723 
724  auto set_pc = [&](auto pc, auto block_dm) {
726  auto block_is = getDMSubData(block_dm)->getSmartRowIs();
727  CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
728  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
730  };
731 
732  auto set_diagonal_pc = [&](auto pc, auto schur_dm) {
734 
735  if (AT == BLOCK_SCHUR || AT == BLOCK_MAT) {
736  auto A = createDMBlockMat(simple->getDM());
737  auto P = createDMNestSchurMat(simple->getDM());
738  CHKERR PCSetOperators(pc, A, P);
739  }
740 
741  KSP *subksp;
742  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
743  auto get_pc = [](auto ksp) {
744  PC pc_raw;
745  CHKERR KSPGetPC(ksp, &pc_raw);
746  return pc_raw;
747  };
748  CHKERR setSchurA00MatSolvePC(SmartPetscObj<PC>(get_pc(subksp[0]), true));
749 
750  auto set_pc_p_mg = [&](auto dm, auto pc) {
752 
753  CHKERR PCSetDM(pc, dm);
754  PetscBool same = PETSC_FALSE;
755  PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
756  if (same) {
757  // By default do not use shell mg mat. Implementation of SOR is slow.
759  pc, createPCMGSetUpViaApproxOrdersCtx(dm, S, false));
760  CHKERR PCSetFromOptions(pc);
761  }
763  };
764 
765  CHKERR set_pc_p_mg(schur_dm, get_pc(subksp[1]));
766 
767  CHKERR PetscFree(subksp);
769  };
770 
771  auto [schur_dm, block_dm] = create_sub_dm();
772  if (AT == BLOCK_SCHUR || AT == BLOCK_MAT) {
773  auto nested_mat_data = get_nested_mat_data(schur_dm, block_dm);
774  CHKERR DMMoFEMSetNestSchurData(simple->getDM(), nested_mat_data);
775  }
776  S = createDMHybridisedL2Matrix(schur_dm);
777  CHKERR MatSetDM(S, PETSC_NULL);
778 
779  int bs = (SPACE_DIM == 2) ? NBEDGE_L2(approx_order - 1)
780  : NBFACETRI_L2(approx_order - 1);
781  CHKERR MatSetBlockSize(S, bs);
782 
783  CHKERR set_ops(schur_dm);
784  CHKERR set_pc(pc, block_dm);
785  DM solver_dm;
786  CHKERR KSPGetDM(ksp, &solver_dm);
787  if (AT == BLOCK_SCHUR || AT == BLOCK_MAT)
788  CHKERR DMSetMatType(solver_dm, MATSHELL);
789 
790  CHKERR KSPSetUp(ksp);
791  if (AT == BLOCK_SCHUR || AT == BLOCK_MAT)
792  CHKERR set_diagonal_pc(pc, schur_dm);
793 
794  } else {
795  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
796  "PC is not set to PCFIELDSPLIT");
797  }
799 }

◆ setUp() [3/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( SmartPetscObj< TS >  solver)
virtual

Implements SetUpSchur.

◆ setUp() [4/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( SmartPetscObj< TS >  solver)
virtual

Implements SetUpSchur.

Definition at line 1007 of file contact.cpp.

1007  {
1009  auto simple = mField.getInterface<Simple>();
1010  auto pip = mField.getInterface<PipelineManager>();
1011 
1012  SNES snes;
1013  CHKERR TSGetSNES(solver, &snes);
1014  KSP ksp;
1015  CHKERR SNESGetKSP(snes, &ksp);
1016  CHKERR KSPSetFromOptions(ksp);
1017 
1018  PC pc;
1019  CHKERR KSPGetPC(ksp, &pc);
1020 
1021  PetscBool is_pcfs = PETSC_FALSE;
1022  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1023  if (is_pcfs) {
1024 
1025  MOFEM_LOG("CONTACT", Sev::inform) << "Setup Schur pc";
1026 
1027  if (S) {
1030  "It is expected that Schur matrix is not allocated. This is "
1031  "possible only if PC is set up twice");
1032  }
1033 
1034  CHKERR createSubDM();
1035 
1036  // Add data to DM storage
1038  CHKERR MatSetBlockSize(S, SPACE_DIM);
1039  // CHKERR MatSetOption(S, MAT_SYMMETRIC, PETSC_TRUE);
1040 
1041  // Set DM to use shell block matrix
1042  DM solver_dm;
1043  CHKERR TSGetDM(solver, &solver_dm);
1044  CHKERR DMSetMatType(solver_dm, MATSHELL);
1045 
1046  auto ts_ctx_ptr = getDMTsCtx(solver_dm);
1047  auto A = createDMBlockMat(simple->getDM());
1048  auto P = createDMNestSchurMat(simple->getDM());
1049 
1050  if (is_quasi_static == PETSC_TRUE) {
1051  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
1052  Mat A, Mat B, void *ctx) {
1053  return TsSetIJacobian(ts, t, u, u_t, a, B, A, ctx);
1054  };
1055  CHKERR TSSetIJacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1056  } else {
1057  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, Vec utt,
1058  PetscReal a, PetscReal aa, Mat A, Mat B,
1059  void *ctx) {
1060  return TsSetI2Jacobian(ts, t, u, u_t, utt, a, aa, B, A, ctx);
1061  };
1062  CHKERR TSSetI2Jacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1063  }
1064  CHKERR KSPSetOperators(ksp, A, P);
1065 
1066  CHKERR setOperator();
1067  CHKERR setPC(pc);
1068  CHKERR TSSetUp(solver);
1069  CHKERR KSPSetUp(ksp);
1070  CHKERR setDiagonalPC(pc);
1071 
1072  } else {
1073  MOFEM_LOG("CONTACT", Sev::inform) << "No Schur PC";
1074  pip->getOpBoundaryLhsPipeline().push_front(createOpSchurAssembleBegin());
1075  pip->getOpBoundaryLhsPipeline().push_back(createOpSchurAssembleEnd({}, {}));
1076  pip->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1077  pip->getOpDomainLhsPipeline().push_back(createOpSchurAssembleEnd({}, {}));
1078  }
1080 }

◆ setUp() [5/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( TS  solver)
virtual

Implements SetUpSchur.

Definition at line 1665 of file plastic.cpp.

1665  {
1667  auto simple = mField.getInterface<Simple>();
1668  auto pip_mng = mField.getInterface<PipelineManager>();
1669 
1670  SNES snes;
1671  CHKERR TSGetSNES(solver, &snes);
1672  KSP ksp;
1673  CHKERR SNESGetKSP(snes, &ksp);
1674  CHKERR KSPSetFromOptions(ksp);
1675 
1676  PC pc;
1677  CHKERR KSPGetPC(ksp, &pc);
1678  PetscBool is_pcfs = PETSC_FALSE;
1679  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1680  if (is_pcfs) {
1681  if (S) {
1683  "Is expected that schur matrix is not "
1684  "allocated. This is "
1685  "possible only is PC is set up twice");
1686  }
1687 
1688  S = createDMMatrix(subDM);
1689  CHKERR MatSetBlockSize(S, SPACE_DIM);
1690 
1691  // Set DM to use shell block matrix
1692  DM solver_dm;
1693  CHKERR TSGetDM(solver, &solver_dm);
1694  CHKERR DMSetMatType(solver_dm, MATSHELL);
1695 
1696  auto ts_ctx_ptr = getDMTsCtx(solver_dm);
1697  auto A = createDMBlockMat(simple->getDM());
1698  auto P = createDMNestSchurMat(simple->getDM());
1699 
1700  if (is_quasi_static == PETSC_TRUE) {
1701  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
1702  Mat A, Mat B, void *ctx) {
1703  return TsSetIJacobian(ts, t, u, u_t, a, B, A, ctx);
1704  };
1705  CHKERR TSSetIJacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1706  } else {
1707  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, Vec utt,
1708  PetscReal a, PetscReal aa, Mat A, Mat B,
1709  void *ctx) {
1710  return TsSetI2Jacobian(ts, t, u, u_t, utt, a, aa, B, A, ctx);
1711  };
1712  CHKERR TSSetI2Jacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1713  }
1714  CHKERR KSPSetOperators(ksp, A, P);
1715 
1716  auto set_ops = [&]() {
1718  auto pip_mng = mField.getInterface<PipelineManager>();
1719 
1720 #ifndef ADD_CONTACT
1721  // Boundary
1722  pip_mng->getOpBoundaryLhsPipeline().push_front(
1724  pip_mng->getOpBoundaryLhsPipeline().push_back(createOpSchurAssembleEnd(
1725 
1726  {"EP", "TAU"}, {nullptr, nullptr}, aoSchur, S, false, false
1727 
1728  ));
1729  // Domain
1730  pip_mng->getOpDomainLhsPipeline().push_front(
1732  pip_mng->getOpDomainLhsPipeline().push_back(createOpSchurAssembleEnd(
1733 
1734  {"EP", "TAU"}, {nullptr, nullptr}, aoSchur, S, false, false
1735 
1736  ));
1737 #else
1738 
1739  double eps_stab = 1e-4;
1740  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-eps_stab", &eps_stab,
1741  PETSC_NULL);
1742 
1745  using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1746 
1747  // Boundary
1748  pip_mng->getOpBoundaryLhsPipeline().push_front(
1750  pip_mng->getOpBoundaryLhsPipeline().push_back(
1751  new OpMassStab("SIGMA", "SIGMA", [eps_stab](double, double, double) {
1752  return eps_stab;
1753  }));
1754  pip_mng->getOpBoundaryLhsPipeline().push_back(createOpSchurAssembleEnd(
1755 
1756  {"SIGMA", "EP", "TAU"}, {nullptr, nullptr, nullptr}, aoSchur, S,
1757  false, false
1758 
1759  ));
1760  // Domain
1761  pip_mng->getOpDomainLhsPipeline().push_front(
1763  pip_mng->getOpDomainLhsPipeline().push_back(createOpSchurAssembleEnd(
1764 
1765  {"SIGMA", "EP", "TAU"}, {nullptr, nullptr, nullptr}, aoSchur, S,
1766  false, false
1767 
1768  ));
1769 #endif // ADD_CONTACT
1771  };
1772 
1773  auto set_assemble_elems = [&]() {
1775  auto schur_asmb_pre_proc = boost::make_shared<FEMethod>();
1776  schur_asmb_pre_proc->preProcessHook = [this]() {
1778  CHKERR MatZeroEntries(S);
1779  MOFEM_LOG("TIMER", Sev::verbose) << "Lhs Assemble Begin";
1781  };
1782  auto schur_asmb_post_proc = boost::make_shared<FEMethod>();
1783 
1784  schur_asmb_post_proc->postProcessHook = [this, schur_asmb_post_proc]() {
1786  MOFEM_LOG("TIMER", Sev::verbose) << "Lhs Assemble End";
1787 
1788  // Apply essential constrains to Schur complement
1789  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
1790  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
1792  mField, schur_asmb_post_proc, 1, S, aoSchur)();
1793 
1795  };
1796  auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
1797  ts_ctx_ptr->getPreProcessIJacobian().push_front(schur_asmb_pre_proc);
1798  ts_ctx_ptr->getPostProcessIJacobian().push_front(schur_asmb_post_proc);
1800  };
1801 
1802  auto set_pc = [&]() {
1804  CHKERR PCFieldSplitSetIS(pc, NULL, fieldSplitIS);
1805  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
1807  };
1808 
1809  auto set_diagonal_pc = [&]() {
1811  KSP *subksp;
1812  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1813  auto get_pc = [](auto ksp) {
1814  PC pc_raw;
1815  CHKERR KSPGetPC(ksp, &pc_raw);
1816  return SmartPetscObj<PC>(pc_raw,
1817  true); // bump reference
1818  };
1819  CHKERR setSchurA00MatSolvePC(get_pc(subksp[0]));
1820  CHKERR PetscFree(subksp);
1822  };
1823 
1824  CHKERR set_ops();
1825  CHKERR set_pc();
1826  CHKERR set_assemble_elems();
1827 
1828  CHKERR TSSetUp(solver);
1829  CHKERR KSPSetUp(ksp);
1830  CHKERR set_diagonal_pc();
1831 
1832  } else {
1833  pip_mng->getOpBoundaryLhsPipeline().push_front(
1835  pip_mng->getOpBoundaryLhsPipeline().push_back(
1836  createOpSchurAssembleEnd({}, {}));
1837  pip_mng->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1838  pip_mng->getOpDomainLhsPipeline().push_back(
1839  createOpSchurAssembleEnd({}, {}));
1840  }
1841 
1842  // fieldSplitIS.reset();
1843  // aoSchur.reset();
1845 }

◆ setUp() [6/6]

MoFEMErrorCode SetUpSchurImpl::setUp ( TS  ts)
virtual

Implements SetUpSchur.

Member Data Documentation

◆ aoS

SmartPetscObj<AO> SetUpSchurImpl::aoS
private

Definition at line 24 of file SetUpSchurImpl.cpp.

◆ aoSchur

SmartPetscObj<AO> SetUpSchurImpl::aoSchur
private
Examples
plastic.cpp.

Definition at line 1662 of file plastic.cpp.

◆ blockDM

SmartPetscObj< DM > SetUpSchurImpl::blockDM
private

Definition at line 1004 of file contact.cpp.

◆ epCorePtr

EshelbianCore* SetUpSchurImpl::epCorePtr
private

Definition at line 21 of file SetUpSchurImpl.cpp.

◆ fieldSplitIS

SmartPetscObj<IS> SetUpSchurImpl::fieldSplitIS
private

IS for split Schur block.

Examples
plastic.cpp.

Definition at line 1661 of file plastic.cpp.

◆ mField

MoFEM::Interface & SetUpSchurImpl::mField
private
Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 528 of file test_broken_space.cpp.

◆ piolaZeroDofsMarker

boost::shared_ptr<std::vector<unsigned char> > SetUpSchurImpl::piolaZeroDofsMarker
private

Definition at line 29 of file SetUpSchurImpl.cpp.

◆ piolaZeroDofsVec

boost::shared_ptr<std::vector<boost::weak_ptr<NumeredDofEntity> > > SetUpSchurImpl::piolaZeroDofsVec
private

Definition at line 27 of file SetUpSchurImpl.cpp.

◆ pMGPtr

boost::shared_ptr<P_MultiGridData> SetUpSchurImpl::pMGPtr
private

Definition at line 51 of file SetUpSchurImpl.cpp.

◆ S

SmartPetscObj< Mat > SetUpSchurImpl::S
private
Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 529 of file test_broken_space.cpp.

◆ schurDM

SmartPetscObj< DM > SetUpSchurImpl::schurDM
private

Definition at line 1003 of file contact.cpp.

◆ subDM

SmartPetscObj< DM > SetUpSchurImpl::subDM
private

field split sub dm

Examples
plastic.cpp.

Definition at line 1660 of file plastic.cpp.

◆ subEnts

Range SetUpSchurImpl::subEnts
private

Definition at line 950 of file elastic.cpp.

◆ volEnts

Range SetUpSchurImpl::volEnts
private

Definition at line 949 of file elastic.cpp.


The documentation for this struct was generated from the following files:
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::DMMoFEMGetBlocMatData
MoFEMErrorCode DMMoFEMGetBlocMatData(DM dm, boost::shared_ptr< BlockStructure > &)
Get data for block mat.
Definition: DMMoFEM.cpp:1542
SPACE_DIM
constexpr int SPACE_DIM
Definition: test_broken_space.cpp:31
MoFEM::createAOMappingIS
auto createAOMappingIS(IS isapp, IS ispetsc)
Creates an application mapping using two index sets.
Definition: PetscSmartObj.hpp:318
MoFEM::DMMoFEMAddSubFieldCol
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:280
SetUpSchurImpl::aoSchur
SmartPetscObj< AO > aoSchur
Definition: plastic.cpp:1662
EshelbianCore::spatialL2Disp
const std::string spatialL2Disp
Definition: EshelbianCore.hpp:102
MoFEM::EssentialPostProcLhs< DisplacementCubitBcData >
Specialization for DisplacementCubitBcData.
Definition: EssentialDisplacementCubitBcData.hpp:134
MoFEM::BLOCK_PRECONDITIONER_SCHUR
@ BLOCK_PRECONDITIONER_SCHUR
Definition: FormsIntegrators.hpp:109
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
SetUpSchurImpl::epCorePtr
EshelbianCore * epCorePtr
Definition: SetUpSchurImpl.cpp:21
MoFEM::createPCMGSetUpViaApproxOrdersCtx
boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > createPCMGSetUpViaApproxOrdersCtx(DM dm, Mat A, bool use_shell_mat)
createPCMGSetUpViaApproxOrdersCtx
Definition: PCMGSetUpViaApproxOrders.cpp:630
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
MoFEM::DMMoFEMSetSquareProblem
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
Definition: DMMoFEM.cpp:456
MoFEM::getDMKspCtx
auto getDMKspCtx(DM dm)
Get KSP context data structure used by DM.
Definition: DMMoFEM.hpp:1113
MoFEM::BLOCK_MAT
@ BLOCK_MAT
Definition: FormsIntegrators.hpp:107
SetUpSchurImpl::setPC
MoFEMErrorCode setPC(PC pc)
Definition: contact.cpp:1225
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
MoFEM::TsSetI2Jacobian
PetscErrorCode TsSetI2Jacobian(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, PetscReal a, PetscReal aa, Mat A, Mat B, void *ctx)
Calculation Jacobian for second order PDE in time.
Definition: TsCtx.cpp:519
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
MoFEM::getDMSubData
auto getDMSubData(DM dm)
Get sub problem data structure.
Definition: DMMoFEM.hpp:1157
SetUpSchurImpl::schurDM
SmartPetscObj< DM > schurDM
Definition: contact.cpp:1003
SetUpSchurImpl::createSubDM
MoFEMErrorCode createSubDM()
Definition: contact.cpp:1082
SetUpSchurImpl::subDM
SmartPetscObj< DM > subDM
field split sub dm
Definition: plastic.cpp:1660
MoFEM::createDMMatrix
auto createDMMatrix(DM dm)
Get smart matrix from DM.
Definition: DMMoFEM.hpp:1056
MoFEM::DMMoFEMAddElement
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition: DMMoFEM.cpp:497
MoFEM::createDMBlockMat
auto createDMBlockMat(DM dm)
Definition: DMMoFEM.hpp:1076
SPACE_DIM
constexpr int SPACE_DIM
Definition: contact.cpp:55
SetUpSchurImpl::volEnts
Range volEnts
Definition: elastic.cpp:949
EshelbianCore::contactDisp
const std::string contactDisp
Definition: EshelbianCore.hpp:108
SetUpSchurImpl::blockDM
SmartPetscObj< DM > blockDM
Definition: contact.cpp:1004
MoFEM::createOpSchurAssembleEnd
OpSchurAssembleBase * createOpSchurAssembleEnd(std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range >> field_ents, SmartPetscObj< AO > ao, SmartPetscObj< Mat > schur, bool sym_schur, bool symm_op)
Construct a new Op Schur Assemble End object.
Definition: Schur.cpp:2585
AT
constexpr AssemblyType AT
Definition: test_broken_space.cpp:24
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
SetUpSchurImpl::S
SmartPetscObj< Mat > S
Definition: test_broken_space.cpp:529
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
MoFEM::createDM
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
Definition: PetscSmartObj.hpp:141
a
constexpr double a
Definition: approx_sphere.cpp:30
SetUpSchurImpl::fieldSplitIS
SmartPetscObj< IS > fieldSplitIS
IS for split Schur block.
Definition: plastic.cpp:1661
EshelbianCore::rotAxis
const std::string rotAxis
Definition: EshelbianCore.hpp:110
SPACE_DIM
constexpr int SPACE_DIM
Definition: plastic.cpp:40
MoFEM::createDMHybridisedL2Matrix
auto createDMHybridisedL2Matrix(DM dm)
Get smart hybridised L2 matrix from DM.
Definition: DMMoFEM.hpp:1069
SetUpSchurImpl::subEnts
Range subEnts
Definition: elastic.cpp:950
is_quasi_static
PetscBool is_quasi_static
Definition: plastic.cpp:143
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
NBEDGE_L2
#define NBEDGE_L2(P)
Number of base functions on edge from L2 space.
Definition: h1_hdiv_hcurl_l2.h:48
MoFEM::DMMoFEMCreateSubDM
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
Definition: DMMoFEM.cpp:215
MoFEM::FormsIntegrators::Assembly
Assembly methods.
Definition: FormsIntegrators.hpp:317
SetUpSchurImpl::mField
MoFEM::Interface & mField
Definition: test_broken_space.cpp:528
EshelbianPlasticity::P
@ P
Definition: EshelbianContact.cpp:201
MoFEM::createOpSchurAssembleBegin
OpSchurAssembleBase * createOpSchurAssembleBegin()
Definition: Schur.cpp:2580
MoFEM::createDMNestSchurMat
auto createDMNestSchurMat(DM dm)
Definition: DMMoFEM.hpp:1083
MoFEM::TsSetIJacobian
PetscErrorCode TsSetIJacobian(TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a, Mat A, Mat B, void *ctx)
Set function evaluating jacobian in TS solver.
Definition: TsCtx.cpp:169
SPACE_DIM
constexpr int SPACE_DIM
[Define dimension]
Definition: elastic.cpp:18
SetUpSchurImpl::setOperator
MoFEMErrorCode setOperator()
Definition: contact.cpp:1149
MoFEM::matDuplicate
SmartPetscObj< Mat > matDuplicate(Mat mat, MatDuplicateOption op)
Definition: PetscSmartObj.hpp:234
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
EshelbianCore::hybridSpatialDisp
const std::string hybridSpatialDisp
Definition: EshelbianCore.hpp:106
EshelbianCore::stretchTensor
const std::string stretchTensor
Definition: EshelbianCore.hpp:109
BiLinearForm
SetUpSchur::SetUpSchur
SetUpSchur()=default
MoFEM::assembleBlockMatSchur
MoFEMErrorCode assembleBlockMatSchur(MoFEM::Interface &m_field, Mat B, Mat S, std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range >> field_ents, SmartPetscObj< AO > ao)
Assemble Schur matrix.
Definition: Schur.cpp:1817
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::setSchurA00MatSolvePC
MoFEMErrorCode setSchurA00MatSolvePC(SmartPetscObj< PC > pc)
Set PC for A00 block.
Definition: Schur.cpp:2627
is_quasi_static
PetscBool is_quasi_static
[Operators used for contact]
Definition: contact.cpp:78
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
EshelbianCore::bubbleField
const std::string bubbleField
Definition: EshelbianCore.hpp:111
NBFACETRI_L2
#define NBFACETRI_L2(P)
Number of base functions on triangle for L2 space.
Definition: h1_hdiv_hcurl_l2.h:42
approx_order
int approx_order
Definition: test_broken_space.cpp:54
MoFEM::createSchurNestedMatrixStruture
boost::shared_ptr< NestSchurData > createSchurNestedMatrixStruture(std::pair< SmartPetscObj< DM >, SmartPetscObj< DM >> dms, boost::shared_ptr< BlockStructure > block_mat_data_ptr, std::vector< std::string > fields_names, std::vector< boost::shared_ptr< Range >> field_ents, bool add_preconditioner_block)
Get the Schur Nest Mat Array object.
Definition: Schur.cpp:2343
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:64
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
EshelbianCore::piolaStress
const std::string piolaStress
Definition: EshelbianCore.hpp:100
MoFEM::BLOCK_SCHUR
@ BLOCK_SCHUR
Definition: FormsIntegrators.hpp:108
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEM::DMMoFEMSetNestSchurData
MoFEMErrorCode DMMoFEMSetNestSchurData(DM dm, boost::shared_ptr< NestSchurData >)
Definition: DMMoFEM.cpp:1562
MoFEM::createBlockMatStructure
boost::shared_ptr< BlockStructure > createBlockMatStructure(DM dm, SchurFEOpsFEandFields schur_fe_op_vec)
Create a Mat Diag Blocks object.
Definition: Schur.cpp:1082
MoFEM::PCMGSetUpViaApproxOrders
MoFEMErrorCode PCMGSetUpViaApproxOrders(PC pc, boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > ctx, int verb)
Function build MG structure.
Definition: PCMGSetUpViaApproxOrders.cpp:634
MoFEM::PetscOptionsGetScalar
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:162
MoFEM::DMMoFEMAddSubFieldRow
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:238
MoFEM::SmartPetscObj
intrusive_ptr for managing petsc objects
Definition: PetscSmartObj.hpp:82
SetUpSchurImpl::setDiagonalPC
MoFEMErrorCode setDiagonalPC(PC pc)
Definition: contact.cpp:1233
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
AT
constexpr AssemblyType AT
Definition: contact.cpp:36
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::getDMTsCtx
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition: DMMoFEM.hpp:1141
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359