16 auto create_post_step_ksp = [&]() {
21 using DomainEle = VolumeElementForcesAndSourcesCore;
23 using OpDomainMass = FormsIntegrators<DomainEleOp>::Assembly<
25 using OpRhs = FormsIntegrators<DomainEleOp>::Assembly<
26 PETSC>::LinearForm<GAUSS>::OpBaseTimesVector<1, 3, 1>;
27 auto fe_lhs = boost::make_shared<DomainEle>(ep_ptr->mField);
28 auto fe_rhs = boost::make_shared<DomainEle>(ep_ptr->mField);
30 fe_lhs->getUserPolynomialBase() =
31 boost::shared_ptr<BaseFunction>(
new CGGUserPolynomialBase());
32 fe_rhs->getUserPolynomialBase() =
33 boost::shared_ptr<BaseFunction>(
new CGGUserPolynomialBase());
36 fe_lhs->getOpPtrVector(), {L2}, ep_ptr->materialH1Positions,
37 ep_ptr->frontAdjEdges);
40 fe_rhs->getOpPtrVector(), {L2}, ep_ptr->materialH1Positions,
41 ep_ptr->frontAdjEdges);
43 fe_lhs->getOpPtrVector().push_back(
44 new OpDomainMass(ep_ptr->spatialH1Disp, ep_ptr->spatialH1Disp));
45 auto w_ptr = boost::make_shared<MatrixDouble>();
46 fe_rhs->getOpPtrVector().push_back(
47 new OpCalculateVectorFieldValues<3>(ep_ptr->spatialL2Disp, w_ptr));
48 fe_rhs->getOpPtrVector().push_back(
49 new OpRhs(ep_ptr->spatialH1Disp, w_ptr));
52 ep_ptr->elementVolumeName, fe_lhs,
55 ep_ptr->elementVolumeName, fe_rhs,
65 CHKERR KSPAppendOptionsPrefix(ksp,
"prjspatial_");
66 CHKERR KSPSetFromOptions(ksp);
67 CHKERR KSPSetDM(ksp, ep_ptr->dmPrjSpatial);
77 prjKsp = create_post_step_ksp();
80 prjDM = ep_ptr->dmPrjSpatial;
97 MOFEM_LOG(
"EP", Sev::inform) <<
"Pre step";
100 CHKERR TSGetSolution(ts, &T);
102 auto zero_filled = [&](
auto name) {
104 auto is_mng =
epPtr->mField.getInterface<ISManager>();
105 SmartPetscObj<IS> is;
106 CHKERR is_mng->isCreateProblemFieldAndRankLocal(
108 const int *index_ptr;
109 CHKERR ISGetIndices(is, &index_ptr);
111 CHKERR ISGetLocalSize(is, &size);
114 for (
auto i = 0;
i != size;
i++) {
118 CHKERR ISRestoreIndices(is, &index_ptr);
122 switch (EshelbianCore::gradApproximator) {
126 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (large) fields";
131 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (moderate) fields";
136 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (small) fields";
147 MOFEM_LOG(
"EP", Sev::inform) <<
"Solve H1 post-step";
150 CHKERR VecGhostUpdateBegin(
prjD, INSERT_VALUES, SCATTER_FORWARD);
151 CHKERR VecGhostUpdateEnd(
prjD, INSERT_VALUES, SCATTER_FORWARD);
161 static SmartPetscObj<KSP>
prjKsp;
162 static SmartPetscObj<Vec>
prjD;
163 static SmartPetscObj<Vec>
prjF;