v0.14.0
SetUpSchurImpl.cpp
Go to the documentation of this file.
1 /** @file SetUpSchurImpl
2  * @brief
3  * @date 2023-05-13
4  *
5  * @license{This project is released under the MIT License.}
6  *
7  */
8 
9 struct SetUpSchurImpl : public EshelbianCore::SetUpSchur {
10 
11  SetUpSchurImpl(MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr)
12  : SetUpSchur(), mField(m_field), epCorePtr(ep_core_ptr) {}
13  virtual ~SetUpSchurImpl() {}
14 
15  MoFEMErrorCode setUp(TS ts);
18 
19 private:
21  EshelbianCore *epCorePtr;
22 
23  SmartPetscObj<Mat> S;
24 
25  boost::shared_ptr<std::vector<boost::weak_ptr<NumeredDofEntity>>>
26  piolaZeroDofsVec; //< Dofs on crack surface
27  boost::shared_ptr<std::vector<unsigned char>>
28  piolaZeroDofsMarker; //< marker for crack dofs on surface
29 };
30 
33 
34  auto get_schur_fields = [&]() {
35  std::vector<std::string> schur_field_list{epCorePtr->hybridSpatialDisp,
36  epCorePtr->contactDisp};
37  std::vector<boost::shared_ptr<Range>> dm_range_list{nullptr, nullptr};
38  return std::make_pair(schur_field_list, dm_range_list);
39  };
40 
41  auto get_a00_fields = [&]() {
42  std::vector<std::string> a00_field_list{
43 
44  epCorePtr->stretchTensor,
45 
46  epCorePtr->bubbleField,
47 
48  epCorePtr->piolaStress,
49 
50  epCorePtr->rotAxis,
51 
52  epCorePtr->spatialL2Disp
53 
54  };
55  std::vector<boost::shared_ptr<Range>> range_list_ptr(a00_field_list.size(),
56  nullptr);
57  return std::make_pair(a00_field_list, range_list_ptr);
58  };
59 
60  auto schur_data = get_schur_fields();
61  auto [schur_field_list, schur_range_list] = schur_data;
62  auto a00_data = get_a00_fields();
63  auto [a00_field_list, a00_range_list] = a00_data;
64 
65  auto create_schur_dm = [&](SmartPetscObj<DM> &dm_sub) {
67 
68  dm_sub = createDM(mField.get_comm(), "DMMOFEM_MG");
69  CHKERR DMMoFEMCreateSubDM(dm_sub, epCorePtr->dmElastic, "SUB_SCHUR");
70  CHKERR DMMoFEMSetSquareProblem(dm_sub, PETSC_TRUE);
71  CHKERR DMMoFEMSetIsPartitioned(dm_sub, PETSC_TRUE);
72  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->skeletonElement);
73  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->contactElement);
74 
75  int r_idx = 0;
76  auto [schur_field_list, schur_range_list] = schur_data;
77  for (auto f : schur_field_list) {
78  MOFEM_LOG("EP", Sev::inform) << "Add schur field: " << f;
79  CHKERR DMMoFEMAddSubFieldRow(dm_sub, f, schur_range_list[r_idx]);
80  CHKERR DMMoFEMAddSubFieldCol(dm_sub, f, schur_range_list[r_idx]);
81  ++r_idx;
82  }
83  CHKERR DMSetUp(dm_sub);
85  };
86 
87  auto create_a00_dm = [&](SmartPetscObj<DM> &dm_sub) {
89  dm_sub = createDM(mField.get_comm(), "DMMOFEM");
90  CHKERR DMMoFEMCreateSubDM(dm_sub, epCorePtr->dmElastic, "SUB_A00");
91  CHKERR DMMoFEMSetSquareProblem(dm_sub, PETSC_TRUE);
92  CHKERR DMMoFEMSetIsPartitioned(dm_sub, PETSC_TRUE);
93  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->elementVolumeName);
94  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->skeletonElement);
95  CHKERR DMMoFEMAddElement(dm_sub, epCorePtr->contactElement);
96 
97  int r_idx = 0;
98  auto [a00_field_list, a00_range_list] = a00_data;
99  for (auto f : a00_field_list) {
100  MOFEM_LOG("EP", Sev::inform) << "Add a00 field: " << f;
101  CHKERR DMMoFEMAddSubFieldRow(dm_sub, f, a00_range_list[r_idx]);
102  CHKERR DMMoFEMAddSubFieldCol(dm_sub, f, a00_range_list[r_idx]);
103  ++r_idx;
104  }
105  CHKERR DMSetUp(dm_sub);
107  };
108 
109  auto get_snes = [&](TS ts) {
110  SNES snes;
111  CHKERR TSGetSNES(ts, &snes);
112  return snes;
113  };
114 
115  auto get_ksp = [&](SNES snes) {
116  KSP ksp;
117  CHKERR SNESGetKSP(snes, &ksp);
118  CHKERR KSPSetFromOptions(ksp);
119  return ksp;
120  };
121 
122  auto get_pc = [&](KSP ksp) {
123  PC pc;
124  CHKERR KSPGetPC(ksp, &pc);
125  return pc;
126  };
127 
128  auto ksp = get_ksp(get_snes(ts));
129  auto pc = get_pc(ksp);
130 
131  PetscBool is_pcfs = PETSC_FALSE;
132  PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
133  if (is_pcfs) {
134 
135  MOFEM_LOG("EP", Sev::inform) << "SetUpSchurImpl::setUp: PCFIELDSPLIT";
136 
137  SmartPetscObj<DM> schur_dm, a00_dm;
138  CHKERR create_schur_dm(schur_dm);
139  CHKERR create_a00_dm(a00_dm);
140 
141  auto dm_elastic = epCorePtr->dmElastic;
142  auto vol_elem_name = epCorePtr->elementVolumeName;
143  auto skel_elem_name = epCorePtr->skeletonElement;
144  auto contact_elem_name = epCorePtr->contactElement;
145 
146  std::vector<std::pair<std::string, std::string>> mat_block_list = {
147 
148  {epCorePtr->piolaStress, epCorePtr->piolaStress},
149  {epCorePtr->stretchTensor, epCorePtr->stretchTensor},
150  {epCorePtr->piolaStress, epCorePtr->stretchTensor},
151  {epCorePtr->stretchTensor, epCorePtr->piolaStress},
152  {epCorePtr->bubbleField, epCorePtr->stretchTensor},
153  {epCorePtr->stretchTensor, epCorePtr->bubbleField},
154 
155  {epCorePtr->piolaStress, epCorePtr->spatialL2Disp},
156  {epCorePtr->spatialL2Disp, epCorePtr->piolaStress},
157  {epCorePtr->piolaStress, epCorePtr->rotAxis},
158  {epCorePtr->rotAxis, epCorePtr->piolaStress},
159  {epCorePtr->bubbleField, epCorePtr->rotAxis},
160  {epCorePtr->rotAxis, epCorePtr->bubbleField},
161  {epCorePtr->spatialL2Disp, epCorePtr->spatialL2Disp}
162 
163  };
164 
165  if(epCorePtr->noStretch) {
166  mat_block_list.push_back(
167  {epCorePtr->bubbleField, epCorePtr->bubbleField});
168  mat_block_list.push_back(
169  {epCorePtr->bubbleField, epCorePtr->piolaStress});
170  mat_block_list.push_back(
171  {epCorePtr->piolaStress, epCorePtr->bubbleField});
172  }
173 
174  if (epCorePtr->gradApproximator > EshelbianPlasticity::SMALL_ROT ||
175  epCorePtr->rotSelector > EshelbianPlasticity::SMALL_ROT) {
176  mat_block_list.push_back({epCorePtr->rotAxis, epCorePtr->rotAxis});
177  mat_block_list.push_back({epCorePtr->stretchTensor, epCorePtr->rotAxis});
178  mat_block_list.push_back({epCorePtr->rotAxis, epCorePtr->stretchTensor});
179  }
180 
181  auto get_nested_mat_data = [&](auto schur_dm, auto block_dm) {
182  auto block_mat_data = createBlockMatStructure(
183  dm_elastic,
184 
185  {
186 
187  {vol_elem_name, mat_block_list},
188 
189  {skel_elem_name,
190 
191  {
192 
193  {epCorePtr->piolaStress, epCorePtr->hybridSpatialDisp},
194  {epCorePtr->hybridSpatialDisp, epCorePtr->piolaStress}
195 
196  }},
197 
198  {contact_elem_name,
199 
200  {
201 
202  {epCorePtr->contactDisp, epCorePtr->contactDisp},
203  {epCorePtr->piolaStress, epCorePtr->contactDisp},
204  {epCorePtr->contactDisp, epCorePtr->piolaStress}
205 
206  }}
207 
208  }
209 
210  );
211 
212  auto [a00_field_list, a00_range_list] = a00_data;
213 
215 
216  {schur_dm, a00_dm}, block_mat_data,
217 
218  a00_field_list,
219 
220  a00_range_list,
221 
222  false
223 
224  );
225  };
226 
227  auto nested_mat_data = get_nested_mat_data(schur_dm, a00_dm);
228  CHKERR DMMoFEMSetNestSchurData(epCorePtr->dmElastic, nested_mat_data);
229  CHKERR DMSetMatType(epCorePtr->dmElastic, MATSHELL);
230 
231  auto m = createDMBlockMat(epCorePtr->dmElastic);
232  auto p = createDMNestSchurMat(epCorePtr->dmElastic);
233 
234  if (std::abs(epCorePtr->alphaRho) >
235  std::numeric_limits<double>::epsilon()) {
236  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, Vec utt,
237  PetscReal a, PetscReal aa, Mat A, Mat B,
238  void *ctx) {
239  return TsSetI2Jacobian(ts, t, u, u_t, utt, a, aa, B, A, ctx);
240  };
241  auto ts_ctx_ptr = getDMTsCtx(epCorePtr->dmElastic);
242  CHKERR TSSetI2Jacobian(ts, m, p, swap_assemble, ts_ctx_ptr.get());
243  } else {
244  auto swap_assemble = [](TS ts, PetscReal t, Vec u, Vec u_t, PetscReal a,
245  Mat A, Mat B, void *ctx) {
246  return TsSetIJacobian(ts, t, u, u_t, a, B, A, ctx);
247  };
248  auto ts_ctx_ptr = getDMTsCtx(epCorePtr->dmElastic);
249  CHKERR TSSetIJacobian(ts, m, p, swap_assemble, ts_ctx_ptr.get());
250  }
251  CHKERR KSPSetOperators(ksp, m, p);
252 
253  auto set_assembly = [&]() {
255  auto [a00_field_list, a00_range_list] = a00_data;
256  std::vector<boost::shared_ptr<Range>> ranges_list(a00_field_list.size(),
257  nullptr);
258 
259  auto schur_ao = getDMSubData(schur_dm)->getSmartRowMap();
260  S = createDMHybridisedL2Matrix(schur_dm);
261  CHKERR MatSetBlockSize(S, SPACE_DIM *
262  NBFACETRI_L2(epCorePtr->spaceOrder - 1));
263 
264  auto set_ops = [&]() {
266 
267  auto [a00_field_list, a00_range_list] = a00_data;
268  const bool symmetric_schur = false;
269  const bool symmetric_block = false;
270  epCorePtr->elasticFeLhs->getOpPtrVector().push_front(
272  epCorePtr->elasticFeLhs->getOpPtrVector().push_back(
273  createOpSchurZeroRowsAndCols(piolaZeroDofsMarker, 1.));
274  epCorePtr->elasticFeLhs->getOpPtrVector().push_back(
275  createOpSchurAssembleEnd(a00_field_list, ranges_list, schur_ao,
276  S, symmetric_schur, symmetric_block));
277  epCorePtr->elasticBcLhs->getOpPtrVector().push_front(
279  epCorePtr->elasticBcLhs->getOpPtrVector().push_back(
280  createOpSchurZeroRowsAndCols(piolaZeroDofsMarker, 1.));
281  epCorePtr->elasticBcLhs->getOpPtrVector().push_back(
282  createOpSchurAssembleEnd(a00_field_list, ranges_list, schur_ao, S,
283  symmetric_schur, symmetric_block));
285  };
286 
287  auto set_assemble = [&]() {
289  auto schur_asmb_pre_proc_lhs = boost::make_shared<FEMethod>();
290  auto schur_asmb_pre_proc_rhs = boost::make_shared<FEMethod>();
291 
292  schur_asmb_pre_proc_lhs->preProcessHook = [this]() {
294  CHKERR MatZeroEntries(S);
296  };
297 
298  schur_asmb_pre_proc_rhs->preProcessHook =
299  [this, schur_asmb_pre_proc_rhs]() {
301  auto prb_ptr = schur_asmb_pre_proc_rhs->problemPtr;
302  auto dofs_prb = prb_ptr->getNumeredRowDofsPtr();
303 
304  auto crack_faces = epCorePtr->crackFaces;
305  piolaZeroDofsVec->clear();
306  CHKERR mField.getInterface<ProblemsManager>()
307  ->getSideDofsOnBrokenSpaceEntities(
308  *piolaZeroDofsVec, prb_ptr->getName(), ROW,
309  epCorePtr->piolaStress, *crack_faces, SPACE_DIM, 0,
310  SPACE_DIM);
311 
312  piolaZeroDofsMarker->resize(dofs_prb->size(), 0);
313  piolaZeroDofsMarker->clear();
314  for (auto &dof : *piolaZeroDofsVec) {
315  if (auto dof_ptr = dof.lock()) {
316  auto idx = dof_ptr->getPetscLocalDofIdx();
317  (*piolaZeroDofsMarker)[idx] = 1;
318  }
319  }
320 
322  };
323 
324  auto schur_asmb_post_proc_lhs = boost::make_shared<FEMethod>();
325  auto schur_asmb_post_proc_rhs = boost::make_shared<FEMethod>();
326 
327  schur_asmb_post_proc_rhs->postProcessHook =
328  [this, schur_asmb_post_proc_rhs]() {
330 
331  CHKERR VecGhostUpdateBegin(schur_asmb_post_proc_rhs->f,
332  ADD_VALUES, SCATTER_REVERSE);
333  CHKERR VecGhostUpdateEnd(schur_asmb_post_proc_rhs->f, ADD_VALUES,
334  SCATTER_REVERSE);
335  CHKERR VecAssemblyBegin(schur_asmb_post_proc_rhs->f);
336  CHKERR VecAssemblyEnd(schur_asmb_post_proc_rhs->f);
337  *(schur_asmb_post_proc_rhs->vecAssembleSwitch) = false;
338 
339  {
340 
341  auto problem_name =
342  schur_asmb_post_proc_rhs->problemPtr->getName();
343 
344  auto crack_faces = epCorePtr->crackFaces;
345 
346  SmartPetscObj<IS> crack_hybrid_is;
347  CHKERR epCorePtr->mField.getInterface<ISManager>()
348  ->isCreateProblemFieldAndRank(
349  problem_name, ROW, epCorePtr->hybridSpatialDisp, 0,
350  SPACE_DIM, crack_hybrid_is, &*crack_faces);
351 
352  SmartPetscObj<IS> crack_piola_is;
353  CHKERR epCorePtr->mField.getInterface<ISManager>()
354  ->isCreateProblemBrokenFieldAndRank(*piolaZeroDofsVec,
355  crack_piola_is);
356 
357  double *a_f;
358  CHKERR VecGetArray(schur_asmb_post_proc_rhs->f, &a_f);
359  auto zero_by_is = [&](auto is) {
361  const PetscInt *is_array;
362  PetscInt is_size;
363  CHKERR ISGetLocalSize(is, &is_size);
364  CHKERR ISGetIndices(is, &is_array);
365  for (int i = 0; i != is_size; ++i) {
366  a_f[is_array[i]] = 0;
367  }
368  CHKERR ISRestoreIndices(is, &is_array);
370  };
371 
372  CHKERR zero_by_is(crack_hybrid_is);
373  CHKERR zero_by_is(crack_piola_is);
374 
375  CHKERR VecRestoreArray(schur_asmb_post_proc_rhs->f, &a_f);
376 
377  }
378 
380  };
381 
382  schur_asmb_post_proc_lhs->postProcessHook =
383  [this, schur_asmb_post_proc_lhs]() {
385 
386  // Apply essential constrains to Schur complement
387  CHKERR MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
388  CHKERR MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
389 
390  // Zero rows and columns hybrid disp on crack surface
391  auto crack_faces = epCorePtr->crackFaces;
392  {
393  SmartPetscObj<IS> crack_hybrid_is;
394  CHKERR epCorePtr->mField.getInterface<ISManager>()
395  ->isCreateProblemFieldAndRank(
396  "SUB_SCHUR", ROW, epCorePtr->hybridSpatialDisp, 0,
397  SPACE_DIM, crack_hybrid_is, &*crack_faces);
398  CHKERR MatZeroRowsColumnsIS(S, crack_hybrid_is, 1, PETSC_NULL,
399  PETSC_NULL);
400  }
401 
402  // Assemble matrix
403  CHKERR MatAssemblyBegin(schur_asmb_post_proc_lhs->B,
404  MAT_FINAL_ASSEMBLY);
405  CHKERR MatAssemblyEnd(schur_asmb_post_proc_lhs->B,
406  MAT_FINAL_ASSEMBLY);
407  *(schur_asmb_post_proc_lhs->matAssembleSwitch) = false;
408  {
409  SmartPetscObj<IS> crack_hybrid_is;
410  CHKERR epCorePtr->mField.getInterface<ISManager>()
411  ->isCreateProblemFieldAndRank(
412  "ELASTIC_PROBLEM", ROW, epCorePtr->hybridSpatialDisp, 0,
413  SPACE_DIM, crack_hybrid_is, &*crack_faces);
414  CHKERR MatZeroRowsColumnsIS(schur_asmb_post_proc_lhs->B,
415  crack_hybrid_is, 1, PETSC_NULL,
416  PETSC_NULL);
417  }
418  {
419  SmartPetscObj<IS> crack_piola_is;
420  CHKERR epCorePtr->mField.getInterface<ISManager>()
421  ->isCreateProblemBrokenFieldAndRank(*piolaZeroDofsVec,
422  crack_piola_is);
423  CHKERR MatZeroRowsColumnsIS(schur_asmb_post_proc_lhs->B,
424  crack_piola_is, 1, PETSC_NULL,
425  PETSC_NULL);
426  }
427 
429  };
430 
431  auto ts_ctx_ptr = getDMTsCtx(epCorePtr->dmElastic);
432  ts_ctx_ptr->getPreProcessIFunction().push_front(
433  schur_asmb_pre_proc_rhs);
434  ts_ctx_ptr->getPostProcessIFunction().push_back(
435  schur_asmb_post_proc_rhs);
436  ts_ctx_ptr->getPreProcessIJacobian().push_front(
437  schur_asmb_pre_proc_lhs);
438  ts_ctx_ptr->getPostProcessIJacobian().push_back(
439  schur_asmb_post_proc_lhs);
441  };
442 
444  boost::make_shared<std::vector<boost::weak_ptr<NumeredDofEntity>>>();
445  piolaZeroDofsMarker = boost::make_shared<std::vector<unsigned char>>();
446  CHKERR set_ops();
447  CHKERR set_assemble();
448 
450  };
451 
452  auto set_pc = [&]() {
454  auto a00_is = getDMSubData(a00_dm)->getSmartRowIs();
455  auto schur_is = getDMSubData(schur_dm)->getSmartRowIs();
456  CHKERR PCFieldSplitSetIS(pc, NULL, a00_is);
457  CHKERR PCFieldSplitSetIS(pc, NULL, schur_is);
458  CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER, S);
460  };
461 
462  auto set_diagonal_pc = [&]() {
464  KSP *subksp;
465  CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
466  auto get_pc = [](auto ksp) {
467  PC pc_raw;
468  CHKERR KSPGetPC(ksp, &pc_raw);
469  return SmartPetscObj<PC>(pc_raw, true); // bump reference
470  };
471  CHKERR setSchurA00MatSolvePC(get_pc(subksp[0]));
472 
473  auto set_pc_p_mg = [](auto dm, auto pc, auto S) {
475  CHKERR PCSetDM(pc, dm);
476  PetscBool same = PETSC_FALSE;
477  PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
478  if (same) {
480  pc, createPCMGSetUpViaApproxOrdersCtx(dm, S, false));
481  CHKERR PCSetFromOptions(pc);
482  }
484  };
485 
486  CHKERR set_pc_p_mg(schur_dm, get_pc(subksp[1]), S);
487 
488  CHKERR PetscFree(subksp);
490  };
491 
492  CHKERR set_assembly();
493  CHKERR set_pc();
494  CHKERR TSSetUp(ts);
495  CHKERR KSPSetUp(ksp);
496  CHKERR set_diagonal_pc();
497 
498  } else {
499  MOFEM_LOG("EP", Sev::inform) << "SetUpSchurImpl::setUp: PCLU or other";
500 
501  epCorePtr->elasticFeLhs->getOpPtrVector().push_front(
503  epCorePtr->elasticFeLhs->getOpPtrVector().push_back(
504  createOpSchurAssembleEnd({}, {}));
505  epCorePtr->elasticBcLhs->getOpPtrVector().push_front(
507  epCorePtr->elasticBcLhs->getOpPtrVector().push_back(
508  createOpSchurAssembleEnd({}, {}));
509  }
510 
512 }
513 
514 boost::shared_ptr<EshelbianCore::SetUpSchur>
515 EshelbianCore::SetUpSchur::createSetUpSchur(MoFEM::Interface &m_field,
516  EshelbianCore *ep_core_ptr) {
517  return boost::shared_ptr<SetUpSchur>(
518  new SetUpSchurImpl(m_field, ep_core_ptr));
519 }
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
SetUpSchurImpl
Definition: test_broken_space.cpp:515
MoFEM::DMMoFEMAddSubFieldCol
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:280
SetUpSchurImpl::setUp
MoFEMErrorCode setUp(SmartPetscObj< KSP >)
Definition: test_broken_space.cpp:528
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
MoFEM::DMMoFEMSetSquareProblem
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
Definition: DMMoFEM.cpp:456
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
SetUpSchurImpl::~SetUpSchurImpl
virtual ~SetUpSchurImpl()
Definition: SetUpSchurImpl.cpp:13
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::getDMSubData
auto getDMSubData(DM dm)
Get sub problem data structure.
Definition: DMMoFEM.hpp:1157
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
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
ROW
@ ROW
Definition: definitions.h:136
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:2186
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
SetUpSchurImpl::S
SmartPetscObj< Mat > S
Definition: test_broken_space.cpp:525
SetUpSchurImpl::SetUpSchurImpl
SetUpSchurImpl(MoFEM::Interface &m_field, EshelbianCore *ep_core_ptr)
Definition: SetUpSchurImpl.cpp:11
SPACE_DIM
constexpr int SPACE_DIM
Definition: child_and_parent.cpp:16
SetUpSchurImpl::piolaZeroDofsMarker
boost::shared_ptr< std::vector< unsigned char > > piolaZeroDofsMarker
Definition: SetUpSchurImpl.cpp:28
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
MoFEM::createDMHybridisedL2Matrix
auto createDMHybridisedL2Matrix(DM dm)
Get smart hybridised L2 matrix from DM.
Definition: DMMoFEM.hpp:1069
SetUpSchurImpl::preProc
MoFEMErrorCode preProc()
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
SetUpSchurImpl::mField
MoFEM::Interface & mField
Definition: test_broken_space.cpp:524
MoFEM::createOpSchurAssembleBegin
OpSchurAssembleBase * createOpSchurAssembleBegin()
Definition: Schur.cpp:2181
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
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
MoFEM::setSchurA00MatSolvePC
MoFEMErrorCode setSchurA00MatSolvePC(SmartPetscObj< PC > pc)
Set PC for A00 block.
Definition: Schur.cpp:2223
EshelbianPlasticity::EshelbianCore
Definition: EshelbianPlasticity.hpp:894
SetUpSchurImpl::piolaZeroDofsVec
boost::shared_ptr< std::vector< boost::weak_ptr< NumeredDofEntity > > > piolaZeroDofsVec
Definition: SetUpSchurImpl.cpp:26
EshelbianPlasticity::SMALL_ROT
@ SMALL_ROT
Definition: EshelbianPlasticity.hpp:43
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
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:1944
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
SetUpSchur
[Push operators to pipeline]
Definition: test_broken_space.cpp:40
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
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:1009
MoFEM::PCMGSetUpViaApproxOrders
MoFEMErrorCode PCMGSetUpViaApproxOrders(PC pc, boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > ctx, int verb)
Function build MG structure.
Definition: PCMGSetUpViaApproxOrders.cpp:634
MoFEM::DMMoFEMAddSubFieldRow
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:238
SetUpSchurImpl::postProc
MoFEMErrorCode postProc()
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
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::DMMoFEMSetIsPartitioned
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition: DMMoFEM.cpp:1123