16 auto create_post_step_ksp = [&]() {
21 using DomainEle = VolumeElementForcesAndSourcesCore;
23 using OpDomainMass = FormsIntegrators<DomainEleOp>::Assembly<
25 using OpRhs = FormsIntegrators<DomainEleOp>::Assembly<
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());
43 fe_lhs->getOpPtrVector().push_back(
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(
65 CHKERR KSPAppendOptionsPrefix(ksp,
"prjspatial_");
66 CHKERR KSPSetFromOptions(ksp);
77 prjKsp = create_post_step_ksp();
97 MOFEM_LOG(
"EP", Sev::inform) <<
"Pre step";
100 CHKERR TSGetTime(ts, &time);
104 auto debug_crack = [&]() {
107 PetscBool debug_crack_mesh = PETSC_FALSE;
108 CHKERR PetscOptionsGetBool(PETSC_NULLPTR,
"",
"-debug_crack_mesh",
109 &debug_crack_mesh, PETSC_NULLPTR);
110 if (debug_crack_mesh) {
112 auto get_meshsets_from_block =
114 std::vector<EntityHandle> r) {
116 auto mesh_mng = m_field.
getInterface<MeshsetsManager>();
117 auto bcs = mesh_mng->getCubitMeshsetPtr(
119 std::regex((boost::format(
"%s(.*)") % block_name).str())
123 for (
auto bc : bcs) {
124 r.push_back(bc->getMeshset());
141 *meshset_ptr, 3, tets);
144 std::vector<EntityHandle> meshsets;
145 meshsets.push_back(*meshset_ptr);
148 get_meshsets_from_block(
epPtr->
mField,
"CRACK", 2, meshsets);
150 get_meshsets_from_block(
epPtr->
mField,
"FRONT", 1, meshsets);
152 get_meshsets_from_block(
epPtr->
mField,
"EDGE", 1, meshsets);
155 CHKERR TSGetStepNumber(ts, &time_step);
156 std::string file_name =
157 "crack_meshsets_" + std::to_string(time_step) +
".h5m";
159 file_name.c_str(),
"MOAB",
nullptr, meshsets.data());
173 CHKERR TSGetSolution(ts, &T);
175 auto zero_filled = [&](
auto name) {
178 SmartPetscObj<IS> is;
179 CHKERR is_mng->isCreateProblemFieldAndRankLocal(
181 const int *index_ptr;
182 CHKERR ISGetIndices(is, &index_ptr);
184 CHKERR ISGetLocalSize(is, &size);
187 for (
auto i = 0;
i != size;
i++) {
191 CHKERR ISRestoreIndices(is, &index_ptr);
196 case NO_H1_CONFIGURATION:
199 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (large) fields";
204 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (moderate) fields";
209 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (small) fields";
227 CHKERR TSGetTime(ts, &time);
229 MOFEM_LOG(
"EP", Sev::inform) <<
"Solve H1 post-step";
232 CHKERR VecGhostUpdateBegin(
prjD, INSERT_VALUES, SCATTER_FORWARD);
233 CHKERR VecGhostUpdateEnd(
prjD, INSERT_VALUES, SCATTER_FORWARD);
234 CHKERR DMoFEMMeshToLocalVector(
prjDM,
prjD, INSERT_VALUES, SCATTER_REVERSE);
239 case GRIFFITH_SKELETON:
240 MOFEM_LOG(
"EP", Sev::inform) <<
"Calculate Griffith force";
245 "Energy release selector not handled");
248 MOFEM_LOG(
"EP", Sev::inform) <<
"Calculate faces orientation";
266 static SmartPetscObj<Vec>
prjD;
267 static SmartPetscObj<Vec>
prjF;
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
[Define dimension]
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
boost::shared_ptr< Range > frontAdjEdges
MoFEM::Interface & mField
const std::string spatialL2Disp
MoFEMErrorCode projectGeometry(const EntityHandle meshset=0)
const std::string materialH1Positions
static PetscBool crackingOn
MoFEMErrorCode calculateFaceMaterialForce(const int tag, TS ts)
const std::string elementVolumeName
static enum RotSelector gradApproximator
boost::shared_ptr< Range > maxMovedFaces
const std::string spatialH1Disp
static double crackingStartTime
MoFEMErrorCode calculateOrientation(const int tag, bool set_orientation)
MoFEMErrorCode setNewFrontCoordinates()
const std::string rotAxis
SmartPetscObj< DM > dmPrjSpatial
Projection spatial displacement.
MoFEMErrorCode addCrackSurfaces(const bool debug=false)
static int addCrackMeshsetId
static enum EnergyReleaseSelector energyReleaseSelector
SmartPetscObj< Vec > solTSStep
const std::string stretchTensor
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static SmartPetscObj< Vec > prjD
static EshelbianCore * epPtr
static MoFEMErrorCode postStepInitialise(EshelbianCore *ep_ptr)
static MoFEMErrorCode postStepDestroy()
static SmartPetscObj< Vec > prjF
static MoFEMErrorCode preStepFun(TS ts)
static SmartPetscObj< KSP > prjKsp
static boost::shared_ptr< FEMethod > preProcRhs
static MoFEMErrorCode postStepFun(TS ts)
static SmartPetscObj< DM > prjDM