15#include <boost/math/constants/constants.hpp>
16#include <boost/math/special_functions/lambert_w.hpp>
27 auto create_post_step_ksp = [&]() {
37 GAUSS>::OpBaseTimesVector<1, 3, 1>;
38 auto fe_lhs = boost::make_shared<DomainEle>(ep_ptr->
mField);
39 auto fe_rhs = boost::make_shared<DomainEle>(ep_ptr->
mField);
41 fe_lhs->getUserPolynomialBase() =
43 fe_rhs->getUserPolynomialBase() =
46 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
50 EshelbianPlasticity::AddHOOps<SPACE_DIM, SPACE_DIM, SPACE_DIM>::add(
54 fe_lhs->getOpPtrVector().push_back(
56 auto w_ptr = boost::make_shared<MatrixDouble>();
57 fe_rhs->getOpPtrVector().push_back(
59 fe_rhs->getOpPtrVector().push_back(
76 CHKERR KSPAppendOptionsPrefix(ksp,
"prjspatial_");
77 CHKERR KSPSetFromOptions(ksp);
88 prjKsp = create_post_step_ksp();
108 MOFEM_LOG(
"EP", Sev::inform) <<
"Pre step";
111 CHKERR TSGetTime(ts, &time);
115 auto debug_crack = [&]() {
118 PetscBool debug_crack_mesh = PETSC_FALSE;
120 &debug_crack_mesh, PETSC_NULLPTR);
121 if (debug_crack_mesh) {
124 std::string block_name,
int dim,
125 std::vector<EntityHandle> r) {
129 std::regex((boost::format(
"%s(.*)") % block_name).str())
133 for (
auto bc : bcs) {
134 r.push_back(bc->getMeshset());
151 *meshset_ptr, 3, tets);
154 std::vector<EntityHandle> meshsets;
155 meshsets.push_back(*meshset_ptr);
158 get_meshsets_from_block(
epPtr->
mField,
"CRACK", 2, meshsets);
160 get_meshsets_from_block(
epPtr->
mField,
"FRONT", 1, meshsets);
162 get_meshsets_from_block(
epPtr->
mField,
"EDGE", 1, meshsets);
165 CHKERR TSGetStepNumber(ts, &time_step);
166 std::string file_name =
167 "crack_meshsets_" + std::to_string(time_step) +
".h5m";
169 nullptr, meshsets.data());
184 CHKERR TSGetSolution(ts, &T);
186 auto zero_filled = [&](
auto name) {
190 CHKERR is_mng->isCreateProblemFieldAndRankLocal(
192 const int *index_ptr;
193 CHKERR ISGetIndices(is, &index_ptr);
195 CHKERR ISGetLocalSize(is, &size);
198 for (
auto i = 0;
i != size;
i++) {
202 CHKERR ISRestoreIndices(is, &index_ptr);
210 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (large) fields";
215 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (moderate) fields";
220 MOFEM_LOG(
"EP", Sev::verbose) <<
"Zeroing (small) fields";
237 CHKERR TSGetTime(ts, &time);
239 MOFEM_LOG(
"EP", Sev::inform) <<
"Solve H1 post-step";
242 CHKERR VecGhostUpdateBegin(
prjD, INSERT_VALUES, SCATTER_FORWARD);
243 CHKERR VecGhostUpdateEnd(
prjD, INSERT_VALUES, SCATTER_FORWARD);
250 MOFEM_LOG(
"EP", Sev::inform) <<
"Calculate Griffith force";
255 "Energy release selector not handled");
258 MOFEM_LOG(
"EP", Sev::inform) <<
"Calculate faces orientation";
Eshelbian plasticity interface.
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
#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.
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set KSP right hand side evaluation function
auto createDMVector(DM dm)
Get smart vector from DM.
PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set KSP operators and push mofem finite element methods.
#define MOFEM_LOG(channel, severity)
Log.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto createKSP(MPI_Comm comm)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
CGG User Polynomial Base.
boost::shared_ptr< Range > frontAdjEdges
MoFEM::Interface & mField
const std::string spatialL2Disp
MoFEMErrorCode projectInternalStress(const EntityHandle meshset=0)
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
static MoFEMErrorCode preStepFun(TS ts)
static SmartPetscObj< Vec > prjF
static boost::shared_ptr< FEMethod > preProcRhs
static SmartPetscObj< Vec > prjD
static SmartPetscObj< KSP > prjKsp
static MoFEMErrorCode postStepDestroy()
static MoFEMErrorCode postStepFun(TS ts)
static EshelbianCore * epPtr
static MoFEMErrorCode postStepInitialise(EshelbianCore *ep_ptr)
static SmartPetscObj< DM > prjDM
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
Section manager is used to create indexes and sections.
Interface for managing meshsets containing materials and boundary conditions.
Specialization for double precision vector field values calculation.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Volume finite element base.