|
| v0.14.0
|
◆ SetUpSchurImpl() [1/7]
◆ ~SetUpSchurImpl() [1/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
virtualdefault |
◆ SetUpSchurImpl() [2/7]
Definition at line 1285 of file plastic.cpp.
1292 "Is expected that schur matrix is not allocated. This is "
1293 "possible only is PC is set up twice");
◆ ~SetUpSchurImpl() [2/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
inlinevirtual |
◆ SetUpSchurImpl() [3/7]
Definition at line 1273 of file plasticity_old_schur.cpp.
1280 "Is expected that schur matrix is not allocated. This is "
1281 "possible only is PC is set up twice");
◆ ~SetUpSchurImpl() [3/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
inlinevirtual |
◆ SetUpSchurImpl() [4/7]
◆ ~SetUpSchurImpl() [4/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
inlinevirtual |
◆ SetUpSchurImpl() [5/7]
◆ ~SetUpSchurImpl() [5/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
inlinevirtual |
◆ SetUpSchurImpl() [6/7]
Definition at line 886 of file elastic.cpp.
890 "Is expected that schur matrix is not allocated. This is "
891 "possible only is PC is set up twice");
◆ ~SetUpSchurImpl() [6/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
virtualdefault |
◆ SetUpSchurImpl() [7/7]
SetUpSchurImpl::SetUpSchurImpl |
( |
MoFEM::Interface & |
m_field, |
|
|
EshelbianCore * |
ep_core_ptr |
|
) |
| |
|
inline |
◆ ~SetUpSchurImpl() [7/7]
virtual SetUpSchurImpl::~SetUpSchurImpl |
( |
| ) |
|
|
inlinevirtual |
◆ createSubDM() [1/3]
◆ createSubDM() [2/3]
◆ createSubDM() [3/3]
Definition at line 1083 of file contact.cpp.
1087 auto create_dm = [&](
const char *name,
const char *
field_name,
auto dm_type) {
1089 auto create_dm_imp = [&]() {
1101 "Error in creating schurDM. It is possible that schurDM is "
1109 schurDM = create_dm(
"SCHUR",
"U",
"DMMOFEM_MG");
1110 blockDM = create_dm(
"BLOCK",
"SIGMA",
"DMMOFEM");
1114 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
1120 simple->getDomainFEName(),
1124 {
"U",
"U"}, {
"SIGMA",
"U"}, {
"U",
"SIGMA"}, {
"SIGMA",
"SIGMA"}
1132 {schur_dm, block_dm}, block_mat_data,
1134 {
"SIGMA"}, {
nullptr}, true
1144 "Only BLOCK_SCHUR is implemented");
◆ postProc() [1/3]
MoFEMErrorCode SetUpSchurImpl::postProc |
( |
| ) |
|
◆ postProc() [2/3]
◆ postProc() [3/3]
◆ preProc() [1/3]
MoFEMErrorCode SetUpSchurImpl::preProc |
( |
| ) |
|
◆ preProc() [2/3]
◆ preProc() [3/3]
◆ setDiagonalPC() [1/2]
◆ setDiagonalPC() [2/2]
Definition at line 1235 of file contact.cpp.
1238 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1239 auto get_pc = [](
auto ksp) {
1241 CHKERR KSPGetPC(ksp, &pc_raw);
1246 auto set_pc_p_mg = [](
auto dm,
auto pc,
auto S) {
1249 PetscBool same = PETSC_FALSE;
1250 PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
1254 CHKERR PCSetFromOptions(pc);
1261 CHKERR PetscFree(subksp);
◆ setEntities()
◆ setOperator() [1/3]
◆ setOperator() [2/3]
◆ setOperator() [3/3]
Definition at line 1150 of file contact.cpp.
1153 double eps_stab = 1e-4;
1159 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1169 pip->getOpBoundaryLhsPipeline().push_back(
1170 new OpMassStab(
"SIGMA",
"SIGMA",
1171 [eps_stab](
double,
double,
double) {
return eps_stab; }));
1172 pip->getOpBoundaryLhsPipeline().push_back(
1180 pip->getOpDomainLhsPipeline().push_back(
1187 auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1188 auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
1190 pre_proc_schur_lhs_ptr->preProcessHook = [
this]() {
1193 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Begin";
1197 post_proc_schur_lhs_ptr->postProcessHook = [
this, ao_up,
1198 post_proc_schur_lhs_ptr]() {
1200 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble End";
1201 auto print_mat_norm = [
this](
auto a, std::string prefix) {
1204 CHKERR MatNorm(
a, NORM_FROBENIUS, &nrm);
1205 MOFEM_LOG(
"CONTACT", Sev::noisy) << prefix <<
" norm = " << nrm;
1208 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1209 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1211 mField, post_proc_schur_lhs_ptr, 1,
S, ao_up)();
1213 CHKERR print_mat_norm(
S,
"S");
1215 MOFEM_LOG(
"CONTACT", Sev::verbose) <<
"Lhs Assemble Finish";
1220 ts_ctx_ptr->getPreProcessIJacobian().push_front(pre_proc_schur_lhs_ptr);
1221 ts_ctx_ptr->getPostProcessIJacobian().push_back(post_proc_schur_lhs_ptr);
◆ setPC() [1/3]
◆ setPC() [2/3]
◆ setPC() [3/3]
Definition at line 1226 of file contact.cpp.
1230 CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
1231 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
◆ setUp() [1/7]
◆ setUp() [2/7]
Implements SetUpSchur.
- Examples
- plastic.cpp, and test_broken_space.cpp.
Definition at line 528 of file test_broken_space.cpp.
533 CHKERR KSPSetFromOptions(ksp);
535 CHKERR KSPGetPC(ksp, &pc);
537 PetscBool is_pcfs = PETSC_FALSE;
538 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
541 MOFEM_LOG(
"AT", Sev::inform) <<
"Setup Schur pc";
543 auto create_sub_dm = [&]() {
546 auto create_dm = [&](
548 std::string problem_name,
549 std::vector<std::string> fe_names,
550 std::vector<std::string> fields,
556 auto create_dm_imp = [&]() {
560 for (
auto fe : fe_names) {
564 for (
auto field : fields) {
573 "Error in creating schurDM. It is possible that schurDM is "
578 auto schur_dm = create_dm(
582 {
simple->getDomainFEName(),
simple->getSkeletonFEName()},
588 auto block_dm = create_dm(
592 {
simple->getDomainFEName(),
simple->getSkeletonFEName()},
598 return std::make_tuple(schur_dm, block_dm);
601 auto get_nested_mat_data = [&](
auto schur_dm,
auto block_dm) {
609 simple->getDomainFEName(),
613 {
"BROKEN",
"BROKEN"},
624 simple->getSkeletonFEName(),
628 {
"BROKEN",
"HYBRID"}, {
"HYBRID",
"BROKEN"}
640 {schur_dm, block_dm}, block_mat_data,
642 {
"BROKEN",
"U"}, {
nullptr,
nullptr}, true
647 auto set_ops = [&](
auto schur_dm) {
652 boost::shared_ptr<BlockStructure> block_data;
655 pip_mng->getOpDomainLhsPipeline().push_front(
657 pip_mng->getOpDomainLhsPipeline().push_back(
664 auto pre_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
665 auto post_proc_schur_lhs_ptr = boost::make_shared<FEMethod>();
667 pre_proc_schur_lhs_ptr->preProcessHook = [
this]() {
670 MOFEM_LOG(
"AT", Sev::verbose) <<
"Lhs Assemble Begin";
674 post_proc_schur_lhs_ptr->postProcessHook = [
this, ao_up,
675 post_proc_schur_lhs_ptr]() {
677 MOFEM_LOG(
"AT", Sev::verbose) <<
"Lhs Assemble End";
678 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
679 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
680 MOFEM_LOG(
"AT", Sev::verbose) <<
"Lhs Assemble Finish";
685 ksp_ctx_ptr->getPreProcSetOperators().push_front(pre_proc_schur_lhs_ptr);
686 ksp_ctx_ptr->getPostProcSetOperators().push_back(post_proc_schur_lhs_ptr);
691 auto set_pc = [&](
auto pc,
auto block_dm) {
693 auto block_is =
getDMSubData(block_dm)->getSmartRowIs();
694 CHKERR PCFieldSplitSetIS(pc, NULL, block_is);
695 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
699 auto set_diagonal_pc = [&](
auto pc,
auto schur_dm) {
709 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
710 auto get_pc = [](
auto ksp) {
712 CHKERR KSPGetPC(ksp, &pc_raw);
717 auto set_pc_p_mg = [&](
auto dm,
auto pc) {
721 PetscBool same = PETSC_FALSE;
722 PetscObjectTypeCompare((PetscObject)pc, PCMG, &same);
727 CHKERR PCSetFromOptions(pc);
732 CHKERR set_pc_p_mg(schur_dm, get_pc(subksp[1]));
738 auto [schur_dm, block_dm] = create_sub_dm();
740 auto nested_mat_data = get_nested_mat_data(schur_dm, block_dm);
744 CHKERR MatSetDM(
S, PETSC_NULL);
750 CHKERR set_pc(pc, block_dm);
752 CHKERR KSPGetDM(ksp, &solver_dm);
754 CHKERR DMSetMatType(solver_dm, MATSHELL);
758 CHKERR set_diagonal_pc(pc, schur_dm);
762 "PC is not set to PCFIELDSPLIT");
◆ setUp() [3/7]
◆ setUp() [4/7]
Implements SetUpSchur.
Definition at line 1008 of file contact.cpp.
1014 CHKERR TSGetSNES(solver, &snes);
1016 CHKERR SNESGetKSP(snes, &ksp);
1017 CHKERR KSPSetFromOptions(ksp);
1020 CHKERR KSPGetPC(ksp, &pc);
1022 PetscBool is_pcfs = PETSC_FALSE;
1023 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1026 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"Setup Schur pc";
1031 "It is expected that Schur matrix is not allocated. This is "
1032 "possible only if PC is set up twice");
1044 CHKERR TSGetDM(solver, &solver_dm);
1045 CHKERR DMSetMatType(solver_dm, MATSHELL);
1052 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t, PetscReal
a,
1053 Mat
A, Mat B,
void *ctx) {
1056 CHKERR TSSetIJacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1058 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t,
Vec utt,
1059 PetscReal
a, PetscReal aa, Mat
A, Mat B,
1063 CHKERR TSSetI2Jacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1074 MOFEM_LOG(
"CONTACT", Sev::inform) <<
"No Schur PC";
◆ setUp() [5/7]
◆ setUp() [6/7]
Implements SetUpSchur.
Definition at line 1311 of file plastic.cpp.
1317 CHKERR TSGetSNES(solver, &snes);
1319 CHKERR SNESGetKSP(snes, &ksp);
1320 CHKERR KSPSetFromOptions(ksp);
1323 CHKERR KSPGetPC(ksp, &pc);
1324 PetscBool is_pcfs = PETSC_FALSE;
1325 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1330 "Is expected that schur matrix is not allocated. This is "
1331 "possible only is PC is set up twice");
1339 CHKERR TSGetDM(solver, &solver_dm);
1340 CHKERR DMSetMatType(solver_dm, MATSHELL);
1347 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t, PetscReal
a,
1348 Mat
A, Mat B,
void *ctx) {
1351 CHKERR TSSetIJacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1353 auto swap_assemble = [](TS ts, PetscReal
t,
Vec u,
Vec u_t,
Vec utt,
1354 PetscReal
a, PetscReal aa, Mat
A, Mat B,
1358 CHKERR TSSetI2Jacobian(solver,
A,
P, swap_assemble, ts_ctx_ptr.get());
1362 auto set_ops = [&]() {
1368 pip_mng->getOpBoundaryLhsPipeline().push_front(
1372 {
"EP",
"TAU"}, {
nullptr,
nullptr},
aoSchur,
S,
false, false
1376 pip_mng->getOpDomainLhsPipeline().push_front(
1380 {
"EP",
"TAU"}, {
nullptr,
nullptr},
aoSchur,
S,
false, false
1385 double eps_stab = 1e-4;
1391 using OpMassStab = B::OpMass<3, SPACE_DIM * SPACE_DIM>;
1394 pip_mng->getOpBoundaryLhsPipeline().push_front(
1396 pip_mng->getOpBoundaryLhsPipeline().push_back(
1397 new OpMassStab(
"SIGMA",
"SIGMA", [eps_stab](
double,
double,
double) {
1402 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
aoSchur,
S,
1407 pip_mng->getOpDomainLhsPipeline().push_front(
1411 {
"SIGMA",
"EP",
"TAU"}, {
nullptr,
nullptr,
nullptr},
aoSchur,
S,
1415 #endif // ADD_CONTACT
1419 auto set_assemble_elems = [&]() {
1421 auto schur_asmb_pre_proc = boost::make_shared<FEMethod>();
1422 schur_asmb_pre_proc->preProcessHook = [
this]() {
1425 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble Begin";
1428 auto schur_asmb_post_proc = boost::make_shared<FEMethod>();
1430 schur_asmb_post_proc->postProcessHook = [
this, schur_asmb_post_proc]() {
1432 MOFEM_LOG(
"TIMER", Sev::verbose) <<
"Lhs Assemble End";
1435 CHKERR MatAssemblyBegin(
S, MAT_FINAL_ASSEMBLY);
1436 CHKERR MatAssemblyEnd(
S, MAT_FINAL_ASSEMBLY);
1443 ts_ctx_ptr->getPreProcessIJacobian().push_front(schur_asmb_pre_proc);
1444 ts_ctx_ptr->getPostProcessIJacobian().push_front(schur_asmb_post_proc);
1448 auto set_pc = [&]() {
1451 CHKERR PCFieldSplitSetSchurPre(pc, PC_FIELDSPLIT_SCHUR_PRE_USER,
S);
1455 auto set_diagonal_pc = [&]() {
1458 CHKERR PCFieldSplitSchurGetSubKSP(pc, PETSC_NULL, &subksp);
1459 auto get_pc = [](
auto ksp) {
1461 CHKERR KSPGetPC(ksp, &pc_raw);
1465 CHKERR PetscFree(subksp);
1471 CHKERR set_assemble_elems();
1475 CHKERR set_diagonal_pc();
1478 pip_mng->getOpBoundaryLhsPipeline().push_front(
1480 pip_mng->getOpBoundaryLhsPipeline().push_back(
1483 pip_mng->getOpDomainLhsPipeline().push_back(
◆ setUp() [7/7]
MoFEMErrorCode SetUpSchurImpl::setUp |
( |
TS |
ts | ) |
|
|
virtual |
◆ aoSchur
◆ aoUp
◆ blockDM
◆ epCorePtr
EshelbianCore* SetUpSchurImpl::epCorePtr |
|
private |
◆ fieldSplitIS
◆ mField
◆ piolaZeroDofsMarker
boost::shared_ptr<std::vector<unsigned char> > SetUpSchurImpl::piolaZeroDofsMarker |
|
private |
◆ piolaZeroDofsVec
boost::shared_ptr<std::vector<boost::weak_ptr<NumeredDofEntity> > > SetUpSchurImpl::piolaZeroDofsVec |
|
private |
◆ schurDM
◆ subDM
◆ subEnts
Range SetUpSchurImpl::subEnts |
|
private |
◆ volEnts
Range SetUpSchurImpl::volEnts |
|
private |
The documentation for this struct was generated from the following files:
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode DMMoFEMGetBlocMatData(DM dm, boost::shared_ptr< BlockStructure > &)
Get data for block mat.
SmartPetscObj< IS > fieldSplitIS
IS for split Schur block.
auto createAOMappingIS(IS isapp, IS ispetsc)
Creates an application mapping using two index sets.
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
SmartPetscObj< AO > aoSchur
Specialization for DisplacementCubitBcData.
virtual MPI_Comm & get_comm() const =0
EshelbianCore * epCorePtr
boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > createPCMGSetUpViaApproxOrdersCtx(DM dm, Mat A, bool use_shell_mat)
createPCMGSetUpViaApproxOrdersCtx
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
auto getDMKspCtx(DM dm)
Get KSP context data structure used by DM.
MoFEMErrorCode setPC(PC pc)
PipelineManager interface.
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.
Simple interface for fast problem set-up.
auto getDMSubData(DM dm)
Get sub problem data structure.
SmartPetscObj< DM > schurDM
MoFEMErrorCode createSubDM()
SmartPetscObj< DM > subDM
field split sub dm
auto createDMMatrix(DM dm)
Get smart matrix from DM.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
auto createDMBlockMat(DM dm)
SmartPetscObj< DM > blockDM
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.
constexpr AssemblyType AT
#define CHKERR
Inline error check.
virtual moab::Interface & get_moab()=0
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
auto createDMHybridisedL2Matrix(DM dm)
Get smart hybridised L2 matrix from DM.
PetscBool is_quasi_static
void simple(double P1[], double P2[], double P3[], double c[], const int N)
#define NBEDGE_L2(P)
Number of base functions on edge from L2 space.
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
MoFEM::Interface & mField
OpSchurAssembleBase * createOpSchurAssembleBegin()
auto createDMNestSchurMat(DM dm)
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.
constexpr int SPACE_DIM
[Define dimension]
MoFEMErrorCode setOperator()
constexpr double t
plate stiffness
constexpr auto field_name
MoFEMErrorCode setSchurA00MatSolvePC(SmartPetscObj< PC > pc)
Set PC for A00 block.
#define MOFEM_LOG(channel, severity)
Log.
#define NBFACETRI_L2(P)
Number of base functions on triangle for L2 space.
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.
const FTensor::Tensor2< T, Dim, Dim > Vec
@ MOFEM_DATA_INCONSISTENCY
@ MOFEM_ATOM_TEST_INVALID
MoFEMErrorCode DMMoFEMSetNestSchurData(DM dm, boost::shared_ptr< NestSchurData >)
boost::shared_ptr< BlockStructure > createBlockMatStructure(DM dm, SchurFEOpsFEandFields schur_fe_op_vec)
Create a Mat Diag Blocks object.
MoFEMErrorCode PCMGSetUpViaApproxOrders(PC pc, boost::shared_ptr< PCMGSetUpViaApproxOrdersCtx > ctx, int verb)
Function build MG structure.
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
intrusive_ptr for managing petsc objects
MoFEMErrorCode setDiagonalPC(PC pc)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...