v0.14.0
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]

Public Member Functions

 SetUpSchurImpl (MoFEM::Interface &m_field)
 
virtual ~SetUpSchurImpl ()=default
 
MoFEMErrorCode setUp (SmartPetscObj< KSP >)
 
 SetUpSchurImpl (MoFEM::Interface &m_field, SmartPetscObj< Mat > m, SmartPetscObj< Mat > p, EshelbianCore *ep_core_ptr)
 
virtual ~SetUpSchurImpl ()
 
MoFEMErrorCode setUp (KSP solver)
 
MoFEMErrorCode preProc ()
 
MoFEMErrorCode postProc ()
 
 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, 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)
 

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)
 

Private Attributes

MoFEM::InterfacemField
 
SmartPetscObj< Mat > S
 
SmartPetscObj< Mat > M
 
SmartPetscObj< Mat > P
 
SmartPetscObj< AO > aoUp
 
SmartPetscObj< IS > isA00
 
SmartPetscObj< IS > isShift
 
EshelbianCore * epCorePtr
 
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
 

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, 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
 
 SetUpSchur ()=default
 

Detailed Description

Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 512 of file test_broken_space.cpp.

Constructor & Destructor Documentation

◆ SetUpSchurImpl() [1/7]

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

Definition at line 514 of file test_broken_space.cpp.

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

◆ ~SetUpSchurImpl() [1/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
virtualdefault

◆ SetUpSchurImpl() [2/7]

SetUpSchurImpl::SetUpSchurImpl ( MoFEM::Interface m_field,
SmartPetscObj< Mat >  m,
SmartPetscObj< Mat >  p,
EshelbianCore *  ep_core_ptr 
)
inline

Definition at line 11 of file SetUpSchurImpl.cpp.

13  : SetUpSchur(), mField(m_field), M(m), P(p), epCorePtr(ep_core_ptr) {
14  if (S) {
17  "Is expected that schur matrix is not allocated. This is "
18  "possible only is PC is set up twice");
19  }
20  }

◆ ~SetUpSchurImpl() [2/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 21 of file SetUpSchurImpl.cpp.

21 { S.reset(); }

◆ SetUpSchurImpl() [3/7]

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

Definition at line 1285 of file plastic.cpp.

1287  : SetUpSchur(), mField(m_field), subDM(sub_dm),
1288  fieldSplitIS(field_split_is), aoSchur(ao_up) {
1289  if (S) {
1292  "Is expected that schur matrix is not allocated. This is "
1293  "possible only is PC is set up twice");
1294  }
1295  }

◆ ~SetUpSchurImpl() [3/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 1296 of file plastic.cpp.

1296 { S.reset(); }

◆ SetUpSchurImpl() [4/7]

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

Definition at line 1273 of file plasticity_old_schur.cpp.

1275  : SetUpSchur(), mField(m_field), subDM(sub_dm),
1276  fieldSplitIS(field_split_is), aoUp(ao_up) {
1277  if (S) {
1280  "Is expected that schur matrix is not allocated. This is "
1281  "possible only is PC is set up twice");
1282  }
1283  }

◆ ~SetUpSchurImpl() [4/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 1284 of file plasticity_old_schur.cpp.

1284  {
1285 #ifdef ADD_CONTACT
1286  A.reset();
1287  P.reset();
1288 #endif // ADD_CONTACT
1289  S.reset();
1290  }

◆ SetUpSchurImpl() [5/7]

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

Definition at line 960 of file contact.cpp.

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

◆ ~SetUpSchurImpl() [5/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 962 of file contact.cpp.

962 {}

◆ SetUpSchurImpl() [6/7]

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

Definition at line 935 of file incompressible_elasticity.cpp.

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

◆ ~SetUpSchurImpl() [6/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
inlinevirtual

Definition at line 936 of file incompressible_elasticity.cpp.

936 { S.reset(); }

◆ SetUpSchurImpl() [7/7]

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

Definition at line 884 of file elastic.cpp.

884  : SetUpSchur(), mField(m_field) {
885  if (S) {
888  "Is expected that schur matrix is not allocated. This is "
889  "possible only is PC is set up twice");
890  }
891  }

◆ ~SetUpSchurImpl() [7/7]

virtual SetUpSchurImpl::~SetUpSchurImpl ( )
virtualdefault

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 1056 of file contact.cpp.

1056  {
1058  auto simple = mField.getInterface<Simple>();
1059 
1060  auto create_dm = [&](const char *name, const char *field_name) {
1061  auto dm = createDM(mField.get_comm(), "DMMOFEM");
1062  auto create_dm_imp = [&]() {
1064  CHKERR DMMoFEMCreateSubDM(dm, simple->getDM(), name);
1065  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_TRUE);
1066  CHKERR DMMoFEMAddElement(dm, simple->getDomainFEName());
1069  CHKERR DMSetUp(dm);
1071  };
1073  create_dm_imp(),
1074  "Error in creating schurDM. It is possible that schurDM is "
1075  "already created");
1076  return dm;
1077  };
1078 
1079  // Note: here we can make block with bubbles of "U" and "SIGMA" fields. See
1080  // vec-0 where bubbles are added.
1081 
1082  schurDM = create_dm("SCHUR", "U");
1083  blockDM = create_dm("BLOCK", "SIGMA");
1084 
1085  if constexpr (AT == AssemblyType::BLOCK_SCHUR) {
1086 
1087  auto get_nested_mat_data = [&](auto schur_dm, auto block_dm) {
1088  auto block_mat_data = createBlockMatStructure(
1089  simple->getDM(),
1090 
1091  {{
1092 
1093  simple->getDomainFEName(),
1094 
1095  {
1096 
1097  {"U", "U"}, {"SIGMA", "U"}, {"U", "SIGMA"}, {"SIGMA", "SIGMA"}
1098 
1099  }}}
1100 
1101  );
1102 
1103  return getNestSchurData(
1104 
1105  {schurDM, blockDM}, block_mat_data,
1106 
1107  {"SIGMA"}, {nullptr}, true
1108 
1109  );
1110  };
1111 
1112  auto nested_mat_data = get_nested_mat_data(schurDM, blockDM);
1113  CHKERR DMMoFEMSetNestSchurData(simple->getDM(), nested_mat_data);
1114 
1115  } else {
1116  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1117  "Only BLOCK_SCHUR is implemented");
1118  }
1119 
1121 }

◆ postProc() [1/3]

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

Definition at line 213 of file SetUpSchurImpl.cpp.

213  {
215  if (S) {
216  MOFEM_LOG("EP", Sev::verbose) << "Assemble Schur";
217  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
218  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
219  }
220  CHKERR MatAssemblyBegin(M, MAT_FINAL_ASSEMBLY);
221  CHKERR MatAssemblyEnd(M, MAT_FINAL_ASSEMBLY);
222  CHKERR MatAssemblyBegin(P, MAT_FINAL_ASSEMBLY);
223  CHKERR MatAssemblyEnd(P, MAT_FINAL_ASSEMBLY);
224  CHKERR MatAXPY(P, 1, M, SAME_NONZERO_PATTERN);
225 
227 }

◆ postProc() [2/3]

MoFEMErrorCode SetUpSchurImpl::postProc ( )

◆ postProc() [3/3]

MoFEMErrorCode SetUpSchurImpl::postProc ( )

◆ preProc() [1/3]

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

Definition at line 202 of file SetUpSchurImpl.cpp.

202  {
204  MOFEM_LOG("EP", Sev::verbose) << "Zero Schur";
205  if (SetUpSchurImpl::S) {
206  CHKERR MatZeroEntries(S);
207  }
208  CHKERR MatZeroEntries(M);
209  CHKERR MatZeroEntries(P);
211 }

◆ preProc() [2/3]

MoFEMErrorCode SetUpSchurImpl::preProc ( )

◆ preProc() [3/3]

MoFEMErrorCode SetUpSchurImpl::preProc ( )

◆ setDiagonalPC() [1/2]

MoFEMErrorCode SetUpSchurImpl::setDiagonalPC ( PC  pc)
private

◆ setDiagonalPC() [2/2]

MoFEMErrorCode SetUpSchurImpl::setDiagonalPC ( PC  pc)
private

Definition at line 1213 of file contact.cpp.

1213  {
1215  KSP *subksp;
1216  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1217  auto get_pc = [](auto ksp) {
1218  PC pc_raw;
1219  CHKERR KSPGetPC(ksp, &pc_raw);
1220  return SmartPetscObj<PC>(pc_raw, true); // bump reference
1221  };
1222  CHKERR setSchurMatSolvePC(get_pc(subksp[0]));
1223  CHKERR PetscFree(subksp);
1225 }

◆ setEntities()

MoFEMErrorCode SetUpSchurImpl::setEntities ( )
private

Definition at line 960 of file elastic.cpp.

960  {
962  auto simple = mField.getInterface<Simple>();
963  CHKERR mField.get_moab().get_entities_by_dimension(simple->getMeshset(),
964  SPACE_DIM, volEnts);
965  CHKERR mField.get_moab().get_entities_by_handle(simple->getMeshset(),
966  subEnts);
967  subEnts = subtract(subEnts, volEnts);
969 };

◆ setOperator() [1/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

◆ setOperator() [2/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

◆ setOperator() [3/3]

MoFEMErrorCode SetUpSchurImpl::setOperator ( )
private

Definition at line 1123 of file contact.cpp.

1123  {
1125 
1126  double eps_stab = 1e-4;
1127  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-eps_stab", &eps_stab,
1128  PETSC_NULL);
1129 
1132  using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1133 
1134  auto simple = mField.getInterface<Simple>();
1135  auto pip = mField.getInterface<PipelineManager>();
1136 
1137  // block data structure
1138  boost::shared_ptr<BlockStructure> block_data;
1139  CHKERR DMMoFEMGetBlocMatData(simple->getDM(), block_data);
1140 
1141  // Boundary
1142  auto dm_is = getDMSubData(schurDM)->getSmartRowIs();
1143  auto ao_up = createAOMappingIS(dm_is, PETSC_NULL);
1144 
1145  pip->getOpBoundaryLhsPipeline().push_front(createOpSchurAssembleBegin());
1146  pip->getOpBoundaryLhsPipeline().push_back(
1147  new OpMassStab("SIGMA", "SIGMA",
1148  [eps_stab](double, double, double) { return eps_stab; }));
1149  pip->getOpBoundaryLhsPipeline().push_back(
1150 
1151  createOpSchurAssembleEnd({"SIGMA"}, {nullptr}, {ao_up}, {S}, {false},
1152  false, block_data)
1153 
1154  );
1155 
1156  // Domain
1157  pip->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1158  pip->getOpDomainLhsPipeline().push_back(
1159 
1160  createOpSchurAssembleEnd({"SIGMA"}, {nullptr}, {ao_up}, {S}, {false},
1161  false, block_data)
1162 
1163  );
1164 
1165  auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1166  auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1167 
1168  pre_proc_schur_lhs_ptr->preProcessHook = [this]() {
1170  CHKERR MatZeroEntries(S);
1171  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble Begin";
1173  };
1174 
1175  post_proc_schur_lhs_ptr->postProcessHook = [this, ao_up,
1176  post_proc_schur_lhs_ptr]() {
1178  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble End";
1179  auto print_mat_norm = [this](auto a, std::string prefix) {
1181  double nrm;
1182  CHKERR MatNorm(a, NORM_FROBENIUS, &nrm);
1183  MOFEM_LOG("CONTACT", Sev::noisy) << prefix << " norm = " << nrm;
1185  };
1186  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
1187  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
1189  mField, post_proc_schur_lhs_ptr, 1, S, ao_up)();
1190 #ifndef NDEBUG
1191  CHKERR print_mat_norm(S, "S");
1192 #endif // NDEBUG
1193  MOFEM_LOG("CONTACT", Sev::verbose) << "Lhs Assemble Finish";
1195  };
1196 
1197  auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
1198  ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_schur_lhs_ptr);
1199  ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_schur_lhs_ptr);
1200 
1202 }

◆ 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 1204 of file contact.cpp.

1204  {
1206  auto simple = mField.getInterface<Simple>();
1207  auto block_is = getDMSubData(blockDM)->getSmartRowIs();
1208  CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
1209  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
1211 }

◆ setUp() [1/7]

MoFEMErrorCode SetUpSchurImpl::setUp ( KSP  solver)

Definition at line 39 of file SetUpSchurImpl.cpp.

39  {
41 
42  auto get_ents_by_dim = [&](int dim) {
43  Range ents;
44  CHKERR mField.get_moab().get_entities_by_dimension(0, dim, ents);
45  return ents;
46  };
47 
48  std::vector<std::string> schur_field_list{
49 
50  epCorePtr->stretchTensor,
51 
52  epCorePtr->bubbleField,
53 
54  epCorePtr->rotAxis,
55 
56  epCorePtr->spatialL2Disp,
57 
58  epCorePtr->piolaStress
59 
60  };
61  std::vector<std::string> field_list{epCorePtr->piolaStress,
62  epCorePtr->contactDisp};
63 
64  auto create_schur_dm = [&](SmartPetscObj<DM> &dm_sub) {
66 
67  dm_sub = createDM(mField.get_comm(), "DMMOFEM");
68  CHKERR DMMoFEMCreateSubDM(dm_sub, epCorePtr->dmElastic, "SUB_SCHUR");
69  CHKERR DMMoFEMSetSquareProblem(dm_sub, PETSC_TRUE);
70  CHKERR DMMoFEMSetIsPartitioned(dm_sub, PETSC_TRUE);
71  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->elementVolumeName);
72  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->naturalBcElement);
73  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->contactElement);
74 
75  auto faces_ptr = boost::make_shared<Range>(get_ents_by_dim(SPACE_DIM - 1));
76  std::vector<boost::shared_ptr<Range>> dm_range_list{faces_ptr, nullptr};
77 
78  if (field_list.size() != dm_range_list.size()) {
79  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
80  "Both ranges should have the same size");
81  }
82 
83  int r_idx = 0;
84  for (auto f : field_list) {
85  MOFEM_LOG("EP", Sev::inform) << "Add schur field: " << f;
86  CHKERR DMMoFEMAddSubFieldRow(dm_sub, f, dm_range_list[r_idx]);
87  CHKERR DMMoFEMAddSubFieldCol(dm_sub, f, dm_range_list[r_idx]);
88  ++r_idx;
89  }
90  CHKERR DMSetUp(dm_sub);
92  };
93 
94  auto create_a00_is = [&](SmartPetscObj<IS> &is_a00) {
96  auto vols = get_ents_by_dim(SPACE_DIM);
97  std::vector<SmartPetscObj<IS>> is_vec;
98  std::vector<Range *> range_list_ptr(schur_field_list.size(), nullptr);
99  range_list_ptr.back() = &vols;
100 
101  int r_idx = 0;
102  for (auto f : schur_field_list) {
103  SmartPetscObj<IS> is;
104  CHKERR mField.getInterface<ISManager>()->isCreateProblemFieldAndRank(
105  "ELASTIC_PROBLEM", ROW, f, 0, MAX_DOFS_ON_ENTITY, is,
106  range_list_ptr[r_idx]);
107  is_vec.push_back(is);
108  ++r_idx;
109  }
110  if (is_vec.size()) {
111  is_a00 = is_vec[0];
112  for (auto i = 1; i < is_vec.size(); ++i) {
113  IS is_union_raw;
114  CHKERR ISExpand(is_a00, is_vec[i], &is_union_raw);
115  is_a00 = SmartPetscObj<IS>(is_union_raw);
116  }
117  CHKERR ISSort(is_a00);
118  }
120  };
121 
122  PC pc;
123  CHKERR KSPSetFromOptions(solver);
124  CHKERR KSPGetPC(solver, &pc);
125  PetscBool is_pcfs = PETSC_FALSE;
126  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
127  if (is_pcfs) {
128 
129  SmartPetscObj<DM> schur_dm, a00_dm;
130  CHKERR create_schur_dm(schur_dm);
131  CHKERR create_a00_is(isA00);
132 
133  if (S) {
136  "Is expected that schur matrix is not allocated. This is "
137  "possible only is PC is set up twice");
138  }
139 
140  S = createDMMatrix(schur_dm);
141 
142  auto set_ops = [&]() {
144  auto range_ptr = boost::make_shared<Range>(get_ents_by_dim(SPACE_DIM));
145  std::vector<boost::shared_ptr<Range>> ranges_list(schur_field_list.size(),
146  nullptr);
147  ranges_list.back() = range_ptr;
148  std::vector<SmartPetscObj<AO>> ao_list(schur_field_list.size(),
149  SmartPetscObj<AO>());
150  std::vector<SmartPetscObj<Mat>> mat_list(schur_field_list.size(),
151  SmartPetscObj<Mat>());
152  std::vector<bool> symm_list(schur_field_list.size(), false);
153 
154  auto dm_is = getDMSubData(schur_dm)->getSmartRowIs();
155  aoUp = createAOMappingIS(dm_is, PETSC_NULL);
156  ao_list.back() = aoUp;
157  mat_list.back() = S;
158 
159  const bool symmetric_system =
160  EshelbianCore::gradApperoximator <= MODERATE_ROT &&
161  EshelbianCore::rotSelector == SMALL_ROT;
162  epCorePtr->elasticFeLhs->getOpPtrVector().push_front(
163  new OpSchurAssembleBegin());
164  epCorePtr->elasticFeLhs->getOpPtrVector().push_back(
165  new OpSchurAssembleEnd<SCHUR_DGESV>(schur_field_list, ranges_list,
166  ao_list, mat_list, symm_list,
167  symmetric_system));
168  epCorePtr->elasticBcLhs->getOpPtrVector().push_front(
169  new OpSchurAssembleBegin());
170  epCorePtr->elasticBcLhs->getOpPtrVector().push_back(
171  new OpSchurAssembleEnd<SCHUR_DGESV>(schur_field_list, ranges_list,
172  ao_list, mat_list, symm_list,
173  symmetric_system));
174 
176  };
177 
178  auto set_pc = [&]() {
180  CHKERR PCFieldSplitSetIS(pc, NULL, isA00);
181  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
183  };
184 
185  CHKERR set_ops();
186  CHKERR set_pc();
187 
188  } else {
189  epCorePtr->elasticFeLhs->getOpPtrVector().push_front(
190  new OpSchurAssembleBegin());
191  epCorePtr->elasticFeLhs->getOpPtrVector().push_back(
192  new OpSchurAssembleEnd<SCHUR_DGESV>({}, {}, {}, {}, {}));
193  epCorePtr->elasticBcLhs->getOpPtrVector().push_front(
194  new OpSchurAssembleBegin());
195  epCorePtr->elasticBcLhs->getOpPtrVector().push_back(
196  new OpSchurAssembleEnd<SCHUR_DGESV>({}, {}, {}, {}, {}));
197  }
198 
200 }

◆ setUp() [2/7]

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

Implements SetUpSchur.

◆ setUp() [3/7]

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

Implements SetUpSchur.

Examples
plastic.cpp, and test_broken_space.cpp.

Definition at line 525 of file test_broken_space.cpp.

525  {
527  auto simple = mField.getInterface<Simple>();
528  auto pip_mng = mField.getInterface<PipelineManager>();
529 
530  CHKERR KSPSetFromOptions(ksp);
531  PC pc;
532  CHKERR KSPGetPC(ksp, &pc);
533 
534  PetscBool is_pcfs = PETSC_FALSE;
535  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
536  if (is_pcfs) {
537 
538  MOFEM_LOG("AT", Sev::inform) << "Setup Schur pc";
539 
540  auto create_sub_dm = [&]() {
541  auto simple = mField.getInterface<Simple>();
542 
543  auto create_dm = [&](
544 
545  std::string problem_name,
546  std::vector<std::string> fe_names,
547  std::vector<std::string> fields,
548 
549  auto dm_type
550 
551  ) {
552  auto dm = createDM(mField.get_comm(), dm_type);
553  auto create_dm_imp = [&]() {
555  CHKERR DMMoFEMCreateSubDM(dm, simple->getDM(), problem_name.c_str());
556  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_TRUE);
557  for (auto fe : fe_names) {
558  CHKERR DMMoFEMAddElement(dm, fe);
559  }
560  CHKERR DMMoFEMAddElement(dm, simple->getSkeletonFEName());
561  for (auto field : fields) {
562  CHKERR DMMoFEMAddSubFieldRow(dm, field);
563  CHKERR DMMoFEMAddSubFieldCol(dm, field);
564  }
565  CHKERR DMSetUp(dm);
567  };
569  create_dm_imp(),
570  "Error in creating schurDM. It is possible that schurDM is "
571  "already created");
572  return dm;
573  };
574 
575  auto schur_dm = create_dm(
576 
577  "SCHUR",
578 
579  {simple->getDomainFEName(), simple->getSkeletonFEName()},
580 
581  {"HYBRID"},
582 
583  "DMMOFEM_MG");
584 
585  auto block_dm = create_dm(
586 
587  "BLOCK",
588 
589  {simple->getDomainFEName(), simple->getSkeletonFEName()},
590 
591  {"BROKEN", "U"},
592 
593  "DMMOFEM");
594 
595  return std::make_tuple(schur_dm, block_dm);
596  };
597 
598  auto get_nested_mat_data = [&](auto schur_dm, auto block_dm) {
599  auto block_mat_data = createBlockMatStructure(
600  simple->getDM(),
601 
602  {
603 
604  {
605 
606  simple->getDomainFEName(),
607 
608  {
609 
610  {"BROKEN", "BROKEN"},
611  {"U", "U"},
612  {"BROKEN", "U"},
613  {"U", "BROKEN"}
614 
615  }
616 
617  },
618 
619  {
620 
621  simple->getSkeletonFEName(),
622 
623  {
624 
625  {"BROKEN", "HYBRID"}, {"HYBRID", "BROKEN"}
626 
627  }
628 
629  }
630 
631  }
632 
633  );
634 
635  return getNestSchurData(
636 
637  {schur_dm, block_dm}, block_mat_data,
638 
639  {"BROKEN", "U"}, {nullptr, nullptr}, true
640 
641  );
642  };
643 
644  auto set_ops = [&](auto schur_dm) {
646  auto dm_is = getDMSubData(schur_dm)->getSmartRowIs();
647  auto ao_up = createAOMappingIS(dm_is, PETSC_NULL);
648 
649  boost::shared_ptr<BlockStructure> block_data;
650  CHKERR DMMoFEMGetBlocMatData(simple->getDM(), block_data);
651 
652  pip_mng->getOpDomainLhsPipeline().push_front(
654  pip_mng->getOpDomainLhsPipeline().push_back(
655 
657  {"BROKEN", "U"}, {nullptr, nullptr}, {SmartPetscObj<AO>(), ao_up},
658  {SmartPetscObj<Mat>(), S}, {true, true}, true, block_data)
659 
660  );
661 
662  auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
663  auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
664 
665  pre_proc_schur_lhs_ptr->preProcessHook = [this]() {
667  CHKERR MatZeroEntries(S);
668  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble Begin";
670  };
671 
672  post_proc_schur_lhs_ptr->postProcessHook = [this, ao_up,
673  post_proc_schur_lhs_ptr]() {
675  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble End";
676  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
677  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
678  MOFEM_LOG("AT", Sev::verbose) << "Lhs Assemble Finish";
680  };
681 
682  auto ksp_ctx_ptr = getDMKspCtx(simple->getDM());
683  ksp_ctx_ptr->getPreProcSetOperators().push_front(pre_proc_schur_lhs_ptr);
684  ksp_ctx_ptr->getPostProcSetOperators().push_back(post_proc_schur_lhs_ptr);
685 
687  };
688 
689  auto set_pc = [&](auto pc, auto block_dm) {
691  auto block_is = getDMSubData(block_dm)->getSmartRowIs();
692  CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
693  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
695  };
696 
697  auto set_diagonal_pc = [&](auto pc, auto schur_dm) {
699 
700  auto A = createDMBlockMat(simple->getDM());
701  auto P = createDMNestSchurMat(simple->getDM());
702  CHKERR PCSetOperators(pc, A, P);
703 
704  KSP *subksp;
705  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
706  auto get_pc = [](auto ksp) {
707  PC pc_raw;
708  CHKERR KSPGetPC(ksp, &pc_raw);
709  return pc_raw;
710  };
711  CHKERR setSchurA00MatSolvePC(SmartPetscObj<PC>(get_pc(subksp[0]), true));
712 
713  auto set_pc_p_mg = [&](auto dm, auto pc) {
715 
716  CHKERR PCSetDM(pc, dm);
717  PetscBool same = PETSC_FALSE;
718  PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
719  if (same) {
720  // By default do not use shell mg mat. Implementation of SOR is slow.
722  pc, createPCMGSetUpViaApproxOrdersCtx(dm, S, false));
723  CHKERR PCSetFromOptions(pc);
724  }
726  };
727 
728  CHKERR set_pc_p_mg(schur_dm, get_pc(subksp[1]));
729 
730  CHKERR PetscFree(subksp);
732  };
733 
734  auto [schur_dm, block_dm] = create_sub_dm();
735  auto nested_mat_data = get_nested_mat_data(schur_dm, block_dm);
736  CHKERR DMMoFEMSetNestSchurData(simple->getDM(), nested_mat_data);
737  S = createDMHybridisedL2Matrix(schur_dm);
738  CHKERR MatSetDM(S, PETSC_NULL);
739  int bs = (SPACE_DIM == 2) ? NBEDGE_L2(approx_order - 1)
740  : NBFACETRI_L2(approx_order - 1);
741  CHKERR MatSetBlockSize(S, bs);
742 
743  CHKERR set_ops(schur_dm);
744  CHKERR set_pc(pc, block_dm);
745  DM solver_dm;
746  CHKERR KSPGetDM(ksp, &solver_dm);
747  CHKERR DMSetMatType(solver_dm, MATSHELL);
748 
749  CHKERR KSPSetUp(ksp);
750  CHKERR set_diagonal_pc(pc, schur_dm);
751 
752  } else {
753  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
754  "PC is not set to PCFIELDSPLIT");
755  }
757 }

◆ setUp() [4/7]

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

Implements SetUpSchur.

◆ setUp() [5/7]

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

Implements SetUpSchur.

Definition at line 979 of file contact.cpp.

979  {
981  auto simple = mField.getInterface<Simple>();
982  auto pip = mField.getInterface<PipelineManager>();
983 
984  SNES snes;
985  CHKERR TSGetSNES(solver, &snes);
986  KSP ksp;
987  CHKERR SNESGetKSP(snes, &ksp);
988  CHKERR KSPSetFromOptions(ksp);
989 
990  PC pc;
991  CHKERR KSPGetPC(ksp, &pc);
992 
993  PetscBool is_pcfs = PETSC_FALSE;
994  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
995  if (is_pcfs) {
996 
997  MOFEM_LOG("CONTACT", Sev::inform) << "Setup Schur pc";
998 
999  if (S) {
1002  "It is expected that Schur matrix is not allocated. This is "
1003  "possible only if PC is set up twice");
1004  }
1005 
1006  CHKERR createSubDM();
1007 
1008  // Add data to DM storage
1010  CHKERR MatSetBlockSize(S, SPACE_DIM);
1011  // CHKERR MatSetOption(S, MAT_SYMMETRIC, PETSC_TRUE);
1012 
1013  // Set DM to use shell block matrix
1014  DM solver_dm;
1015  CHKERR TSGetDM(solver, &solver_dm);
1016  CHKERR DMSetMatType(solver_dm, MATSHELL);
1017 
1018  auto ts_ctx_ptr = getDMTsCtx(solver_dm);
1019  auto A = createDMBlockMat(simple->getDM());
1020  auto P = createDMNestSchurMat(simple->getDM());
1021 
1022  if (is_quasi_static == PETSC_TRUE) {
1023  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
1024  Mat A, Mat B, void *ctx) {
1025  return TsSetIJacobian(ts, t, u, u_t, a, B, A, ctx);
1026  };
1027  CHKERR TSSetIJacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1028  } else {
1029  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, Vec utt,
1030  PetscReal a, PetscReal aa, Mat A, Mat B,
1031  void *ctx) {
1032  return TsSetI2Jacobian(ts, t, u, u_t, utt, a, aa, B, A, ctx);
1033  };
1034  CHKERR TSSetI2Jacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1035  }
1036  CHKERR KSPSetOperators(ksp, A, P);
1037 
1038  CHKERR setOperator();
1039  CHKERR setPC(pc);
1040  CHKERR TSSetUp(solver);
1041  CHKERR KSPSetUp(ksp);
1042  CHKERR setDiagonalPC(pc);
1043 
1044  } else {
1045  MOFEM_LOG("CONTACT", Sev::inform) << "No Schur PC";
1046  pip->getOpBoundaryLhsPipeline().push_front(createOpSchurAssembleBegin());
1047  pip->getOpBoundaryLhsPipeline().push_back(
1048  createOpSchurAssembleEnd({}, {}, {}, {}, {}, false));
1049  pip->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1050  pip->getOpDomainLhsPipeline().push_back(
1051  createOpSchurAssembleEnd({}, {}, {}, {}, {}, false));
1052  }
1054 }

◆ setUp() [6/7]

MoFEMErrorCode SetUpSchurImpl::setUp ( TS  solver)
virtual

Implements SetUpSchur.

◆ setUp() [7/7]

MoFEMErrorCode SetUpSchurImpl::setUp ( TS  solver)
virtual

Implements SetUpSchur.

Definition at line 1311 of file plastic.cpp.

1311  {
1313  auto simple = mField.getInterface<Simple>();
1314  auto pip_mng = mField.getInterface<PipelineManager>();
1315 
1316  SNES snes;
1317  CHKERR TSGetSNES(solver, &snes);
1318  KSP ksp;
1319  CHKERR SNESGetKSP(snes, &ksp);
1320  CHKERR KSPSetFromOptions(ksp);
1321 
1322  PC pc;
1323  CHKERR KSPSetFromOptions(ksp);
1324  CHKERR KSPGetPC(ksp, &pc);
1325  PetscBool is_pcfs = PETSC_FALSE;
1326  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1327  if (is_pcfs) {
1328  if (S) {
1331  "Is expected that schur matrix is not allocated. This is "
1332  "possible only is PC is set up twice");
1333  }
1334 
1335  S = createDMMatrix(subDM);
1336  CHKERR MatSetBlockSize(S, SPACE_DIM);
1337 
1338  // Set DM to use shell block matrix
1339  DM solver_dm;
1340  CHKERR TSGetDM(solver, &solver_dm);
1341  CHKERR DMSetMatType(solver_dm, MATSHELL);
1342 
1343  auto ts_ctx_ptr = getDMTsCtx(solver_dm);
1344  auto A = createDMBlockMat(simple->getDM());
1345  auto P = createDMNestSchurMat(simple->getDM());
1346 
1347  if (is_quasi_static == PETSC_TRUE) {
1348  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
1349  Mat A, Mat B, void *ctx) {
1350  return TsSetIJacobian(ts, t, u, u_t, a, B, A, ctx);
1351  };
1352  CHKERR TSSetIJacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1353  } else {
1354  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, Vec utt,
1355  PetscReal a, PetscReal aa, Mat A, Mat B,
1356  void *ctx) {
1357  return TsSetI2Jacobian(ts, t, u, u_t, utt, a, aa, B, A, ctx);
1358  };
1359  CHKERR TSSetI2Jacobian(solver, A, P, swap_assemble, ts_ctx_ptr.get());
1360  }
1361  CHKERR KSPSetOperators(ksp, A, P);
1362 
1363  auto set_ops = [&]() {
1365  auto pip_mng = mField.getInterface<PipelineManager>();
1366 
1367  boost::shared_ptr<BlockStructure> block_data;
1368  CHKERR DMMoFEMGetBlocMatData(simple->getDM(), block_data);
1369 
1370 #ifndef ADD_CONTACT
1371  // Boundary
1372  pip_mng->getOpBoundaryLhsPipeline().push_front(
1374  pip_mng->getOpBoundaryLhsPipeline().push_back(createOpSchurAssembleEnd(
1375 
1376  {"EP", "TAU"}, {nullptr, nullptr}, {SmartPetscObj<AO>(), aoSchur},
1377  {SmartPetscObj<Mat>(), S}, {false, false}, false, block_data
1378 
1379  ));
1380  // Domain
1381  pip_mng->getOpDomainLhsPipeline().push_front(
1383  pip_mng->getOpDomainLhsPipeline().push_back(createOpSchurAssembleEnd(
1384 
1385  {"EP", "TAU"}, {nullptr, nullptr}, {SmartPetscObj<AO>(), aoSchur},
1386  {SmartPetscObj<Mat>(), S}, {false, false}, false, block_data
1387 
1388  ));
1389 #else
1390 
1391  double eps_stab = 1e-4;
1392  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-eps_stab", &eps_stab,
1393  PETSC_NULL);
1394 
1397  using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1398 
1399  // Boundary
1400  pip_mng->getOpBoundaryLhsPipeline().push_front(
1402  pip_mng->getOpBoundaryLhsPipeline().push_back(
1403  new OpMassStab("SIGMA", "SIGMA", [eps_stab](double, double, double) {
1404  return eps_stab;
1405  }));
1406  pip_mng->getOpBoundaryLhsPipeline().push_back(createOpSchurAssembleEnd(
1407 
1408  {"SIGMA", "EP", "TAU"}, {nullptr, nullptr, nullptr},
1411  {false, false, false}, false, block_data
1412 
1413  ));
1414  // Domain
1415  pip_mng->getOpDomainLhsPipeline().push_front(
1417  pip_mng->getOpDomainLhsPipeline().push_back(createOpSchurAssembleEnd(
1418 
1419  {"SIGMA", "EP", "TAU"}, {nullptr, nullptr, nullptr},
1422  {false, false, false}, false, block_data
1423 
1424  ));
1425 #endif // ADD_CONTACT
1427  };
1428 
1429  auto set_assemble_elems = [&]() {
1431  auto schur_asmb_pre_proc = boost::make_shared<FEMethod>();
1432  schur_asmb_pre_proc->preProcessHook = [this]() {
1434  CHKERR MatZeroEntries(S);
1435  MOFEM_LOG("TIMER", Sev::verbose) << "Lhs Assemble Begin";
1437  };
1438  auto schur_asmb_post_proc = boost::make_shared<FEMethod>();
1439 
1440  schur_asmb_post_proc->postProcessHook = [this, schur_asmb_post_proc]() {
1442  MOFEM_LOG("TIMER", Sev::verbose) << "Lhs Assemble End";
1443 
1444  // Apply essential constrains to Schur complement
1445  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
1446  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
1448  mField, schur_asmb_post_proc, 1, S, aoSchur)();
1449 
1451  };
1452  auto ts_ctx_ptr = getDMTsCtx(simple->getDM());
1453  ts_ctx_ptr->getPreProcessIJacobian().push_front(schur_asmb_pre_proc);
1454  ts_ctx_ptr->getPostProcessIJacobian().push_front(schur_asmb_post_proc);
1456  };
1457 
1458  auto set_pc = [&]() {
1460  CHKERR PCFieldSplitSetIS(pc, NULL, fieldSplitIS);
1461  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
1463  };
1464 
1465  auto set_diagonal_pc = [&]() {
1467  KSP *subksp;
1468  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1469  auto get_pc = [](auto ksp) {
1470  PC pc_raw;
1471  CHKERR KSPGetPC(ksp, &pc_raw);
1472  return SmartPetscObj<PC>(pc_raw, true); // bump reference
1473  };
1474  CHKERR setSchurMatSolvePC(get_pc(subksp[0]));
1475  CHKERR PetscFree(subksp);
1477  };
1478 
1479  CHKERR set_ops();
1480  CHKERR set_pc();
1481  CHKERR set_assemble_elems();
1482 
1483  CHKERR TSSetUp(solver);
1484  CHKERR KSPSetUp(ksp);
1485  CHKERR set_diagonal_pc();
1486 
1487  } else {
1488  pip_mng->getOpBoundaryLhsPipeline().push_front(
1490  pip_mng->getOpBoundaryLhsPipeline().push_back(
1491  createOpSchurAssembleEnd({}, {}, {}, {}, {}, false));
1492  pip_mng->getOpDomainLhsPipeline().push_front(createOpSchurAssembleBegin());
1493  pip_mng->getOpDomainLhsPipeline().push_back(
1494  createOpSchurAssembleEnd({}, {}, {}, {}, {}, false));
1495  }
1496 
1497  // fieldSplitIS.reset();
1498  // aoSchur.reset();
1500 }

Member Data Documentation

◆ aoSchur

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

Definition at line 1308 of file plastic.cpp.

◆ aoUp

SmartPetscObj< AO > SetUpSchurImpl::aoUp
private

Definition at line 31 of file SetUpSchurImpl.cpp.

◆ blockDM

SmartPetscObj< DM > SetUpSchurImpl::blockDM
private

Definition at line 976 of file contact.cpp.

◆ epCorePtr

EshelbianCore* SetUpSchurImpl::epCorePtr
private

Definition at line 36 of file SetUpSchurImpl.cpp.

◆ fieldSplitIS

SmartPetscObj< IS > SetUpSchurImpl::fieldSplitIS
private

IS for split Schur block.

Examples
plastic.cpp.

Definition at line 1307 of file plastic.cpp.

◆ isA00

SmartPetscObj<IS> SetUpSchurImpl::isA00
private

Definition at line 32 of file SetUpSchurImpl.cpp.

◆ isShift

SmartPetscObj<IS> SetUpSchurImpl::isShift
private

Definition at line 33 of file SetUpSchurImpl.cpp.

◆ M

SmartPetscObj<Mat> SetUpSchurImpl::M
private

Definition at line 28 of file SetUpSchurImpl.cpp.

◆ mField

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

Definition at line 521 of file test_broken_space.cpp.

◆ P

SmartPetscObj<Mat> SetUpSchurImpl::P
private
Examples
plastic.cpp.

Definition at line 29 of file SetUpSchurImpl.cpp.

◆ S

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

Definition at line 522 of file test_broken_space.cpp.

◆ schurDM

SmartPetscObj< DM > SetUpSchurImpl::schurDM
private

Definition at line 975 of file contact.cpp.

◆ subDM

SmartPetscObj< DM > SetUpSchurImpl::subDM
private

field split sub dm

Examples
plastic.cpp.

Definition at line 1306 of file plastic.cpp.

◆ subEnts

Range SetUpSchurImpl::subEnts
private

Definition at line 910 of file elastic.cpp.

◆ volEnts

Range SetUpSchurImpl::volEnts
private

Definition at line 909 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
SetUpSchurImpl::fieldSplitIS
SmartPetscObj< IS > fieldSplitIS
IS for split Schur block.
Definition: plastic.cpp:1307
SPACE_DIM
constexpr int SPACE_DIM
Definition: test_broken_space.cpp:27
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:1308
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:36
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
SetUpSchurImpl::M
SmartPetscObj< Mat > M
Definition: SetUpSchurImpl.cpp:28
SetUpSchurImpl::isA00
SmartPetscObj< IS > isA00
Definition: SetUpSchurImpl.cpp:32
SetUpSchurImpl::setPC
MoFEMErrorCode setPC(PC pc)
Definition: contact.cpp:1204
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:511
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:975
SetUpSchurImpl::createSubDM
MoFEMErrorCode createSubDM()
Definition: contact.cpp:1056
SetUpSchurImpl::subDM
SmartPetscObj< DM > subDM
field split sub dm
Definition: plastic.cpp:1306
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:53
SetUpSchurImpl::volEnts
Range volEnts
Definition: elastic.cpp:909
ROW
@ ROW
Definition: definitions.h:136
SetUpSchurImpl::blockDM
SmartPetscObj< DM > blockDM
Definition: contact.cpp:976
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
SetUpSchurImpl::S
SmartPetscObj< Mat > S
Definition: test_broken_space.cpp:522
MoFEM::createOpSchurAssembleEnd
OpSchurAssembleBase * createOpSchurAssembleEnd(std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range >> field_ents, std::vector< SmartPetscObj< AO >> sequence_of_aos, std::vector< SmartPetscObj< Mat >> sequence_of_mats, std::vector< bool > sym_schur, bool symm_op, boost::shared_ptr< BlockStructure > diag_blocks)
Construct a new Op Schur Assemble End object.
Definition: Schur.cpp:2771
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
SPACE_DIM
constexpr int SPACE_DIM
Definition: child_and_parent.cpp:16
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
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:910
is_quasi_static
PetscBool is_quasi_static
Definition: plastic.cpp:139
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 fro 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:312
SetUpSchurImpl::mField
MoFEM::Interface & mField
Definition: test_broken_space.cpp:521
MoFEM::createOpSchurAssembleBegin
OpSchurAssembleBase * createOpSchurAssembleBegin()
Definition: Schur.cpp:2766
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:165
SPACE_DIM
constexpr int SPACE_DIM
[Define dimension]
Definition: elastic.cpp:18
SetUpSchurImpl::setOperator
MoFEMErrorCode setOperator()
Definition: contact.cpp:1123
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
BiLinearForm
SetUpSchur::SetUpSchur
SetUpSchur()=default
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::setSchurMatSolvePC
MoFEMErrorCode setSchurMatSolvePC(SmartPetscObj< PC > pc)
Definition: Schur.cpp:2823
MoFEM::setSchurA00MatSolvePC
MoFEMErrorCode setSchurA00MatSolvePC(SmartPetscObj< PC > pc)
Set PC for A00 block.
Definition: Schur.cpp:2805
MAX_DOFS_ON_ENTITY
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
Definition: definitions.h:249
Range
is_quasi_static
PetscBool is_quasi_static
[Operators used for contact]
Definition: contact.cpp:76
EshelbianPlasticity::SMALL_ROT
@ SMALL_ROT
Definition: EshelbianPlasticity.hpp:20
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
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:50
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::BLOCK_SCHUR
@ BLOCK_SCHUR
Definition: FormsIntegrators.hpp:108
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
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:1196
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
EshelbianPlasticity::MODERATE_ROT
@ MODERATE_ROT
Definition: EshelbianPlasticity.hpp:20
SetUpSchurImpl::setDiagonalPC
MoFEMErrorCode setDiagonalPC(PC pc)
Definition: contact.cpp:1213
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
SetUpSchurImpl::aoUp
SmartPetscObj< AO > aoUp
Definition: SetUpSchurImpl.cpp:31
AT
constexpr AssemblyType AT
Definition: contact.cpp:34
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
MoFEM::getNestSchurData
boost::shared_ptr< NestSchurData > getNestSchurData(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:2249
MoFEM::DMMoFEMSetIsPartitioned
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition: DMMoFEM.cpp:1123
SetUpSchurImpl::P
SmartPetscObj< Mat > P
Definition: SetUpSchurImpl.cpp:29