v0.14.0
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
FractureMechanics::CrackPropagation Struct Reference

#include <users_modules/fracture_mechanics/src/CrackPropagation.hpp>

Inheritance diagram for FractureMechanics::CrackPropagation:
[legend]
Collaboration diagram for FractureMechanics::CrackPropagation:
[legend]

Classes

struct  ArcLengthSnesCtx
 
struct  BothSurfaceConstrains
 Constrains material displacement on both sides. More...
 
struct  FaceOrientation
 Determine face orientation. More...
 
struct  PostProcVertexMethod
 operator to post-process results on crack front nodes More...
 

Public Member Functions

MoFEMErrorCode getInterfaceVersion (Version &version) const
 
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Getting interface of core database. More...
 
 CrackPropagation (MoFEM::Interface &m_field, const int approx_order=2, const int geometry_order=1)
 Constructor of Crack Propagation, prints fracture module version and registers the three interfaces used to solve fracture problem, i.e. CrackPropagation, CPSolvers and CPMeshCut. More...
 
virtual ~CrackPropagation ()
 
MoFEMErrorCode getOptions ()
 Get options form command line. More...
 
MoFEMErrorCode tetsingReleaseEnergyCalculation ()
 This is run with ctest. More...
 
int & getNbLoadSteps ()
 
int getNbLoadSteps () const
 
doublegetLoadScale ()
 
double getLoadScale () const
 
int & getNbCutSteps ()
 
int getNbCutSteps () const
 
MoFEMErrorCode readMedFile ()
 read mesh file More...
 
MoFEMErrorCode saveEachPart (const std::string prefix, const Range &ents)
 Save entities on ech processor. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Static Public Member Functions

static FTensor::Tensor2_symmetric< double, 3 > analyticalStrainFunction (FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, 3 > &t_coords)
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Public Attributes

Version fileVersion
 
boost::shared_ptr< WrapMPIComm > moabCommWorld
 
MoFEM::InterfacemField
 
bool setSingularCoordinates
 
int approxOrder
 
int geometryOrder
 
double gC
 Griffith energy. More...
 
double griffithE
 Griffith stability parameter. More...
 
double griffithR
 Griffith regularisation parameter. More...
 
double betaGc
 heterogeneous Griffith energy exponent More...
 
PetscBool isGcHeterogeneous
 flag for heterogeneous gc More...
 
PetscBool isPartitioned
 
PetscBool propagateCrack
 If true crack propagation is calculated. More...
 
int refAtCrackTip
 
int refOrderAtTip
 
PetscBool addSingularity
 
PetscBool otherSideConstrains
 
PetscBool isPressureAle
 If true surface pressure is considered in ALE. More...
 
PetscBool areSpringsAle
 If true surface spring is considered in ALE. More...
 
PetscBool isSurfaceForceAle
 If true surface pressure is considered in ALE. More...
 
PetscBool ignoreMaterialForce
 If true surface pressure is considered in ALE. More...
 
std::string mwlsApproxFile
 Name of file with internal stresses. More...
 
std::string mwlsStressTagName
 Name of tag with internal stresses. More...
 
std::string mwlsEigenStressTagName
 Name of tag with eigen stresses. More...
 
std::string mwlsRhoTagName
 Name of tag with density. More...
 
int residualStressBlock
 Block on which residual stress is applied. More...
 
int densityMapBlock
 
std::string configFile
 
bool isStressTagSavedOnNodes
 
double partitioningWeightPower
 
PetscBool resetMWLSCoeffsEveryPropagationStep
 
PetscBool addAnalyticalInternalStressOperators
 
PetscBool solveEigenStressProblem
 Solve eigen problem. More...
 
PetscBool useEigenPositionsSimpleContact
 
int postProcLevel
 level of postprocessing (amount of output files) More...
 
int startStep
 
double crackFrontLength
 
double crackSurfaceArea
 
std::map< std::string, BitRefLevel > mapBitLevel
 

Static Public Attributes

static bool debug = false
 
static bool parallelReadAndBroadcast
 

Resolve shared entities and partition mesh

MoFEMErrorCode partitionMesh (BitRefLevel bit1, BitRefLevel bit2, int verb=QUIET, const bool debug=false)
 partotion mesh More...
 
MoFEMErrorCode resolveShared (const Range &tets, Range &proc_ents, const int verb=QUIET, const bool debug=false)
 resolve shared entities More...
 
MoFEMErrorCode resolveSharedBitRefLevel (const BitRefLevel bit, const int verb=QUIET, const bool debug=false)
 resole shared entities by bit level More...
 

Set bit level for material problem

MoFEMErrorCode setCrackFrontBitLevel (BitRefLevel from_bit, BitRefLevel bit, const int nb_levels=2, const bool debug=false)
 Set bit ref level for entities adjacent to crack front. More...
 

Build problem

MoFEMErrorCode buildProblemFields (const BitRefLevel &bit1, const BitRefLevel &mask1, const BitRefLevel &bit2, const int verb=QUIET, const bool debug=false)
 Build problem fields. More...
 
MoFEMErrorCode buildProblemFiniteElements (BitRefLevel bit1, BitRefLevel bit2, std::vector< int > surface_ids, const int verb=QUIET, const bool debug=false)
 Build problem finite elements. More...
 
MoFEMErrorCode createProblemDataStructures (const std::vector< int > surface_ids, const int verb=QUIET, const bool debug=false)
 Construct problem data structures. More...
 
MoFEMErrorCode createDMs (SmartPetscObj< DM > &dm_elastic, SmartPetscObj< DM > &dm_eigen_elastic, SmartPetscObj< DM > &dm_material, SmartPetscObj< DM > &dm_crack_propagation, SmartPetscObj< DM > &dm_material_forces, SmartPetscObj< DM > &dm_surface_projection, SmartPetscObj< DM > &dm_crack_srf_area, std::vector< int > surface_ids, std::vector< std::string > fe_surf_proj_list)
 Crate DMs for all problems and sub problems. More...
 
MoFEMErrorCode deleteEntities (const int verb=QUIET, const bool debug=false)
 

Build fields

MoFEMErrorCode buildElasticFields (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 Declate fields for elastic analysis. More...
 
MoFEMErrorCode buildArcLengthField (const BitRefLevel bit, const bool build_fields=true, const int verb=QUIET)
 Declate field for arc-length. More...
 
MoFEMErrorCode buildSurfaceFields (const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 build fields with Lagrange multipliers to constrain surfaces More...
 
MoFEMErrorCode buildEdgeFields (const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 build fields with Lagrange multipliers to constrain edges More...
 
MoFEMErrorCode buildCrackSurfaceFieldId (const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 declare crack surface files More...
 
MoFEMErrorCode buildCrackFrontFieldId (const BitRefLevel bit, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 declare crack surface files More...
 
MoFEMErrorCode buildBothSidesFieldId (const BitRefLevel bit_spatial, const BitRefLevel bit_material, const bool proc_only=false, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
 Lagrange multipliers field which constrains material displacements. More...
 
MoFEMErrorCode zeroLambdaFields ()
 Zero fields with lagrange multipliers. More...
 

Build finite elements

MoFEMErrorCode declareElasticFE (const BitRefLevel bit1, const BitRefLevel mask1, const BitRefLevel bit2, const BitRefLevel mask2, const bool add_forces=true, const bool proc_only=true, const int verb=QUIET)
 declare elastic finite elements More...
 
MoFEMErrorCode declareArcLengthFE (const BitRefLevel bits, const int verb=QUIET)
 create arc-length element entity and declare elemets More...
 
MoFEMErrorCode declareExternalForcesFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
 
MoFEMErrorCode declareSurfaceForceAleFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
 Declare FE for pressure BC in ALE formulation (in material domain) More...
 
MoFEMErrorCode declarePressureAleFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
 Declare FE for pressure BC in ALE formulation (in material domain) More...
 
MoFEMErrorCode declareSpringsAleFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
 Declare FE for spring BC in ALE formulation (in material domain) More...
 
MoFEMErrorCode declareSimpleContactAleFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
 Declare FE for pressure BC in ALE formulation (in material domain) More...
 
MoFEMErrorCode declareMaterialFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
 declare material finite elements More...
 
MoFEMErrorCode declareFrontFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
 
MoFEMErrorCode declareBothSidesFE (const BitRefLevel bit_spatial, const BitRefLevel bit_material, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
 
MoFEMErrorCode declareSmoothingFE (const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
 declare mesh smoothing finite elements More...
 
MoFEMErrorCode declareSurfaceFE (std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const std::vector< int > &ids, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
 declare surface sliding elements More...
 
MoFEMErrorCode declareEdgeFE (std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
 
MoFEMErrorCode declareCrackSurfaceFE (std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
 

Create DMs & problems

MoFEMErrorCode createCrackPropagationDM (SmartPetscObj< DM > &dm, const std::string prb_name, SmartPetscObj< DM > dm_elastic, SmartPetscObj< DM > dm_material, const BitRefLevel bit, const BitRefLevel mask, const std::vector< std::string > fe_list)
 Create DM by composition of elastic DM and material DM. More...
 
MoFEMErrorCode createElasticDM (SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
 Create elastic problem DM. More...
 
MoFEMErrorCode createEigenElasticDM (SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
 Create elastic problem DM. More...
 
MoFEMErrorCode createBcDM (SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
 Create problem to calculate boundary conditions. More...
 
MoFEMErrorCode createMaterialDM (SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask, const std::vector< std::string > fe_list, const bool debug=false)
 Create DM fto calculate material problem. More...
 
MoFEMErrorCode createMaterialForcesDM (SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const int verb=QUIET)
 Create DM for calculation of material forces (sub DM of DM material) More...
 
MoFEMErrorCode createSurfaceProjectionDM (SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const std::vector< int > surface_ids, const std::vector< std::string > fe_list, const int verb=QUIET)
 create DM to calculate projection matrices (sub DM of DM material) More...
 
MoFEMErrorCode createCrackFrontAreaDM (SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const bool verb=QUIET)
 create DM to calculate Griffith energy More...
 

Create finite element instances

MoFEMErrorCode assembleElasticDM (const std::string mwls_stress_tag_name, const int verb=QUIET, const bool debug=false)
 create elastic finite element instance for spatial assembly More...
 
MoFEMErrorCode assembleElasticDM (const int verb=QUIET, const bool debug=false)
 create elastic finite element instance for spatial assembly More...
 
MoFEMErrorCode addElasticFEInstancesToSnes (DM dm, Mat m, Vec q, Vec f, boost::shared_ptr< FEMethod > arc_method=boost::shared_ptr< FEMethod >(), boost::shared_ptr< ArcLengthCtx > arc_ctx=nullptr, const int verb=QUIET, const bool debug=false)
 
MoFEMErrorCode assembleMaterialForcesDM (DM dm, const int verb=QUIET, const bool debug=false)
 create material element instance More...
 
MoFEMErrorCode assembleSmootherForcesDM (DM dm, const std::vector< int > ids, const int verb=QUIET, const bool debug=false)
 create smoothing element instance More...
 
MoFEMErrorCode assembleCouplingForcesDM (DM dm, const int verb=QUIET, const bool debug=false)
 assemble coupling element instances More...
 
MoFEMErrorCode addMaterialFEInstancesToSnes (DM dm, const bool fix_crack_front, const int verb=QUIET, const bool debug=false)
 add material elements instances to SNES More...
 
MoFEMErrorCode addSmoothingFEInstancesToSnes (DM dm, const bool fix_crack_front, const int verb=QUIET, const bool debug=false)
 add softening elements instances to SNES More...
 
MoFEMErrorCode addPropagationFEInstancesToSnes (DM dm, boost::shared_ptr< FEMethod > arc_method, boost::shared_ptr< ArcLengthCtx > arc_ctx, const std::vector< int > &surface_ids, const int verb=QUIET, const bool debug=false)
 add finite element to SNES for crack propagation problem More...
 
MoFEMErrorCode testJacobians (const BitRefLevel bit, const BitRefLevel mask, tangent_tests test)
 test LHS Jacobians More...
 
MoFEMErrorCode addMWLSStressOperators (boost::shared_ptr< CrackFrontElement > &fe_rhs, boost::shared_ptr< CrackFrontElement > &fe_lhs)
 
MoFEMErrorCode addMWLSDensityOperators (boost::shared_ptr< CrackFrontElement > &fe_rhs, boost::shared_ptr< CrackFrontElement > &fe_lhs)
 
MoFEMErrorCode updateMaterialFixedNode (const bool fix_front, const bool fix_small_g, const bool debug=false)
 Update fixed nodes. More...
 

Assemble and calculate

MoFEMErrorCode calculateElasticEnergy (DM dm, const std::string msg="")
 assemble elastic part of matrix, by running elastic finite element instance More...
 
MoFEMErrorCode calculateMaterialForcesDM (DM dm, Vec q, Vec f, const int verb=QUIET, const bool debug=false)
 assemble material forces, by running material finite element instance More...
 
MoFEMErrorCode calculateSmoothingForcesDM (DM dm, Vec q, Vec f, const int verb=QUIET, const bool debug=false)
 assemble smoothing forces, by running material finite element instance More...
 
MoFEMErrorCode calculateSmoothingForceFactor (const int verb=QUIET, const bool debug=true)
 
MoFEMErrorCode calculateSurfaceProjectionMatrix (DM dm_front, DM dm_project, const std::vector< int > &ids, const int verb=QUIET, const bool debug=false)
 assemble projection matrices More...
 
MoFEMErrorCode calculateFrontProjectionMatrix (DM dm_surface, DM dm_project, const int verb=QUIET, const bool debug=false)
 assemble crack front projection matrix (that constrains crack area growth) More...
 
MoFEMErrorCode projectMaterialForcesDM (DM dm_project, Vec f, Vec f_proj, const int verb=QUIET, const bool debug=false)
 project material forces along the crack elongation direction More...
 
MoFEMErrorCode calculateGriffithForce (DM dm, const double gc, Vec f_griffith, const int verb=QUIET, const bool debug=false)
 calculate Griffith (driving) force More...
 
MoFEMErrorCode projectGriffithForce (DM dm, Vec f_griffith, Vec f_griffith_proj, const int verb=QUIET, const bool debug=false)
 project Griffith forces More...
 
MoFEMErrorCode calculateReleaseEnergy (DM dm, Vec f_material_proj, Vec f_griffith_proj, Vec f_lambda, const double gc, const int verb=QUIET, const bool debug=true)
 calculate release energy More...
 

Solvers

MoFEMErrorCode solveElasticDM (DM dm, SNES snes, Mat m, Vec q, Vec f, bool snes_set_up, Mat *shell_m)
 solve elastic problem More...
 
MoFEMErrorCode solvePropagationDM (DM dm, DM dm_elastic, SNES snes, Mat m, Vec q, Vec f)
 solve crack propagation problem More...
 

Postprocess results

MoFEMErrorCode savePositionsOnCrackFrontDM (DM dm, Vec q, const int verb=QUIET, const bool debug=false)
 
MoFEMErrorCode writeCrackFont (const BitRefLevel &bit, const int step)
 
MoFEMErrorCode postProcessDM (DM dm, const int step, const std::string fe_name, const bool approx_internal_stress)
 post-process results for elastic solution More...
 

Set data from mesh to vectors and back

MoFEMErrorCode setFieldFromCoords (const std::string field_name)
 set field from node positions More...
 
MoFEMErrorCode setMaterialPositionFromCoords ()
 set material field from nodes More...
 
MoFEMErrorCode setSpatialPositionFromCoords ()
 set spatial field from nodes More...
 
MoFEMErrorCode setCoordsFromField (const std::string field_name="MESH_NODE_POSITIONS")
 set coordinates from field More...
 
MoFEMErrorCode setSingularDofs (const string field_name, const int verb=QUIET)
 set singular dofs (on edges adjacent to crack front) from geometry More...
 
MoFEMErrorCode setSingularElementMatrialPositions (const int verb=QUIET)
 set singular dofs of material field (on edges adjacent to crack front) from geometry More...
 
MoFEMErrorCode unsetSingularElementMatrialPositions ()
 remove singularity More...
 
MoFEMErrorCode cleanSingularElementMatrialPositions ()
 set maetrial field order to one More...
 

Auxiliary method

boost::shared_ptr< DofEntity > arcLengthDof
 
MoFEMErrorCode getArcLengthDof ()
 set pointer to arc-length DOF More...
 
boost::shared_ptr< ArcLengthCtx > & getArcCtx ()
 
boost::shared_ptr< ArcLengthCtx > & getEigenArcCtx ()
 
boost::shared_ptr< FEMethodgetFrontArcLengthControl (boost::shared_ptr< ArcLengthCtx > arc_ctx)
 
boost::shared_ptr< AnalyticalDirichletBC::DirichletBCgetAnalyticalDirichletBc ()
 
boost::shared_ptr< MWLSApprox > & getMWLSApprox ()
 

Pointers to finite element instances

bool onlyHooke
 True if only Hooke material is applied. More...
 
PetscBool onlyHookeFromOptions
 True if only Hooke material is applied. More...
 
boost::shared_ptr< NonlinearElasticElementelasticFe
 
boost::shared_ptr< NonlinearElasticElementmaterialFe
 
boost::shared_ptr< CrackFrontElementfeLhs
 Integrate elastic FE. More...
 
boost::shared_ptr< CrackFrontElementfeRhs
 Integrate elastic FE. More...
 
boost::shared_ptr< CrackFrontElementfeMaterialRhs
 Integrate material stresses, assemble vector. More...
 
boost::shared_ptr< CrackFrontElementfeMaterialLhs
 Integrate material stresses, assemble matrix. More...
 
boost::shared_ptr< CrackFrontElementfeEnergy
 Integrate energy. More...
 
boost::shared_ptr< ConstrainMatrixCtxprojSurfaceCtx
 Data structure to project on the body surface. More...
 
boost::shared_ptr< ConstrainMatrixCtxprojFrontCtx
 Data structure to project on crack front. More...
 
boost::shared_ptr< MWLSApproxmwlsApprox
 
boost::shared_ptr< NeumannForcesSurface::MyTriangleFEfeMaterialAnaliticalTraction
 Surface elment to calculate tractions in material space. More...
 
boost::shared_ptr< DirichletSpatialPositionsBcspatialDirichletBc
 apply Dirichlet BC to sparial positions More...
 
boost::shared_ptr< AnalyticalDirichletBC::DirichletBCanalyticalDirichletBc
 
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfaceForces
 assemble surface forces More...
 
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfaceForceAle
 assemble surface pressure (ALE) More...
 
boost::shared_ptr< NeumannForcesSurface::DataAtIntegrationPtscommonDataSurfaceForceAle
 common data at integration points (ALE) More...
 
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfacePressure
 assemble surface pressure More...
 
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfacePressureAle
 assemble surface pressure (ALE) More...
 
boost::shared_ptr< NeumannForcesSurface::DataAtIntegrationPtscommonDataSurfacePressureAle
 common data at integration points (ALE) More...
 
boost::shared_ptr< boost::ptr_map< string, EdgeForce > > edgeForces
 assemble edge forces More...
 
boost::shared_ptr< boost::ptr_map< string, NodalForce > > nodalForces
 assemble nodal forces More...
 
boost::shared_ptr< FEMethodassembleFlambda
 assemble F_lambda vector More...
 
boost::shared_ptr< FEMethodzeroFlambda
 assemble F_lambda vector More...
 
boost::shared_ptr< CrackFrontElementfeCouplingElasticLhs
 FE instance to assemble coupling terms. More...
 
boost::shared_ptr< CrackFrontElementfeCouplingMaterialLhs
 FE instance to assemble coupling terms. More...
 
boost::shared_ptr< SmoothersmootherFe
 
boost::shared_ptr< Smoother::MyVolumeFEfeSmootherRhs
 Integrate smoothing operators. More...
 
boost::shared_ptr< Smoother::MyVolumeFEfeSmootherLhs
 Integrate smoothing operators. More...
 
boost::shared_ptr< VolumeLengthQuality< double > > volumeLengthDouble
 
boost::shared_ptr< VolumeLengthQuality< adouble > > volumeLengthAdouble
 
boost::shared_ptr< ObosleteUsersModules::TangentWithMeshSmoothingFrontConstraintangentConstrains
 Constrains crack front in tangent directiona. More...
 
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientationskinOrientation
 
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientationcrackOrientation
 
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientationcontactOrientation
 
map< int, boost::shared_ptr< SurfaceSlidingConstrains > > surfaceConstrain
 
map< int, boost::shared_ptr< EdgeSlidingConstrains > > edgeConstrains
 
boost::shared_ptr< BothSurfaceConstrainsbothSidesConstrains
 
boost::shared_ptr< BothSurfaceConstrainscloseCrackConstrains
 
boost::shared_ptr< BothSurfaceConstrainsbothSidesContactConstrains
 
boost::shared_ptr< DirichletFixFieldAtEntitiesBcfixMaterialEnts
 
boost::shared_ptr< GriffithForceElementgriffithForceElement
 
boost::shared_ptr< GriffithForceElement::MyTriangleFEfeGriffithForceRhs
 
boost::shared_ptr< GriffithForceElement::MyTriangleFEfeGriffithForceLhs
 
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsDeltafeGriffithConstrainsDelta
 
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsfeGriffithConstrainsRhs
 
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsfeGriffithConstrainsLhs
 
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > analiticalSurfaceElement
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeSpringLhsPtr
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeSpringRhsPtr
 

Entity ranges

Range bitEnts
 
Range bitProcEnts
 
Range bodySkin
 
Range crackFaces
 
Range oneSideCrackFaces
 
Range otherSideCrackFaces
 
Range crackFront
 
Range crackFrontNodes
 
Range crackFrontNodesEdges
 
Range crackFrontNodesTris
 
Range crackFrontElements
 
EntityHandle arcLengthVertex
 Vertex associated with dof for arc-length control. More...
 

Auxiliary data

int defaultMaterial
 
int nbLoadSteps
 
int nbCutSteps
 
double loadScale
 
double maxG1
 
double maxJ
 
double fractionOfFixedNodes
 
map< EntityHandle, doublemapG1
 hashmap of g1 - release energy at nodes More...
 
map< EntityHandle, doublemapG3
 hashmap of g3 - release energy at nodes More...
 
map< EntityHandle, doublemapJ
 hashmap of J - release energy at nodes More...
 
map< EntityHandle, VectorDouble3 > mapMatForce
 hashmap of material force at nodes More...
 
map< EntityHandle, VectorDouble3 > mapGriffith
 hashmap of Griffith energy at nodes More...
 
map< EntityHandle, doublemapSmoothingForceFactor
 
bool doSurfaceProjection
 
double smootherAlpha
 Controls mesh smoothing. More...
 
double initialSmootherAlpha
 
double smootherGamma
 Controls mesh smoothing. More...
 

arc-length options

double arcAlpha
 
double arcBeta
 
double arcS
 
boost::shared_ptr< ArcLengthCtxarcCtx
 
boost::shared_ptr< ArcLengthCtxarcEigenCtx
 

Contact parameters, entity ranges and data structures

int contactOrder
 
int contactLambdaOrder
 
double rValue
 
double cnValue
 
PetscBool ignoreContact
 
PetscBool fixContactNodes
 
PetscBool printContactState
 
Range contactMeshsetFaces
 
Range contactElements
 
Range contactMasterFaces
 
Range contactSlaveFaces
 
Range mortarContactElements
 
Range mortarContactMasterFaces
 
Range mortarContactSlaveFaces
 
boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndexcontactSearchMultiIndexPtr
 
Range contactBothSidesMasterFaces
 
Range contactBothSidesSlaveFaces
 
Range contactBothSidesMasterNodes
 
Range contactTets
 
EntityHandle meshsetFaces
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeLhsSpringALE
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeLhsSpringALEMaterial
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeRhsSpringALEMaterial
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeLhsSurfaceForceALEMaterial
 
boost::shared_ptr< FaceElementForcesAndSourcesCorefeRhsSurfaceForceALEMaterial
 
boost::shared_ptr< MetaSpringBC::DataAtIntegrationPtsSpringscommonDataSpringsALE
 
boost::shared_ptr< SimpleContactProblemcontactProblem
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfeRhsSimpleContact
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfeLhsSimpleContact
 
boost::shared_ptr< SimpleContactProblem::CommonDataSimpleContactcommonDataSimpleContact
 
boost::shared_ptr< MortarContactProblemmortarContactProblemPtr
 
boost::shared_ptr< MortarContactProblem::MortarContactElementfeRhsMortarContact
 
boost::shared_ptr< MortarContactProblem::MortarContactElementfeLhsMortarContact
 
boost::shared_ptr< MortarContactProblem::CommonDataMortarContactcommonDataMortarContact
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfeRhsSimpleContactALEMaterial
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfeLhsSimpleContactALEMaterial
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfeLhsSimpleContactALE
 
boost::shared_ptr< SimpleContactProblem::CommonDataSimpleContactcommonDataSimpleContactALE
 
PetscBool contactOutputIntegPts
 
boost::shared_ptr< SimpleContactProblem::SimpleContactElementfePostProcSimpleContact
 
boost::shared_ptr< MortarContactProblem::MortarContactElementfePostProcMortarContact
 
moab::Core contactPostProcCore
 
moab::Interface & contactPostProcMoab
 
Range constrainedInterface
 Range of faces on the constrained interface. More...
 

Data for bone

double rHo0
 Reference density if bone is analyzed. More...
 
double nBone
 Exponent parameter in bone density. More...
 

Interfaces

const boost::scoped_ptr< UnknownInterface > cpSolversPtr
 
const boost::scoped_ptr< UnknownInterface > cpMeshCutPtr
 

Cut/Refine/Split options

PetscBool doCutMesh
 
double crackAccelerationFactor
 
PetscBool doElasticWithoutCrack
 

Detailed Description

Crack propagation data and methods

Definition at line 77 of file CrackPropagation.hpp.

Constructor & Destructor Documentation

◆ CrackPropagation()

FractureMechanics::CrackPropagation::CrackPropagation ( MoFEM::Interface m_field,
const int  approx_order = 2,
const int  geometry_order = 1 
)

Constructor of Crack Propagation, prints fracture module version and registers the three interfaces used to solve fracture problem, i.e. CrackPropagation, CPSolvers and CPMeshCut.

Parameters
m_fieldinterface to MoAB database
approx_orderorder of approximation space, default is 2
geometry_orderorder of geometry, default is 1 (can be up to 2)

Definition at line 521 of file CrackPropagation.cpp.

526  geometryOrder(geometry_order), gC(0), betaGc(0),
527  isGcHeterogeneous(PETSC_FALSE), isPartitioned(PETSC_FALSE),
528  propagateCrack(PETSC_FALSE), refAtCrackTip(0), refOrderAtTip(0),
532  nBone(0), cpSolversPtr(new CPSolvers(*this)),
533  cpMeshCutPtr(new CPMeshCut(*this)) {
534 
535  if (!LogManager::checkIfChannelExist("CPWorld")) {
536  auto core_log = logging::core::get();
537 
538  core_log->add_sink(
539  LogManager::createSink(LogManager::getStrmWorld(), "CPWorld"));
540  core_log->add_sink(
541  LogManager::createSink(LogManager::getStrmSync(), "CPSync"));
542  core_log->add_sink(
543  LogManager::createSink(LogManager::getStrmSelf(), "CPSelf"));
544 
545  LogManager::setLog("CPWorld");
546  LogManager::setLog("CPSync");
547  LogManager::setLog("CPSelf");
548 
549  MOFEM_LOG_TAG("CPWorld", "CP");
550  MOFEM_LOG_TAG("CPSync", "CP");
551  MOFEM_LOG_TAG("CPSelf", "CP");
552  }
553 
554  MOFEM_LOG("CPWorld", Sev::noisy) << "CPSolve created";
555 
556 #ifdef GIT_UM_SHA1_NAME
557  MOFEM_LOG_C("CPWorld", Sev::inform, "User module git commit id %s",
558  GIT_UM_SHA1_NAME);
559 #endif
560 
561  Version version;
562  getInterfaceVersion(version);
563  MOFEM_LOG("CPWorld", Sev::inform)
564  << "Fracture module version " << version.strVersion();
565 
566 #ifdef GIT_FM_SHA1_NAME
567  MOFEM_LOG_C("CPWorld", Sev::inform, "Fracture module git commit id %s",
568  GIT_FM_SHA1_NAME);
569 #endif
570 
571  ierr = registerInterface<CrackPropagation>();
572  CHKERRABORT(PETSC_COMM_SELF, ierr);
573  ierr = registerInterface<CPSolvers>();
574  CHKERRABORT(PETSC_COMM_SELF, ierr);
575  ierr = registerInterface<CPMeshCut>();
576  CHKERRABORT(PETSC_COMM_SELF, ierr);
577 
578  mapBitLevel["mesh_cut"] = BitRefLevel().set(0);
579  mapBitLevel["spatial_domain"] = BitRefLevel().set(1);
580  mapBitLevel["material_domain"] = BitRefLevel().set(2);
581 
582  if (!moabCommWorld)
583  moabCommWorld = boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD, false);
584 }

◆ ~CrackPropagation()

FractureMechanics::CrackPropagation::~CrackPropagation ( )
virtual

Definition at line 586 of file CrackPropagation.cpp.

586 {}

Member Function Documentation

◆ addElasticFEInstancesToSnes()

MoFEMErrorCode FractureMechanics::CrackPropagation::addElasticFEInstancesToSnes ( DM  dm,
Mat  m,
Vec  q,
Vec  f,
boost::shared_ptr< FEMethod arc_method = boost::shared_ptr<FEMethod>(),
boost::shared_ptr< ArcLengthCtx arc_ctx = nullptr,
const int  verb = QUIET,
const bool  debug = false 
)

Definition at line 4610 of file CrackPropagation.cpp.

4612  {
4613  boost::shared_ptr<FEMethod> null;
4615 
4616  // Assemble F_lambda force
4617  assembleFlambda = boost::shared_ptr<FEMethod>(
4618  new AssembleFlambda(arc_ctx, spatialDirichletBc));
4619  zeroFlambda = boost::shared_ptr<FEMethod>(new ZeroFLmabda(arc_ctx));
4620 
4621  if (mwlsApprox) {
4622  mwlsApprox->F_lambda = arc_ctx->F_lambda;
4624  mwlsApprox->arcLengthDof = arcLengthDof;
4625  }
4626  // Set up DM specific vectors and data
4627  spatialDirichletBc->mapZeroRows.clear();
4628 
4629  VecSetOption(arc_ctx->F_lambda, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
4630 
4631  // Set-up F_lambda to elements & operator evalulating forces
4632  // Surface force
4633  for (auto fit = surfaceForces->begin(); fit != surfaceForces->end(); fit++) {
4634  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
4635  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
4636  for (; oit != hi_oit; oit++) {
4637  if (boost::typeindex::type_id_runtime(*oit) ==
4638  boost::typeindex::type_id<NeumannForcesSurface::OpNeumannForce>()) {
4639  dynamic_cast<NeumannForcesSurface::OpNeumannForce &>(*oit).F =
4640  arc_ctx->F_lambda;
4641  }
4642  }
4643  }
4644  for (auto fit = surfacePressure->begin(); fit != surfacePressure->end();
4645  fit++) {
4646  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
4647  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
4648  for (; oit != hi_oit; oit++) {
4649  if (boost::typeindex::type_id_runtime(*oit) ==
4650  boost::typeindex::type_id<
4652  dynamic_cast<NeumannForcesSurface::OpNeumannPressure &>(*oit).F =
4653  arc_ctx->F_lambda;
4654  }
4655  if (boost::typeindex::type_id_runtime(*oit) ==
4656  boost::typeindex::type_id<
4658  dynamic_cast<NeumannForcesSurface::OpNeumannForceAnalytical &>(*oit).F =
4659  arc_ctx->F_lambda;
4660  }
4661  }
4662  }
4663  for (auto fit = edgeForces->begin(); fit != edgeForces->end(); fit++) {
4664  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
4665  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
4666  for (; oit != hi_oit; oit++) {
4667  if (boost::typeindex::type_id_runtime(*oit) ==
4668  boost::typeindex::type_id<EdgeForce::OpEdgeForce>()) {
4669  dynamic_cast<EdgeForce::OpEdgeForce &>(*oit).F = arc_ctx->F_lambda;
4670  }
4671  }
4672  }
4673  for (auto fit = nodalForces->begin(); fit != nodalForces->end(); fit++) {
4674  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
4675  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
4676  for (; oit != hi_oit; oit++) {
4677  if (boost::typeindex::type_id_runtime(*oit) ==
4678  boost::typeindex::type_id<NodalForce::OpNodalForce>()) {
4679  dynamic_cast<NodalForce::OpNodalForce &>(*oit).F = arc_ctx->F_lambda;
4680  }
4681  }
4682  }
4683 
4684  // Lhs
4686  null);
4687 #ifdef __ANALITICAL_DISPLACEMENT__
4688  if (mField.check_problem("BC_PROBLEM")) {
4690  analyticalDirichletBc, null);
4691  }
4692 #endif //__ANALITICAL_DISPLACEMENT__
4693  CHKERR DMMoFEMSNESSetJacobian(dm, "ELASTIC", feLhs, null, null);
4694  CHKERR DMMoFEMSNESSetJacobian(dm, "SPRING", feSpringLhsPtr, null, null);
4695  CHKERR DMMoFEMSNESSetJacobian(dm, "CONTACT", feLhsSimpleContact, null, null);
4696  CHKERR DMMoFEMSNESSetJacobian(dm, "MORTAR_CONTACT", feLhsMortarContact, null,
4697  null);
4698  {
4699  const MoFEM::Problem *problem_ptr;
4700  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
4701  if (problem_ptr->getName() == "EIGEN_ELASTIC") {
4703  null, null);
4704  }
4705  }
4706 
4707 #ifdef __ANALITICAL_DISPLACEMENT__
4708  if (mField.check_problem("BC_PROBLEM")) {
4711  }
4712 #endif //__ANALITICAL_DISPLACEMENT__
4715  CHKERR DMMoFEMSNESSetJacobian(dm, "ARC_LENGTH", arc_method, null, null);
4716 
4717  // Rhs
4718  auto fe_set_option = boost::make_shared<FEMethod>();
4719  fe_set_option->preProcessHook = [fe_set_option]() {
4720  return VecSetOption(fe_set_option->snes_f, VEC_IGNORE_NEGATIVE_INDICES,
4721  PETSC_TRUE);
4722  };
4723  CHKERR DMMoFEMSNESSetFunction(dm, DM_NO_ELEMENT, null, fe_set_option, null);
4725  null);
4726  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", null, zeroFlambda, null);
4727 #ifdef __ANALITICAL_DISPLACEMENT__
4728  if (mField.check_problem("BC_PROBLEM")) {
4730  analyticalDirichletBc, null);
4731  }
4732 #endif //__ANALITICAL_DISPLACEMENT__
4733  CHKERR DMMoFEMSNESSetFunction(dm, "ELASTIC", feRhs, null, null);
4734  CHKERR DMMoFEMSNESSetFunction(dm, "SPRING", feSpringRhsPtr, null, null);
4735  CHKERR DMMoFEMSNESSetFunction(dm, "CONTACT", feRhsSimpleContact, null, null);
4736  CHKERR DMMoFEMSNESSetFunction(dm, "MORTAR_CONTACT", feRhsMortarContact, null,
4737  null);
4738  {
4739  const MoFEM::Problem *problem_ptr;
4740  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
4741  if (problem_ptr->getName() == "EIGEN_ELASTIC") {
4743  null, null);
4744  }
4745  }
4746 
4747  for (auto fit = surfaceForces->begin(); fit != surfaceForces->end(); fit++) {
4749  dm, fit->first.c_str(),
4750  boost::shared_ptr<FEMethod>(surfaceForces, &fit->second->getLoopFe()),
4751  null, null);
4752  }
4753  for (auto fit = surfacePressure->begin(); fit != surfacePressure->end();
4754  fit++) {
4756  dm, fit->first.c_str(),
4757  boost::shared_ptr<FEMethod>(surfacePressure, &fit->second->getLoopFe()),
4758  null, null);
4759  }
4760  for (auto fit = edgeForces->begin(); fit != edgeForces->end(); fit++) {
4762  dm, fit->first.c_str(),
4763  boost::shared_ptr<FEMethod>(edgeForces, &fit->second->getLoopFe()),
4764  null, null);
4765  }
4766  for (auto fit = nodalForces->begin(); fit != nodalForces->end(); fit++) {
4768  dm, fit->first.c_str(),
4769  boost::shared_ptr<FEMethod>(nodalForces, &fit->second->getLoopFe()),
4770  null, null);
4771  }
4772 #ifdef __ANALITICAL_TRACTION__
4774  for (auto fit = analiticalSurfaceElement->begin();
4775  fit != analiticalSurfaceElement->end(); fit++) {
4777  dm, fit->first.c_str(),
4778  boost::shared_ptr<FEMethod>(analiticalSurfaceElement,
4779  &fit->second->fe),
4780  null, null);
4781  }
4782  }
4783 #endif //__ANALITICAL_TRACTION__
4784 #ifdef __ANALITICAL_DISPLACEMENT__
4785  if (mField.check_problem("BC_PROBLEM")) {
4788  }
4789 #endif //__ANALITICAL_DISPLACEMENT__
4790  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", assembleFlambda, null, null);
4791  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", arc_method, null, null);
4794 
4795  if (debug) {
4796  if (m == PETSC_NULL || q == PETSC_NULL || f == PETSC_NULL) {
4797  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
4798  "problem matrix or vectors are set to null");
4799  }
4800  SNES snes;
4801  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
4802  SnesCtx *snes_ctx;
4803  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
4804  CHKERR SNESSetFunction(snes, f, SnesRhs, snes_ctx);
4805  CHKERR SNESSetJacobian(snes, m, m, SnesMat, snes_ctx);
4806  CHKERR SnesMat(snes, q, m, m, snes_ctx);
4807  CHKERR SnesRhs(snes, q, f, snes_ctx);
4808  CHKERR SNESDestroy(&snes);
4809  MatView(m, PETSC_VIEWER_DRAW_WORLD);
4810  std::string wait;
4811  std::cin >> wait;
4812  }
4813 
4815 }

◆ addMaterialFEInstancesToSnes()

MoFEMErrorCode FractureMechanics::CrackPropagation::addMaterialFEInstancesToSnes ( DM  dm,
const bool  fix_crack_front,
const int  verb = QUIET,
const bool  debug = false 
)

add material elements instances to SNES

Definition at line 6631 of file CrackPropagation.cpp.

6632  {
6633  boost::shared_ptr<FEMethod> null;
6635 
6636  // Set up DM specific vectors and data
6637  Vec front_f, tangent_front_f;
6638  CHKERR DMCreateGlobalVector(dm, &front_f);
6639  CHKERR VecDuplicate(front_f, &tangent_front_f);
6640  CHKERR VecSetOption(front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
6641  CHKERR VecSetOption(tangent_front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
6642  if (smootherFe->smootherData.ownVectors) {
6643  if (smootherFe->smootherData.frontF != PETSC_NULL)
6644  CHKERR VecDestroy(&smootherFe->smootherData.frontF);
6645  if (smootherFe->smootherData.tangentFrontF != PETSC_NULL)
6646  CHKERR VecDestroy(&smootherFe->smootherData.tangentFrontF);
6647  }
6648  smootherFe->smootherData.frontF = front_f;
6649  smootherFe->smootherData.tangentFrontF = tangent_front_f;
6650  smootherFe->smootherData.ownVectors = true;
6651  CHKERR PetscObjectReference((PetscObject)front_f);
6652  CHKERR PetscObjectReference((PetscObject)tangent_front_f);
6653  if (tangentConstrains->ownVectors) {
6654  if (tangentConstrains->frontF != PETSC_NULL)
6655  VecDestroy(&tangentConstrains->frontF);
6656  if (tangentConstrains->tangentFrontF != PETSC_NULL)
6657  VecDestroy(&tangentConstrains->tangentFrontF);
6658  }
6659  tangentConstrains->frontF = front_f;
6660  tangentConstrains->tangentFrontF = tangent_front_f;
6661  tangentConstrains->ownVectors = true;
6662  CHKERR PetscObjectReference((PetscObject)front_f);
6663  CHKERR PetscObjectReference((PetscObject)tangent_front_f);
6664  CHKERR VecDestroy(&front_f);
6665  CHKERR VecDestroy(&tangent_front_f);
6666 
6667  const MoFEM::Problem *problem_ptr;
6668  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
6669  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(
6670  problem_ptr->getName(), COL, feGriffithConstrainsDelta->deltaVec);
6671  CHKERR VecSetOption(feGriffithConstrainsDelta->deltaVec,
6672  VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
6673  feGriffithConstrainsRhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
6674  feGriffithConstrainsLhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
6675 
6676  // Fix nodes
6677  CHKERR updateMaterialFixedNode(true, false, debug);
6678 
6679  if (debug && !mField.get_comm_rank()) {
6680  const FieldEntity_multiIndex *field_ents;
6681  CHKERR mField.get_field_ents(&field_ents);
6682  for (Range::iterator vit = crackFrontNodes.begin();
6683  vit != crackFrontNodes.end(); ++vit) {
6684  cerr << "Node " << endl;
6685  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator eit, hi_eit;
6686  eit = field_ents->get<Ent_mi_tag>().lower_bound(*vit);
6687  hi_eit = field_ents->get<Ent_mi_tag>().upper_bound(*vit);
6688  for (; eit != hi_eit; ++eit) {
6689  cerr << **eit << endl;
6690  }
6691  }
6692  }
6693 
6694  SnesCtx *snes_ctx;
6695  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
6696  CHKERR snes_ctx->clearLoops();
6697 
6698  // Add to SNES Jacobian
6700  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null, null);
6701  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feMaterialLhs, null, null);
6702  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
6703  null, null);
6704  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CONTACT",
6705  bothSidesContactConstrains, null, null);
6706  for (auto &m : surfaceConstrain) {
6707  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
6708  CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE", m.second->feLhsPtr, null,
6709  null);
6710  } else {
6711  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACK_SURFACE", m.second->feLhsPtr,
6712  null, null);
6713  }
6714  }
6715  for (auto &m : edgeConstrains) {
6716  CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE", m.second->feLhsPtr, null, null);
6717  }
6718  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
6719  feGriffithConstrainsDelta, null, null);
6720  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
6721  feGriffithConstrainsLhs, null, null);
6722  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
6723  tangentConstrains, null, null);
6724  CHKERR DMMoFEMSNESSetJacobian(dm, "GRIFFITH_FORCE_ELEMENT",
6725  feGriffithForceLhs, null, null);
6727 
6728  // Add to SNES residuals
6730  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null, null);
6731  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feMaterialRhs, null, null);
6732  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
6733  null, null);
6734  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CONTACT",
6735  bothSidesContactConstrains, null, null);
6736  for (auto &m : surfaceConstrain) {
6737  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
6738  CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE", m.second->feRhsPtr, null,
6739  null);
6740  } else {
6741  CHKERR DMMoFEMSNESSetFunction(dm, "CRACK_SURFACE", m.second->feRhsPtr,
6742  null, null);
6743  }
6744  }
6745  for (auto &m : edgeConstrains) {
6746  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE", m.second->feRhsPtr, null, null);
6747  }
6748  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
6749  feGriffithConstrainsDelta, null, null);
6750  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
6751  feGriffithConstrainsRhs, null, null);
6752  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
6753  tangentConstrains, null, null);
6754  CHKERR DMMoFEMSNESSetFunction(dm, "GRIFFITH_FORCE_ELEMENT",
6755  feGriffithForceRhs, null, null);
6757 
6758  if (debug) {
6759  Vec q, f;
6760  CHKERR DMCreateGlobalVector(dm, &q);
6761  CHKERR VecDuplicate(q, &f);
6762  CHKERR DMoFEMMeshToLocalVector(dm, q, INSERT_VALUES, SCATTER_FORWARD);
6763  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
6764  Mat m;
6765  CHKERR DMCreateMatrix(dm, &m);
6766  SNES snes;
6767  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
6768  SnesCtx *snes_ctx;
6769  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
6770  CHKERR SNESSetFunction(snes, f, SnesRhs, snes_ctx);
6771  CHKERR SNESSetJacobian(snes, m, m, SnesMat, snes_ctx);
6772  CHKERR SnesMat(snes, q, m, m, snes_ctx);
6773  CHKERR SnesRhs(snes, q, f, snes_ctx);
6774  CHKERR SNESDestroy(&snes);
6775  // MatView(m,PETSC_VIEWER_DRAW_WORLD);
6776  MatView(m, PETSC_VIEWER_STDOUT_WORLD);
6777  std::string wait;
6778  std::cin >> wait;
6779  CHKERR VecDestroy(&q);
6780  CHKERR VecDestroy(&f);
6781  CHKERR MatDestroy(&m);
6782  }
6784 }

◆ addMWLSDensityOperators()

MoFEMErrorCode FractureMechanics::CrackPropagation::addMWLSDensityOperators ( boost::shared_ptr< CrackFrontElement > &  fe_rhs,
boost::shared_ptr< CrackFrontElement > &  fe_lhs 
)

Definition at line 5027 of file CrackPropagation.cpp.

5029  {
5031 
5032  if (densityMapBlock == -1)
5034 
5035  if (!elasticFe) {
5036  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
5037  "Elastic element instance not created");
5038  }
5039 
5040  // Create elastic element finite element instance for residuals. Note that
5041  // this element approx. singularity at crack front.
5042  fe_rhs = boost::make_shared<CrackFrontElement>(
5045  // Create finite element instance for assembly of tangent matrix
5046  fe_lhs = boost::make_shared<CrackFrontElement>(
5049 
5050  bool test_with_mwls = false; // switch for debugging
5051 
5052  // Arbitrary lagrangian formulation, mesh node positions are taken into
5053  // account by operators.
5054  fe_rhs->meshPositionsFieldName = "NONE";
5055  fe_lhs->meshPositionsFieldName = "NONE";
5056  fe_rhs->addToRule = 0;
5057  fe_lhs->addToRule = 0;
5058 
5059  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
5060  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
5061  boost::shared_ptr<map<int, NonlinearElasticElement::BlockData>>
5062  block_sets_ptr(elasticFe, &elasticFe->setOfBlocks);
5063 
5064  if (!mwlsApprox) {
5065  // Create instance for moving least square approximation
5066  mwlsApprox = boost::make_shared<MWLSApprox>(mField);
5067  // Load mesh with stresses
5068  CHKERR mwlsApprox->loadMWLSMesh(mwlsApproxFile.c_str());
5069  MeshsetsManager *block_manager_ptr;
5070  CHKERR mField.getInterface(block_manager_ptr);
5071  CHKERR block_manager_ptr->getEntitiesByDimension(
5072  densityMapBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
5073  Tag th_rho;
5074  if (mwlsApprox->mwlsMoab.tag_get_handle(mwlsRhoTagName.c_str(), th_rho) !=
5075  MB_SUCCESS) {
5076  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
5077  "Density tag name %s cannot be found. Please "
5078  "provide the correct name.",
5079  mwlsRhoTagName.c_str());
5080  }
5081  CHKERR mwlsApprox->mwlsMoab.tag_get_handle(mwlsRhoTagName.c_str(), th_rho);
5082  CHKERR mwlsApprox->getValuesToNodes(th_rho);
5083  } else {
5084  mwlsApprox->tetsInBlock.clear();
5085  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
5086  densityMapBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
5087  }
5088 
5089  auto mat_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
5090  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5091  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
5092  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5093  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
5094 
5095  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_MWLS_ptr(
5096  mwlsApprox, &mwlsApprox->mwlsMaterialPositions);
5097  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5098  "MESH_NODE_POSITIONS", mat_pos_at_pts_MWLS_ptr));
5099  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5100  "MESH_NODE_POSITIONS", mat_pos_at_pts_MWLS_ptr));
5101  auto mat_grad_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
5102  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
5103  "MESH_NODE_POSITIONS", mat_grad_pos_at_pts_ptr));
5104  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
5105  "MESH_NODE_POSITIONS", mat_grad_pos_at_pts_ptr));
5106  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
5107  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
5108  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
5109  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
5110  fe_rhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
5111  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
5112  fe_rhs->singularElement, fe_rhs->invSJac));
5113  fe_lhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
5114  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
5115  fe_lhs->singularElement, fe_lhs->invSJac));
5116  auto space_grad_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
5117  fe_rhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
5118  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr, fe_rhs->singularElement,
5119  fe_rhs->invSJac));
5120  fe_lhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
5121  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr, fe_lhs->singularElement,
5122  fe_lhs->invSJac));
5123 
5124  fe_rhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
5125  fe_rhs->singularElement, fe_rhs->detS, fe_rhs->invSJac));
5126 
5127  // data_hooke_element_at_pts->HMat = mat_grad_pos_at_pts_ptr;
5128  // data_hooke_element_at_pts->hMat = space_grad_pos_at_pts_ptr;
5129 
5130  // RHS //
5131  if (test_with_mwls) {
5132  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5133  fe_rhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSRhoAtGaussPts(
5134  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox,
5135  mwlsRhoTagName, true, false));
5136  else {
5137  fe_rhs->getOpPtrVector().push_back(
5139  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox));
5140  fe_rhs->getOpPtrVector().push_back(
5141  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
5142  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox,
5143  mwlsRhoTagName, true, false));
5144  }
5145  } else {
5146 
5147  fe_rhs->getOpPtrVector().push_back(new OpGetDensityFieldForTesting(
5148  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr, mwlsApprox->rhoAtGaussPts,
5149  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
5150  fe_rhs, mwlsApprox->singularInitialDisplacement,
5151  mat_grad_pos_at_pts_ptr));
5152  }
5153 
5154  fe_rhs->getOpPtrVector().push_back(
5155  new HookeElement::OpCalculateStiffnessScaledByDensityField(
5156  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5157  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone, rHo0));
5158  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpCalculateStrainAle(
5159  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5160  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpCalculateStress<1>(
5161  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5162  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpCalculateEnergy(
5163  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5164 
5165  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpCalculateEshelbyStress(
5166  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5167 
5168  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpAleRhs_dX(
5169  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5170  fe_rhs->getOpPtrVector().push_back(new HookeElement::OpAleRhs_dx(
5171  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts));
5172 
5173  fe_rhs->getOpPtrVector().push_back(new OpRhsBoneExplicitDerivariveWithHooke(
5174  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5175  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->tetsInBlock, rHo0, nBone,
5176  &crackFrontNodes));
5177 
5178  // LHS //
5179  fe_lhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
5180  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr, fe_lhs->singularElement,
5181  fe_lhs->invSJac));
5182  fe_lhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
5183  fe_lhs->singularElement, fe_lhs->detS, fe_lhs->invSJac));
5184 
5185  if (test_with_mwls) {
5186  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5187  fe_lhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSRhoAtGaussPts(
5188  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox,
5189  mwlsRhoTagName, true, true));
5190  else {
5191  fe_lhs->getOpPtrVector().push_back(
5193  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox));
5194  fe_lhs->getOpPtrVector().push_back(
5195  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
5196  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox,
5197  mwlsRhoTagName, true, true));
5198  }
5199  } else {
5200  fe_lhs->getOpPtrVector().push_back(new OpGetDensityFieldForTesting(
5201  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr, mwlsApprox->rhoAtGaussPts,
5202  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
5203  fe_lhs, mwlsApprox->singularInitialDisplacement,
5204  mat_grad_pos_at_pts_ptr));
5205  }
5206 
5207  fe_lhs->getOpPtrVector().push_back(
5208  new HookeElement::OpCalculateStiffnessScaledByDensityField(
5209  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5210  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone, rHo0));
5211 
5212  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpCalculateStrainAle(
5213  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5214  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpCalculateStress<1>(
5215  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5216  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpCalculateEnergy(
5217  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5218  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpCalculateEshelbyStress(
5219  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5220 
5221  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dX_dX<1>(
5222  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5223  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpAleLhsPre_dX_dx<1>(
5224  "MESH_NODE_POSITIONS", "SPATIAL_POSITION", data_hooke_element_at_pts));
5225  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dX_dx(
5226  "MESH_NODE_POSITIONS", "SPATIAL_POSITION", data_hooke_element_at_pts));
5227  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dx_dx<1>(
5228  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts));
5229  fe_lhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dx_dX<1>(
5230  "SPATIAL_POSITION", "MESH_NODE_POSITIONS", data_hooke_element_at_pts));
5231 
5232  fe_lhs->getOpPtrVector().push_back(
5233  new HookeElement::OpAleLhsWithDensity_dX_dX(
5234  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5235  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5236  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0));
5237 
5238  fe_lhs->getOpPtrVector().push_back(
5239  new HookeElement::OpAleLhsWithDensity_dx_dX(
5240  "SPATIAL_POSITION", "MESH_NODE_POSITIONS", data_hooke_element_at_pts,
5241  mwlsApprox->rhoAtGaussPts, mwlsApprox->diffRhoAtGaussPts, nBone,
5242  rHo0));
5243 
5244  boost::shared_ptr<MatrixDouble> mat_singular_disp_ptr = nullptr;
5245  if (addSingularity) {
5246  mat_singular_disp_ptr = boost::shared_ptr<MatrixDouble>(
5247  mwlsApprox, &mwlsApprox->singularInitialDisplacement);
5248 
5249  fe_lhs->getOpPtrVector().push_back(
5250  new OpAleLhsWithDensitySingularElement_dX_dX(
5251  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5252  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5253  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0, mat_singular_disp_ptr));
5254 
5255  fe_lhs->getOpPtrVector().push_back(
5256  new OpAleLhsWithDensitySingularElement_dx_dX(
5257  "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
5258  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5259  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0, mat_singular_disp_ptr));
5260  }
5261 
5262  fe_lhs->getOpPtrVector().push_back(
5263  new OpLhsBoneExplicitDerivariveWithHooke_dX(
5264  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5265  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
5266  mwlsApprox->singularInitialDisplacement, mwlsApprox->tetsInBlock,
5267  rHo0, nBone, &crackFrontNodes));
5268 
5269  fe_lhs->getOpPtrVector().push_back(
5270  new OpLhsBoneExplicitDerivariveWithHooke_dx(
5271  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5272  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
5273  mwlsApprox->singularInitialDisplacement, mwlsApprox->tetsInBlock,
5274  rHo0, nBone, &crackFrontNodes));
5275 
5277 }

◆ addMWLSStressOperators()

MoFEMErrorCode FractureMechanics::CrackPropagation::addMWLSStressOperators ( boost::shared_ptr< CrackFrontElement > &  fe_rhs,
boost::shared_ptr< CrackFrontElement > &  fe_lhs 
)

Definition at line 4902 of file CrackPropagation.cpp.

4904  {
4906 
4907  if (residualStressBlock == -1)
4909 
4910  if (!elasticFe) {
4911  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
4912  "Elastic element instance not created");
4913  }
4914 
4915  // Create elastic element finite element instance for residuals. Note that
4916  // this element approx. singularity at crack front.
4917  fe_rhs = boost::make_shared<CrackFrontElement>(
4920  // Create finite element instance for assembly of tangent matrix
4921  fe_lhs = boost::make_shared<CrackFrontElement>(
4924 
4925  // Arbitrary lagrangian formulation, mesh node positions are taken into
4926  // account by operators.
4927  fe_rhs->meshPositionsFieldName = "NONE";
4928  fe_lhs->meshPositionsFieldName = "NONE";
4929  fe_rhs->addToRule = 0;
4930  fe_lhs->addToRule = 0;
4931 
4932  if (!mwlsApprox) {
4933  // Create instance for moving least square approximation
4934  mwlsApprox = boost::make_shared<MWLSApprox>(mField);
4935  // Load mesh with stresses
4936  CHKERR mwlsApprox->loadMWLSMesh(mwlsApproxFile.c_str());
4937  MeshsetsManager *block_manager_ptr;
4938  CHKERR mField.getInterface(block_manager_ptr);
4939  CHKERR block_manager_ptr->getEntitiesByDimension(
4940  residualStressBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
4941  Tag th;
4942  if (mwlsApprox->mwlsMoab.tag_get_handle(mwlsStressTagName.c_str(), th) !=
4943  MB_SUCCESS) {
4944  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
4945  "Internal stress tag name %s cannot be found. Please "
4946  "provide the correct name.",
4947  mwlsStressTagName.substr(4).c_str());
4948  }
4949  CHKERR mwlsApprox->mwlsMoab.tag_get_handle(mwlsStressTagName.c_str(), th);
4950  CHKERR mwlsApprox->getValuesToNodes(th);
4951  } else {
4952  mwlsApprox->tetsInBlock.clear();
4953  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
4954  residualStressBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
4955  }
4956 
4957  auto mat_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
4958  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
4959  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
4960  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
4961  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
4962  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr(new MatrixDouble());
4963  fe_rhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
4964  "MESH_NODE_POSITIONS", mat_grad_pos_at_pts_ptr));
4965  fe_lhs->getOpPtrVector().push_back(new OpCalculateVectorFieldGradient<3, 3>(
4966  "MESH_NODE_POSITIONS", mat_grad_pos_at_pts_ptr));
4967 
4968  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr(new MatrixDouble());
4969  fe_rhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
4970  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr, fe_rhs->singularElement,
4971  fe_rhs->invSJac));
4972  fe_rhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4973  fe_rhs->singularElement, fe_rhs->detS, fe_rhs->invSJac));
4974 
4975  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
4976  fe_rhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSStressAtGaussPts(
4977  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox,
4978  mwlsStressTagName, false, false));
4979  else {
4980  fe_rhs->getOpPtrVector().push_back(
4982  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox));
4983  fe_rhs->getOpPtrVector().push_back(
4984  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
4985  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_rhs, mwlsApprox,
4986  mwlsStressTagName, false, false));
4987  }
4988 
4989  fe_rhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSSpatialStressRhs(
4990  mat_grad_pos_at_pts_ptr, mwlsApprox, false));
4991  fe_rhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSMaterialStressRhs(
4992  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
4993  &crackFrontNodes));
4994 
4995  fe_lhs->getOpPtrVector().push_back(new OpGetCrackFrontDataGradientAtGaussPts(
4996  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr, fe_lhs->singularElement,
4997  fe_lhs->invSJac));
4998  fe_lhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4999  fe_lhs->singularElement, fe_lhs->detS, fe_lhs->invSJac));
5000 
5001  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5002  fe_lhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSStressAtGaussPts(
5003  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox,
5004  mwlsStressTagName, true, false));
5005  else {
5006  fe_lhs->getOpPtrVector().push_back(
5008  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox));
5009  fe_lhs->getOpPtrVector().push_back(
5010  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
5011  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_lhs, mwlsApprox,
5012  mwlsStressTagName, true, false));
5013  }
5014 
5015  fe_lhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSSpatialStressLhs_DX(
5016  mat_grad_pos_at_pts_ptr, mwlsApprox));
5017  fe_lhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSMaterialStressLhs_DX(
5018  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
5019  &crackFrontNodes));
5020  fe_lhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSMaterialStressLhs_Dx(
5021  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
5022  &crackFrontNodes));
5023 
5025 }

◆ addPropagationFEInstancesToSnes()

MoFEMErrorCode FractureMechanics::CrackPropagation::addPropagationFEInstancesToSnes ( DM  dm,
boost::shared_ptr< FEMethod arc_method,
boost::shared_ptr< ArcLengthCtx arc_ctx,
const std::vector< int > &  surface_ids,
const int  verb = QUIET,
const bool  debug = false 
)

add finite element to SNES for crack propagation problem

Definition at line 6921 of file CrackPropagation.cpp.

6924  {
6925  boost::shared_ptr<FEMethod> null;
6927 
6928  // Assemble F_lambda force
6929  assembleFlambda = boost::shared_ptr<FEMethod>(
6930  new AssembleFlambda(arc_ctx, spatialDirichletBc));
6931  zeroFlambda = boost::shared_ptr<FEMethod>(new ZeroFLmabda(arc_ctx));
6932 
6933  if (mwlsApprox) {
6934  mwlsApprox->F_lambda = arc_ctx->F_lambda;
6936  mwlsApprox->arcLengthDof = arcLengthDof;
6937  }
6938 
6939  // Set up DM specific vectors and data
6940  spatialDirichletBc->mapZeroRows.clear();
6941 
6942  // Set-up F_lambda to elements & operator evalulating forces
6943  // Surface fores
6944  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
6945  surfaceForces->begin();
6946  fit != surfaceForces->end(); fit++) {
6947  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
6948  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
6949  for (; oit != hi_oit; oit++) {
6950  if (boost::typeindex::type_id_runtime(*oit) ==
6951  boost::typeindex::type_id<NeumannForcesSurface::OpNeumannForce>()) {
6952  dynamic_cast<NeumannForcesSurface::OpNeumannForce &>(*oit).F =
6953  arc_ctx->F_lambda;
6954  }
6955  }
6956  }
6957  // Surface pressure (ALE)
6958  if (isSurfaceForceAle) {
6959  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
6960  surfaceForceAle->begin();
6961  fit != surfaceForceAle->end(); fit++) {
6962 
6964  commonDataSurfaceForceAle->arcLengthDof = arcLengthDof;
6965 
6966  auto oit = fit->second->getLoopFeMatRhs().getOpPtrVector().begin();
6967  auto hi_oit = fit->second->getLoopFeMatRhs().getOpPtrVector().end();
6968  for (; oit != hi_oit; oit++) {
6969  if (boost::typeindex::type_id_runtime(*oit) ==
6970  boost::typeindex::type_id<
6972  dynamic_cast<
6974  .F = arc_ctx->F_lambda;
6975  }
6976  }
6977  }
6978  }
6979 
6980  // Surface pressure
6981  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
6982  surfacePressure->begin();
6983  fit != surfacePressure->end(); fit++) {
6984 
6985  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
6986  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
6987  for (; oit != hi_oit; oit++) {
6988  if (boost::typeindex::type_id_runtime(*oit) ==
6989  boost::typeindex::type_id<
6991  dynamic_cast<NeumannForcesSurface::OpNeumannPressure &>(*oit).F =
6992  arc_ctx->F_lambda;
6993  }
6994  if (boost::typeindex::type_id_runtime(*oit) ==
6995  boost::typeindex::type_id<
6997  dynamic_cast<NeumannForcesSurface::OpNeumannForceAnalytical &>(*oit).F =
6998  arc_ctx->F_lambda;
6999  }
7000  }
7001  }
7002  // Surface pressure (ALE)
7003  if (isPressureAle) {
7004  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
7005  surfacePressureAle->begin();
7006  fit != surfacePressureAle->end(); fit++) {
7007 
7010 
7011  auto oit = fit->second->getLoopFeMatRhs().getOpPtrVector().begin();
7012  auto hi_oit = fit->second->getLoopFeMatRhs().getOpPtrVector().end();
7013  for (; oit != hi_oit; oit++) {
7014  if (boost::typeindex::type_id_runtime(*oit) ==
7015  boost::typeindex::type_id<
7018  *oit)
7019  .F = arc_ctx->F_lambda;
7020  }
7021  }
7022  }
7023  }
7024  // Surface edge
7025  for (boost::ptr_map<string, EdgeForce>::iterator fit = edgeForces->begin();
7026  fit != edgeForces->end(); fit++) {
7027  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
7028  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
7029  for (; oit != hi_oit; oit++) {
7030  if (boost::typeindex::type_id_runtime(*oit) ==
7031  boost::typeindex::type_id<EdgeForce::OpEdgeForce>()) {
7032  dynamic_cast<EdgeForce::OpEdgeForce &>(*oit).F = arc_ctx->F_lambda;
7033  }
7034  }
7035  }
7036  // Nodal force
7037  for (boost::ptr_map<string, NodalForce>::iterator fit = nodalForces->begin();
7038  fit != nodalForces->end(); fit++) {
7039  auto oit = fit->second->getLoopFe().getOpPtrVector().begin();
7040  auto hi_oit = fit->second->getLoopFe().getOpPtrVector().end();
7041  for (; oit != hi_oit; oit++) {
7042  if (boost::typeindex::type_id_runtime(*oit) ==
7043  boost::typeindex::type_id<NodalForce::OpNodalForce>()) {
7044  dynamic_cast<NodalForce::OpNodalForce &>(*oit).F = arc_ctx->F_lambda;
7045  }
7046  }
7047  }
7048  // Set up DM specific vectors and data
7049  Vec front_f, tangent_front_f;
7050  CHKERR DMCreateGlobalVector(dm, &front_f);
7051  CHKERR VecDuplicate(front_f, &tangent_front_f);
7052  CHKERR VecSetOption(front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7053  CHKERR VecSetOption(tangent_front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7054 
7055  {
7056  if (smootherFe->smootherData.ownVectors) {
7057  if (smootherFe->smootherData.frontF != PETSC_NULL)
7058  CHKERR VecDestroy(&smootherFe->smootherData.frontF);
7059  if (smootherFe->smootherData.tangentFrontF != PETSC_NULL)
7060  CHKERR VecDestroy(&smootherFe->smootherData.tangentFrontF);
7061  }
7062  smootherFe->smootherData.frontF = front_f;
7063  smootherFe->smootherData.tangentFrontF = tangent_front_f;
7064  smootherFe->smootherData.ownVectors = true;
7065 
7066  if (tangentConstrains->ownVectors) {
7067  if (tangentConstrains->frontF != PETSC_NULL)
7068  CHKERR VecDestroy(&tangentConstrains->frontF);
7069  if (tangentConstrains->tangentFrontF != PETSC_NULL)
7070  CHKERR VecDestroy(&tangentConstrains->tangentFrontF);
7071  }
7072  tangentConstrains->frontF = front_f;
7073  tangentConstrains->tangentFrontF = tangent_front_f;
7074  tangentConstrains->ownVectors = false;
7075  }
7076 
7077  const MoFEM::Problem *problem_ptr;
7078  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
7079  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(
7080  problem_ptr->getName(), COL, feGriffithConstrainsDelta->deltaVec);
7081  CHKERR VecSetOption(feGriffithConstrainsDelta->deltaVec,
7082  VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7083  feGriffithConstrainsRhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
7084  feGriffithConstrainsLhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
7085 
7086  // Fix nodes
7087  CHKERR updateMaterialFixedNode(false, true, debug);
7088  dynamic_cast<AssembleFlambda *>(assembleFlambda.get())
7089  ->pushDirichletBC(fixMaterialEnts);
7090 
7091  // Add to SNES Jacobian
7092  // Lhs
7095  null);
7096  CHKERR DMMoFEMSNESSetJacobian(dm, "ELASTIC_NOT_ALE", feLhs, null, null);
7097  CHKERR DMMoFEMSNESSetJacobian(dm, "MATERIAL", feCouplingElasticLhs, null,
7098  null);
7099  CHKERR DMMoFEMSNESSetJacobian(dm, "MATERIAL", feCouplingMaterialLhs, null,
7100  null);
7101  CHKERR DMMoFEMSNESSetJacobian(dm, "SPRING", feSpringLhsPtr, null, null);
7102  CHKERR DMMoFEMSNESSetJacobian(dm, "CONTACT", feLhsSimpleContact, null, null);
7103  CHKERR DMMoFEMSNESSetJacobian(dm, "MORTAR_CONTACT", feLhsMortarContact, null,
7104  null);
7105  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
7106  null, null);
7107  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CONTACT",
7108  bothSidesContactConstrains, null, null);
7109  for (auto &m : surfaceConstrain) {
7110  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
7111  CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE", m.second->feLhsPtr, null,
7112  null);
7113  } else {
7114  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACK_SURFACE", m.second->feLhsPtr,
7115  null, null);
7116  }
7117  }
7118  for (auto &m : edgeConstrains)
7119  CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE", m.second->feLhsPtr, null, null);
7120 
7121  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
7122  feGriffithConstrainsDelta, null, null);
7123  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
7124  feGriffithConstrainsLhs, null, null);
7125  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
7126  tangentConstrains, null, null);
7127  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null, null);
7128  CHKERR DMMoFEMSNESSetJacobian(dm, "GRIFFITH_FORCE_ELEMENT",
7129  feGriffithForceLhs, null, null);
7133  CHKERR DMMoFEMSNESSetJacobian(dm, "ARC_LENGTH", arc_method, null, null);
7134 
7135  // Rhs
7138  null);
7139  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", null, zeroFlambda, null);
7140  CHKERR DMMoFEMSNESSetFunction(dm, "ELASTIC", feRhs, null, null);
7141  CHKERR DMMoFEMSNESSetFunction(dm, "SPRING", feSpringRhsPtr, null, null);
7142  CHKERR DMMoFEMSNESSetFunction(dm, "CONTACT", feRhsSimpleContact, null, null);
7143  CHKERR DMMoFEMSNESSetFunction(dm, "MORTAR_CONTACT", feRhsMortarContact, null,
7144  null);
7145  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
7146  null, null);
7147  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CONTACT",
7148  bothSidesContactConstrains, null, null);
7149  for (auto &m : surfaceConstrain) {
7150  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
7151  CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE", m.second->feRhsPtr, null,
7152  null);
7153  } else {
7154  CHKERR DMMoFEMSNESSetFunction(dm, "CRACK_SURFACE", m.second->feRhsPtr,
7155  null, null);
7156  }
7157  }
7158  for (auto &m : edgeConstrains) {
7159  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE", m.second->feRhsPtr, null, null);
7160  }
7161  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null, null);
7162  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
7163  feGriffithConstrainsDelta, null, null);
7164  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
7165  feGriffithConstrainsRhs, null, null);
7166  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
7167  tangentConstrains, null, null);
7168  CHKERR DMMoFEMSNESSetFunction(dm, "MATERIAL", feMaterialRhs, null, null);
7169  CHKERR DMMoFEMSNESSetFunction(dm, "GRIFFITH_FORCE_ELEMENT",
7170  feGriffithForceRhs, null, null);
7171  // Add force elements
7172  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
7173  surfaceForces->begin();
7174  fit != surfaceForces->end(); fit++) {
7176  dm, fit->first.c_str(),
7177  boost::shared_ptr<FEMethod>(surfaceForces, &fit->second->getLoopFe()),
7178  null, null);
7179  }
7180 
7181  // Add surface force elements (ALE)
7182  if (isSurfaceForceAle) {
7183  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
7184  surfaceForceAle->begin();
7185  fit != surfaceForceAle->end(); fit++) {
7187  dm, fit->first.c_str(),
7188  boost::shared_ptr<FEMethod>(surfaceForceAle,
7189  &fit->second->getLoopFeLhs()),
7190  null, null);
7191  if (!ignoreMaterialForce) {
7193  dm, fit->first.c_str(),
7194  boost::shared_ptr<FEMethod>(surfaceForceAle,
7195  &fit->second->getLoopFeMatRhs()),
7196  null, null);
7198  dm, fit->first.c_str(),
7199  boost::shared_ptr<FEMethod>(surfaceForceAle,
7200  &fit->second->getLoopFeMatLhs()),
7201  null, null);
7202  }
7203  }
7204  }
7205 
7206  // Add pressure elements
7207  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
7208  surfacePressure->begin();
7209  fit != surfacePressure->end(); fit++) {
7211  dm, fit->first.c_str(),
7212  boost::shared_ptr<FEMethod>(surfacePressure, &fit->second->getLoopFe()),
7213  null, null);
7214  }
7215 
7216  if (isPressureAle) {
7217  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
7218  surfacePressureAle->begin();
7219  fit != surfacePressureAle->end(); fit++) {
7221  dm, fit->first.c_str(),
7222  boost::shared_ptr<FEMethod>(surfacePressureAle,
7223  &fit->second->getLoopFeLhs()),
7224  null, null);
7226  dm, fit->first.c_str(),
7227  boost::shared_ptr<FEMethod>(surfacePressureAle,
7228  &fit->second->getLoopFeMatRhs()),
7229  null, null);
7231  dm, fit->first.c_str(),
7232  boost::shared_ptr<FEMethod>(surfacePressureAle,
7233  &fit->second->getLoopFeMatLhs()),
7234  null, null);
7235  }
7236  }
7237 
7238  if (areSpringsAle) {
7240  dm, "SPRING_ALE", feRhsSpringALEMaterial.get(), PETSC_NULL, PETSC_NULL);
7241  CHKERR DMMoFEMSNESSetJacobian(dm, "SPRING_ALE", feLhsSpringALE.get(), NULL,
7242  NULL);
7243  CHKERR DMMoFEMSNESSetJacobian(dm, "SPRING_ALE",
7244  feLhsSpringALEMaterial.get(), NULL, NULL);
7245  }
7246 
7247  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
7248  CHKERR DMMoFEMSNESSetFunction(dm, "SIMPLE_CONTACT_ALE",
7250  PETSC_NULL, PETSC_NULL);
7251  CHKERR DMMoFEMSNESSetJacobian(dm, "SIMPLE_CONTACT_ALE",
7252  feLhsSimpleContactALEMaterial.get(), NULL,
7253  NULL);
7254  CHKERR DMMoFEMSNESSetJacobian(dm, "SIMPLE_CONTACT_ALE",
7255  feLhsSimpleContactALE.get(), NULL, NULL);
7256  }
7257  for (boost::ptr_map<string, EdgeForce>::iterator fit = edgeForces->begin();
7258  fit != edgeForces->end(); fit++) {
7260  dm, fit->first.c_str(),
7261  boost::shared_ptr<FEMethod>(edgeForces, &fit->second->getLoopFe()),
7262  null, null);
7263  }
7264  for (boost::ptr_map<string, NodalForce>::iterator fit = nodalForces->begin();
7265  fit != nodalForces->end(); fit++) {
7267  dm, fit->first.c_str(),
7268  boost::shared_ptr<FEMethod>(nodalForces, &fit->second->getLoopFe()),
7269  null, null);
7270  }
7271  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", assembleFlambda, null, null);
7272  CHKERR DMMoFEMSNESSetFunction(dm, "ARC_LENGTH", arc_method, null, null);
7276 
7278 }

◆ addSmoothingFEInstancesToSnes()

MoFEMErrorCode FractureMechanics::CrackPropagation::addSmoothingFEInstancesToSnes ( DM  dm,
const bool  fix_crack_front,
const int  verb = QUIET,
const bool  debug = false 
)

add softening elements instances to SNES

Definition at line 6786 of file CrackPropagation.cpp.

6787  {
6788  boost::shared_ptr<FEMethod> null;
6790 
6791  // Set up DM specific vectors and data
6792  if (smootherFe->smootherData.ownVectors) {
6793  if (smootherFe->smootherData.frontF != PETSC_NULL)
6794  CHKERR VecDestroy(&smootherFe->smootherData.frontF);
6795  if (smootherFe->smootherData.tangentFrontF != PETSC_NULL)
6796  CHKERR VecDestroy(&smootherFe->smootherData.tangentFrontF);
6797  }
6798  smootherFe->smootherData.frontF = PETSC_NULL;
6799  smootherFe->smootherData.tangentFrontF = PETSC_NULL;
6800  smootherFe->smootherData.ownVectors = false;
6801 
6802  // Fix nodes
6803  CHKERR updateMaterialFixedNode(true, false, debug);
6804 
6805  if (debug && !mField.get_comm_rank()) {
6806  const FieldEntity_multiIndex *field_ents;
6807  CHKERR mField.get_field_ents(&field_ents);
6808  for (Range::iterator vit = crackFrontNodes.begin();
6809  vit != crackFrontNodes.end(); ++vit) {
6810  cerr << "Node " << endl;
6811  FieldEntity_multiIndex::index<Ent_mi_tag>::type::iterator eit, hi_eit;
6812  eit = field_ents->get<Ent_mi_tag>().lower_bound(*vit);
6813  hi_eit = field_ents->get<Ent_mi_tag>().upper_bound(*vit);
6814  for (; eit != hi_eit; ++eit) {
6815  cerr << **eit << endl;
6816  }
6817  }
6818  }
6819 
6820  SnesCtx *snes_ctx;
6821  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
6822  CHKERR snes_ctx->clearLoops();
6823 
6824  // Add to SNES Jacobian
6826  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
6827  null, null);
6828  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CONTACT",
6829  bothSidesContactConstrains, null, null);
6830  for (auto &m : surfaceConstrain) {
6831  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
6832  CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE", m.second->feLhsPtr, null,
6833  null);
6834  } else {
6835  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACK_SURFACE", m.second->feLhsPtr,
6836  null, null);
6837  }
6838  }
6839  for (auto &m : edgeConstrains) {
6840  CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE", m.second->feLhsPtr, null, null);
6841  }
6842  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null, null);
6844 
6845  // Add to SNES residuals
6847  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CRACK", bothSidesConstrains,
6848  null, null);
6849  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CONTACT",
6850  bothSidesContactConstrains, null, null);
6851  for (auto &m : surfaceConstrain) {
6852  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
6853  CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE", m.second->feRhsPtr, null,
6854  null);
6855  } else {
6856  CHKERR DMMoFEMSNESSetFunction(dm, "CRACK_SURFACE", m.second->feRhsPtr,
6857  null, null);
6858  }
6859  }
6860  for (auto &m : edgeConstrains) {
6861  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE", m.second->feRhsPtr, null, null);
6862  }
6863 
6864  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null, null);
6866  for (auto &m : edgeConstrains) {
6867  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE", null, null, m.second->feRhsPtr);
6868  }
6869 
6870  if (debug) {
6871  Vec q, f;
6872  CHKERR DMCreateGlobalVector(dm, &q);
6873  CHKERR VecDuplicate(q, &f);
6874  CHKERR DMoFEMMeshToLocalVector(dm, q, INSERT_VALUES, SCATTER_FORWARD);
6875  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
6876  Mat m;
6877  CHKERR DMCreateMatrix(dm, &m);
6878  SNES snes;
6879  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
6880  SnesCtx *snes_ctx;
6881  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
6882  CHKERR SNESSetFunction(snes, f, SnesRhs, snes_ctx);
6883  CHKERR SNESSetJacobian(snes, m, m, SnesMat, snes_ctx);
6884  CHKERR SnesMat(snes, q, m, m, snes_ctx);
6885  CHKERR SnesRhs(snes, q, f, snes_ctx);
6886  CHKERR SNESDestroy(&snes);
6887  // MatView(m,PETSC_VIEWER_DRAW_WORLD);
6888  MatView(m, PETSC_VIEWER_STDOUT_WORLD);
6889  std::string wait;
6890  std::cin >> wait;
6891  CHKERR VecDestroy(&q);
6892  CHKERR VecDestroy(&f);
6893  CHKERR MatDestroy(&m);
6894  }
6896 }

◆ analyticalStrainFunction()

FTensor::Tensor2_symmetric< double, 3 > FractureMechanics::CrackPropagation::analyticalStrainFunction ( FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, 3 > &  t_coords)
static

Definition at line 10030 of file CrackPropagation.cpp.

10034  {
10035  FTensor::Tensor2_symmetric<double, 3> t_thermal_strain;
10036  constexpr double alpha = 1.e-5;
10039  constexpr auto t_kd = FTensor::Kronecker_Delta_symmetric<int>();
10040  // FIXME put here formula from test
10041  double temp = 250.;
10042  double z = t_coords(2);
10043  if ((-10. < z && z < -1.) || std::abs(z + 1.) < 1e-15) {
10044  temp = 10. / 3. * (35. - 4. * z);
10045  }
10046  if ((-1. < z && z < 2.) || std::abs(z - 2.) < 1e-15) {
10047  temp = 10. / 3. * (34. - 5. * z);
10048  }
10049  if (2. < z && z < 10.) {
10050  temp = 5. / 4. * (30. + 17. * z);
10051  }
10052 
10053  t_thermal_strain(i, j) = alpha * (temp - 250.) * t_kd(i, j);
10054  return t_thermal_strain;
10055 }

◆ assembleCouplingForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::assembleCouplingForcesDM ( DM  dm,
const int  verb = QUIET,
const bool  debug = false 
)

assemble coupling element instances

Definition at line 6178 of file CrackPropagation.cpp.

6179  {
6181 
6182  if (!elasticFe) {
6183  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
6184  "Elastic element instance not created");
6185  }
6186  feCouplingElasticLhs = boost::make_shared<CrackFrontElement>(
6189  feCouplingElasticLhs->meshPositionsFieldName = "NONE";
6190  feCouplingElasticLhs->addToRule = 0;
6191 
6193  boost::shared_ptr<map<int, BlockData>> block_sets_ptr(
6194  elasticFe, &elasticFe->setOfBlocks);
6195 
6196  // Calculate spatial positions and gradients (of deformation) at integration
6197  // pts.
6198  // This operator takes into account singularity at crack front
6199  if (!onlyHooke) {
6200  feCouplingElasticLhs->getOpPtrVector().push_back(
6201  new OpGetCrackFrontCommonDataAtGaussPts(
6202  "SPATIAL_POSITION", elasticFe->commonData,
6203  feCouplingElasticLhs->singularElement,
6204  feCouplingElasticLhs->invSJac));
6205  // Calculate material positions and gradients at integration pts.
6206  feCouplingElasticLhs->getOpPtrVector().push_back(
6208  "MESH_NODE_POSITIONS", elasticFe->commonData));
6209  // Transform base functions to get singular base functions at crack front
6210  feCouplingElasticLhs->getOpPtrVector().push_back(
6211  new OpTransfromSingularBaseFunctions(
6212  feCouplingElasticLhs->singularElement, feCouplingElasticLhs->detS,
6213  feCouplingElasticLhs->invSJac));
6214  // Iterate over material blocks
6215  map<int, NonlinearElasticElement::BlockData>::iterator sit =
6216  elasticFe->setOfBlocks.begin();
6217  for (; sit != elasticFe->setOfBlocks.end(); sit++) {
6218  // Evaluate stress at integration pts
6219  feCouplingElasticLhs->getOpPtrVector().push_back(
6221  "SPATIAL_POSITION", sit->second, elasticFe->commonData,
6222  ELASTIC_TAG, true, true, false));
6223  // Assemble tangent matrix, derivative of spatial positions
6224  feCouplingElasticLhs->getOpPtrVector().push_back(
6226  "SPATIAL_POSITION", "SPATIAL_POSITION", sit->second,
6227  elasticFe->commonData));
6228  // Assemble tangent matrix, derivative of material positions
6229  feCouplingElasticLhs->getOpPtrVector().push_back(
6231  "SPATIAL_POSITION", "MESH_NODE_POSITIONS", sit->second,
6232  elasticFe->commonData));
6233  }
6234  } else {
6235  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
6236  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
6237  feCouplingElasticLhs->getOpPtrVector().push_back(
6239  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
6240 
6241  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr(new MatrixDouble());
6242  feCouplingElasticLhs->getOpPtrVector().push_back(
6243  new OpCalculateVectorFieldValues<3>("MESH_NODE_POSITIONS",
6244  mat_pos_at_pts_ptr));
6245 
6246  if (defaultMaterial == BONEHOOKE) {
6247  if (!mwlsApprox) {
6248  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
6249  "mwlsApprox not allocated");
6250  }
6251  // calculate position at integration points
6252  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
6253  mat_grad_pos_at_pts_ptr =
6254  boost::shared_ptr<MatrixDouble>(new MatrixDouble());
6255  feCouplingElasticLhs->getOpPtrVector().push_back(
6256  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
6257  mat_grad_pos_at_pts_ptr));
6258  feCouplingElasticLhs->getOpPtrVector().push_back(
6259  new OpGetCrackFrontDataGradientAtGaussPts(
6260  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
6261  feCouplingElasticLhs->singularElement,
6262  feCouplingElasticLhs->invSJac));
6263 
6264  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
6265  feCouplingElasticLhs->getOpPtrVector().push_back(
6266  new MWLSApprox::OpMWLSRhoAtGaussPts(
6267  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6269  else {
6270  feCouplingElasticLhs->getOpPtrVector().push_back(
6272  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6274  feCouplingElasticLhs->getOpPtrVector().push_back(
6275  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
6276  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6278  }
6279  feCouplingElasticLhs->getOpPtrVector().push_back(
6280  new HookeElement::OpCalculateStiffnessScaledByDensityField(
6281  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
6282  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
6283  rHo0));
6284  // Calculate spatial positions and gradients (of deformation) at
6285  // integration pts. This operator takes into account singularity at crack
6286  // front
6287  feCouplingElasticLhs->getOpPtrVector().push_back(
6288  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
6289  "SPATIAL_POSITION",
6290  data_hooke_element_at_pts));
6291  feCouplingElasticLhs->getOpPtrVector().push_back(
6292  new HookeElement::OpCalculateStress<1>("SPATIAL_POSITION",
6293  "SPATIAL_POSITION",
6294  data_hooke_element_at_pts));
6295  // Transform base functions to get singular base functions at crack front
6296  feCouplingElasticLhs->getOpPtrVector().push_back(
6297  new OpTransfromSingularBaseFunctions(
6298  feCouplingElasticLhs->singularElement, feCouplingElasticLhs->detS,
6299  feCouplingElasticLhs->invSJac));
6300  feCouplingElasticLhs->getOpPtrVector().push_back(
6301  new HookeElement::OpAleLhs_dx_dx<1>("SPATIAL_POSITION",
6302  "SPATIAL_POSITION",
6303  data_hooke_element_at_pts));
6304  feCouplingElasticLhs->getOpPtrVector().push_back(
6305  new HookeElement::OpAleLhs_dx_dX<1>("SPATIAL_POSITION",
6306  "MESH_NODE_POSITIONS",
6307  data_hooke_element_at_pts));
6308 
6309  feCouplingElasticLhs->getOpPtrVector().push_back(
6310  new HookeElement::OpAleLhsWithDensity_dx_dX(
6311  "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
6312  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6313  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0));
6314 
6315  boost::shared_ptr<MatrixDouble> mat_singular_disp_ptr = nullptr;
6316  if (addSingularity) {
6317 
6318  mat_singular_disp_ptr = boost::shared_ptr<MatrixDouble>(
6319  mwlsApprox, &mwlsApprox->singularInitialDisplacement);
6320 
6321  feCouplingElasticLhs->getOpPtrVector().push_back(
6322  new OpAleLhsWithDensitySingularElement_dx_dX(
6323  "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
6324  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6325  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0,
6326  mat_singular_disp_ptr));
6327  }
6328 
6329  } else {
6330 
6331  feCouplingElasticLhs->getOpPtrVector().push_back(
6332  new HookeElement::OpCalculateHomogeneousStiffness<0>(
6333  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
6334  data_hooke_element_at_pts));
6335  // Calculate spatial positions and gradients (of deformation) at
6336  // integration pts. This operator takes into account singularity at crack
6337  // front
6338  feCouplingElasticLhs->getOpPtrVector().push_back(
6339  new OpGetCrackFrontDataGradientAtGaussPts(
6340  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
6341  feCouplingElasticLhs->singularElement,
6342  feCouplingElasticLhs->invSJac));
6343  feCouplingElasticLhs->getOpPtrVector().push_back(
6344  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
6345  "SPATIAL_POSITION",
6346  data_hooke_element_at_pts));
6347  feCouplingElasticLhs->getOpPtrVector().push_back(
6348  new HookeElement::OpCalculateStress<0>("SPATIAL_POSITION",
6349  "SPATIAL_POSITION",
6350  data_hooke_element_at_pts));
6351  // Transform base functions to get singular base functions at crack front
6352  feCouplingElasticLhs->getOpPtrVector().push_back(
6353  new OpTransfromSingularBaseFunctions(
6354  feCouplingElasticLhs->singularElement, feCouplingElasticLhs->detS,
6355  feCouplingElasticLhs->invSJac));
6356  feCouplingElasticLhs->getOpPtrVector().push_back(
6357  new HookeElement::OpAleLhs_dx_dx<0>("SPATIAL_POSITION",
6358  "SPATIAL_POSITION",
6359  data_hooke_element_at_pts));
6360  feCouplingElasticLhs->getOpPtrVector().push_back(
6361  new HookeElement::OpAleLhs_dx_dX<0>("SPATIAL_POSITION",
6362  "MESH_NODE_POSITIONS",
6363  data_hooke_element_at_pts));
6364  }
6365  }
6366 
6367  if (!materialFe) {
6368  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
6369  "Material element instance not created");
6370  }
6371  feCouplingMaterialLhs = boost::make_shared<CrackFrontElement>(
6374  feCouplingMaterialLhs->meshPositionsFieldName = "NONE";
6375  feCouplingMaterialLhs->addToRule = 0;
6376 
6377  // calculate positions at integration points
6378  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr(new MatrixDouble());
6379  feCouplingMaterialLhs->getOpPtrVector().push_back(
6380  new OpCalculateVectorFieldValues<3>("MESH_NODE_POSITIONS",
6381  mat_pos_at_pts_ptr));
6382  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
6383  if (!onlyHooke && residualStressBlock != -1) {
6384  mat_grad_pos_at_pts_ptr =
6385  boost::shared_ptr<MatrixDouble>(new MatrixDouble());
6386  feCouplingMaterialLhs->getOpPtrVector().push_back(
6387  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
6388  mat_grad_pos_at_pts_ptr));
6389  }
6390  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr;
6391  if (!onlyHooke && residualStressBlock != -1) {
6392  space_grad_pos_at_pts_ptr =
6393  boost::shared_ptr<MatrixDouble>(new MatrixDouble());
6394  feCouplingMaterialLhs->getOpPtrVector().push_back(
6395  new OpGetCrackFrontDataGradientAtGaussPts(
6396  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr,
6397  feCouplingMaterialLhs->singularElement,
6398  feCouplingMaterialLhs->invSJac));
6399  }
6400 
6401  // assemble tangent matrix
6402  if (!onlyHooke) {
6403  feCouplingMaterialLhs->getOpPtrVector().push_back(
6404  new OpGetCrackFrontCommonDataAtGaussPts(
6405  "SPATIAL_POSITION", materialFe->commonData,
6406  feCouplingMaterialLhs->singularElement,
6407  feCouplingMaterialLhs->invSJac));
6408  feCouplingMaterialLhs->getOpPtrVector().push_back(
6410  "MESH_NODE_POSITIONS", materialFe->commonData));
6411  feCouplingMaterialLhs->getOpPtrVector().push_back(
6412  new OpTransfromSingularBaseFunctions(
6413  feCouplingMaterialLhs->singularElement, feCouplingMaterialLhs->detS,
6414  feCouplingMaterialLhs->invSJac));
6415  for (map<int, NonlinearElasticElement::BlockData>::iterator sit =
6416  materialFe->setOfBlocks.begin();
6417  sit != materialFe->setOfBlocks.end(); sit++) {
6418  feCouplingMaterialLhs->getOpPtrVector().push_back(
6420  "SPATIAL_POSITION", sit->second, materialFe->commonData,
6421  MATERIAL_TAG, true, true));
6422  feCouplingMaterialLhs->getOpPtrVector().push_back(
6424  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", sit->second,
6425  materialFe->commonData));
6426  feCouplingMaterialLhs->getOpPtrVector().push_back(
6428  "MESH_NODE_POSITIONS", "SPATIAL_POSITION", sit->second,
6429  materialFe->commonData));
6430  }
6431  } else {
6432 
6433  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
6434  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
6435  data_hooke_element_at_pts->forcesOnlyOnEntitiesRow = crackFrontNodes;
6436 
6437  feCouplingMaterialLhs->getOpPtrVector().push_back(
6439  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
6440  mat_grad_pos_at_pts_ptr = data_hooke_element_at_pts->HMat;
6441 
6442  if (defaultMaterial == BONEHOOKE) {
6443  if (!mwlsApprox) {
6444  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
6445  "mwlsApprox not allocated");
6446  }
6447 
6448  feCouplingMaterialLhs->getOpPtrVector().push_back(
6449  new OpGetCrackFrontDataGradientAtGaussPts(
6450  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
6451  feCouplingMaterialLhs->singularElement,
6452  feCouplingMaterialLhs->invSJac));
6453 
6454  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
6455  feCouplingMaterialLhs->getOpPtrVector().push_back(
6456  new MWLSApprox::OpMWLSRhoAtGaussPts(
6457  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6459  else {
6460  feCouplingMaterialLhs->getOpPtrVector().push_back(
6462  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6464  feCouplingMaterialLhs->getOpPtrVector().push_back(
6465  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
6466  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6468  }
6469 
6470  feCouplingMaterialLhs->getOpPtrVector().push_back(
6471  new HookeElement::OpCalculateStiffnessScaledByDensityField(
6472  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
6473  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
6474  rHo0));
6475  space_grad_pos_at_pts_ptr = data_hooke_element_at_pts->hMat;
6476  feCouplingMaterialLhs->getOpPtrVector().push_back(
6477  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
6478  "MESH_NODE_POSITIONS",
6479  data_hooke_element_at_pts));
6480  feCouplingMaterialLhs->getOpPtrVector().push_back(
6481  new HookeElement::OpCalculateStress<1>("MESH_NODE_POSITIONS",
6482  "MESH_NODE_POSITIONS",
6483  data_hooke_element_at_pts));
6484  feCouplingMaterialLhs->getOpPtrVector().push_back(
6485  new HookeElement::OpCalculateEnergy("MESH_NODE_POSITIONS",
6486  "MESH_NODE_POSITIONS",
6487  data_hooke_element_at_pts));
6488  feCouplingMaterialLhs->getOpPtrVector().push_back(
6489  new HookeElement::OpCalculateEshelbyStress(
6490  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
6491  data_hooke_element_at_pts));
6492  feCouplingMaterialLhs->getOpPtrVector().push_back(
6493  new OpTransfromSingularBaseFunctions(
6494  feCouplingMaterialLhs->singularElement,
6495  feCouplingMaterialLhs->detS, feCouplingMaterialLhs->invSJac));
6496  feCouplingMaterialLhs->getOpPtrVector().push_back(
6497  new HookeElement::OpAleLhs_dX_dX<1>("MESH_NODE_POSITIONS",
6498  "MESH_NODE_POSITIONS",
6499  data_hooke_element_at_pts));
6500  feCouplingMaterialLhs->getOpPtrVector().push_back(
6501  new HookeElement::OpAleLhsPre_dX_dx<1>("MESH_NODE_POSITIONS",
6502  "SPATIAL_POSITION",
6503  data_hooke_element_at_pts));
6504  feCouplingMaterialLhs->getOpPtrVector().push_back(
6505  new HookeElement::OpAleLhs_dX_dx("MESH_NODE_POSITIONS",
6506  "SPATIAL_POSITION",
6507  data_hooke_element_at_pts));
6508 
6509  feCouplingMaterialLhs->getOpPtrVector().push_back(
6510  new HookeElement::OpAleLhsWithDensity_dX_dX(
6511  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
6512  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6513  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0));
6514 
6515  boost::shared_ptr<MatrixDouble> mat_singular_disp_ptr = nullptr;
6516  if (addSingularity) {
6517 
6518  mat_singular_disp_ptr = boost::shared_ptr<MatrixDouble>(
6519  mwlsApprox, &mwlsApprox->singularInitialDisplacement);
6520 
6521  feCouplingMaterialLhs->getOpPtrVector().push_back(
6522  new OpAleLhsWithDensitySingularElement_dX_dX(
6523  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
6524  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6525  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0,
6526  mat_singular_disp_ptr));
6527  }
6528 
6529  feCouplingMaterialLhs->getOpPtrVector().push_back(
6530  new OpLhsBoneExplicitDerivariveWithHooke_dX(
6531  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6532  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
6533  mwlsApprox->singularInitialDisplacement, mwlsApprox->tetsInBlock,
6534  rHo0, nBone, &crackFrontNodes));
6535 
6536  feCouplingMaterialLhs->getOpPtrVector().push_back(
6537  new OpLhsBoneExplicitDerivariveWithHooke_dx(
6538  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
6539  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
6540  mwlsApprox->singularInitialDisplacement, mwlsApprox->tetsInBlock,
6541  rHo0, nBone, &crackFrontNodes));
6542 
6543  } else {
6544 
6545  feCouplingMaterialLhs->getOpPtrVector().push_back(
6546  new HookeElement::OpCalculateHomogeneousStiffness<0>(
6547  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
6548  data_hooke_element_at_pts));
6549  // Calculate spatial positions and gradients (of deformation) at
6550  // integration pts. This operator takes into account singularity at crack
6551  // front
6552  feCouplingMaterialLhs->getOpPtrVector().push_back(
6553  new OpGetCrackFrontDataGradientAtGaussPts(
6554  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
6555  feCouplingMaterialLhs->singularElement,
6556  feCouplingMaterialLhs->invSJac));
6557  space_grad_pos_at_pts_ptr = data_hooke_element_at_pts->hMat;
6558  feCouplingMaterialLhs->getOpPtrVector().push_back(
6559  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
6560  "MESH_NODE_POSITIONS",
6561  data_hooke_element_at_pts));
6562  feCouplingMaterialLhs->getOpPtrVector().push_back(
6563  new HookeElement::OpCalculateStress<0>("MESH_NODE_POSITIONS",
6564  "MESH_NODE_POSITIONS",
6565  data_hooke_element_at_pts));
6566  feCouplingMaterialLhs->getOpPtrVector().push_back(
6567  new HookeElement::OpCalculateEnergy("MESH_NODE_POSITIONS",
6568  "MESH_NODE_POSITIONS",
6569  data_hooke_element_at_pts));
6570  feCouplingMaterialLhs->getOpPtrVector().push_back(
6571  new HookeElement::OpCalculateEshelbyStress(
6572  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
6573  data_hooke_element_at_pts));
6574  feCouplingMaterialLhs->getOpPtrVector().push_back(
6575  new OpTransfromSingularBaseFunctions(
6576  feCouplingMaterialLhs->singularElement,
6577  feCouplingMaterialLhs->detS, feCouplingMaterialLhs->invSJac));
6578  feCouplingMaterialLhs->getOpPtrVector().push_back(
6579  new HookeElement::OpAleLhs_dX_dX<0>("MESH_NODE_POSITIONS",
6580  "MESH_NODE_POSITIONS",
6581  data_hooke_element_at_pts));
6582  feCouplingMaterialLhs->getOpPtrVector().push_back(
6583  new HookeElement::OpAleLhsPre_dX_dx<0>("MESH_NODE_POSITIONS",
6584  "SPATIAL_POSITION",
6585  data_hooke_element_at_pts));
6586  feCouplingMaterialLhs->getOpPtrVector().push_back(
6587  new HookeElement::OpAleLhs_dX_dx("MESH_NODE_POSITIONS",
6588  "SPATIAL_POSITION",
6589  data_hooke_element_at_pts));
6590  }
6591  }
6592 
6593  if (residualStressBlock != -1) {
6594  if (!mwlsApprox) {
6595  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
6596  "mwlsApprox not allocated");
6597  }
6598 
6599  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
6600  feCouplingMaterialLhs->getOpPtrVector().push_back(
6601  new MWLSApprox::OpMWLSStressAtGaussPts(
6602  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6604  else {
6605  feCouplingMaterialLhs->getOpPtrVector().push_back(
6607  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6609  feCouplingMaterialLhs->getOpPtrVector().push_back(
6610  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
6611  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
6613  }
6614 
6615  feCouplingMaterialLhs->getOpPtrVector().push_back(
6616  new MWLSApprox::OpMWLSSpatialStressLhs_DX(mat_grad_pos_at_pts_ptr,
6617  mwlsApprox));
6618  feCouplingMaterialLhs->getOpPtrVector().push_back(
6619  new MWLSApprox::OpMWLSMaterialStressLhs_DX(
6620  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
6621  &crackFrontNodes));
6622  feCouplingMaterialLhs->getOpPtrVector().push_back(
6623  new MWLSApprox::OpMWLSMaterialStressLhs_Dx(
6624  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
6625  &crackFrontNodes));
6626  }
6627 
6629 }

◆ assembleElasticDM() [1/2]

MoFEMErrorCode FractureMechanics::CrackPropagation::assembleElasticDM ( const int  verb = QUIET,
const bool  debug = false 
)

create elastic finite element instance for spatial assembly

Parameters
verbcompilation parameter determining the amount of information printed (not in use here)
debugflag for debugging
Returns
error code

Definition at line 4601 of file CrackPropagation.cpp.

4602  {
4604 
4606 
4608 }

◆ assembleElasticDM() [2/2]

MoFEMErrorCode FractureMechanics::CrackPropagation::assembleElasticDM ( const std::string  mwls_stress_tag_name,
const int  verb = QUIET,
const bool  debug = false 
)

create elastic finite element instance for spatial assembly

Parameters
mwls_stress_tag_nameName of internal stress tag
close_crackif true, crack surface is closed
verbcompilation parameter determining the amount of information printed (not in use here)
debugflag for debugging
Returns
error code

Rhs

Lhs

Definition at line 3795 of file CrackPropagation.cpp.

3796  {
3798 
3799  // Create elastic element data structure
3800  elasticFe = boost::make_shared<NonlinearElasticElement>(mField, ELASTIC_TAG);
3801 
3802  // Create elastic element finite element instance for residuals. Note that
3803  // this element approx. singularity at crack front.
3804  feRhs = boost::make_shared<CrackFrontElement>(
3807 
3808  // Create finite element instance for assembly of tangent matrix
3809  feLhs = boost::make_shared<CrackFrontElement>(
3812 
3813  // Arbitrary lagrangian formulation, mesh node positions are taken into
3814  // account by operators.
3815  feRhs->meshPositionsFieldName = "NONE";
3816  feLhs->meshPositionsFieldName = "NONE";
3817  feRhs->addToRule = 0;
3818  feLhs->addToRule = 0;
3819 
3820  // Create operators to calculate finite element matrices for elastic element
3821  onlyHooke = true;
3823  boost::shared_ptr<map<int, BlockData>> block_sets_ptr(
3824  elasticFe, &elasticFe->setOfBlocks);
3825  {
3827  mField, BLOCKSET | MAT_ELASTICSET, it)) {
3828 
3829  // Get data from block
3830  Mat_Elastic mydata;
3831  CHKERR it->getAttributeDataStructure(mydata);
3832  int id = it->getMeshsetId();
3833  EntityHandle meshset = it->getMeshset();
3834  CHKERR mField.get_moab().get_entities_by_type(
3835  meshset, MBTET, elasticFe->setOfBlocks[id].tEts, true);
3836  elasticFe->setOfBlocks[id].iD = id;
3837  elasticFe->setOfBlocks[id].E = mydata.data.Young;
3838  elasticFe->setOfBlocks[id].PoissonRatio = mydata.data.Poisson;
3839 
3840  // Print material properties of blocks after being read
3841  CHKERR PetscPrintf(PETSC_COMM_WORLD, "\nMaterial block %d \n", id);
3842  CHKERR PetscPrintf(PETSC_COMM_WORLD, "\tYoung's modulus %6.4e \n",
3843  mydata.data.Young);
3844  CHKERR PetscPrintf(PETSC_COMM_WORLD, "\tPoisson's ratio %6.4e \n\n",
3845  mydata.data.Poisson);
3846 
3847  // Set default material to elastic blocks. Create material instances
3848  switch (defaultMaterial) {
3849  case HOOKE:
3850  elasticFe->setOfBlocks[id].materialDoublePtr =
3851  boost::make_shared<Hooke<double>>();
3852  elasticFe->setOfBlocks[id].materialAdoublePtr =
3853  boost::make_shared<Hooke<adouble>>();
3854  break;
3855  case KIRCHHOFF:
3856  elasticFe->setOfBlocks[id].materialDoublePtr = boost::make_shared<
3858  double>>();
3859  elasticFe->setOfBlocks[id].materialAdoublePtr = boost::make_shared<
3861  adouble>>();
3862  onlyHooke = false;
3863  break;
3864  case NEOHOOKEAN:
3865  elasticFe->setOfBlocks[id].materialDoublePtr =
3866  boost::make_shared<NeoHookean<double>>();
3867  elasticFe->setOfBlocks[id].materialAdoublePtr =
3868  boost::make_shared<NeoHookean<adouble>>();
3869  onlyHooke = false;
3870  break;
3871  case BONEHOOKE:
3872  elasticFe->setOfBlocks[id].materialDoublePtr =
3873  boost::make_shared<Hooke<double>>();
3874  elasticFe->setOfBlocks[id].materialAdoublePtr =
3875  boost::make_shared<Hooke<adouble>>();
3876  break;
3877  default:
3878  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
3879  "Material type not yet implemented");
3880  break;
3881  }
3882  }
3883  if (onlyHookeFromOptions == PETSC_FALSE)
3884  onlyHooke = false;
3885 
3886  elasticFe->commonData.spatialPositions = "SPATIAL_POSITION";
3887  elasticFe->commonData.meshPositions = "MESH_NODE_POSITIONS";
3888 
3889  auto data_hooke_element_at_pts =
3890  boost::make_shared<HookeElement::DataAtIntegrationPts>();
3891 
3892  // calculate material positions at integration points
3893  auto mat_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
3894  feRhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
3895  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
3896  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
3897  if (residualStressBlock != -1 || densityMapBlock != -1) {
3898  mat_grad_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
3899  feRhs->getOpPtrVector().push_back(
3900  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
3901  mat_grad_pos_at_pts_ptr));
3902  }
3903 
3904  /// Rhs
3905  if (!onlyHooke) {
3906  // Calculate spatial positions and gradients (of deformation) at
3907  // integration pts. This operator takes into account singularity at crack
3908  // front
3909  feRhs->getOpPtrVector().push_back(new OpGetCrackFrontCommonDataAtGaussPts(
3910  "SPATIAL_POSITION", elasticFe->commonData, feRhs->singularElement,
3911  feRhs->invSJac));
3912  // Calculate material positions and gradients at integration pts.
3913  feRhs->getOpPtrVector().push_back(
3915  "MESH_NODE_POSITIONS", elasticFe->commonData));
3916  // Transfrom base functions to create singularity at crack front
3917  feRhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
3918  feRhs->singularElement, feRhs->detS, feRhs->invSJac));
3919  // Iterate over material blocks
3920  map<int, NonlinearElasticElement::BlockData>::iterator sit =
3921  elasticFe->setOfBlocks.begin();
3922  for (; sit != elasticFe->setOfBlocks.end(); sit++) {
3923  // Evaluate stress at integration pts.
3924  feRhs->getOpPtrVector().push_back(
3926  "SPATIAL_POSITION", sit->second, elasticFe->commonData,
3927  ELASTIC_TAG, false, true, false));
3928  // Assemble internal forces for right hand side
3929  feRhs->getOpPtrVector().push_back(
3931  "SPATIAL_POSITION", sit->second, elasticFe->commonData));
3932  }
3933  } else {
3934  feRhs->getOpPtrVector().push_back(
3936  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
3937  mat_grad_pos_at_pts_ptr = data_hooke_element_at_pts->HMat;
3938 
3939  // Evaluate density at integration points fro material like bone
3940  if (defaultMaterial == BONEHOOKE) {
3941  if (!mwlsApprox) {
3942  // Create instance for moving least square approximation
3943  mwlsApprox = boost::make_shared<MWLSApprox>(mField);
3944  // Load mesh with stresses
3945  CHKERR mwlsApprox->loadMWLSMesh(mwlsApproxFile.c_str());
3946  MeshsetsManager *block_manager_ptr;
3947  CHKERR mField.getInterface(block_manager_ptr);
3948  CHKERR block_manager_ptr->getEntitiesByDimension(
3949  densityMapBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
3950  Tag th_rho;
3951  if (mwlsApprox->mwlsMoab.tag_get_handle(mwlsRhoTagName.c_str(),
3952  th_rho) != MB_SUCCESS) {
3953  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
3954  "Density tag name %s cannot be found. Please "
3955  "provide the correct name.",
3956  mwlsRhoTagName.c_str());
3957  }
3958  CHKERR mwlsApprox->mwlsMoab.tag_get_handle(mwlsRhoTagName.c_str(),
3959  th_rho);
3960  CHKERR mwlsApprox->getValuesToNodes(th_rho);
3961  } else {
3962  mwlsApprox->tetsInBlock.clear();
3963  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
3964  densityMapBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
3965  }
3966  // Calculate spatial positions and gradients (of deformation) at
3967  // integration pts. This operator takes into account singularity at
3968  // crack front
3969  feRhs->getOpPtrVector().push_back(
3970  new OpGetCrackFrontDataGradientAtGaussPts(
3971  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
3972  feRhs->singularElement, feRhs->invSJac));
3973  // Evaluate density at integration pts.
3974  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
3975  feRhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSRhoAtGaussPts(
3976  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs, mwlsApprox,
3977  mwlsRhoTagName, true, true));
3978  else {
3979  feRhs->getOpPtrVector().push_back(
3981  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs,
3982  mwlsApprox));
3983  feRhs->getOpPtrVector().push_back(
3984  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
3985  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs,
3986  mwlsApprox, mwlsRhoTagName, true, false));
3987  }
3988 
3989  feRhs->getOpPtrVector().push_back(
3990  new HookeElement::OpCalculateStiffnessScaledByDensityField(
3991  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
3992  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
3993  rHo0));
3994  feRhs->getOpPtrVector().push_back(
3995  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
3996  "SPATIAL_POSITION",
3997  data_hooke_element_at_pts));
3998  feRhs->getOpPtrVector().push_back(
3999  new HookeElement::OpCalculateStress<1>("SPATIAL_POSITION",
4000  "SPATIAL_POSITION",
4001  data_hooke_element_at_pts));
4002  } else {
4003  feRhs->getOpPtrVector().push_back(
4004  new HookeElement::OpCalculateHomogeneousStiffness<0>(
4005  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
4006  data_hooke_element_at_pts));
4007  // Calculate spatial positions and gradients (of deformation) at
4008  // integration pts. This operator takes into account singularity at
4009  // crack front
4010  feRhs->getOpPtrVector().push_back(
4011  new OpGetCrackFrontDataGradientAtGaussPts(
4012  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
4013  feRhs->singularElement, feRhs->invSJac));
4014  feRhs->getOpPtrVector().push_back(
4015  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
4016  "SPATIAL_POSITION",
4017  data_hooke_element_at_pts));
4018  feRhs->getOpPtrVector().push_back(
4019  new HookeElement::OpCalculateStress<0>("SPATIAL_POSITION",
4020  "SPATIAL_POSITION",
4021  data_hooke_element_at_pts));
4022  }
4023 
4024  feRhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4025  feRhs->singularElement, feRhs->detS, feRhs->invSJac));
4026  feRhs->getOpPtrVector().push_back(new HookeElement::OpAleRhs_dx(
4027  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts));
4028  }
4029 
4030  // Add operators if internal stresses are present
4031  if (residualStressBlock != -1) {
4032  if (!mwlsApprox) {
4033  // Create instance for moving least square approximation
4034  mwlsApprox = boost::make_shared<MWLSApprox>(mField);
4035  // Load mesh with stresses
4036  CHKERR mwlsApprox->loadMWLSMesh(mwlsApproxFile.c_str());
4037  MeshsetsManager *block_manager_ptr;
4038  CHKERR mField.getInterface(block_manager_ptr);
4039  CHKERR block_manager_ptr->getEntitiesByDimension(
4040  residualStressBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
4041  Tag th;
4042  if (mwlsApprox->mwlsMoab.tag_get_handle(mwls_stress_tag_name.c_str(),
4043  th) != MB_SUCCESS) {
4044  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
4045  "Internal stress tag name %s cannot be found. Please "
4046  "provide the correct name.",
4047  mwls_stress_tag_name.substr(4).c_str());
4048  }
4049  }
4050 
4051  Tag th;
4052  if (mwlsApprox->mwlsMoab.tag_get_handle(mwls_stress_tag_name.c_str(),
4053  th) != MB_SUCCESS) {
4054  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
4055  "Internal stress tag name %s cannot be found. Please "
4056  "provide the correct name.",
4057  mwls_stress_tag_name.substr(4).c_str());
4058  }
4059  CHKERR mwlsApprox->mwlsMoab.tag_get_handle(mwls_stress_tag_name.c_str(),
4060  th);
4061  CHKERR mwlsApprox->getValuesToNodes(th);
4062 
4063  // Evaluate internal stresses at integration pts.
4064  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
4065  feRhs->getOpPtrVector().push_back(
4066  new MWLSApprox::OpMWLSStressAtGaussPts(
4067  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs, mwlsApprox,
4068  mwls_stress_tag_name, false));
4069  else {
4070  feRhs->getOpPtrVector().push_back(
4072  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs,
4073  mwlsApprox));
4074  feRhs->getOpPtrVector().push_back(
4075  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
4076  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feRhs, mwlsApprox,
4077  mwls_stress_tag_name, false));
4078  }
4079 
4080  // Assemble internall stresses forces
4081  feRhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSSpatialStressRhs(
4082  mat_grad_pos_at_pts_ptr, mwlsApprox));
4084  feRhs->getOpPtrVector().push_back(
4085  new HookeElement::OpAnalyticalInternalAleStrain_dx<0>(
4086  "SPATIAL_POSITION", data_hooke_element_at_pts,
4088  boost::shared_ptr<MatrixDouble>(
4089  mwlsApprox, &mwlsApprox->mwlsMaterialPositions)));
4090  }
4091  }
4092 
4093  /// Lhs
4094  if (!onlyHooke) {
4095  // Calculate spatial positions and gradients (of deformation) at
4096  // integration pts. This operator takes into account singularity at crack
4097  // front
4098  feLhs->getOpPtrVector().push_back(new OpGetCrackFrontCommonDataAtGaussPts(
4099  "SPATIAL_POSITION", elasticFe->commonData, feLhs->singularElement,
4100  feLhs->invSJac));
4101  // Calculate material positions and gradients at integration pts.
4102  feLhs->getOpPtrVector().push_back(
4104  "MESH_NODE_POSITIONS", elasticFe->commonData));
4105  // Transform base functions to get singular base functions at crack front
4106  feLhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4107  feLhs->singularElement, feLhs->detS, feLhs->invSJac));
4108  // Iterate over material blocks
4109  map<int, NonlinearElasticElement::BlockData>::iterator sit =
4110  elasticFe->setOfBlocks.begin();
4111  for (; sit != elasticFe->setOfBlocks.end(); sit++) {
4112  // Evaluate stress at integration pts
4113  feLhs->getOpPtrVector().push_back(
4115  "SPATIAL_POSITION", sit->second, elasticFe->commonData,
4116  ELASTIC_TAG, true, true, false));
4117  // Assemble tanget matrix, derivative of spatial poisotions
4118  feLhs->getOpPtrVector().push_back(
4120  "SPATIAL_POSITION", "SPATIAL_POSITION", sit->second,
4121  elasticFe->commonData));
4122  }
4123  } else {
4124  // calculate material positions at integration points
4125  feLhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
4126  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
4127  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
4128  if (residualStressBlock != -1 || densityMapBlock != -1) {
4129  mat_grad_pos_at_pts_ptr = boost::make_shared<MatrixDouble>();
4130  feLhs->getOpPtrVector().push_back(
4131  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
4132  mat_grad_pos_at_pts_ptr));
4133  }
4134 
4135  feLhs->getOpPtrVector().push_back(
4137  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
4138  mat_grad_pos_at_pts_ptr = data_hooke_element_at_pts->HMat;
4139 
4140  if (defaultMaterial == BONEHOOKE) {
4141  if (!mwlsApprox) {
4142  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
4143  "mwlsApprox not allocated");
4144  } else {
4145  mwlsApprox->tetsInBlock.clear();
4146  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
4147  densityMapBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock,
4148  true); // FIXME: do we still need this?
4149  }
4150 
4151  // Calculate spatial positions and gradients (of deformation) at
4152  // integration pts. This operator takes into account singularity at
4153  // crack front
4154  feLhs->getOpPtrVector().push_back(
4155  new OpGetCrackFrontDataGradientAtGaussPts(
4156  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
4157  feLhs->singularElement, feLhs->invSJac));
4158 
4159  // Evaluate density at integration pts.
4160  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
4161  feLhs->getOpPtrVector().push_back(new MWLSApprox::OpMWLSRhoAtGaussPts(
4162  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feLhs, mwlsApprox,
4163  mwlsRhoTagName, true, true));
4164  else {
4165  feLhs->getOpPtrVector().push_back(
4167  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feLhs,
4168  mwlsApprox));
4169  feLhs->getOpPtrVector().push_back(
4170  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
4171  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feLhs,
4172  mwlsApprox, mwlsRhoTagName, true, false));
4173  }
4174 
4175  feLhs->getOpPtrVector().push_back(
4176  new HookeElement::OpCalculateStiffnessScaledByDensityField(
4177  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
4178  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
4179  rHo0));
4180  feLhs->getOpPtrVector().push_back(
4181  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
4182  "SPATIAL_POSITION",
4183  data_hooke_element_at_pts));
4184  feLhs->getOpPtrVector().push_back(
4185  new HookeElement::OpCalculateStress<1>("SPATIAL_POSITION",
4186  "SPATIAL_POSITION",
4187  data_hooke_element_at_pts));
4188 
4189  feLhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4190  feLhs->singularElement, feLhs->detS, feLhs->invSJac));
4191  feLhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dx_dx<1>(
4192  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts));
4193 
4194  } else {
4195  feLhs->getOpPtrVector().push_back(
4196  new HookeElement::OpCalculateHomogeneousStiffness<0>(
4197  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
4198  data_hooke_element_at_pts));
4199  // Calculate spatial positions and gradients (of deformation) at
4200  // integration pts. This operator takes into account singularity at
4201  // crack front
4202  feLhs->getOpPtrVector().push_back(
4203  new OpGetCrackFrontDataGradientAtGaussPts(
4204  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
4205  feLhs->singularElement, feLhs->invSJac));
4206  feLhs->getOpPtrVector().push_back(
4207  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
4208  "SPATIAL_POSITION",
4209  data_hooke_element_at_pts));
4210  feLhs->getOpPtrVector().push_back(
4211  new HookeElement::OpCalculateStress<0>("SPATIAL_POSITION",
4212  "SPATIAL_POSITION",
4213  data_hooke_element_at_pts));
4214  // Transform base functions to get singular base functions at crack
4215  // front
4216  feLhs->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
4217  feLhs->singularElement, feLhs->detS, feLhs->invSJac));
4218  feLhs->getOpPtrVector().push_back(new HookeElement::OpAleLhs_dx_dx<0>(
4219  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts));
4220  }
4221  }
4222  }
4223 
4224  // Assembly forces
4225 
4226  surfaceForces =
4227  boost::make_shared<boost::ptr_map<string, NeumannForcesSurface>>();
4228  // Surface forces
4229  {
4230  string fe_name_str = "FORCE_FE";
4231  surfaceForces->insert(fe_name_str, new NeumannForcesSurface(mField));
4232  auto &nf = surfaceForces->at(fe_name_str);
4233  auto &fe = nf.getLoopFe();
4234 
4235  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe, false, false);
4236 
4238  it)) {
4239  CHKERR surfaceForces->at(fe_name_str)
4240  .addForce("SPATIAL_POSITION", PETSC_NULL, it->getMeshsetId(), true);
4241  }
4242 
4243  const string block_set_force_name("FORCE");
4244  // search for block named FORCE and add its attributes to FORCE_FE element
4246  if (it->getName().compare(0, block_set_force_name.length(),
4247  block_set_force_name) == 0) {
4248  CHKERR surfaceForces->at(fe_name_str)
4249  .addForce("SPATIAL_POSITION", PETSC_NULL, (it->getMeshsetId()),
4250  true, true);
4251  }
4252  }
4253  }
4254 
4255  if (isSurfaceForceAle) {
4256  surfaceForceAle =
4257  boost::make_shared<boost::ptr_map<string, NeumannForcesSurface>>();
4259  boost::make_shared<NeumannForcesSurface::DataAtIntegrationPts>();
4260  commonDataSurfaceForceAle->forcesOnlyOnEntitiesRow = crackFrontNodes;
4261 
4262  string fe_name_str = "FORCE_FE_ALE";
4263  surfaceForceAle->insert(fe_name_str, new NeumannForcesSurface(mField));
4264 
4265  auto &nf = surfaceForceAle->at(fe_name_str);
4266  auto &fe_lhs = nf.getLoopFeLhs();
4267  auto &fe_mat_rhs = nf.getLoopFeMatRhs();
4268  auto &fe_mat_lhs = nf.getLoopFeMatLhs();
4269 
4270  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_lhs, false, false);
4271  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_mat_rhs, false, false);
4272  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_mat_lhs, false, false);
4273 
4275  bit)) {
4276  CHKERR surfaceForceAle->at(fe_name_str)
4277  .addForceAle("SPATIAL_POSITION", "MESH_NODE_POSITIONS",
4278  commonDataSurfaceForceAle, "MATERIAL", PETSC_NULL,
4279  PETSC_NULL, bit->getMeshsetId(), true, false,
4281  }
4282 
4283  const string block_set_force_name("FORCE");
4284  // search for block named FORCE and add its attributes to FORCE_FE element
4286  if (it->getName().compare(0, block_set_force_name.length(),
4287  block_set_force_name) == 0) {
4288  CHKERR surfaceForceAle->at(fe_name_str)
4289  .addForceAle("SPATIAL_POSITION", "MESH_NODE_POSITIONS",
4290  commonDataSurfaceForceAle, "MATERIAL", PETSC_NULL,
4291  PETSC_NULL, it->getMeshsetId(), true, true,
4293  }
4294  }
4295  }
4296 
4297  // assemble surface pressure
4298  surfacePressure =
4299  boost::make_shared<boost::ptr_map<string, NeumannForcesSurface>>();
4300  {
4301  string fe_name_str = "PRESSURE_FE";
4302  surfacePressure->insert(fe_name_str, new NeumannForcesSurface(mField));
4303 
4304  auto &nf = surfacePressure->at(fe_name_str);
4305  auto &fe = nf.getLoopFe();
4306 
4307  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe, false, false);
4308 
4309  // iterate over sidestep where pressure is applied
4311  mField, SIDESET | PRESSURESET, it)) {
4312  CHKERR surfacePressure->at(fe_name_str)
4313  .addPressure("SPATIAL_POSITION", PETSC_NULL, it->getMeshsetId(),
4314  true);
4315  }
4316 
4317  const string block_set_pressure_name("PRESSURE");
4319  if (it->getName().compare(0, block_set_pressure_name.length(),
4320  block_set_pressure_name) == 0) {
4321  CHKERR surfacePressure->at(fe_name_str)
4322  .addPressure("SPATIAL_POSITION", PETSC_NULL, it->getMeshsetId(),
4323  true, true);
4324  }
4325  }
4326 
4327  const string block_set_linear_pressure_name("LINEAR_PRESSURE");
4329  if (it->getName().compare(0, block_set_linear_pressure_name.length(),
4330  block_set_linear_pressure_name) == 0) {
4331  CHKERR surfacePressure->at(fe_name_str)
4332  .addLinearPressure("SPATIAL_POSITION", PETSC_NULL,
4333  it->getMeshsetId(), true);
4334  }
4335  }
4336  }
4337  // assemble surface pressure (ALE)
4338  if (isPressureAle) {
4340  boost::make_shared<boost::ptr_map<string, NeumannForcesSurface>>();
4342  boost::make_shared<NeumannForcesSurface::DataAtIntegrationPts>();
4343  commonDataSurfacePressureAle->forcesOnlyOnEntitiesRow = crackFrontNodes;
4344  string fe_name_str = "PRESSURE_ALE";
4345  surfacePressureAle->insert(fe_name_str, new NeumannForcesSurface(mField));
4346 
4347  auto &nf = surfacePressureAle->at(fe_name_str);
4348  auto &fe_lhs = nf.getLoopFeLhs();
4349  auto &fe_mat_rhs = nf.getLoopFeMatRhs();
4350  auto &fe_mat_lhs = nf.getLoopFeMatLhs();
4351 
4352  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_lhs, false, false);
4353  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_mat_rhs, false, false);
4354  CHKERR addHOOpsFace3D("MESH_NODE_POSITIONS", fe_mat_lhs, false, false);
4355 
4356  // iterate over sidesets where pressure is applied
4358  mField, SIDESET | PRESSURESET, it)) {
4359  CHKERR surfacePressureAle->at(fe_name_str)
4360  .addPressureAle("SPATIAL_POSITION", "MESH_NODE_POSITIONS",
4361  commonDataSurfacePressureAle, "MATERIAL", PETSC_NULL,
4362  PETSC_NULL, it->getMeshsetId(), true);
4363  }
4364  }
4365 
4366  if (areSpringsAle) {
4368  boost::make_shared<FaceElementForcesAndSourcesCore>(mField);
4369 
4370  feLhsSpringALE =
4371  boost::make_shared<FaceElementForcesAndSourcesCore>(mField);
4373  boost::make_shared<FaceElementForcesAndSourcesCore>(mField);
4375  boost::make_shared<MetaSpringBC::DataAtIntegrationPtsSprings>(mField);
4376  commonDataSpringsALE->forcesOnlyOnEntitiesRow = crackFrontNodes;
4377 
4380  commonDataSpringsALE, "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
4381  "MATERIAL");
4382  }
4383 
4384  // Implementation of spring element
4385  // Create new instances of face elements for springs
4386  feSpringLhsPtr = boost::shared_ptr<FaceElementForcesAndSourcesCore>(
4388  feSpringRhsPtr = boost::shared_ptr<FaceElementForcesAndSourcesCore>(
4390 
4392  feSpringRhsPtr, "SPATIAL_POSITION",
4393  "MESH_NODE_POSITIONS");
4394 
4395  bool use_eigen_pos =
4396  solveEigenStressProblem && (mwls_stress_tag_name == mwlsStressTagName);
4397 
4398  bool use_eigen_pos_simple_contact =
4399  use_eigen_pos && useEigenPositionsSimpleContact;
4400 
4401  // Set contact operators
4403  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4405  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4407  boost::make_shared<SimpleContactProblem::CommonDataSimpleContact>(mField);
4408 
4409  if (!ignoreContact) {
4410  if (printContactState) {
4411  feRhsSimpleContact->contactStateVec =
4412  commonDataSimpleContact->gaussPtsStateVec;
4413  }
4414  contactProblem->setContactOperatorsRhs(
4415  feRhsSimpleContact, commonDataSimpleContact, "SPATIAL_POSITION",
4416  "LAMBDA_CONTACT", false, use_eigen_pos_simple_contact,
4417  "EIGEN_SPATIAL_POSITIONS");
4418  contactProblem->setMasterForceOperatorsRhs(
4419  feRhsSimpleContact, commonDataSimpleContact, "SPATIAL_POSITION",
4420  "LAMBDA_CONTACT", false, use_eigen_pos_simple_contact,
4421  "EIGEN_SPATIAL_POSITIONS");
4422 
4423  contactProblem->setContactOperatorsLhs(
4424  feLhsSimpleContact, commonDataSimpleContact, "SPATIAL_POSITION",
4425  "LAMBDA_CONTACT", false, use_eigen_pos_simple_contact,
4426  "EIGEN_SPATIAL_POSITIONS");
4427 
4428  contactProblem->setMasterForceOperatorsLhs(
4429  feLhsSimpleContact, commonDataSimpleContact, "SPATIAL_POSITION",
4430  "LAMBDA_CONTACT", false, use_eigen_pos_simple_contact,
4431  "EIGEN_SPATIAL_POSITIONS");
4432  }
4433 
4434  // Close crack constrains
4437  boost::shared_ptr<BothSurfaceConstrains>(new BothSurfaceConstrains(
4438  mField, "LAMBDA_CLOSE_CRACK", "SPATIAL_POSITION"));
4439  closeCrackConstrains->aLpha = 1;
4440  }
4441 
4442  // Set contact operators
4443 
4444  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
4445  // Set contact operators
4447  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4449  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4451  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4453  boost::make_shared<SimpleContactProblem::CommonDataSimpleContact>(
4454  mField);
4455 
4456  commonDataSimpleContactALE->forcesOnlyOnEntitiesRow = crackFrontNodes;
4457 
4458  contactProblem->setContactOperatorsRhsALEMaterial(
4460  "SPATIAL_POSITION", "MESH_NODE_POSITIONS", "LAMBDA_CONTACT",
4461  "MAT_CONTACT");
4462 
4463  contactProblem->setContactOperatorsLhsALEMaterial(
4465  "SPATIAL_POSITION", "MESH_NODE_POSITIONS", "LAMBDA_CONTACT",
4466  "MAT_CONTACT");
4467 
4468  contactProblem->setContactOperatorsLhsALE(
4470  "MESH_NODE_POSITIONS", "LAMBDA_CONTACT", use_eigen_pos_simple_contact,
4471  "EIGEN_SPATIAL_POSITIONS");
4472  }
4473 
4475  boost::make_shared<MortarContactProblem::MortarContactElement>(
4476  mField, contactSearchMultiIndexPtr, "SPATIAL_POSITION",
4477  "MESH_NODE_POSITIONS");
4479  boost::make_shared<MortarContactProblem::MortarContactElement>(
4480  mField, contactSearchMultiIndexPtr, "SPATIAL_POSITION",
4481  "MESH_NODE_POSITIONS");
4483  boost::make_shared<MortarContactProblem::CommonDataMortarContact>(mField);
4484 
4485  if (!ignoreContact) {
4486  if (printContactState) {
4487  feRhsMortarContact->contactStateVec =
4488  commonDataMortarContact->gaussPtsStateVec;
4489  }
4490  mortarContactProblemPtr->setContactOperatorsRhs(
4491  feRhsMortarContact, commonDataMortarContact, "SPATIAL_POSITION",
4492  "LAMBDA_CONTACT", false, use_eigen_pos, "EIGEN_SPATIAL_POSITIONS");
4493 
4494  mortarContactProblemPtr->setMasterForceOperatorsRhs(
4495  feRhsMortarContact, commonDataMortarContact, "SPATIAL_POSITION",
4496  "LAMBDA_CONTACT", false, use_eigen_pos, "EIGEN_SPATIAL_POSITIONS");
4497 
4498  mortarContactProblemPtr->setContactOperatorsLhs(
4499  feLhsMortarContact, commonDataMortarContact, "SPATIAL_POSITION",
4500  "LAMBDA_CONTACT", false, use_eigen_pos, "EIGEN_SPATIAL_POSITIONS");
4501 
4502  mortarContactProblemPtr->setMasterForceOperatorsLhs(
4503  feLhsMortarContact, commonDataMortarContact, "SPATIAL_POSITION",
4504  "LAMBDA_CONTACT", false, use_eigen_pos, "EIGEN_SPATIAL_POSITIONS");
4505  }
4506 
4507  // set contact post proc operators
4508 
4510  boost::make_shared<SimpleContactProblem::SimpleContactElement>(mField);
4511 
4513  boost::make_shared<MortarContactProblem::MortarContactElement>(
4514  mField, contactSearchMultiIndexPtr, "SPATIAL_POSITION",
4515  "MESH_NODE_POSITIONS");
4516 
4517  if (!ignoreContact) {
4518  CHKERR contactProblem->setContactOperatorsForPostProc(
4520  "SPATIAL_POSITION", "LAMBDA_CONTACT", contactPostProcMoab, false,
4521  use_eigen_pos_simple_contact, "EIGEN_SPATIAL_POSITIONS");
4522 
4523  CHKERR mortarContactProblemPtr->setContactOperatorsForPostProc(
4525  "SPATIAL_POSITION", "LAMBDA_CONTACT", contactPostProcMoab, false,
4526  use_eigen_pos, "EIGEN_SPATIAL_POSITIONS");
4527  }
4528 
4529  // assemble nodal forces
4530  nodalForces = boost::make_shared<boost::ptr_map<string, NodalForce>>();
4531  {
4532  string fe_name_str = "FORCE_FE";
4533  nodalForces->insert(fe_name_str, new NodalForce(mField));
4535  it)) {
4536  CHKERR nodalForces->at(fe_name_str)
4537  .addForce("SPATIAL_POSITION", PETSC_NULL, it->getMeshsetId(), false);
4538  }
4539  }
4540  // assemble edge forces
4541  edgeForces = boost::make_shared<boost::ptr_map<string, EdgeForce>>();
4542  {
4543  string fe_name_str = "FORCE_FE";
4544  edgeForces->insert(fe_name_str, new EdgeForce(mField));
4546  it)) {
4547  CHKERR edgeForces->at(fe_name_str)
4548  .addForce("SPATIAL_POSITION", PETSC_NULL, it->getMeshsetId(), false);
4549  }
4550  }
4551 
4552  // Kinematic boundary conditions
4553  spatialDirichletBc = boost::shared_ptr<DirichletSpatialPositionsBc>(
4554  new DirichletSpatialPositionsBc(mField, "SPATIAL_POSITION", PETSC_NULL,
4555  PETSC_NULL, PETSC_NULL));
4556 
4557 // Add boundary conditions for displacements given by analytical function
4558 #ifdef __ANALITICAL_DISPLACEMENT__
4559  analyticalDirichletBc = boost::shared_ptr<AnalyticalDirichletBC::DirichletBC>(
4561  mField, "SPATIAL_POSITION", PETSC_NULL, PETSC_NULL, PETSC_NULL));
4562 #endif //__ANALITICAL_DISPLACEMENT__
4563 
4564 // Analytical forces
4565 #ifdef __ANALITICAL_TRACTION__
4566  MeshsetsManager *meshset_manager_ptr;
4567  CHKERR mField.getInterface(meshset_manager_ptr);
4568  if (meshset_manager_ptr->checkMeshset("ANALITICAL_TRACTION")) {
4569  if (!analiticalSurfaceElement) {
4571  boost::make_shared<boost::ptr_map<string, NeumannForcesSurface>>();
4572  {
4573  string fe_name_str = "ANALITICAL_TRACTION";
4574  analiticalSurfaceElement->insert(fe_name_str,
4576  analiticalSurfaceElement->at(fe_name_str).fe.addToRule = 1;
4577  const CubitMeshSets *cubit_meshset_ptr;
4578  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_TRACTION",
4579  &cubit_meshset_ptr);
4580  Range faces;
4581  CHKERR meshset_manager_ptr->getEntitiesByDimension(
4582  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, faces, true);
4583  analiticalSurfaceElement->at(fe_name_str)
4584  .analyticalForceOp.push_back(new AnalyticalForces());
4585  analiticalSurfaceElement->at(fe_name_str)
4586  .fe.getOpPtrVector()
4587  .push_back(new OpAnalyticalSpatialTraction(
4590  "SPATIAL_POSITION", faces,
4591  analiticalSurfaceElement->at(fe_name_str).methodsOp,
4592  analiticalSurfaceElement->at(fe_name_str).analyticalForceOp));
4593  }
4594  }
4595  }
4596 #endif //__ANALITICAL_TRACTION__
4597 
4599 }

◆ assembleMaterialForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::assembleMaterialForcesDM ( DM  dm,
const int  verb = QUIET,
const bool  debug = false 
)

create material element instance

Operators to assemble rhs

Definition at line 5531 of file CrackPropagation.cpp.

5532  {
5534  if (!elasticFe)
5535  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
5536  "Elastic element instance not created");
5537 
5538  // Create element
5539  materialFe = boost::shared_ptr<NonlinearElasticElement>(
5541 
5542  // Create material data blocks
5543  for (std::map<int, NonlinearElasticElement::BlockData>::iterator sit =
5544  elasticFe->setOfBlocks.begin();
5545  sit != elasticFe->setOfBlocks.end(); sit++) {
5546  materialFe->setOfBlocks[sit->first] = sit->second;
5547  materialFe->setOfBlocks[sit->first].forcesOnlyOnEntitiesRow =
5549  }
5550  materialFe->commonData.spatialPositions = "SPATIAL_POSITION";
5551  materialFe->commonData.meshPositions = "MESH_NODE_POSITIONS";
5552 
5553  // create finite element instances for the right hand side and left hand side
5554  feMaterialRhs = boost::make_shared<CrackFrontElement>(
5557  feMaterialLhs = boost::make_shared<CrackFrontElement>(
5560  feMaterialRhs->meshPositionsFieldName = "NONE";
5561  feMaterialLhs->meshPositionsFieldName = "NONE";
5562  feMaterialRhs->addToRule = 0;
5563  feMaterialLhs->addToRule = 0;
5564 
5566  boost::shared_ptr<map<int, BlockData>> block_sets_ptr(
5567  elasticFe, &elasticFe->setOfBlocks);
5568  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
5569  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
5570  data_hooke_element_at_pts->forcesOnlyOnEntitiesRow = crackFrontNodes;
5571 
5572  // calculate position at integration points
5573  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr(new MatrixDouble());
5574  feMaterialRhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5575  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
5576  feMaterialLhs->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
5577  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
5578  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
5579  if (!onlyHooke && (residualStressBlock != -1 || densityMapBlock != -1)) {
5580  mat_grad_pos_at_pts_ptr =
5581  boost::shared_ptr<MatrixDouble>(new MatrixDouble());
5582  feMaterialRhs->getOpPtrVector().push_back(
5583  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
5584  mat_grad_pos_at_pts_ptr));
5585  feMaterialLhs->getOpPtrVector().push_back(
5586  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS",
5587  mat_grad_pos_at_pts_ptr));
5588  }
5589  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr;
5590  if (!onlyHooke && (residualStressBlock != -1 || densityMapBlock != -1)) {
5591  space_grad_pos_at_pts_ptr =
5592  boost::shared_ptr<MatrixDouble>(new MatrixDouble());
5593  feMaterialRhs->getOpPtrVector().push_back(
5594  new OpGetCrackFrontDataGradientAtGaussPts(
5595  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr,
5596  feMaterialRhs->singularElement, feMaterialRhs->invSJac));
5597  feMaterialLhs->getOpPtrVector().push_back(
5598  new OpGetCrackFrontDataGradientAtGaussPts(
5599  "SPATIAL_POSITION", space_grad_pos_at_pts_ptr,
5600  feMaterialLhs->singularElement, feMaterialLhs->invSJac));
5601  }
5602 
5603  /// Operators to assemble rhs
5604  if (!onlyHooke) {
5605  feMaterialRhs->getOpPtrVector().push_back(
5606  new OpGetCrackFrontCommonDataAtGaussPts(
5607  "SPATIAL_POSITION", materialFe->commonData,
5608  feMaterialRhs->singularElement, feMaterialRhs->invSJac));
5609  feMaterialRhs->getOpPtrVector().push_back(
5611  "MESH_NODE_POSITIONS", materialFe->commonData));
5612 
5613  feMaterialRhs->getOpPtrVector().push_back(
5614  new OpTransfromSingularBaseFunctions(feMaterialRhs->singularElement,
5615  feMaterialRhs->detS,
5616  feMaterialRhs->invSJac));
5617  for (map<int, NonlinearElasticElement::BlockData>::iterator sit =
5618  materialFe->setOfBlocks.begin();
5619  sit != materialFe->setOfBlocks.end(); sit++) {
5620  feMaterialRhs->getOpPtrVector().push_back(
5622  "SPATIAL_POSITION", sit->second, materialFe->commonData,
5623  MATERIAL_TAG, false, true));
5624  feMaterialRhs->getOpPtrVector().push_back(
5626  "MESH_NODE_POSITIONS", sit->second, materialFe->commonData));
5627  }
5628 
5629  } else { // HOOKE
5630 
5631  feMaterialRhs->getOpPtrVector().push_back(
5633  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
5634  mat_grad_pos_at_pts_ptr = data_hooke_element_at_pts->HMat;
5635 
5636  feMaterialRhs->getOpPtrVector().push_back(
5637  new OpGetCrackFrontDataGradientAtGaussPts(
5638  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
5639  feMaterialRhs->singularElement, feMaterialRhs->invSJac));
5640  space_grad_pos_at_pts_ptr = data_hooke_element_at_pts->hMat;
5641 
5642  if (defaultMaterial == BONEHOOKE) {
5643  if (!mwlsApprox) {
5644  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
5645  "mwlsApprox not allocated");
5646  }
5647 
5648  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5649  feMaterialRhs->getOpPtrVector().push_back(
5650  new MWLSApprox::OpMWLSRhoAtGaussPts(
5651  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5652  mwlsApprox, mwlsRhoTagName, true, true));
5653  else {
5654  feMaterialRhs->getOpPtrVector().push_back(
5656  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5657  mwlsApprox));
5658  feMaterialRhs->getOpPtrVector().push_back(
5659  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
5660  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5661  mwlsApprox, mwlsRhoTagName, true, false));
5662  }
5663 
5664  feMaterialRhs->getOpPtrVector().push_back(
5665  new HookeElement::OpCalculateStiffnessScaledByDensityField(
5666  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5667  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
5668  rHo0));
5669  feMaterialRhs->getOpPtrVector().push_back(
5670  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
5671  "MESH_NODE_POSITIONS",
5672  data_hooke_element_at_pts));
5673  feMaterialRhs->getOpPtrVector().push_back(
5674  new HookeElement::OpCalculateStress<1>("MESH_NODE_POSITIONS",
5675  "MESH_NODE_POSITIONS",
5676  data_hooke_element_at_pts));
5677 
5678  } else {
5679  feMaterialRhs->getOpPtrVector().push_back(
5680  new HookeElement::OpCalculateHomogeneousStiffness<0>(
5681  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5682  data_hooke_element_at_pts));
5683  feMaterialRhs->getOpPtrVector().push_back(
5684  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
5685  "MESH_NODE_POSITIONS",
5686  data_hooke_element_at_pts));
5687  feMaterialRhs->getOpPtrVector().push_back(
5688  new HookeElement::OpCalculateStress<0>("MESH_NODE_POSITIONS",
5689  "MESH_NODE_POSITIONS",
5690  data_hooke_element_at_pts));
5691  }
5692  feMaterialRhs->getOpPtrVector().push_back(
5693  new HookeElement::OpCalculateEnergy("MESH_NODE_POSITIONS",
5694  "MESH_NODE_POSITIONS",
5695  data_hooke_element_at_pts));
5696 
5697  feMaterialRhs->getOpPtrVector().push_back(
5698  new HookeElement::OpCalculateEshelbyStress("MESH_NODE_POSITIONS",
5699  "MESH_NODE_POSITIONS",
5700  data_hooke_element_at_pts));
5701  feMaterialRhs->getOpPtrVector().push_back(
5702  new OpTransfromSingularBaseFunctions(feMaterialRhs->singularElement,
5703  feMaterialRhs->detS,
5704  feMaterialRhs->invSJac));
5705 
5706  feMaterialRhs->getOpPtrVector().push_back(new HookeElement::OpAleRhs_dX(
5707  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5708  data_hooke_element_at_pts));
5709 
5710  if (defaultMaterial == BONEHOOKE) {
5711  feMaterialRhs->getOpPtrVector().push_back(
5712  new OpRhsBoneExplicitDerivariveWithHooke(
5713  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5714  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->tetsInBlock, rHo0,
5715  nBone, &crackFrontNodes));
5716  }
5717  }
5718 
5719  if (residualStressBlock != -1) {
5720  if (!mwlsApprox) {
5721  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
5722  "mwlsApprox not allocated");
5723  } else {
5724  mwlsApprox->tetsInBlock.clear();
5725  CHKERR mField.getInterface<MeshsetsManager>()->getEntitiesByDimension(
5726  residualStressBlock, BLOCKSET, 3, mwlsApprox->tetsInBlock, true);
5727  }
5728 
5729  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5730  feMaterialRhs->getOpPtrVector().push_back(
5731  new MWLSApprox::OpMWLSStressAtGaussPts(
5732  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5733  mwlsApprox, mwlsStressTagName, false));
5734  else {
5735  feMaterialRhs->getOpPtrVector().push_back(
5737  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5738  mwlsApprox));
5739  feMaterialRhs->getOpPtrVector().push_back(
5740  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
5741  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialRhs,
5742  mwlsApprox, mwlsStressTagName, false));
5743  }
5744 
5745  feMaterialRhs->getOpPtrVector().push_back(
5746  new MWLSApprox::OpMWLSMaterialStressRhs(space_grad_pos_at_pts_ptr,
5747  mat_grad_pos_at_pts_ptr,
5750  feMaterialRhs->getOpPtrVector().push_back(
5751  new HookeElement::OpAnalyticalInternalAleStrain_dX<0>(
5752  "MESH_NODE_POSITIONS", data_hooke_element_at_pts,
5754  boost::shared_ptr<MatrixDouble>(
5755  mwlsApprox, &mwlsApprox->mwlsMaterialPositions)));
5756  }
5757  }
5758 
5759 // Analytical forces
5760 #ifdef __ANALITICAL_TRACTION__
5761  {
5764  boost::shared_ptr<NeumannForcesSurface::MyTriangleFE>(
5765  // analiticalSurfaceElement,
5767  feMaterialAnaliticalTraction->addToRule = 1;
5768  MeshsetsManager *meshset_manager_ptr;
5769  CHKERR mField.getInterface(meshset_manager_ptr);
5770  if (meshset_manager_ptr->checkMeshset("ANALITICAL_TRACTION")) {
5771  const CubitMeshSets *cubit_meshset_ptr;
5772  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_TRACTION",
5773  &cubit_meshset_ptr);
5774  Range faces;
5775  CHKERR meshset_manager_ptr->getEntitiesByDimension(
5776  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, faces, true);
5777  feMaterialAnaliticalTraction->getOpPtrVector().push_back(
5778  new OpAnalyticalMaterialTraction(
5781  "MESH_NODE_POSITIONS", faces,
5782  analiticalSurfaceElement->at("ANALITICAL_TRACTION").methodsOp,
5783  analiticalSurfaceElement->at("ANALITICAL_TRACTION")
5784  .analyticalForceOp,
5785  &crackFrontNodes));
5786  }
5787  }
5788  }
5789 #endif //__ANALITICAL_TRACTION__
5790 
5791  // assemble tangent matrix
5792  if (!onlyHooke) {
5793  feMaterialLhs->getOpPtrVector().push_back(
5794  new OpGetCrackFrontCommonDataAtGaussPts(
5795  "SPATIAL_POSITION", materialFe->commonData,
5796  feMaterialLhs->singularElement, feMaterialLhs->invSJac));
5797  feMaterialLhs->getOpPtrVector().push_back(
5799  "MESH_NODE_POSITIONS", materialFe->commonData));
5800  feMaterialLhs->getOpPtrVector().push_back(
5801  new OpTransfromSingularBaseFunctions(
5802  feMaterialLhs->singularElement, feMaterialLhs->detS,
5804  ->invSJac //,AINSWORTH_LOBATTO_BASE//,AINSWORTH_LEGENDRE_BASE
5805  ));
5806  for (auto sit = materialFe->setOfBlocks.begin();
5807  sit != materialFe->setOfBlocks.end(); sit++) {
5808  feMaterialLhs->getOpPtrVector().push_back(
5810  "SPATIAL_POSITION", sit->second, materialFe->commonData,
5811  MATERIAL_TAG, true, true));
5812  feMaterialLhs->getOpPtrVector().push_back(
5814  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS", sit->second,
5815  materialFe->commonData));
5816  }
5817  } else { // HOOKE
5818  feMaterialLhs->getOpPtrVector().push_back(
5820  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
5821  mat_grad_pos_at_pts_ptr = data_hooke_element_at_pts->HMat;
5822  feMaterialLhs->getOpPtrVector().push_back(
5823  new OpGetCrackFrontDataGradientAtGaussPts(
5824  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
5825  feMaterialLhs->singularElement, feMaterialLhs->invSJac));
5826  space_grad_pos_at_pts_ptr = data_hooke_element_at_pts->hMat;
5827 
5828  if (defaultMaterial == BONEHOOKE) {
5829  if (!mwlsApprox) {
5830  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
5831  "mwlsApprox not allocated");
5832  }
5833 
5834  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5835  feMaterialLhs->getOpPtrVector().push_back(
5836  new MWLSApprox::OpMWLSRhoAtGaussPts(
5837  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5838  mwlsApprox, mwlsRhoTagName, true, true));
5839  else {
5840  feMaterialLhs->getOpPtrVector().push_back(
5842  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5843  mwlsApprox));
5844  feMaterialLhs->getOpPtrVector().push_back(
5845  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
5846  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5847  mwlsApprox, mwlsRhoTagName, true, true));
5848  }
5849 
5850  feMaterialLhs->getOpPtrVector().push_back(
5851  new HookeElement::OpCalculateStiffnessScaledByDensityField(
5852  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5853  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
5854  rHo0));
5855 
5856  feMaterialLhs->getOpPtrVector().push_back(
5857  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
5858  "MESH_NODE_POSITIONS",
5859  data_hooke_element_at_pts));
5860 
5861  feMaterialLhs->getOpPtrVector().push_back(
5862  new HookeElement::OpCalculateStress<1>("MESH_NODE_POSITIONS",
5863  "MESH_NODE_POSITIONS",
5864  data_hooke_element_at_pts));
5865 
5866  feMaterialLhs->getOpPtrVector().push_back(
5867  new HookeElement::OpCalculateEnergy("MESH_NODE_POSITIONS",
5868  "MESH_NODE_POSITIONS",
5869  data_hooke_element_at_pts));
5870  feMaterialLhs->getOpPtrVector().push_back(
5871  new HookeElement::OpCalculateEshelbyStress(
5872  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5873  data_hooke_element_at_pts));
5874  feMaterialLhs->getOpPtrVector().push_back(
5875  new OpTransfromSingularBaseFunctions(feMaterialLhs->singularElement,
5876  feMaterialLhs->detS,
5877  feMaterialLhs->invSJac));
5878  feMaterialLhs->getOpPtrVector().push_back(
5879  new HookeElement::OpAleLhs_dX_dX<1>("MESH_NODE_POSITIONS",
5880  "MESH_NODE_POSITIONS",
5881  data_hooke_element_at_pts));
5882 
5883  feMaterialLhs->getOpPtrVector().push_back(
5884  new HookeElement::OpAleLhsWithDensity_dX_dX(
5885  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5886  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5887  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0));
5888 
5889  boost::shared_ptr<MatrixDouble> mat_singular_disp_ptr = nullptr;
5890  if (addSingularity) {
5891 
5892  mat_singular_disp_ptr = boost::shared_ptr<MatrixDouble>(
5893  mwlsApprox, &mwlsApprox->singularInitialDisplacement);
5894 
5895  feMaterialLhs->getOpPtrVector().push_back(
5896  new OpAleLhsWithDensitySingularElement_dX_dX(
5897  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5898  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5899  mwlsApprox->diffRhoAtGaussPts, nBone, rHo0,
5900  mat_singular_disp_ptr));
5901  }
5902 
5903  feMaterialLhs->getOpPtrVector().push_back(
5904  new OpLhsBoneExplicitDerivariveWithHooke_dX(
5905  *data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts,
5906  mwlsApprox->diffRhoAtGaussPts, mwlsApprox->diffDiffRhoAtGaussPts,
5907  mwlsApprox->singularInitialDisplacement, mwlsApprox->tetsInBlock,
5908  rHo0, nBone, &crackFrontNodes));
5909 
5910  } else {
5911  feMaterialLhs->getOpPtrVector().push_back(
5912  new HookeElement::OpCalculateHomogeneousStiffness<0>(
5913  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
5914  data_hooke_element_at_pts));
5915 
5916  feMaterialLhs->getOpPtrVector().push_back(
5917  new HookeElement::OpCalculateStrainAle("MESH_NODE_POSITIONS",
5918  "MESH_NODE_POSITIONS",
5919  data_hooke_element_at_pts));
5920  feMaterialLhs->getOpPtrVector().push_back(
5921  new HookeElement::OpCalculateStress<0>("MESH_NODE_POSITIONS",
5922  "MESH_NODE_POSITIONS",
5923  data_hooke_element_at_pts));
5924 
5925  feMaterialLhs->getOpPtrVector().push_back(
5926  new HookeElement::OpCalculateEnergy("MESH_NODE_POSITIONS",
5927  "MESH_NODE_POSITIONS",
5928  data_hooke_element_at_pts));
5929  feMaterialLhs->getOpPtrVector().push_back(
5930  new HookeElement::OpCalculateEshelbyStress(
5931  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
5932  data_hooke_element_at_pts));
5933  feMaterialLhs->getOpPtrVector().push_back(
5934  new OpTransfromSingularBaseFunctions(feMaterialLhs->singularElement,
5935  feMaterialLhs->detS,
5936  feMaterialLhs->invSJac));
5937  feMaterialLhs->getOpPtrVector().push_back(
5938  new HookeElement::OpAleLhs_dX_dX<0>("MESH_NODE_POSITIONS",
5939  "MESH_NODE_POSITIONS",
5940  data_hooke_element_at_pts));
5941  }
5942  }
5943  if (residualStressBlock != -1) {
5944  if (!mwlsApprox) {
5945  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
5946  "mwlsApprox not allocated");
5947  }
5948 
5949  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
5950  feMaterialLhs->getOpPtrVector().push_back(
5951  new MWLSApprox::OpMWLSStressAtGaussPts(
5952  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5953  mwlsApprox, mwlsStressTagName, true));
5954  else {
5955  feMaterialLhs->getOpPtrVector().push_back(
5957  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5958  mwlsApprox));
5959  feMaterialLhs->getOpPtrVector().push_back(
5960  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
5961  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feMaterialLhs,
5962  mwlsApprox, mwlsStressTagName, false));
5963  }
5964 
5965  feMaterialLhs->getOpPtrVector().push_back(
5966  new MWLSApprox::OpMWLSMaterialStressLhs_DX(
5967  space_grad_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, mwlsApprox,
5968  &crackFrontNodes));
5969  }
5970 
5972 }

◆ assembleSmootherForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::assembleSmootherForcesDM ( DM  dm,
const std::vector< int >  ids,
const int  verb = QUIET,
const bool  debug = false 
)

create smoothing element instance

Definition at line 5975 of file CrackPropagation.cpp.

5976  {
5978  if (!elasticFe)
5979  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
5980  "Elastic element instance not created");
5981 
5982  smootherFe = boost::make_shared<Smoother>(mField);
5983  volumeLengthAdouble = boost::shared_ptr<VolumeLengthQuality<adouble>>(
5986  smootherGamma));
5987  volumeLengthDouble = boost::shared_ptr<VolumeLengthQuality<double>>(
5990  smootherGamma));
5991 
5992  // set block data
5993  for (std::map<int, NonlinearElasticElement::BlockData>::iterator sit =
5994  elasticFe->setOfBlocks.begin();
5995  sit != elasticFe->setOfBlocks.end(); sit++) {
5996  // E = fmax(E,sit->second.E);
5997  smootherFe->setOfBlocks[0].tEts.merge(sit->second.tEts);
5998  }
5999  smootherFe->setOfBlocks[0].materialDoublePtr = volumeLengthDouble;
6000  smootherFe->setOfBlocks[0].materialAdoublePtr = volumeLengthAdouble;
6001  smootherFe->setOfBlocks[0].forcesOnlyOnEntitiesRow = crackFrontNodes;
6002 
6003  // set element data
6004  smootherFe->commonData.spatialPositions = "MESH_NODE_POSITIONS";
6005  smootherFe->commonData.meshPositions = "NONE";
6006 
6007  // mesh field name
6008  smootherFe->feRhs.meshPositionsFieldName = "NONE";
6009  smootherFe->feLhs.meshPositionsFieldName = "NONE";
6010  smootherFe->feRhs.addToRule = 0;
6011  smootherFe->feLhs.addToRule = 0;
6012 
6013  // Create finite element instances for the right hand side and left hand side
6014  feSmootherRhs = smootherFe->feRhsPtr;
6015  feSmootherLhs = smootherFe->feLhsPtr;
6016 
6017  // Smoother right hand side
6018  feSmootherRhs->getOpPtrVector().push_back(
6020  "MESH_NODE_POSITIONS", smootherFe->commonData));
6021  map<int, NonlinearElasticElement::BlockData>::iterator sit =
6022  smootherFe->setOfBlocks.begin();
6023  feSmootherRhs->getOpPtrVector().push_back(new Smoother::OpJacobianSmoother(
6024  "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
6025  smootherFe->commonData, SMOOTHING_TAG, false));
6026  feSmootherRhs->getOpPtrVector().push_back(new Smoother::OpRhsSmoother(
6027  "MESH_NODE_POSITIONS", sit->second, smootherFe->commonData,
6028  smootherFe->smootherData));
6029 
6030  // Smoother left hand side
6031  feSmootherLhs->getOpPtrVector().push_back(
6033  "MESH_NODE_POSITIONS", smootherFe->commonData));
6034  feSmootherLhs->getOpPtrVector().push_back(new Smoother::OpJacobianSmoother(
6035  "MESH_NODE_POSITIONS", smootherFe->setOfBlocks.at(0),
6036  smootherFe->commonData, SMOOTHING_TAG, true));
6037  feSmootherLhs->getOpPtrVector().push_back(new Smoother::OpLhsSmoother(
6038  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
6039  smootherFe->setOfBlocks.at(0), smootherFe->commonData,
6040  smootherFe->smootherData, "LAMBDA_CRACKFRONT_AREA_TANGENT"));
6041 
6042  // Constrains at crack front
6043  tangentConstrains = boost::shared_ptr<
6046  mField, "LAMBDA_CRACKFRONT_AREA_TANGENT"));
6047 
6048  Range contact_faces;
6049  contact_faces.merge(contactSlaveFaces);
6050  contact_faces.merge(contactMasterFaces);
6051 
6052  // Surface sliding constrains
6053  surfaceConstrain.clear();
6054  skinOrientation =
6055  boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>(
6056  new FaceOrientation(false, contact_faces, mapBitLevel["mesh_cut"]));
6057  for (auto id : ids) {
6058  if (id != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
6059  surfaceConstrain[id] = boost::make_shared<SurfaceSlidingConstrains>(
6061  surfaceConstrain[id]->setOperators(
6063  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(id),
6064  "MESH_NODE_POSITIONS", &smootherAlpha);
6065  }
6066  }
6067  // Add crack surface sliding constrains
6069  boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>(
6070  new FaceOrientation(true, contact_faces, mapBitLevel["mesh_cut"]));
6071  surfaceConstrain[getInterface<CPMeshCut>()->getCrackSurfaceId()] =
6072  boost::make_shared<SurfaceSlidingConstrains>(mField, *crackOrientation);
6073  surfaceConstrain[getInterface<CPMeshCut>()->getCrackSurfaceId()]
6074  ->setOperators(SURFACE_SLIDING_TAG,
6075  "LAMBDA_SURFACE" +
6076  boost::lexical_cast<std::string>(
6077  getInterface<CPMeshCut>()->getCrackSurfaceId()),
6078  "MESH_NODE_POSITIONS", &smootherAlpha);
6079 
6080  edgeConstrains.clear();
6081  auto get_edges_block_set = [this]() {
6082  return getInterface<CPMeshCut>()->getEdgesBlockSet();
6083  };
6084  if (get_edges_block_set()) {
6085  edgeConstrains[get_edges_block_set()] =
6086  boost::shared_ptr<EdgeSlidingConstrains>(
6088  edgeConstrains[get_edges_block_set()]->setOperators(
6089  EDGE_SLIDING_TAG, "LAMBDA_EDGE", "MESH_NODE_POSITIONS", &smootherAlpha);
6090  }
6091 
6092  bothSidesConstrains = boost::shared_ptr<BothSurfaceConstrains>(
6093  new BothSurfaceConstrains(mField));
6095 
6096  bothSidesContactConstrains = boost::shared_ptr<BothSurfaceConstrains>(
6097  new BothSurfaceConstrains(mField, "LAMBDA_BOTH_SIDES_CONTACT"));
6100 
6101  Range fix_material_nodes;
6102  fixMaterialEnts = boost::make_shared<DirichletFixFieldAtEntitiesBc>(
6103  mField, "MESH_NODE_POSITIONS", fix_material_nodes);
6104  const Field_multiIndex *fields_ptr;
6105  CHKERR mField.get_fields(&fields_ptr);
6106  for (auto f : *fields_ptr) {
6107  if (f->getName().compare(0, 6, "LAMBDA") == 0 &&
6108  f->getName() != "LAMBDA_ARC_LENGTH" &&
6109  f->getName() != "LAMBDA_CONTACT" &&
6110  f->getName() != "LAMBDA_CLOSE_CRACK") {
6111  fixMaterialEnts->fieldNames.push_back(f->getName());
6112  }
6113  }
6114 
6115  // Create griffith force finite element instances and operators
6116  griffithForceElement = boost::make_shared<GriffithForceElement>(mField);
6117  griffithForceElement->blockData[0].gc = gC;
6118  griffithForceElement->blockData[0].E = gC;
6119  griffithForceElement->blockData[0].r = 1.0;
6120  griffithForceElement->blockData[0].frontNodes = crackFrontNodes;
6122  griffithForceElement->blockData[0]);
6123  gC = griffithForceElement->blockData[0].gc;
6124  griffithE = griffithForceElement->blockData[0].E;
6125  griffithR = griffithForceElement->blockData[0].r;
6126 
6129 
6130  feGriffithForceRhs->getOpPtrVector().push_back(
6131  new GriffithForceElement::OpCalculateGriffithForce(
6133  griffithForceElement->commonData));
6134  feGriffithForceRhs->getOpPtrVector().push_back(
6135  new GriffithForceElement::OpRhs(GRIFFITH_FORCE_TAG,
6136  griffithForceElement->blockData[0],
6137  griffithForceElement->commonData));
6138  feGriffithForceLhs->getOpPtrVector().push_back(
6139  new GriffithForceElement::OpLhs(GRIFFITH_FORCE_TAG,
6140  griffithForceElement->blockData[0],
6141  griffithForceElement->commonData));
6142 
6143  // Creating Griffith constrains finite element instances and operators
6145  boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrainsDelta>(
6146  new GriffithForceElement::MyTriangleFEConstrainsDelta(
6147  mField, "LAMBDA_CRACKFRONT_AREA"));
6148  feGriffithConstrainsDelta->getOpPtrVector().push_back(
6149  new GriffithForceElement::OpConstrainsDelta(
6151  griffithForceElement->commonData, "LAMBDA_CRACKFRONT_AREA",
6152  feGriffithConstrainsDelta->deltaVec));
6154  boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrains>(
6155  new GriffithForceElement::MyTriangleFEConstrains(
6156  mField, "LAMBDA_CRACKFRONT_AREA",
6157  griffithForceElement->blockData[0],
6158  feGriffithConstrainsDelta->deltaVec));
6160  boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrains>(
6161  new GriffithForceElement::MyTriangleFEConstrains(
6162  mField, "LAMBDA_CRACKFRONT_AREA",
6163  griffithForceElement->blockData[0],
6164  feGriffithConstrainsDelta->deltaVec));
6165  feGriffithConstrainsRhs->getOpPtrVector().push_back(
6166  new GriffithForceElement::OpConstrainsRhs(
6168  griffithForceElement->commonData, "LAMBDA_CRACKFRONT_AREA"));
6169  feGriffithConstrainsLhs->getOpPtrVector().push_back(
6170  new GriffithForceElement::OpConstrainsLhs(
6172  griffithForceElement->commonData, "LAMBDA_CRACKFRONT_AREA",
6173  feGriffithConstrainsLhs->deltaVec));
6174 
6176 }

◆ buildArcLengthField()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildArcLengthField ( const BitRefLevel  bit,
const bool  build_fields = true,
const int  verb = QUIET 
)

Declate field for arc-length.

Parameters
bitbit refinement level
Returns
error code

Definition at line 1726 of file CrackPropagation.cpp.

1728  {
1729  const RefEntity_multiIndex *refined_ents_ptr;
1730  const FieldEntity_multiIndex *field_ents_ptr;
1732  CHKERR mField.get_ref_ents(&refined_ents_ptr);
1733  CHKERR mField.get_field_ents(&field_ents_ptr);
1734  if (mField.check_field("LAMBDA_ARC_LENGTH")) {
1735  auto vit = refined_ents_ptr->get<Ent_mi_tag>().find(arcLengthVertex);
1736  if (vit == refined_ents_ptr->get<Ent_mi_tag>().end()) {
1737  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1738  "Vertex of arc-length field not found");
1739  }
1740  *(const_cast<RefEntity *>(vit->get())->getBitRefLevelPtr()) |= bit;
1741  auto fit = field_ents_ptr->get<Unique_mi_tag>().find(
1742  FieldEntity::getLocalUniqueIdCalculate(
1743  mField.get_field_bit_number("LAMBDA_ARC_LENGTH"), arcLengthVertex));
1744  if (fit == field_ents_ptr->get<Unique_mi_tag>().end())
1745  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1746  "Arc length field entity not found");
1747 
1748  MOFEM_LOG("CPWorld", Sev::noisy) << **fit;
1749  MOFEM_LOG_C("CPWorld", Sev::inform, "Arc-Length field lambda = %3.4e",
1750  (*fit)->getEntFieldData()[0]);
1752  }
1753 
1754  CHKERR mField.add_field("LAMBDA_ARC_LENGTH", NOFIELD, NOBASE, 1,
1755  MB_TAG_SPARSE, MF_ZERO, verb);
1756  EntityHandle lambda_meshset = mField.get_field_meshset("LAMBDA_ARC_LENGTH");
1757  CHKERR mField.get_moab().add_entities(lambda_meshset, &arcLengthVertex, 1);
1758  // Add vertex to MoFEM database
1759  std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
1760  const_cast<RefEntity_multiIndex *>(refined_ents_ptr)
1761  ->insert(boost::make_shared<RefEntity>(
1763  *(const_cast<RefEntity *>(p_ent.first->get())->getBitRefLevelPtr()) |=
1764  (bit | BitRefLevel().set(BITREFLEVEL_SIZE - 2));
1765  if (build_fields) {
1766  CHKERR mField.build_fields(verb);
1767  }
1769 }

◆ buildBothSidesFieldId()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildBothSidesFieldId ( const BitRefLevel  bit_spatial,
const BitRefLevel  bit_material,
const bool  proc_only = false,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

Lagrange multipliers field which constrains material displacements.

Nodes on both sides are constrainded to have the same material displacements

Definition at line 1973 of file CrackPropagation.cpp.

1976  {
1978 
1979  auto add_both_sides_field = [&](const std::string lambda_field_name,
1980  Range master_nodes, Range nodes_to_remove,
1981  bool add_ho) {
1983  // This field set constrains that both side of crack surface have the same
1984  // node positions
1985  CHKERR mField.add_field(lambda_field_name, H1, AINSWORTH_LEGENDRE_BASE, 3,
1986  MB_TAG_SPARSE, MF_ZERO);
1987 
1988  if (debug) {
1989  std::ostringstream file;
1990  file << lambda_field_name << ".vtk";
1991  EntityHandle meshset;
1992  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
1993  CHKERR mField.get_moab().add_entities(meshset, master_nodes);
1994  CHKERR mField.get_moab().write_file(file.str().c_str(), "VTK", "",
1995  &meshset, 1);
1996  CHKERR mField.get_moab().delete_entities(&meshset, 1);
1997  }
1998 
1999  // remove old ents from field which are no longer part of the field
2000  Range ents_to_remove;
2001  CHKERR mField.get_field_entities_by_handle(lambda_field_name,
2002  ents_to_remove);
2003  ents_to_remove = subtract(ents_to_remove, master_nodes);
2004  CHKERR mField.remove_ents_from_field(lambda_field_name, ents_to_remove,
2005  verb);
2006 
2007  CHKERR mField.add_ents_to_field_by_type(master_nodes, MBVERTEX,
2008  lambda_field_name);
2009  if (approxOrder > 1 && add_ho) {
2010  CHKERR mField.add_ents_to_field_by_type(master_nodes, MBEDGE,
2011  lambda_field_name);
2012  CHKERR mField.add_ents_to_field_by_type(master_nodes, MBTRI,
2013  lambda_field_name);
2014  }
2015  CHKERR mField.set_field_order(master_nodes.subset_by_dimension(0),
2016  lambda_field_name, 1);
2017  if (approxOrder > 1 && add_ho) {
2018  CHKERR mField.set_field_order(master_nodes.subset_by_dimension(1),
2019  lambda_field_name, approxOrder);
2020  CHKERR mField.set_field_order(master_nodes.subset_by_dimension(2),
2021  lambda_field_name, approxOrder);
2022  }
2023 
2024  // Since we state constrains that mesh nodes, in material space, have to
2025  // move the same on the top and bottom side of crack surface, we have to
2026  // remove constraint from the all surface constrains fields, except
2027  // "LAMBDA_SURFACE", otherwise system will be over-constrained.
2028  const Field_multiIndex *fields_ptr;
2029  CHKERR mField.get_fields(&fields_ptr);
2030  for (auto const &field : (*fields_ptr)) {
2031  const std::string field_name = field->getName();
2032  if (field_name.compare(0, 14, "LAMBDA_SURFACE") == 0) {
2033  CHKERR mField.remove_ents_from_field(field_name, nodes_to_remove, verb);
2034  }
2035  if (field_name.compare(0, 11, "LAMBDA_EDGE") == 0) {
2036  CHKERR mField.remove_ents_from_field(field_name, nodes_to_remove, verb);
2037  }
2038  }
2040  };
2041 
2042  auto write_file = [&](const std::string file_name, Range ents) {
2044  EntityHandle meshset;
2045  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
2046  CHKERR mField.get_moab().add_entities(meshset, ents);
2047  if (mField.get_comm_rank() == 0) {
2048  CHKERR mField.get_moab().write_file(file_name.c_str(), "VTK", "",
2049  &meshset, 1);
2050  }
2051  CHKERR mField.get_moab().delete_entities(&meshset, 1);
2053  };
2054 
2055  auto get_prisms_level_nodes = [&](auto bit) {
2056  Range prisms_level;
2057  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2058  bit, BitRefLevel().set(), MBPRISM, prisms_level);
2059  if (proc_only) {
2060  prisms_level = intersect(bitProcEnts, prisms_level);
2061  }
2062  Range prisms_level_nodes;
2063  CHKERR mField.get_moab().get_connectivity(prisms_level, prisms_level_nodes,
2064  true);
2065  return prisms_level_nodes;
2066  };
2067 
2068  auto get_other_side_crack_faces_nodes = [&](auto prisms_level_nodes) {
2069  Range other_side_crack_faces_nodes;
2070  CHKERR mField.get_moab().get_connectivity(
2071  otherSideCrackFaces, other_side_crack_faces_nodes, true);
2072  other_side_crack_faces_nodes =
2073  intersect(other_side_crack_faces_nodes, prisms_level_nodes);
2074  other_side_crack_faces_nodes =
2075  subtract(other_side_crack_faces_nodes, crackFrontNodes);
2076 
2077  return other_side_crack_faces_nodes;
2078  };
2079 
2080  auto prisms_level_nodes = get_prisms_level_nodes(bit_material);
2081  auto other_side_crack_faces_nodes =
2082  get_other_side_crack_faces_nodes(prisms_level_nodes);
2083 
2084  CHKERR add_both_sides_field("LAMBDA_BOTH_SIDES", other_side_crack_faces_nodes,
2085  other_side_crack_faces_nodes, false);
2086 
2088  Range other_side_crack_faces_edges;
2089  if (approxOrder > 1) {
2090  CHKERR mField.get_moab().get_adjacencies(otherSideCrackFaces, 1, false,
2091  other_side_crack_faces_edges,
2092  moab::Interface::UNION);
2093  other_side_crack_faces_edges =
2094  subtract(other_side_crack_faces_edges, crackFront);
2095  other_side_crack_faces_edges.merge(otherSideCrackFaces);
2096  }
2097  other_side_crack_faces_edges.merge(
2098  get_other_side_crack_faces_nodes(get_prisms_level_nodes(bit_spatial)));
2099  CHKERR add_both_sides_field("LAMBDA_CLOSE_CRACK",
2100  other_side_crack_faces_edges, Range(), true);
2101  }
2102 
2103  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
2105  CHKERR mField.get_moab().get_connectivity(
2108  intersect(contactBothSidesMasterNodes, prisms_level_nodes);
2110  subtract(contactBothSidesMasterNodes, other_side_crack_faces_nodes);
2111  Range contact_both_sides_slave_nodes;
2112  for (Range::iterator nit = contactBothSidesMasterNodes.begin();
2113  nit != contactBothSidesMasterNodes.end(); nit++) {
2114  Range contact_prisms;
2115  CHKERR mField.get_moab().get_adjacencies(
2116  &*nit, 1, 3, false, contact_prisms, moab::Interface::UNION);
2117  contact_prisms = intersect(contact_prisms, contactElements);
2118  EntityHandle prism = contact_prisms.front();
2119  const EntityHandle *conn;
2120  int side_number, other_side_number, sense, offset, number_nodes = 0;
2121  CHKERR mField.get_moab().get_connectivity(prism, conn, number_nodes);
2122  CHKERR mField.get_moab().side_number(prism, *nit, side_number, sense,
2123  offset);
2124  if (side_number < 3)
2125  contact_both_sides_slave_nodes.insert(conn[side_number + 3]);
2126  else
2127  contact_both_sides_slave_nodes.insert(conn[side_number - 3]);
2128  }
2129  contact_both_sides_slave_nodes =
2130  intersect(contact_both_sides_slave_nodes, prisms_level_nodes);
2131 
2132  if (debug) {
2133  CHKERR write_file("contact_both_sides_slave_nodes.vtk",
2134  contact_both_sides_slave_nodes);
2135  }
2136 
2137  CHKERR add_both_sides_field("LAMBDA_BOTH_SIDES_CONTACT",
2139  contact_both_sides_slave_nodes, false);
2140  }
2141 
2143 }

◆ buildCrackFrontFieldId()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildCrackFrontFieldId ( const BitRefLevel  bit,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

declare crack surface files

Definition at line 2145 of file CrackPropagation.cpp.

2148  {
2149  moab::Interface &moab = mField.get_moab();
2151 
2152  Range level_edges;
2153  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2154  bit, BitRefLevel().set(), MBEDGE, level_edges);
2155  Range crack_front_edges = intersect(crackFront, level_edges);
2156  Range crack_front_nodes;
2157  CHKERR moab.get_connectivity(crack_front_edges, crack_front_nodes, true);
2158 
2159  CHKERR mField.add_field("LAMBDA_CRACKFRONT_AREA", H1, AINSWORTH_LEGENDRE_BASE,
2160  1, MB_TAG_SPARSE, MF_ZERO, verb);
2161  // Add dofs to LAMBDA_CRACKFRONT_AREA field
2162  {
2163  Range ents_to_remove;
2164  CHKERR mField.get_field_entities_by_handle("LAMBDA_CRACKFRONT_AREA",
2165  ents_to_remove);
2166  ents_to_remove = subtract(ents_to_remove, crack_front_nodes);
2167  CHKERR mField.remove_ents_from_field("LAMBDA_CRACKFRONT_AREA",
2168  ents_to_remove, verb);
2169  CHKERR mField.add_ents_to_field_by_type(crack_front_nodes, MBVERTEX,
2170  "LAMBDA_CRACKFRONT_AREA", verb);
2171  CHKERR mField.set_field_order(crack_front_nodes, "LAMBDA_CRACKFRONT_AREA",
2172  1, verb);
2173  }
2174 
2175  CHKERR mField.add_field("LAMBDA_CRACKFRONT_AREA_TANGENT", H1,
2176  AINSWORTH_LEGENDRE_BASE, 1, MB_TAG_SPARSE, MF_ZERO,
2177  verb);
2178  // Add dofs to LAMBDA_CRACKFRONT_AREA_TANGENT field
2179  {
2180  // Remove dofs on crack front ends
2181  Skinner skin(&mField.get_moab());
2182  Range skin_crack_front;
2183  rval = skin.find_skin(0, crack_front_edges, false, skin_crack_front);
2184  Range field_ents = subtract(crack_front_nodes, skin_crack_front);
2185  // remove old ents from field which are no longer part of the field
2186  Range ents_to_remove;
2187  CHKERR mField.get_field_entities_by_handle("LAMBDA_CRACKFRONT_AREA_TANGENT",
2188  ents_to_remove);
2189  ents_to_remove = subtract(ents_to_remove, field_ents);
2190  CHKERR mField.remove_ents_from_field("LAMBDA_CRACKFRONT_AREA_TANGENT",
2191  ents_to_remove, verb);
2193  field_ents, MBVERTEX, "LAMBDA_CRACKFRONT_AREA_TANGENT", verb);
2194  CHKERR mField.set_field_order(field_ents, "LAMBDA_CRACKFRONT_AREA_TANGENT",
2195  1, verb);
2196  }
2197 
2198  if (build_fields) {
2199  CHKERR mField.build_fields(verb);
2200  }
2201 
2203 }

◆ buildCrackSurfaceFieldId()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildCrackSurfaceFieldId ( const BitRefLevel  bit,
const bool  proc_only = true,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

declare crack surface files

Definition at line 1911 of file CrackPropagation.cpp.

1913  {
1914  moab::Interface &moab = mField.get_moab();
1915  MeshsetsManager *meshset_manager_ptr;
1917 
1918  CHKERR mField.getInterface(meshset_manager_ptr);
1919  Range crack_surface_ents = oneSideCrackFaces;
1920  Range level_tris;
1921  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1922  bit, BitRefLevel().set(), MBTRI, level_tris);
1923  crack_surface_ents = intersect(crack_surface_ents, level_tris);
1924 
1925  if (proc_only) {
1926  Range proc_tris;
1927  CHKERR moab.get_adjacencies(bitProcEnts, 2, false, proc_tris,
1928  moab::Interface::UNION);
1929  crack_surface_ents = intersect(crack_surface_ents, proc_tris);
1930  }
1931 
1932  if (debug) {
1933  EntityHandle meshset;
1934  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
1935  CHKERR mField.get_moab().add_entities(meshset, crack_surface_ents);
1936  std::string field_name;
1937  field_name = "out_proc_crack_" +
1938  boost::lexical_cast<std::string>(mField.get_comm_rank()) +
1939  ".vtk";
1940  CHKERR mField.get_moab().write_file(field_name.c_str(), "VTK", "", &meshset,
1941  1);
1942  CHKERR mField.get_moab().delete_entities(&meshset, 1);
1943  }
1944 
1945  std::string field_name =
1946  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(
1947  getInterface<CPMeshCut>()->getCrackSurfaceId());
1948  Range dofs_nodes;
1949  CHKERR moab.get_connectivity(crack_surface_ents, dofs_nodes, true);
1950  dofs_nodes = subtract(dofs_nodes, crackFrontNodes);
1951  if (proc_only)
1952  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(dofs_nodes,
1953  QUIET);
1954 
1956  MB_TAG_SPARSE, MF_ZERO, verb);
1957  Range ents_to_remove;
1959  ents_to_remove = subtract(ents_to_remove, dofs_nodes);
1960  CHKERR mField.remove_ents_from_field(field_name, ents_to_remove, verb);
1961 
1962  CHKERR mField.add_ents_to_field_by_type(dofs_nodes, MBVERTEX, field_name,
1963  verb);
1964  CHKERR mField.set_field_order(dofs_nodes, field_name, 1, verb);
1965 
1966  if (build_fields) {
1967  CHKERR mField.build_fields(verb);
1968  }
1969 
1971 }

◆ buildEdgeFields()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildEdgeFields ( const BitRefLevel  bit,
const bool  proc_only = true,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

build fields with Lagrange multipliers to constrain edges

Definition at line 1836 of file CrackPropagation.cpp.

1840  {
1841  moab::Interface &moab = mField.get_moab();
1842  auto *meshset_manager_ptr = mField.getInterface<MeshsetsManager>();
1843  auto *bit_ref_manager_ptr = mField.getInterface<BitRefManager>();
1845 
1846  Range level_edges;
1847  CHKERR bit_ref_manager_ptr->getEntitiesByTypeAndRefLevel(
1848  bit, BitRefLevel().set(), MBEDGE, level_edges);
1849  Range edges_ents;
1850  if (meshset_manager_ptr->checkMeshset(
1851  getInterface<CPMeshCut>()->getEdgesBlockSet(), BLOCKSET)) {
1852  Range meshset_ents;
1853  CHKERR meshset_manager_ptr->getEntitiesByDimension(
1854  getInterface<CPMeshCut>()->getEdgesBlockSet(), BLOCKSET, 1,
1855  meshset_ents, true);
1856  edges_ents = intersect(meshset_ents, level_edges);
1857  }
1858 
1859  if (proc_only) {
1860  Range proc_edges;
1861  CHKERR moab.get_adjacencies(bitProcEnts, 1, false, proc_edges,
1862  moab::Interface::UNION);
1863  edges_ents = intersect(edges_ents, proc_edges);
1864  }
1865 
1866  // Get nodes on other side faces
1867  Range other_side_crack_faces_nodes;
1868  rval = mField.get_moab().get_connectivity(otherSideCrackFaces,
1869  other_side_crack_faces_nodes, true);
1870  other_side_crack_faces_nodes =
1871  subtract(other_side_crack_faces_nodes, crackFrontNodes);
1872 
1873  Range dofs_nodes;
1874  CHKERR moab.get_connectivity(edges_ents, dofs_nodes, true);
1875  dofs_nodes = subtract(dofs_nodes, other_side_crack_faces_nodes);
1876  if (proc_only)
1877  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(dofs_nodes,
1878  QUIET);
1879 
1880  std::string field_name = "LAMBDA_EDGE";
1882  MB_TAG_SPARSE, MF_ZERO, verb);
1883 
1884  Range ents_to_remove;
1886  ents_to_remove = subtract(ents_to_remove, dofs_nodes);
1887  CHKERR mField.remove_ents_from_field(field_name, ents_to_remove, verb);
1888 
1889  CHKERR mField.add_ents_to_field_by_type(dofs_nodes, MBVERTEX, field_name,
1890  verb);
1891  CHKERR mField.set_field_order(dofs_nodes, field_name, 1, verb);
1892 
1893  auto get_fields_multi_index = [this]() {
1894  const Field_multiIndex *fields_ptr;
1895  CHKERR mField.get_fields(&fields_ptr);
1896  return *fields_ptr;
1897  };
1898  for (auto field : get_fields_multi_index()) {
1899  if (field->getName().compare(0, 14, "LAMBDA_SURFACE") == 0) {
1900  CHKERR mField.remove_ents_from_field(field->getName(), dofs_nodes, verb);
1901  }
1902  }
1903 
1904  if (build_fields) {
1905  CHKERR mField.build_fields(verb);
1906  }
1907 
1909 }

◆ buildElasticFields()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildElasticFields ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

Declate fields for elastic analysis.

Parameters
bitbit refinement level
Returns
error code

Definition at line 1460 of file CrackPropagation.cpp.

1462  {
1463  moab::Interface &moab = mField.get_moab();
1465 
1466  auto write_file = [&](const std::string file_name, Range ents) {
1468  EntityHandle meshset;
1469  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
1470  CHKERR mField.get_moab().add_entities(meshset, ents);
1471  if (mField.get_comm_rank() == 0) {
1472  CHKERR mField.get_moab().write_file(file_name.c_str(), "VTK", "",
1473  &meshset, 1);
1474  }
1475  CHKERR mField.get_moab().delete_entities(&meshset, 1);
1477  };
1478 
1479  Range tets_level, tets_level_all;
1480  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1481  bit, mask, MBTET, tets_level_all);
1482  if (proc_only) {
1483  tets_level = intersect(bitProcEnts, tets_level_all);
1484  }
1485  // That is ok, since all crack faces are shared
1486  Range prisms_level;
1487  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1488  bit, mask, MBPRISM, prisms_level);
1489  if (proc_only) {
1490  prisms_level = intersect(prisms_level, bitProcEnts);
1491  }
1492  Range prisms_level_tris;
1493  rval = mField.get_moab().get_adjacencies(
1494  prisms_level, 2, false, prisms_level_tris, moab::Interface::UNION);
1495  // MoAB will report problems at crack front since quads are not well defined.
1496  if (rval != MB_SUCCESS && rval != MB_MULTIPLE_ENTITIES_FOUND) {
1497  CHKERRG(rval);
1498  } else {
1499  rval = MB_SUCCESS;
1500  }
1501  prisms_level_tris = intersect(prisms_level_tris, crackFaces);
1502  Range proc_ents = tets_level;
1503  proc_ents.merge(prisms_level_tris);
1504 
1505  CHKERR mField.add_field("SPATIAL_POSITION", H1, AINSWORTH_LOBATTO_BASE, 3,
1506  MB_TAG_SPARSE, MF_ZERO, verb);
1508  CHKERR mField.add_field("EIGEN_SPATIAL_POSITIONS", H1,
1509  AINSWORTH_LEGENDRE_BASE, 3, MB_TAG_SPARSE, MF_ZERO,
1510  verb);
1511  }
1512  CHKERR mField.add_field("MESH_NODE_POSITIONS", H1, AINSWORTH_LEGENDRE_BASE, 3,
1513  MB_TAG_SPARSE, MF_ZERO, verb);
1514 
1515  // Set approx order
1516  Range dofs_ents;
1517  dofs_ents.merge(proc_ents);
1518  for (int dd = 1; dd != 3; ++dd) {
1519  CHKERR moab.get_adjacencies(proc_ents, dd, false, dofs_ents,
1520  moab::Interface::UNION);
1521  }
1522 
1523  Range dofs_nodes;
1524  CHKERR moab.get_connectivity(proc_ents, dofs_nodes, true);
1525  dofs_nodes.merge(crackFrontNodes);
1526  dofs_ents.merge(crackFront);
1527 
1528  EntityHandle spatial_meshset = mField.get_field_meshset("SPATIAL_POSITION");
1529  Range
1530  ents_to_remove_from_field; // Entities which are no part of problem any
1531  // more. Very likely partition has been chaned.
1532  CHKERR mField.get_moab().get_entities_by_handle(spatial_meshset,
1533  ents_to_remove_from_field);
1534  ents_to_remove_from_field = subtract(ents_to_remove_from_field, dofs_nodes);
1535  ents_to_remove_from_field = subtract(ents_to_remove_from_field, dofs_ents);
1536  CHKERR mField.remove_ents_from_field("SPATIAL_POSITION",
1537  ents_to_remove_from_field, verb);
1538  CHKERR mField.remove_ents_from_field("MESH_NODE_POSITIONS",
1539  ents_to_remove_from_field, verb);
1541  CHKERR mField.remove_ents_from_field("EIGEN_SPATIAL_POSITIONS",
1542  ents_to_remove_from_field, verb);
1543 
1544  // Add entities to field
1545  auto add_spatial_field_ents = [&](const auto field_name) {
1548  verb);
1549  CHKERR mField.add_ents_to_field_by_type(prisms_level_tris, MBTRI,
1550  field_name, verb);
1552  field_name, verb);
1554  verb);
1555  CHKERR mField.getInterface<CommInterface>()->synchroniseFieldEntities(
1556  field_name, verb);
1558  };
1559  CHKERR add_spatial_field_ents("SPATIAL_POSITION");
1561  CHKERR add_spatial_field_ents("EIGEN_SPATIAL_POSITIONS");
1562  }
1563 
1564  Range current_field_ents;
1565  CHKERR mField.get_moab().get_entities_by_handle(spatial_meshset,
1566  current_field_ents);
1567  dofs_nodes = current_field_ents.subset_by_type(MBVERTEX);
1568  dofs_ents = subtract(current_field_ents, dofs_nodes);
1569  CHKERR mField.add_ents_to_field_by_type(dofs_nodes, MBVERTEX,
1570  "MESH_NODE_POSITIONS", verb);
1571 
1572  auto set_spatial_field_order = [&](const auto field_name) {
1574  CHKERR mField.set_field_order(dofs_ents, field_name, approxOrder, verb);
1575  CHKERR mField.set_field_order(dofs_nodes, field_name, 1, verb);
1577  };
1578  CHKERR set_spatial_field_order("SPATIAL_POSITION");
1580  CHKERR set_spatial_field_order("EIGEN_SPATIAL_POSITIONS");
1581  }
1582 
1583  CHKERR mField.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS", geometryOrder,
1584  verb);
1585  CHKERR mField.set_field_order(0, MBTRI, "MESH_NODE_POSITIONS", geometryOrder,
1586  verb);
1587  CHKERR mField.set_field_order(0, MBTET, "MESH_NODE_POSITIONS", geometryOrder,
1588  verb);
1589  CHKERR mField.set_field_order(dofs_nodes, "MESH_NODE_POSITIONS", 1, verb);
1590 
1591  if (debug) {
1592  CHKERR write_file("global_order_" + std::to_string(approxOrder) + ".vtk",
1593  dofs_ents);
1594  }
1595 
1596  Range non_ref_ents;
1597  non_ref_ents.merge(dofs_ents);
1598 
1599  Range contact_faces;
1600  contact_faces.merge(contactSlaveFaces);
1601  contact_faces.merge(contactMasterFaces);
1602  contact_faces.merge(mortarContactMasterFaces);
1603  contact_faces.merge(mortarContactSlaveFaces);
1604 
1605  // Set ho approx. at crack front
1606  if (refOrderAtTip > 0) {
1607  Range proc_ents;
1608  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1609  bit, mask, MBTET, proc_ents);
1610  map<int, Range> layers;
1611  Range ref_nodes = crackFrontNodes;
1612  for (int ll = 0; ll != refOrderAtTip; ll++) {
1613  Range tets;
1614  CHKERR moab.get_adjacencies(ref_nodes, 3, false, tets,
1615  moab::Interface::UNION);
1616  tets = intersect(tets_level_all, tets);
1617  layers[ll] = tets;
1618  Range ref_order_ents;
1619  CHKERR moab.get_adjacencies(tets, 2, false, ref_order_ents,
1620  moab::Interface::UNION);
1621  CHKERR moab.get_adjacencies(tets, 1, false, ref_order_ents,
1622  moab::Interface::UNION);
1623  layers[ll].merge(ref_order_ents);
1624  CHKERR moab.get_connectivity(tets, ref_nodes, false);
1625 
1626  if (!contact_faces.empty()) {
1627  Range contact_layer = intersect(layers[ll], contact_faces);
1628  for (Range::iterator tit = contact_layer.begin();
1629  tit != contact_layer.end(); tit++) {
1630  Range contact_prisms, contact_tris;
1631  CHKERR moab.get_adjacencies(&*tit, 1, 3, false, contact_prisms,
1632  moab::Interface::UNION);
1633  contact_prisms = contact_prisms.subset_by_type(MBPRISM);
1634 
1635  Range contact_elements;
1636  if (!contactElements.empty() || !mortarContactElements.empty()) {
1637  contact_elements.merge(contactElements);
1638  contact_elements.merge(mortarContactElements);
1639  contact_elements = intersect(contact_prisms, contact_elements);
1640  if (contact_elements.empty()) {
1641  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1642  "Expecting adjacent contact prism(s), but none found");
1643  }
1644  CHKERR moab.get_adjacencies(contact_elements, 2, false,
1645  contact_tris, moab::Interface::UNION);
1646  contact_tris = contact_tris.subset_by_type(MBTRI);
1647  if (contact_tris.size() < 2) {
1648  SETERRQ1(
1649  PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1650  "Expecting 2 or more adjacent contact tris, but %d found",
1651  contact_tris.size());
1652  }
1653  }
1654 
1655  layers[ll].merge(contact_tris);
1656  Range contact_edges, contact_nodes;
1657  CHKERR moab.get_adjacencies(contact_tris, 1, false, contact_edges,
1658  moab::Interface::UNION);
1659  layers[ll].merge(contact_edges);
1660  CHKERR moab.get_connectivity(contact_tris, contact_nodes, false);
1661  ref_nodes.merge(contact_nodes);
1662  }
1663  }
1664  }
1665  int poo = 1;
1666  for (map<int, Range>::reverse_iterator mit = layers.rbegin();
1667  mit != layers.rend(); mit++, poo++) {
1668  mit->second = intersect(mit->second, dofs_ents);
1669  CHKERR mField.set_field_order(mit->second, "SPATIAL_POSITION",
1670  approxOrder + poo, verb);
1671  non_ref_ents = subtract(non_ref_ents, mit->second);
1672 
1673  if (debug) {
1674  CHKERR write_file("layer_order_" + std::to_string(approxOrder + poo) +
1675  ".vtk",
1676  mit->second);
1677  }
1678  }
1679  }
1680 
1681  if (!contactElements.empty() || !mortarContactElements.empty()) {
1682  if (contactOrder > approxOrder) {
1683  Range cont_ents, cont_adj_ent;
1684  cont_ents.merge(contactSlaveFaces);
1685  cont_ents.merge(contactMasterFaces);
1686  cont_ents.merge(mortarContactMasterFaces);
1687  cont_ents.merge(mortarContactSlaveFaces);
1688 
1689  CHKERR moab.get_adjacencies(cont_ents, 1, false, cont_adj_ent,
1690  moab::Interface::UNION);
1691  cont_ents.merge(cont_adj_ent);
1692  cont_ents = intersect(cont_ents, non_ref_ents);
1693  CHKERR mField.set_field_order(cont_ents, "SPATIAL_POSITION", contactOrder,
1694  verb);
1695  if (debug) {
1696  CHKERR write_file("contact_order_" + std::to_string(contactOrder) +
1697  ".vtk",
1698  cont_ents);
1699  }
1700  }
1701 
1702  // add Lagrange multipliers field for contact constraints on slave faces
1703  CHKERR mField.add_field("LAMBDA_CONTACT", H1, AINSWORTH_LEGENDRE_BASE, 1,
1704  MB_TAG_SPARSE, MF_ZERO);
1705 
1706  if (!contactSlaveFaces.empty())
1708  "LAMBDA_CONTACT");
1709 
1710  if (!mortarContactSlaveFaces.empty())
1712  "LAMBDA_CONTACT");
1713 
1714  CHKERR mField.set_field_order(0, MBTRI, "LAMBDA_CONTACT",
1716  CHKERR mField.set_field_order(0, MBEDGE, "LAMBDA_CONTACT",
1718  CHKERR mField.set_field_order(0, MBVERTEX, "LAMBDA_CONTACT", 1);
1719  }
1720 
1721  CHKERR mField.build_fields(verb);
1722 
1724 }

◆ buildProblemFields()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildProblemFields ( const BitRefLevel bit1,
const BitRefLevel mask1,
const BitRefLevel bit2,
const int  verb = QUIET,
const bool  debug = false 
)

Build problem fields.

Parameters
bit1bit level for computational domain
mask1bit mask
bit2bit level for elements near crack front
mask2bit mask 2
verbverbosity level
debug
Returns
error code

Definition at line 9456 of file CrackPropagation.cpp.

9460  {
9462  CHKERR buildArcLengthField(bit1, false);
9463  CHKERR buildElasticFields(bit1, mask1, true, false, verb, debug);
9464  CHKERR buildSurfaceFields(bit2, true, false, QUIET, debug);
9465  CHKERR buildCrackSurfaceFieldId(bit2, true, false, QUIET, debug);
9466  CHKERR buildCrackFrontFieldId(bit2, false, QUIET, false);
9467  if (getInterface<CPMeshCut>()->getEdgesBlockSet())
9468  CHKERR buildEdgeFields(bit2, true, false, QUIET, false);
9469  if (doCutMesh != PETSC_TRUE) {
9470  CHKERR mField.build_fields(verb);
9471  } else {
9472  CHKERR buildBothSidesFieldId(bit1, bit2, false, false, QUIET, debug);
9473  CHKERR mField.build_fields(verb);
9474  }
9477 }

◆ buildProblemFiniteElements()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildProblemFiniteElements ( BitRefLevel  bit1,
BitRefLevel  bit2,
std::vector< int >  surface_ids,
const int  verb = QUIET,
const bool  debug = false 
)

Build problem finite elements.

Parameters
bit1bit level for computational domain
bit2bit level for elements near crack front
surface_idsmeshsets Ids on body skin
verbverbosity level
debug
Returns
error code

Definition at line 9480 of file CrackPropagation.cpp.

9482  {
9484 
9485  auto all_bits = []() { return BitRefLevel().set(); };
9486 
9487  auto get_edges_block_set = [this]() {
9488  return getInterface<CPMeshCut>()->getEdgesBlockSet();
9489  };
9490 
9491  CHKERR declareElasticFE(bit1, all_bits(), bit2, all_bits(), true);
9492  CHKERR declareArcLengthFE(bit1);
9493  CHKERR declareExternalForcesFE(bit1, all_bits());
9494  if (isSurfaceForceAle) {
9495  CHKERR declareSurfaceForceAleFE(bit2, all_bits());
9496  }
9497  if (isPressureAle) {
9498  CHKERR declarePressureAleFE(bit2, all_bits());
9499  }
9500  if (areSpringsAle) {
9501  CHKERR declareSpringsAleFE(bit2, all_bits());
9502  }
9503 
9504  CHKERR declareMaterialFE(bit2, all_bits(), false);
9505  CHKERR declareFrontFE(bit2, all_bits(), false);
9506  CHKERR declareSurfaceFE("SURFACE", bit2, all_bits(), surface_ids, true, verb,
9507  false);
9508  if (get_edges_block_set()) {
9509  CHKERR declareEdgeFE("EDGE", bit2, all_bits(), false, verb, debug);
9510  }
9511  CHKERR declareCrackSurfaceFE("CRACK_SURFACE", bit2, all_bits(), false, verb,
9512  debug);
9513  if (doCutMesh == PETSC_TRUE) {
9514  // declare mesh smoothing DM
9515  CHKERR declareBothSidesFE(bit1, bit2, all_bits(), false);
9516  CHKERR declareSmoothingFE(bit2, all_bits(), false);
9517  }
9518 
9519  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
9520  CHKERR declareSimpleContactAleFE(bit2, all_bits(), false);
9521  }
9523 }

◆ buildSurfaceFields()

MoFEMErrorCode FractureMechanics::CrackPropagation::buildSurfaceFields ( const BitRefLevel  bit,
const bool  proc_only = true,
const bool  build_fields = true,
const int  verb = QUIET,
const bool  debug = false 
)

build fields with Lagrange multipliers to constrain surfaces

Definition at line 1771 of file CrackPropagation.cpp.

1775  {
1776  moab::Interface &moab = mField.get_moab();
1777  MeshsetsManager *meshset_manager_ptr;
1779  CHKERR mField.getInterface(meshset_manager_ptr);
1780 
1781  Range level_tris;
1782  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1783  bit, BitRefLevel().set(), MBTRI, level_tris);
1784 
1785  Range body_skin_proc_tris;
1786  body_skin_proc_tris = intersect(bodySkin, level_tris);
1787 
1788  if (proc_only) {
1789  Range proc_tris;
1790  CHKERR moab.get_adjacencies(bitProcEnts, 2, false, proc_tris,
1791  moab::Interface::UNION);
1792  body_skin_proc_tris = intersect(body_skin_proc_tris, proc_tris);
1793  }
1794 
1795  if (debug) {
1796  EntityHandle meshset;
1797  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
1798  CHKERR mField.get_moab().add_entities(meshset, body_skin_proc_tris);
1799  std::string field_name;
1800  field_name = "out_proc_body_skin_" +
1801  boost::lexical_cast<std::string>(mField.get_comm_rank()) +
1802  ".vtk";
1803  CHKERR mField.get_moab().write_file(field_name.c_str(), "VTK", "", &meshset,
1804  1);
1805  CHKERR mField.get_moab().delete_entities(&meshset, 1);
1806  }
1807 
1808  std::string field_name =
1809  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(
1810  getInterface<CPMeshCut>()->getSkinOfTheBodyId());
1811  Range dofs_nodes;
1812  CHKERR moab.get_connectivity(body_skin_proc_tris, dofs_nodes, true);
1813  if (proc_only)
1814  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(dofs_nodes,
1815  QUIET);
1816 
1818  MB_TAG_SPARSE, MF_ZERO, verb);
1819 
1820  Range ents_to_remove;
1822  ents_to_remove = subtract(ents_to_remove, dofs_nodes);
1823  CHKERR mField.remove_ents_from_field(field_name, ents_to_remove, verb);
1824 
1825  CHKERR mField.add_ents_to_field_by_type(dofs_nodes, MBVERTEX, field_name,
1826  verb);
1827  CHKERR mField.set_field_order(dofs_nodes, field_name, 1, verb);
1828 
1829  if (build_fields) {
1830  CHKERR mField.build_fields(verb);
1831  }
1832 
1834 }

◆ calculateElasticEnergy()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateElasticEnergy ( DM  dm,
const std::string  msg = "" 
)

assemble elastic part of matrix, by running elastic finite element instance

Definition at line 7280 of file CrackPropagation.cpp.

7281  {
7283  if (!elasticFe)
7284  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
7285  "Elastic element instance not created");
7286 
7287  feEnergy = boost::make_shared<CrackFrontElement>(
7290 
7291  feEnergy->meshPositionsFieldName = "NONE";
7292  feRhs->addToRule = 0;
7293 
7294  if (!onlyHooke) {
7295 
7296  feEnergy->getOpPtrVector().push_back(
7297  new OpGetCrackFrontCommonDataAtGaussPts(
7298  "SPATIAL_POSITION", elasticFe->commonData,
7299  feEnergy->singularElement, feEnergy->invSJac));
7300  feEnergy->getOpPtrVector().push_back(
7302  "MESH_NODE_POSITIONS", elasticFe->commonData));
7303  feEnergy->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
7304  feEnergy->singularElement, feEnergy->detS, feEnergy->invSJac));
7305  map<int, NonlinearElasticElement::BlockData>::iterator sit =
7306  elasticFe->setOfBlocks.begin();
7307  for (; sit != elasticFe->setOfBlocks.end(); sit++) {
7308  feEnergy->getOpPtrVector().push_back(
7309  new NonlinearElasticElement::OpEnergy("SPATIAL_POSITION", sit->second,
7310  elasticFe->commonData,
7311  feEnergy->V, false));
7312  }
7313 
7314  } else {
7315 
7317  boost::shared_ptr<map<int, BlockData>> block_sets_ptr(
7318  elasticFe, &elasticFe->setOfBlocks);
7319 
7320  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
7321  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
7322  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr =
7323  data_hooke_element_at_pts->HMat;
7324  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr =
7325  data_hooke_element_at_pts->hMat;
7326 
7327  feEnergy->getOpPtrVector().push_back(
7329  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
7330 
7331  if (defaultMaterial == BONEHOOKE) { // hooke with heterogeneous stiffness
7332  if (!mwlsApprox) {
7333  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
7334  "mwlsApprox not allocated");
7335  }
7336  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr(new MatrixDouble());
7337  feEnergy->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
7338  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
7339  feEnergy->getOpPtrVector().push_back(
7340  new OpGetCrackFrontDataGradientAtGaussPts(
7341  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
7342  feEnergy->singularElement, feEnergy->invSJac));
7343  if (mwlsApprox->getUseGlobalBaseAtMaterialReferenceConfiguration())
7344  feEnergy->getOpPtrVector().push_back(
7345  new MWLSApprox::OpMWLSRhoAtGaussPts(
7346  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feEnergy,
7347  mwlsApprox, mwlsRhoTagName, true, false));
7348  else {
7349  feEnergy->getOpPtrVector().push_back(
7351  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feEnergy,
7352  mwlsApprox));
7353  feEnergy->getOpPtrVector().push_back(
7354  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
7355  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, feEnergy,
7356  mwlsApprox, mwlsRhoTagName, true, false));
7357  }
7358  feEnergy->getOpPtrVector().push_back(
7359  new HookeElement::OpCalculateStiffnessScaledByDensityField(
7360  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
7361  data_hooke_element_at_pts, mwlsApprox->rhoAtGaussPts, nBone,
7362  rHo0));
7363  feEnergy->getOpPtrVector().push_back(
7364  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
7365  "SPATIAL_POSITION",
7366  data_hooke_element_at_pts));
7367 
7368  feEnergy->getOpPtrVector().push_back(
7369  new HookeElement::OpCalculateStress<1>("SPATIAL_POSITION",
7370  "SPATIAL_POSITION",
7371  data_hooke_element_at_pts));
7372  } else { // hooke with homogeneous stiffness
7373 
7374  feEnergy->getOpPtrVector().push_back(
7375  new HookeElement::OpCalculateHomogeneousStiffness<0>(
7376  "SPATIAL_POSITION", "SPATIAL_POSITION", block_sets_ptr,
7377  data_hooke_element_at_pts));
7378  // Calculate spatial positions and gradients (of deformation) at
7379  // integration pts. This operator takes into account singularity at crack
7380  // front
7381  feEnergy->getOpPtrVector().push_back(
7382  new OpGetCrackFrontDataGradientAtGaussPts(
7383  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat,
7384  feEnergy->singularElement, feEnergy->invSJac));
7385  feEnergy->getOpPtrVector().push_back(
7386  new HookeElement::OpCalculateStrainAle("SPATIAL_POSITION",
7387  "SPATIAL_POSITION",
7388  data_hooke_element_at_pts));
7389  feEnergy->getOpPtrVector().push_back(
7390  new HookeElement::OpCalculateStress<0>("SPATIAL_POSITION",
7391  "SPATIAL_POSITION",
7392  data_hooke_element_at_pts));
7393  }
7394 
7395  feEnergy->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
7396  feEnergy->singularElement, feEnergy->detS, feEnergy->invSJac));
7397  feEnergy->getOpPtrVector().push_back(new HookeElement::OpCalculateEnergy(
7398  "SPATIAL_POSITION", "SPATIAL_POSITION", data_hooke_element_at_pts,
7399  feEnergy->V));
7400  }
7401 
7402  feEnergy->snes_ctx = SnesMethod::CTX_SNESNONE;
7403  feEnergy->eNergy = 0;
7404  CHKERR DMoFEMLoopFiniteElements(dm, "ELASTIC", feEnergy.get());
7405 
7406  if (msg.empty()) {
7407  PetscPrintf(PETSC_COMM_WORLD, "Elastic energy %8.8e\n", msg.c_str(),
7408  feEnergy->eNergy);
7409  } else {
7410  PetscPrintf(PETSC_COMM_WORLD, "%s Elastic energy %8.8e\n", msg.c_str(),
7411  feEnergy->eNergy);
7412  }
7414 }

◆ calculateFrontProjectionMatrix()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateFrontProjectionMatrix ( DM  dm_surface,
DM  dm_project,
const int  verb = QUIET,
const bool  debug = false 
)

assemble crack front projection matrix (that constrains crack area growth)

Definition at line 7637 of file CrackPropagation.cpp.

7638  {
7639  const MoFEM::Problem *prb_front_ptr;
7640  const MoFEM::Problem *prb_proj_ptr;
7642  CHKERR DMMoFEMGetProblemPtr(dm_front, &prb_front_ptr);
7643  if (prb_front_ptr->getNbDofsRow() == 0) {
7644  PetscPrintf(PETSC_COMM_WORLD, "No DOFs at crack front\n");
7646  }
7647  CHKERR DMMoFEMGetProblemPtr(dm_project, &prb_proj_ptr);
7648 
7649  projFrontCtx = boost::shared_ptr<ConstrainMatrixCtx>(new ConstrainMatrixCtx(
7650  mField, prb_proj_ptr->getName(), prb_front_ptr->getName(), true, true));
7651  projFrontCtx->cancelKSPMonitor = false;
7652 
7653  Mat Q;
7654  if (doSurfaceProjection) {
7655  int M, m;
7656  M = prb_proj_ptr->getNbDofsCol();
7657  m = prb_proj_ptr->getNbLocalDofsCol();
7658  CHKERR MatCreateShell(mField.get_comm(), m, m, M, M, projSurfaceCtx.get(),
7659  &Q);
7660  CHKERR MatShellSetOperation(Q, MATOP_MULT,
7661  (void (*)(void))ProjectionMatrixMultOpQ);
7662  }
7663 
7664  CHKERR DMCreateMatrix(dm_front, &projFrontCtx->C);
7665  CHKERR MatSetOption(projFrontCtx->C, MAT_NEW_NONZERO_LOCATIONS, PETSC_FALSE);
7666  CHKERR MatZeroEntries(projFrontCtx->C);
7667 
7668  // Set up const area constrain element and its operators
7669  ConstantArea constant_area(mField);
7670  constant_area.feLhsPtr = boost::shared_ptr<ConstantArea::MyTriangleFE>(
7671  new ConstantArea::MyTriangleFE(mField, constant_area.commonData,
7672  "LAMBDA_CRACKFRONT_AREA"));
7673  constant_area.feLhsPtr->petscB = projFrontCtx->C;
7674  if (doSurfaceProjection) {
7675  constant_area.feLhsPtr->petscQ = Q;
7676  } else {
7677  constant_area.feLhsPtr->petscQ = PETSC_NULL;
7678  }
7679  constant_area.feLhsPtr->getOpPtrVector().push_back(
7680  new ConstantArea::OpAreaJacobian(CONSTANT_AREA_TAG,
7681  constant_area.commonData));
7682  constant_area.feLhsPtr->getOpPtrVector().push_back(
7683  new ConstantArea::OpAreaC(CONSTANT_AREA_TAG, constant_area.commonData));
7684 
7685  // Set up tangent constrain element and its operators
7686  ConstantArea tangent_constrain(mField);
7687  tangent_constrain.feLhsPtr = boost::shared_ptr<ConstantArea::MyTriangleFE>(
7688  new ConstantArea::MyTriangleFE(mField, tangent_constrain.commonData,
7689  "LAMBDA_CRACKFRONT_AREA_TANGENT"));
7690  tangent_constrain.feLhsPtr->petscB = projFrontCtx->C;
7691  if (doSurfaceProjection) {
7692  tangent_constrain.feLhsPtr->petscQ = Q;
7693  } else {
7694  tangent_constrain.feLhsPtr->petscQ = PETSC_NULL;
7695  }
7696  tangent_constrain.feLhsPtr->getOpPtrVector().push_back(
7697  new ConstantArea::OpTangentJacobian(FRONT_TANGENT,
7698  tangent_constrain.commonData));
7699  tangent_constrain.feLhsPtr->getOpPtrVector().push_back(
7700  new ConstantArea::OpTangentC(FRONT_TANGENT,
7701  tangent_constrain.commonData));
7702  CHKERR MatZeroEntries(projFrontCtx->C);
7703  // Calculate constant area and tangent constrains
7704  CHKERR DMoFEMLoopFiniteElements(dm_front, "CRACKFRONT_AREA_ELEM",
7705  constant_area.feLhsPtr.get());
7706  CHKERR DMoFEMLoopFiniteElements(dm_front, "CRACKFRONT_AREA_TANGENT_ELEM",
7707  tangent_constrain.feLhsPtr.get());
7708  CHKERR MatAssemblyBegin(projFrontCtx->C, MAT_FINAL_ASSEMBLY);
7709  CHKERR MatAssemblyEnd(projFrontCtx->C, MAT_FINAL_ASSEMBLY);
7710 
7711  if (debug) {
7712  // MatView(projFrontCtx->C, PETSC_VIEWER_DRAW_WORLD);
7713  // std::string wait;
7714  // std::cin >> wait;
7715  MatView(projFrontCtx->C, PETSC_VIEWER_STDOUT_WORLD);
7716  PetscViewer viewer;
7717  PetscViewerASCIIOpen(PETSC_COMM_WORLD, "C.m", &viewer);
7718  PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_MATLAB);
7719  MatView(projFrontCtx->C, viewer);
7720  PetscViewerPopFormat(viewer);
7721  PetscViewerDestroy(&viewer);
7722  }
7723 
7724  if (doSurfaceProjection) {
7725  CHKERR MatDestroy(&Q);
7726  }
7727 
7729 }

◆ calculateGriffithForce()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateGriffithForce ( DM  dm,
const double  gc,
Vec  f_griffith,
const int  verb = QUIET,
const bool  debug = false 
)

calculate Griffith (driving) force

Definition at line 7962 of file CrackPropagation.cpp.

7965  {
7966  const MoFEM::Problem *problem_ptr;
7968 
7969  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
7970  CHKERR VecSetOption(f_griffith, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7971 
7972  boost::scoped_ptr<GriffithForceElement> griffith_force_element(
7973  new GriffithForceElement(mField));
7974  griffith_force_element->blockData[0].gc = gc;
7975  griffith_force_element->blockData[0].frontNodes = crackFrontNodes;
7977  griffith_force_element->blockData[0]);
7978  gC = griffith_force_element->blockData[0].gc;
7979 
7980  griffith_force_element->feRhs.getOpPtrVector().push_back(
7981  new GriffithForceElement::OpCalculateGriffithForce(
7982  GRIFFITH_FORCE_TAG, griffith_force_element->blockData[0],
7983  griffith_force_element->commonData));
7984  griffith_force_element->feRhs.getOpPtrVector().push_back(
7985  new GriffithForceElement::OpRhs(GRIFFITH_FORCE_TAG,
7986  griffith_force_element->blockData[0],
7987  griffith_force_element->commonData));
7988  griffith_force_element->feRhs.snes_f = f_griffith;
7989  CHKERR VecZeroEntries(f_griffith);
7990  CHKERR VecGhostUpdateBegin(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
7991  CHKERR VecGhostUpdateEnd(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
7992  CHKERR DMoFEMLoopFiniteElements(dm, "GRIFFITH_FORCE_ELEMENT",
7993  &griffith_force_element->feRhs);
7994  CHKERR VecAssemblyBegin(f_griffith);
7995  CHKERR VecAssemblyEnd(f_griffith);
7996  CHKERR VecGhostUpdateBegin(f_griffith, ADD_VALUES, SCATTER_REVERSE);
7997  CHKERR VecGhostUpdateEnd(f_griffith, ADD_VALUES, SCATTER_REVERSE);
7998  CHKERR VecGhostUpdateBegin(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
7999  CHKERR VecGhostUpdateEnd(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
8000 
8001  PostProcVertexMethod ent_method_griffith_force(mField, f_griffith,
8002  "GRIFFITH_FORCE");
8003  CHKERR VecGhostUpdateBegin(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
8004  CHKERR VecGhostUpdateEnd(f_griffith, INSERT_VALUES, SCATTER_FORWARD);
8005  CHKERR mField.loop_dofs(problem_ptr->getName(), "MESH_NODE_POSITIONS", COL,
8006  ent_method_griffith_force, 0, mField.get_comm_size());
8007 
8009 }

◆ calculateMaterialForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateMaterialForcesDM ( DM  dm,
Vec  q,
Vec  f,
const int  verb = QUIET,
const bool  debug = false 
)

assemble material forces, by running material finite element instance

Parameters
dmdm used to calculate material forces, sub-dm of dm_crack_propagation
qDoF sub-vector for crack propagation DM
fRhs sub-vector for crack propagation DM
verbcompilation parameter determining the amount of information printed
debugflag for debugging
Returns
error code

Definition at line 7416 of file CrackPropagation.cpp.

7418  {
7420  if (mwlsApprox) {
7421  mwlsApprox->F_lambda = PETSC_NULL;
7422  }
7423  feMaterialRhs->snes_f = f;
7424  feMaterialRhs->snes_ctx = FEMethod::CTX_SNESSETFUNCTION;
7425  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7426  CHKERR VecZeroEntries(f);
7427  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7428  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7429  // CHKERR setSingularElementMatrialPositions();
7430  CHKERR DMoFEMLoopFiniteElements(dm, "MATERIAL", feMaterialRhs.get());
7431  // CHKERR unsetSingularElementMatrialPositions();
7432 
7433 #ifdef __ANALITICAL_TRACTION__
7435  feMaterialAnaliticalTraction->snes_f = f;
7436  CHKERR DMoFEMLoopFiniteElements(dm, "ANALITICAL_METERIAL_TRACTION",
7438  }
7439 #endif // __ANALITICAL_TRACTION__
7440  CHKERR VecAssemblyBegin(f);
7441  CHKERR VecAssemblyEnd(f);
7442  CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
7443  CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
7444  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7445  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7446  if (debug) {
7447  CHKERR VecView(f, PETSC_VIEWER_STDOUT_WORLD);
7448  }
7449  const MoFEM::Problem *problem_ptr;
7450  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
7451  PostProcVertexMethod ent_method_material_force(mField, f, "MATERIAL_FORCE");
7452  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7453  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7454  CHKERR mField.loop_dofs(problem_ptr->getName(), "MESH_NODE_POSITIONS", ROW,
7455  ent_method_material_force, 0, mField.get_comm_size());
7456  PostProcVertexMethod ent_method_material_position(mField, q,
7457  "MESH_NODE_POSITIONS");
7458  CHKERR VecGhostUpdateBegin(q, INSERT_VALUES, SCATTER_FORWARD);
7459  CHKERR VecGhostUpdateEnd(q, INSERT_VALUES, SCATTER_FORWARD);
7460  CHKERR mField.loop_dofs(problem_ptr->getName(), "MESH_NODE_POSITIONS", ROW,
7461  ent_method_material_position, 0,
7462  mField.get_comm_size());
7463  if (debug) {
7464  if (mField.get_comm_rank() == 0) {
7465  EntityHandle meshset;
7466  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
7467  CHKERR mField.get_moab().add_entities(meshset, crackFront);
7468  CHKERR mField.get_moab().write_file("out_crack_front.vtk", "VTK", "",
7469  &meshset, 1);
7470  CHKERR mField.get_moab().delete_entities(&meshset, 1);
7471  }
7472  }
7474 }

◆ calculateReleaseEnergy()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateReleaseEnergy ( DM  dm,
Vec  f_material_proj,
Vec  f_griffith_proj,
Vec  f_lambda,
const double  gc,
const int  verb = QUIET,
const bool  debug = true 
)

calculate release energy

Definition at line 7731 of file CrackPropagation.cpp.

7733  {
7734  const MoFEM::Problem *prb_ptr;
7736  if (!projFrontCtx) {
7737  PetscPrintf(PETSC_COMM_WORLD, "No crack front projection data structure\n");
7739  }
7740 
7741  CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
7742 
7743  // R = CT*(CC^T)^(-1) [ unit m/m^(-2) = 1/m ] [ 0.5/0.25 = 2 ]
7744  // R^T = (CC^T)^(-T)C [ unit m/m^(-2) = 1/m ]
7745  int N, n;
7746  int M, m;
7747  CHKERR VecGetSize(f_material_proj, &N);
7748  CHKERR VecGetLocalSize(f_material_proj, &n);
7749  CHKERR VecGetSize(f_lambda, &M);
7750  CHKERR VecGetLocalSize(f_lambda, &m);
7751  Mat RT;
7752  CHKERR MatCreateShell(PETSC_COMM_WORLD, m, n, M, N, projFrontCtx.get(), &RT);
7753  CHKERR MatShellSetOperation(RT, MATOP_MULT,
7754  (void (*)(void))ConstrainMatrixMultOpRT);
7755 
7756  CHKERR projFrontCtx->initializeQorP(f_material_proj);
7757  CHKERR MatMult(RT, f_material_proj, f_lambda);
7758  CHKERR VecScale(f_lambda, -1);
7759  CHKERR VecGhostUpdateBegin(f_lambda, INSERT_VALUES, SCATTER_FORWARD);
7760  CHKERR VecGhostUpdateEnd(f_lambda, INSERT_VALUES, SCATTER_FORWARD);
7761 
7762  CHKERR MatDestroy(&RT);
7763 
7764  if (debug)
7765  CHKERR VecView(f_lambda, PETSC_VIEWER_STDOUT_WORLD);
7766 
7767  PostProcVertexMethod ent_method_g1(mField, f_lambda, "G1");
7768  PostProcVertexMethod ent_method_g3(mField, f_lambda, "G3");
7769  CHKERR mField.loop_dofs(prb_ptr->getName(), "LAMBDA_CRACKFRONT_AREA", ROW,
7770  ent_method_g1, 0, mField.get_comm_size());
7771  CHKERR mField.loop_dofs(prb_ptr->getName(), "LAMBDA_CRACKFRONT_AREA_TANGENT",
7772  ROW, ent_method_g3, 0, mField.get_comm_size());
7773 
7774  mapG1.clear();
7775  mapG3.clear();
7776  mapJ.clear();
7777  mapMatForce.clear();
7778  mapGriffith.clear();
7779  {
7780  double *a_lambda;
7781  CHKERR VecGetArray(f_lambda, &a_lambda);
7782  auto it = prb_ptr->getNumeredRowDofsPtr()
7783  ->get<PetscLocalIdx_mi_tag>()
7784  .lower_bound(0);
7785  auto hi_it = prb_ptr->getNumeredRowDofsPtr()
7786  ->get<PetscLocalIdx_mi_tag>()
7787  .upper_bound(prb_ptr->getNbLocalDofsRow() - 1);
7788  for (; it != hi_it; ++it) {
7789  double val = a_lambda[it->get()->getPetscLocalDofIdx()];
7790  if (!std::isnormal(val)) {
7791  SETERRQ1(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE,
7792  "Value vector is not a number val = %3.4f", val);
7793  }
7794  if (it->get()->getName() == "LAMBDA_CRACKFRONT_AREA") {
7795  mapG1[it->get()->getEnt()] = val;
7796  } else if (it->get()->getName() == "LAMBDA_CRACKFRONT_AREA_TANGENT") {
7797  mapG3[it->get()->getEnt()] = val;
7798  } else {
7800  "Should not happen");
7801  }
7802  }
7803  CHKERR VecRestoreArray(f_lambda, &a_lambda);
7804  }
7805  {
7806  Vec f_mat_scat, f_griffith_scat;
7807  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(prb_ptr->getName(),
7808  COL, &f_mat_scat);
7809  CHKERR VecDuplicate(f_mat_scat, &f_griffith_scat);
7810  CHKERR VecScatterBegin(projFrontCtx->sCatter, f_material_proj, f_mat_scat,
7811  INSERT_VALUES, SCATTER_FORWARD);
7812  CHKERR VecScatterEnd(projFrontCtx->sCatter, f_material_proj, f_mat_scat,
7813  INSERT_VALUES, SCATTER_FORWARD);
7814  CHKERR VecScatterBegin(projFrontCtx->sCatter, f_griffith_proj,
7815  f_griffith_scat, INSERT_VALUES, SCATTER_FORWARD);
7816  CHKERR VecScatterEnd(projFrontCtx->sCatter, f_griffith_proj,
7817  f_griffith_scat, INSERT_VALUES, SCATTER_FORWARD);
7818  CHKERR VecGhostUpdateBegin(f_mat_scat, INSERT_VALUES, SCATTER_FORWARD);
7819  CHKERR VecGhostUpdateEnd(f_mat_scat, INSERT_VALUES, SCATTER_FORWARD);
7820  CHKERR VecGhostUpdateBegin(f_griffith_scat, INSERT_VALUES, SCATTER_FORWARD);
7821  CHKERR VecGhostUpdateEnd(f_griffith_scat, INSERT_VALUES, SCATTER_FORWARD);
7822  double *a_material, *a_griffith;
7823  CHKERR VecGetArray(f_mat_scat, &a_material);
7824  CHKERR VecGetArray(f_griffith_scat, &a_griffith);
7825  auto it = prb_ptr->getNumeredColDofsPtr()
7826  ->get<PetscLocalIdx_mi_tag>()
7827  .lower_bound(0);
7828  auto hi_it = prb_ptr->getNumeredColDofsPtr()
7829  ->get<PetscLocalIdx_mi_tag>()
7830  .upper_bound(prb_ptr->getNbLocalDofsCol() - 1);
7831  for (; it != hi_it; it++) {
7832  if (it->get()->getName() == "MESH_NODE_POSITIONS") {
7833  EntityHandle ent = it->get()->getEnt();
7834  mapMatForce[ent].resize(3);
7835  mapMatForce[ent][it->get()->getDofCoeffIdx()] =
7836  a_material[it->get()->getPetscLocalDofIdx()];
7837  mapGriffith[ent].resize(3);
7838  mapGriffith[ent][it->get()->getDofCoeffIdx()] =
7839  a_griffith[it->get()->getPetscLocalDofIdx()];
7840  } else {
7842  "Should not happen");
7843  }
7844  }
7845  CHKERR VecRestoreArray(f_mat_scat, &a_material);
7846  CHKERR VecRestoreArray(f_griffith_scat, &a_griffith);
7847  CHKERR VecDestroy(&f_mat_scat);
7848  CHKERR VecDestroy(&f_griffith_scat);
7849  }
7850  maxG1 = 0;
7851  maxJ = 0;
7852  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
7853  mit != mapG1.end(); mit++) {
7854  EntityHandle ent = mit->first;
7855  double g1 = mit->second;
7856  maxG1 = fmax(maxG1, g1);
7857  double g3 = mapG3[ent];
7858  double j = norm_2(mapMatForce[ent]) /
7859  (norm_2(mapGriffith[ent]) / (gc > 0 ? gc : 1));
7860  mapJ[ent] = j;
7861  maxJ = fmax(maxJ, j);
7862  double g2 = sqrt(fabs(j * j - g1 * g1 - g3 * g3));
7863  double coords[3];
7864  rval = mField.get_moab().get_coords(&ent, 1, coords);
7865  ostringstream ss;
7866  ss << "griffith force at ent ";
7867  ss << setw(5) << ent;
7868  // coords
7869  ss << "\tcoords";
7870  ss << " " << setw(10) << setprecision(4) << coords[0];
7871  ss << " " << setw(10) << setprecision(4) << coords[1];
7872  ss << " " << setw(10) << setprecision(4) << coords[2];
7873  // g1
7874  ss << "\t\tg1 " << scientific << setprecision(6) << g1;
7875  ss << " / " << scientific << setprecision(6) << j;
7876  ss << " ( " << scientific << setprecision(6) << g1 / j << " )";
7877  // g1
7878  ss << "\t\tg2 " << scientific << setprecision(6) << g2;
7879  ss << " ( " << scientific << setprecision(6) << g2 / j << " )";
7880  // g3
7881  ss << "\t\tg3 " << scientific << setprecision(6) << g3;
7882  ss << " ( " << scientific << setprecision(6) << g3 / j << " )";
7883  if (gc > 0) {
7884  ss << "\t relative error (gc-g)/gc ";
7885  ss << scientific << setprecision(6) << (gc - g1) / gc;
7886  ss << " / " << scientific << setprecision(6) << (gc - j) / gc;
7887  }
7888 
7889  MOFEM_LOG("CPWorld", Sev::inform) << ss.str();
7890  }
7891 
7893 
7894  Vec vec_max;
7895  CHKERR VecCreateMPI(mField.get_comm(), 1, mField.get_comm_size(), &vec_max);
7896  CHKERR VecSetValue(vec_max, mField.get_comm_rank(), maxG1, INSERT_VALUES);
7897  CHKERR VecMax(vec_max, PETSC_NULL, &maxG1);
7898  CHKERR VecSetValue(vec_max, mField.get_comm_rank(), maxJ, INSERT_VALUES);
7899  CHKERR VecMax(vec_max, PETSC_NULL, &maxJ);
7900  CHKERR VecDestroy(&vec_max);
7901 
7902  MOFEM_LOG_C("CPWorld", Sev::inform, "max g1 = %6.4e max J = %6.4e", maxG1,
7903  maxJ);
7904 
7906 }

◆ calculateSmoothingForceFactor()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateSmoothingForceFactor ( const int  verb = QUIET,
const bool  debug = true 
)

Definition at line 7524 of file CrackPropagation.cpp.

7525  {
7527  if (!feSmootherRhs)
7528  PetscFunctionReturn(0);
7529  auto get_tag_data = [this](std::string tag_name) {
7530  Tag th;
7531  CHKERR mField.get_moab().tag_get_handle(tag_name.c_str(), th);
7532  std::vector<double> data(crackFrontNodes.size() * 3);
7533  CHKERR mField.get_moab().tag_get_data(th, crackFrontNodes, &*data.begin());
7534  return data;
7535  };
7536  auto griffith_force = get_tag_data("GRIFFITH_FORCE");
7537  auto smoothing_force = get_tag_data("SMOOTHING_FORCE");
7538 
7539  auto get_node_tensor = [](std::vector<double> &data) {
7541  &data[0], &data[1], &data[2]);
7542  };
7543  auto t_griffith_force = get_node_tensor(griffith_force);
7544  auto t_smoothing_force = get_node_tensor(smoothing_force);
7545 
7546  mapSmoothingForceFactor.clear();
7547  for (auto v : crackFrontNodes) {
7548  auto get_magnitude = [](auto t) {
7550  return sqrt(t(i) * t(i));
7551  };
7552  const double griffith_mgn = get_magnitude(t_griffith_force);
7553  const double smoothing_mg = get_magnitude(t_smoothing_force);
7554  mapSmoothingForceFactor[v] = smoothing_mg / griffith_mgn;
7555  PetscPrintf(mField.get_comm(), "Node smoothing force fraction %ld %6.4e\n",
7557  ++t_griffith_force;
7558  ++t_smoothing_force;
7559  }
7561 }

◆ calculateSmoothingForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateSmoothingForcesDM ( DM  dm,
Vec  q,
Vec  f,
const int  verb = QUIET,
const bool  debug = false 
)

assemble smoothing forces, by running material finite element instance

Parameters
dmcrack propagation dm that is composition of elastic DM and material DM
qDoF sub-vector for crack propagation DM
fRhs sub-vector for crack propagation DM
verbcompilation parameter determining the amount of information printed
debugflag for debugging
Returns
error code

Definition at line 7476 of file CrackPropagation.cpp.

7478  {
7480  if (!feSmootherRhs)
7481  PetscFunctionReturn(0);
7482  feSmootherRhs->snes_f = f;
7483  feSmootherRhs->snes_ctx = FEMethod::CTX_SNESSETFUNCTION;
7484  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
7485  CHKERR VecZeroEntries(f);
7486  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7487  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7488  // volumeLengthDouble->tYpe = BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME;
7489  // volumeLengthAdouble->tYpe = BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME;
7490  CHKERR DMoFEMLoopFiniteElements(dm, "SMOOTHING", feSmootherRhs);
7491 
7492  CHKERR VecAssemblyBegin(f);
7493  CHKERR VecAssemblyEnd(f);
7494  CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
7495  CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
7496  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7497  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7498  if (debug) {
7499  CHKERR VecView(f, PETSC_VIEWER_STDOUT_WORLD);
7500  }
7501  const MoFEM::Problem *problem_ptr;
7502  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
7503  PostProcVertexMethod ent_method_material_smoothing(mField, f,
7504  "SMOOTHING_FORCE");
7505  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
7506  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
7507  CHKERR mField.loop_dofs(problem_ptr->getName(), "MESH_NODE_POSITIONS", ROW,
7508  ent_method_material_smoothing, 0,
7509  mField.get_comm_size());
7510  if (debug) {
7511  if (mField.get_comm_rank() == 0) {
7512  EntityHandle meshset;
7513  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
7514  CHKERR mField.get_moab().add_entities(meshset, crackFront);
7515  CHKERR mField.get_moab().write_file("out_crack_front.vtk", "VTK", "",
7516  &meshset, 1);
7517  CHKERR mField.get_moab().delete_entities(&meshset, 1);
7518  }
7519  }
7521 }

◆ calculateSurfaceProjectionMatrix()

MoFEMErrorCode FractureMechanics::CrackPropagation::calculateSurfaceProjectionMatrix ( DM  dm_front,
DM  dm_project,
const std::vector< int > &  ids,
const int  verb = QUIET,
const bool  debug = false 
)

assemble projection matrices

Definition at line 7563 of file CrackPropagation.cpp.

7565  {
7566  const MoFEM::Problem *prb_surf_ptr;
7567  const MoFEM::Problem *prb_proj_ptr;
7569  CHKERR DMMoFEMGetProblemPtr(dm_surface, &prb_surf_ptr);
7570  CHKERR DMMoFEMGetProblemPtr(dm_project, &prb_proj_ptr);
7571 
7572  projSurfaceCtx = boost::shared_ptr<ConstrainMatrixCtx>(new ConstrainMatrixCtx(
7573  mField, prb_proj_ptr->getName(), prb_surf_ptr->getName(), true, true));
7574  projSurfaceCtx->cancelKSPMonitor = false;
7575 
7576  if (prb_surf_ptr->getNbDofsRow() == 0) {
7577  doSurfaceProjection = false;
7579  }
7580  doSurfaceProjection = true;
7581 
7582  CHKERR DMCreateMatrix(dm_surface, &projSurfaceCtx->C);
7583  // CHKERR DMDestroy(&dm_surface); /// Destroy DM. In DMCreateMatrix reference
7584  // count is bumped up.
7585  CHKERR MatSetOption(projSurfaceCtx->C, MAT_NEW_NONZERO_LOCATION_ERR,
7586  PETSC_TRUE);
7587  CHKERR MatSetOption(projSurfaceCtx->C, MAT_NEW_NONZERO_ALLOCATION_ERR,
7588  PETSC_TRUE);
7589  CHKERR MatZeroEntries(projSurfaceCtx->C);
7590 
7591  Range contact_faces;
7592  contact_faces.merge(contactSlaveFaces);
7593  contact_faces.merge(contactMasterFaces);
7594 
7595  // Calculate and assemble constrain matrix
7596  for (auto id : ids) {
7597  bool crack_surface =
7598  (id == getInterface<CPMeshCut>()->getCrackSurfaceId()) ? true : false;
7599  FaceOrientation orientation(crack_surface, contact_faces,
7600  mapBitLevel["mesh_cut"]);
7601  SurfaceSlidingConstrains surface_constrain(mField, orientation);
7602  surface_constrain.setOperatorsConstrainOnly(
7604  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(id),
7605  "MESH_NODE_POSITIONS");
7606  std::string fe_name = (id == getInterface<CPMeshCut>()->getCrackSurfaceId())
7607  ? "CRACK_SURFACE"
7608  : "SURFACE";
7609  surface_constrain.feLhs.snes_B = projSurfaceCtx->C;
7610  CHKERR DMoFEMLoopFiniteElements(dm_surface, fe_name.c_str(),
7611  &surface_constrain.feLhs);
7612  }
7613 
7614  auto get_edges_block_set = [this]() {
7615  return getInterface<CPMeshCut>()->getEdgesBlockSet();
7616  };
7617  if (get_edges_block_set()) {
7618  EdgeSlidingConstrains edge_constrains(mField);
7619  edge_constrains.setOperatorsConstrainOnly(EDGE_SLIDING_TAG, "LAMBDA_EDGE",
7620  "MESH_NODE_POSITIONS");
7621  edge_constrains.feLhs.snes_B = projSurfaceCtx->C;
7622  CHKERR DMoFEMLoopFiniteElements(dm_surface, "EDGE", &edge_constrains.feLhs);
7623  }
7624 
7625  CHKERR MatAssemblyBegin(projSurfaceCtx->C, MAT_FINAL_ASSEMBLY);
7626  CHKERR MatAssemblyEnd(projSurfaceCtx->C, MAT_FINAL_ASSEMBLY);
7627  if (debug) {
7628  MatView(projSurfaceCtx->C, PETSC_VIEWER_DRAW_WORLD);
7629  std::string wait;
7630  std::cin >> wait;
7631  MatView(projSurfaceCtx->C, PETSC_VIEWER_STDOUT_WORLD);
7632  }
7633 
7635 }

◆ cleanSingularElementMatrialPositions()

MoFEMErrorCode FractureMechanics::CrackPropagation::cleanSingularElementMatrialPositions ( )

set maetrial field order to one

Definition at line 9404 of file CrackPropagation.cpp.

9404  {
9405  // const DofEntity_multiIndex *dofs_ptr;
9407  ierr = mField.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS", 1);
9408  CHKERRQ(ierr);
9409  // ierr = mField.clear_inactive_dofs(); CHKERRQ(ierr);
9411 }

◆ createBcDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createBcDM ( SmartPetscObj< DM > &  dm,
const std::string  prb_name,
const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set() 
)

Create problem to calculate boundary conditions.

Parameters
dmnewly created boundary condition DM
prb_nameproblem name
bitauxiliary bit ref level
maskmask ref level for problem
Returns
error code
Note
BcDM is only useed for testing, to enforce boundary conditions staisifing anlylitical solution to which numerical solution is compared.

Definition at line 3625 of file CrackPropagation.cpp.

3628  {
3629  ProblemsManager *prb_mng_ptr;
3630  MeshsetsManager *meshset_manager_ptr;
3632  CHKERR mField.getInterface(prb_mng_ptr);
3633  CHKERR mField.getInterface(meshset_manager_ptr);
3635 #ifdef __ANALITICAL_DISPLACEMENT__
3636  if (meshset_manager_ptr->checkMeshset("ANALITICAL_DISP")) {
3637  const CubitMeshSets *cubit_meshset_ptr;
3638  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_DISP",
3639  &cubit_meshset_ptr);
3640  Range tris;
3641  CHKERR meshset_manager_ptr->getEntitiesByDimension(
3642  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, tris, true);
3643  if (!tris.empty()) {
3644  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3645  CHKERR DMMoFEMCreateMoFEM(dm, &mField, prb_name.c_str(), bit, mask);
3646  CHKERR DMMoFEMAddElement(dm, "BC_FE");
3647  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3648  mField.getInterface<ProblemsManager>()->synchroniseProblemEntities =
3649  PETSC_TRUE;
3650  CHKERR DMSetUp(dm);
3651  mField.getInterface<ProblemsManager>()->synchroniseProblemEntities =
3652  PETSC_FALSE;
3653  }
3654  }
3655 #endif //__ANALITICAL_DISPLACEMENT__
3657 }

◆ createCrackFrontAreaDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createCrackFrontAreaDM ( SmartPetscObj< DM > &  dm,
SmartPetscObj< DM >  dm_material,
const std::string  prb_name,
const bool  verb = QUIET 
)

create DM to calculate Griffith energy

Parameters
dmdm to project material forces on crack surfaces, sub-dm of dm_crack_propagation
dm_materialmaterial DM
prb_nameproblem name
verbcompilation parameter determining the amount of information printed
Returns
error code

Definition at line 3776 of file CrackPropagation.cpp.

3778  {
3780  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3781  CHKERR DMMoFEMSetVerbosity(dm, verb);
3782  CHKERR DMMoFEMCreateSubDM(dm, dm_material, prb_name.c_str());
3783  CHKERR DMMoFEMAddSubFieldRow(dm, "LAMBDA_CRACKFRONT_AREA");
3784  CHKERR DMMoFEMAddSubFieldRow(dm, "LAMBDA_CRACKFRONT_AREA_TANGENT");
3785  CHKERR DMMoFEMAddSubFieldCol(dm, "MESH_NODE_POSITIONS");
3786  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_ELEM");
3787  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_TANGENT_ELEM");
3788  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_FALSE);
3789  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3790  CHKERR DMSetUp(dm);
3792 }

◆ createCrackPropagationDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createCrackPropagationDM ( SmartPetscObj< DM > &  dm,
const std::string  prb_name,
SmartPetscObj< DM >  dm_elastic,
SmartPetscObj< DM >  dm_material,
const BitRefLevel  bit,
const BitRefLevel  mask,
const std::vector< std::string >  fe_list 
)

Create DM by composition of elastic DM and material DM.

Parameters
dmcomposition of elastic DM and material DM
prb_nameproblem name
dm_elasticelastic DM
dm_materialmaterial DM
bitdomain bit ref level
maskmask ref level for problem
Returns
error code

Definition at line 3431 of file CrackPropagation.cpp.

3435  {
3436  const MoFEM::Problem *prb_elastic_ptr;
3437  const MoFEM::Problem *prb_material_ptr;
3439  CHKERR DMMoFEMGetProblemPtr(dm_elastic, &prb_elastic_ptr);
3440  CHKERR DMMoFEMGetProblemPtr(dm_material, &prb_material_ptr);
3441  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3442  CHKERR DMMoFEMCreateMoFEM(dm, &mField, prb_name.c_str(), bit, mask);
3443 
3444  CHKERR DMMoFEMAddElement(dm, "ELASTIC");
3445  CHKERR DMMoFEMAddElement(dm, "ELASTIC_NOT_ALE");
3446  CHKERR DMMoFEMAddElement(dm, "SPRING");
3447  CHKERR DMMoFEMAddElement(dm, "CONTACT");
3448  CHKERR DMMoFEMAddElement(dm, "MORTAR_CONTACT");
3449  CHKERR DMMoFEMAddElement(dm, "CONTACT_POST_PROC");
3450  CHKERR DMMoFEMAddElement(dm, "SKIN"); // for postprocessing
3451  CHKERR DMMoFEMAddElement(dm, "ARC_LENGTH");
3452  CHKERR DMMoFEMAddElement(dm, "FORCE_FE");
3453  CHKERR DMMoFEMAddElement(dm, "PRESSURE_FE");
3454 
3455  if (isSurfaceForceAle) {
3456  CHKERR DMMoFEMAddElement(dm, "FORCE_FE_ALE");
3457  }
3458  if (isPressureAle) {
3459  CHKERR DMMoFEMAddElement(dm, "PRESSURE_ALE");
3460  }
3461  if (areSpringsAle) {
3462  CHKERR DMMoFEMAddElement(dm, "SPRING_ALE");
3463  }
3464  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
3465  CHKERR DMMoFEMAddElement(dm, "SIMPLE_CONTACT_ALE");
3466  CHKERR DMMoFEMAddElement(dm, "MAT_CONTACT");
3467  }
3468  CHKERR DMMoFEMAddElement(dm, "MATERIAL");
3469 
3470  CHKERR DMMoFEMAddElement(dm, "GRIFFITH_FORCE_ELEMENT");
3471  for (std::vector<std::string>::const_iterator it = fe_list.begin();
3472  it != fe_list.end(); it++)
3473  CHKERR DMMoFEMAddElement(dm, it->c_str());
3474 
3475  CHKERR DMMoFEMAddElement(dm, "CRACK_SURFACE");
3476  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_ELEM");
3477  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_TANGENT_ELEM");
3478 #ifdef __ANALITICAL_TRACTION__
3479  CHKERR DMMoFEMAddElement(dm, "ANALITICAL_METERIAL_TRACTION");
3480 #endif
3481  if (mField.check_finite_element("SMOOTHING"))
3482  CHKERR DMMoFEMAddElement(dm, "SMOOTHING");
3483 
3484  if (mField.check_finite_element("EDGE"))
3485  CHKERR DMMoFEMAddElement(dm, "EDGE");
3486 
3487  if (mField.check_finite_element("BOTH_SIDES_OF_CRACK"))
3488  CHKERR DMMoFEMAddElement(dm, "BOTH_SIDES_OF_CRACK");
3489 
3490  if (mField.check_finite_element("BOTH_SIDES_OF_CONTACT"))
3491  CHKERR DMMoFEMAddElement(dm, "BOTH_SIDES_OF_CONTACT");
3492 
3493  CHKERR DMMoFEMAddRowCompositeProblem(dm, prb_elastic_ptr->getName().c_str());
3494  CHKERR DMMoFEMAddRowCompositeProblem(dm, prb_material_ptr->getName().c_str());
3495  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3496  CHKERR DMSetUp(dm);
3497 
3498  // Create material section. This is used by field split solver and snes
3499  // monitor
3500  PetscSection section;
3501  CHKERR mField.getInterface<ISManager>()->sectionCreate(prb_name, &section);
3502  CHKERR DMSetDefaultSection(dm, section);
3503  CHKERR DMSetDefaultGlobalSection(dm, section);
3504  // CHKERR PetscSectionView(section,PETSC_VIEWER_STDOUT_WORLD);
3505  CHKERR PetscSectionDestroy(&section);
3506 
3508 }

◆ createDMs()

MoFEMErrorCode FractureMechanics::CrackPropagation::createDMs ( SmartPetscObj< DM > &  dm_elastic,
SmartPetscObj< DM > &  dm_eigen_elastic,
SmartPetscObj< DM > &  dm_material,
SmartPetscObj< DM > &  dm_crack_propagation,
SmartPetscObj< DM > &  dm_material_forces,
SmartPetscObj< DM > &  dm_surface_projection,
SmartPetscObj< DM > &  dm_crack_srf_area,
std::vector< int >  surface_ids,
std::vector< std::string >  fe_surf_proj_list 
)

Crate DMs for all problems and sub problems.

Parameters
dm_elasticelastic DM
dm_eiegn_elastcieigen_elastic DM to solve proble wih eigen stresses
dm_materialmaterial DM
dm_crack_propagationcomposition of elastic DM and material DM
dm_material_forcesused to calculate material forces, sub-dm of dm_crack_propagation
dm_surface_projectiondm to project material forces on surfaces, sub-dm of dm_crack_propagation
dm_crack_srf_areadm to project material forces on crack surfaces, sub-dm of dm_crack_propagation
surface_idsIDs of surface meshsets
fe_surf_proj_listname of elements on surface elements
Returns
error code

Definition at line 9571 of file CrackPropagation.cpp.

9577  {
9579 
9580  BitRefLevel bit1 = mapBitLevel["spatial_domain"];
9581  BitRefLevel bit2 = mapBitLevel["material_domain"];
9582 
9583  // Create elastic dm to solve spatial problem
9584  CHKERR createElasticDM(dm_elastic, "ELASTIC", bit1, BitRefLevel().set());
9586  CHKERR createEigenElasticDM(dm_eigen_elastic, "EIGEN_ELASTIC", bit1,
9587  BitRefLevel().set());
9588  }
9589 
9590  // Create material dm to solve material problem
9591  CHKERR createMaterialDM(dm_material, "MATERIAL", bit2, BitRefLevel().set(),
9592  fe_surf_proj_list, false);
9593  CHKERR createCrackPropagationDM(dm_crack_propagation, "CRACK_PROPAGATION",
9594  dm_elastic, dm_material, bit1,
9595  BitRefLevel().set(), fe_surf_proj_list);
9596  CHKERR createMaterialForcesDM(dm_material_forces, dm_crack_propagation,
9597  "MATERIAL_FORCES", QUIET);
9598  CHKERR createSurfaceProjectionDM(dm_surface_projection, dm_crack_propagation,
9599  "SURFACE_PROJECTION", surface_ids,
9600  fe_surf_proj_list, QUIET);
9601  CHKERR createCrackFrontAreaDM(dm_crack_srf_area, dm_crack_propagation,
9602  "CRACK_SURFACE_AREA", QUIET);
9603  CHKERR DMMoFEMSetDestroyProblem(dm_elastic, PETSC_TRUE);
9605  CHKERR DMMoFEMSetDestroyProblem(dm_eigen_elastic, PETSC_TRUE);
9606  }
9607  CHKERR DMMoFEMSetDestroyProblem(dm_material, PETSC_TRUE);
9608  CHKERR DMMoFEMSetDestroyProblem(dm_crack_propagation, PETSC_TRUE);
9609  CHKERR DMMoFEMSetDestroyProblem(dm_material_forces, PETSC_TRUE);
9610  CHKERR DMMoFEMSetDestroyProblem(dm_surface_projection, PETSC_TRUE);
9611  CHKERR DMMoFEMSetDestroyProblem(dm_crack_srf_area, PETSC_TRUE);
9613 }

◆ createEigenElasticDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createEigenElasticDM ( SmartPetscObj< DM > &  dm,
const std::string  prb_name,
const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set() 
)

Create elastic problem DM.

Parameters
dmelastic DM
prb_nameproblem name
bitdomain bit ref level
maskmask ref level for problem
Returns
error code

Definition at line 3562 of file CrackPropagation.cpp.

3564  {
3565  ProblemsManager *prb_mng_ptr;
3567  CHKERR mField.getInterface(prb_mng_ptr);
3569  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3570  CHKERR DMMoFEMCreateMoFEM(dm, &mField, prb_name.c_str(), bit, mask);
3571  CHKERR DMMoFEMAddElement(dm, "ELASTIC");
3572  CHKERR DMMoFEMAddElement(dm, "SPRING");
3573  CHKERR DMMoFEMAddElement(dm, "CONTACT");
3574  CHKERR DMMoFEMAddElement(dm, "MORTAR_CONTACT");
3575  CHKERR DMMoFEMAddElement(dm, "CONTACT_POST_PROC");
3576  CHKERR DMMoFEMAddElement(dm, "SKIN");
3577  CHKERR DMMoFEMAddElement(dm, "ARC_LENGTH");
3578  CHKERR DMMoFEMAddElement(dm, "FORCE_FE");
3579  CHKERR DMMoFEMAddElement(dm, "PRESSURE_FE");
3580  CHKERR DMMoFEMAddElement(dm, "CLOSE_CRACK");
3581 #ifdef __ANALITICAL_TRACTION__
3582  CHKERR DMMoFEMAddElement(dm, "ANALITICAL_TRACTION");
3583 #endif
3584 
3585  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3586  mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_TRUE;
3587 
3588  CHKERR DMSetUp(dm);
3589 
3590  auto remove_higher_dofs_than_approx_dofs_from_eigen_elastic = [&]() {
3592  Range ents;
3593  CHKERR mField.get_moab().get_entities_by_handle(0, ents, true);
3594  auto prb_mng = mField.getInterface<ProblemsManager>();
3595  CHKERR prb_mng->removeDofsOnEntities("EIGEN_ELASTIC", "SPATIAL_POSITION",
3596  ents, 0, 3, approxOrder + 1, 100);
3598  };
3599  CHKERR remove_higher_dofs_than_approx_dofs_from_eigen_elastic();
3600 
3601  // Create material section. This is used by field split solver and snes
3602  // monitor
3603  PetscSection section;
3604  CHKERR mField.getInterface<ISManager>()->sectionCreate(prb_name, &section);
3605  CHKERR DMSetDefaultSection(dm, section);
3606  CHKERR DMSetDefaultGlobalSection(dm, section);
3607  // CHKERR PetscSectionView(section,PETSC_VIEWER_STDOUT_WORLD);
3608  CHKERR PetscSectionDestroy(&section);
3609 
3610  mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_FALSE;
3611 
3612  // Setting arc-length control
3613  const MoFEM::Problem *problem_ptr;
3614  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
3615  arcEigenCtx = boost::make_shared<ArcLengthCtx>(mField, problem_ptr->getName(),
3616  "LAMBDA_ARC_LENGTH");
3617  CHKERR arcEigenCtx->setAlphaBeta(0, 1);
3618  auto arc_snes_ctx = boost::make_shared<ArcLengthSnesCtx>(
3619  mField, problem_ptr->getName(), arcEigenCtx);
3620  CHKERR DMMoFEMSetSnesCtx(dm, arc_snes_ctx);
3621 
3623 }

◆ createElasticDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createElasticDM ( SmartPetscObj< DM > &  dm,
const std::string  prb_name,
const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set() 
)

Create elastic problem DM.

Parameters
dmelastic DM
prb_nameproblem name
bitdomain bit ref level
maskmask ref level for problem
Returns
error code

Definition at line 3510 of file CrackPropagation.cpp.

3513  {
3514  ProblemsManager *prb_mng_ptr;
3516  CHKERR mField.getInterface(prb_mng_ptr);
3518  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3519  CHKERR DMMoFEMCreateMoFEM(dm, &mField, prb_name.c_str(), bit, mask);
3520  CHKERR DMMoFEMAddElement(dm, "ELASTIC");
3521  CHKERR DMMoFEMAddElement(dm, "SPRING");
3522  CHKERR DMMoFEMAddElement(dm, "CONTACT");
3523  CHKERR DMMoFEMAddElement(dm, "MORTAR_CONTACT");
3524  CHKERR DMMoFEMAddElement(dm, "CONTACT_POST_PROC");
3525  CHKERR DMMoFEMAddElement(dm, "SKIN");
3526  CHKERR DMMoFEMAddElement(dm, "ARC_LENGTH");
3527  CHKERR DMMoFEMAddElement(dm, "FORCE_FE");
3528  CHKERR DMMoFEMAddElement(dm, "PRESSURE_FE");
3529 #ifdef __ANALITICAL_TRACTION__
3530  CHKERR DMMoFEMAddElement(dm, "ANALITICAL_TRACTION");
3531 #endif
3532 
3533  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3534  mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_TRUE;
3535 
3536  CHKERR DMSetUp(dm);
3537 
3538  // Create material section. This is used by field split solver and snes
3539  // monitor
3540  PetscSection section;
3541  CHKERR mField.getInterface<ISManager>()->sectionCreate(prb_name, &section);
3542  CHKERR DMSetDefaultSection(dm, section);
3543  CHKERR DMSetDefaultGlobalSection(dm, section);
3544  // CHKERR PetscSectionView(section,PETSC_VIEWER_STDOUT_WORLD);
3545  CHKERR PetscSectionDestroy(&section);
3546 
3547  mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_FALSE;
3548 
3549  // Setting arc-length control
3550  const MoFEM::Problem *problem_ptr;
3551  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
3552  arcCtx = boost::make_shared<ArcLengthCtx>(mField, problem_ptr->getName(),
3553  "LAMBDA_ARC_LENGTH");
3554  CHKERR arcCtx->setAlphaBeta(0, 1);
3555  auto arc_snes_ctx = boost::make_shared<ArcLengthSnesCtx>(
3556  mField, problem_ptr->getName(), arcCtx);
3557  CHKERR DMMoFEMSetSnesCtx(dm, arc_snes_ctx);
3558 
3560 }

◆ createMaterialDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createMaterialDM ( SmartPetscObj< DM > &  dm,
const std::string  prb_name,
const BitRefLevel  bit,
const BitRefLevel  mask,
const std::vector< std::string >  fe_list,
const bool  debug = false 
)

Create DM fto calculate material problem.

Parameters
dmused to calculate material forces, sub-dm of dm_crack_propagation
prb_nameproblem name
bitmaterial domain
maskdof mask ref level for problem
fe_listname of elements on surface elements
debugflag for debugging
Returns
error code

Definition at line 3659 of file CrackPropagation.cpp.

3662  {
3665  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3666  CHKERR DMMoFEMCreateMoFEM(dm, &mField, prb_name.c_str(), bit, mask);
3667  CHKERR DMMoFEMAddElement(dm, "GRIFFITH_FORCE_ELEMENT");
3668 
3669  for (auto &fe : fe_list)
3670  CHKERR DMMoFEMAddElement(dm, fe.c_str());
3671 
3672  CHKERR DMMoFEMAddElement(dm, "CRACK_SURFACE");
3673  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_ELEM");
3674  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_TANGENT_ELEM");
3675 #ifdef __ANALITICAL_TRACTION__
3676  CHKERR DMMoFEMAddElement(dm, "ANALITICAL_METERIAL_TRACTION");
3677 #endif
3678  if (mField.check_finite_element("SMOOTHING"))
3679  CHKERR DMMoFEMAddElement(dm, "SMOOTHING");
3680 
3681  if (mField.check_finite_element("EDGE"))
3682  CHKERR DMMoFEMAddElement(dm, "EDGE");
3683 
3684  if (mField.check_finite_element("BOTH_SIDES_OF_CRACK"))
3685  CHKERR DMMoFEMAddElement(dm, "BOTH_SIDES_OF_CRACK");
3686 
3687  if (mField.check_finite_element("BOTH_SIDES_OF_CONTACT"))
3688  CHKERR DMMoFEMAddElement(dm, "BOTH_SIDES_OF_CONTACT");
3689 
3690  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3691  CHKERR DMSetUp(dm);
3692 
3693  // Create crack propagation section
3694  PetscSection section;
3695  CHKERR mField.getInterface<ISManager>()->sectionCreate(prb_name, &section);
3696  CHKERR DMSetDefaultSection(dm, section);
3697  CHKERR DMSetDefaultGlobalSection(dm, section);
3698  // CHKERR PetscSectionView(section,PETSC_VIEWER_STDOUT_WORLD);
3699  CHKERR PetscSectionDestroy(&section);
3700 
3701  if (debug) {
3702  std::vector<std::string> fe_lists;
3703  const MoFEM::Problem *problem_ptr;
3704  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
3705  const FiniteElement_multiIndex *fe_ptr;
3707  for (FiniteElement_multiIndex::iterator fit = fe_ptr->begin();
3708  fit != fe_ptr->end(); fit++) {
3709  if ((fit->get()->getId() & problem_ptr->getBitFEId()).any()) {
3710  std::string fe_name = fit->get()->getName();
3711  EntityHandle meshset;
3712  CHKERR mField.getInterface<ProblemsManager>()->getFEMeshset(
3713  prb_name, fe_name, &meshset);
3714  CHKERR mField.get_moab().write_file(
3715  (prb_name + "_" + fe_name + ".h5m").c_str(), "MOAB",
3716  "PARALLEL=WRITE_PART", &meshset, 1);
3717  CHKERR mField.get_moab().delete_entities(&meshset, 1);
3718  }
3719  }
3720  }
3722 }

◆ createMaterialForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createMaterialForcesDM ( SmartPetscObj< DM > &  dm,
SmartPetscObj< DM >  dm_material,
const std::string  prb_name,
const int  verb = QUIET 
)

Create DM for calculation of material forces (sub DM of DM material)

Parameters
dmused to calculate material forces, sub-dm of dm_crack_propagation
prb_nameproblem name
verbcompilation parameter determining the amount of information printed
Returns
error code

Definition at line 3724 of file CrackPropagation.cpp.

3726  {
3728  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3729  CHKERR DMMoFEMSetVerbosity(dm, verb);
3730  CHKERR DMMoFEMCreateSubDM(dm, dm_material, prb_name.c_str());
3731  CHKERR DMMoFEMAddSubFieldRow(dm, "MESH_NODE_POSITIONS");
3732  CHKERR DMMoFEMAddSubFieldCol(dm, "MESH_NODE_POSITIONS");
3733  CHKERR DMMoFEMAddElement(dm, "MATERIAL");
3734  if (mField.check_finite_element("SMOOTHING")) {
3735  CHKERR DMMoFEMAddElement(dm, "SMOOTHING");
3736  }
3737  CHKERR DMMoFEMAddElement(dm, "GRIFFITH_FORCE_ELEMENT");
3738 #ifdef __ANALITICAL_TRACTION__
3739  CHKERR DMMoFEMAddElement(dm, "ANALITICAL_METERIAL_TRACTION");
3740 #endif
3741  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_TRUE);
3742  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3743  CHKERR DMSetUp(dm);
3745 }

◆ createProblemDataStructures()

MoFEMErrorCode FractureMechanics::CrackPropagation::createProblemDataStructures ( const std::vector< int >  surface_ids,
const int  verb = QUIET,
const bool  debug = false 
)

Construct problem data structures.

Parameters
surface_idssurface_ids meshsets Ids on body skin
verbverbosity level
debug
Returns
error code

Definition at line 9525 of file CrackPropagation.cpp.

9526  {
9528 
9529  BitRefLevel bit1 = mapBitLevel["spatial_domain"];
9530  BitRefLevel bit2 = mapBitLevel["material_domain"];
9531 
9532  // set bit ref reveal for elements at crack front
9533  CHKERR setCrackFrontBitLevel(bit1, bit2, 2, debug);
9534 
9535  if (debug)
9537  ->writeEntitiesAllBitLevelsByType(BitRefLevel().set(), MBTET,
9538  "all_bits.vtk", "VTK", "");
9539 
9540  // Partion mesh
9541  CHKERR partitionMesh(bit1, bit2, VERBOSE, debug);
9542  isPartitioned = PETSC_TRUE;
9544 
9545  // Build fields
9546  CHKERR buildProblemFields(bit1, BitRefLevel().set(), bit2, verb, debug);
9547  // Declare elements
9548  CHKERR buildProblemFiniteElements(bit1, bit2, surface_ids, verb, false);
9549 
9551 }

◆ createSurfaceProjectionDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::createSurfaceProjectionDM ( SmartPetscObj< DM > &  dm,
SmartPetscObj< DM >  dm_material,
const std::string  prb_name,
const std::vector< int >  surface_ids,
const std::vector< std::string >  fe_list,
const int  verb = QUIET 
)

create DM to calculate projection matrices (sub DM of DM material)

Parameters
dmDM to project material forces on surfaces, sub-dm of dm_crack_propagation
dm_materialmaterial DM
prb_nameproblem name
surface_idsIDs of surface meshsets
fe_listname of elements on surface elements
verbcompilation parameter determining the amount of information printed
Returns
error code

Definition at line 3747 of file CrackPropagation.cpp.

3750  {
3752  dm = createSmartDM(PETSC_COMM_WORLD, "MOFEM");
3753  CHKERR DMMoFEMSetVerbosity(dm, verb);
3754  CHKERR DMMoFEMCreateSubDM(dm, dm_material, prb_name.c_str());
3755  CHKERR DMMoFEMSetSquareProblem(dm, PETSC_FALSE);
3756  for (auto id : surface_ids) {
3758  dm, ("LAMBDA_SURFACE" + boost::lexical_cast<std::string>(id)).c_str());
3759  }
3760  CHKERR DMMoFEMAddSubFieldCol(dm, "MESH_NODE_POSITIONS");
3761  for (auto fe : fe_list) {
3762  CHKERR DMMoFEMAddElement(dm, fe.c_str());
3763  }
3764  auto get_edges_block_set = [this]() {
3765  return getInterface<CPMeshCut>()->getEdgesBlockSet();
3766  };
3767  if (get_edges_block_set()) {
3768  CHKERR DMMoFEMAddSubFieldRow(dm, "LAMBDA_EDGE");
3769  CHKERR DMMoFEMAddElement(dm, "EDGE");
3770  }
3771  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
3772  CHKERR DMSetUp(dm);
3774 }

◆ declareArcLengthFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareArcLengthFE ( const BitRefLevel  bits,
const int  verb = QUIET 
)

create arc-length element entity and declare elemets

Definition at line 2344 of file CrackPropagation.cpp.

2345  {
2346  const EntFiniteElement_multiIndex *fe_ent_ptr;
2348  if (mField.check_finite_element("ARC_LENGTH")) {
2349  Range arc_fe_meshsets;
2350  for (auto fit = mField.get_fe_by_name_begin("ARC_LENGTH");
2351  fit != mField.get_fe_by_name_end("ARC_LENGTH"); ++fit) {
2352  arc_fe_meshsets.insert(fit->get()->getEnt());
2353  if (auto ptr = fit->get()->getPartProcPtr())
2354  *ptr = 0;
2355  }
2356  CHKERR mField.getInterface<BitRefManager>()->addBitRefLevel(arc_fe_meshsets,
2357  bit);
2358  CHKERR mField.build_finite_elements("ARC_LENGTH", NULL, verb);
2360  }
2361 
2362  CHKERR mField.add_finite_element("ARC_LENGTH", MF_ZERO, verb);
2364  "LAMBDA_ARC_LENGTH");
2366  "LAMBDA_ARC_LENGTH");
2367  // elem data
2369  "LAMBDA_ARC_LENGTH");
2370 
2371  // finally add created meshset to the ARC_LENGTH finite element
2372  EntityHandle meshset_fe_arc_length;
2373  {
2374  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset_fe_arc_length);
2375  CHKERR mField.get_moab().add_entities(meshset_fe_arc_length,
2376  &arcLengthVertex, 1);
2377  CHKERR mField.getInterface<BitRefManager>()->setBitLevelToMeshset(
2378  meshset_fe_arc_length, bit | BitRefLevel().set(BITREFLEVEL_SIZE - 2));
2379  }
2380  CHKERR mField.add_ents_to_finite_element_by_MESHSET(meshset_fe_arc_length,
2381  "ARC_LENGTH", false);
2382  CHKERR mField.build_finite_elements("ARC_LENGTH", NULL, verb);
2383 
2384  for (auto fit = mField.get_fe_by_name_begin("ARC_LENGTH");
2385  fit != mField.get_fe_by_name_end("ARC_LENGTH"); ++fit) {
2386  if (auto ptr = fit->get()->getPartProcPtr())
2387  *ptr = 0;
2388  }
2390 }

◆ declareBothSidesFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareBothSidesFE ( const BitRefLevel  bit_spatial,
const BitRefLevel  bit_material,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true,
const bool  verb = QUIET 
)

Definition at line 3001 of file CrackPropagation.cpp.

3003  {
3005 
3006  auto get_prisms_level = [&](auto bit) {
3007  Range prisms_level;
3008  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
3009  bit, mask, MBPRISM, prisms_level);
3010  if (proc_only) {
3011  prisms_level = intersect(bitProcEnts, prisms_level);
3012  }
3013  return prisms_level;
3014  };
3015 
3016  auto get_crack_prisms = [&](auto prisms_level) {
3017  Range crack_prisms = subtract(prisms_level, contactElements);
3018  crack_prisms = subtract(crack_prisms, mortarContactElements);
3019  return crack_prisms;
3020  };
3021 
3022  auto add_both_sides_fe = [&](const std::string fe_name,
3023  const std::string lambda_field_name,
3024  const std::string spatial_field, Range ents) {
3026 
3028 
3029  if (!ents.empty()) {
3031  lambda_field_name);
3032  CHKERR mField.modify_finite_element_add_field_row(fe_name, spatial_field);
3033 
3035  lambda_field_name);
3036  CHKERR mField.modify_finite_element_add_field_col(fe_name, spatial_field);
3037 
3039  lambda_field_name);
3041  spatial_field);
3042 
3043  CHKERR mField.add_ents_to_finite_element_by_type(ents, MBPRISM, fe_name);
3044  }
3045 
3046  CHKERR mField.build_finite_elements(fe_name, &ents);
3047 
3049  };
3050 
3052  CHKERR add_both_sides_fe("CLOSE_CRACK", "LAMBDA_CLOSE_CRACK",
3053  "SPATIAL_POSITION",
3054  get_crack_prisms(get_prisms_level(bit_spatial)));
3055  }
3056  CHKERR add_both_sides_fe("BOTH_SIDES_OF_CRACK", "LAMBDA_BOTH_SIDES",
3057  "MESH_NODE_POSITIONS",
3058  get_crack_prisms(get_prisms_level(bit_material)));
3059  {
3060  Range contact_prisms =
3061  intersect(get_prisms_level(bit_material), contactElements);
3062  CHKERR add_both_sides_fe("BOTH_SIDES_OF_CONTACT",
3063  "LAMBDA_BOTH_SIDES_CONTACT", "MESH_NODE_POSITIONS",
3064  contact_prisms);
3065  }
3067 }

◆ declareCrackSurfaceFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareCrackSurfaceFE ( std::string  fe_name,
const BitRefLevel  bit,
const BitRefLevel  mask,
const bool  proc_only = true,
const int  verb = QUIET,
const bool  debug = false 
)

Definition at line 3289 of file CrackPropagation.cpp.

3291  {
3292  moab::Interface &moab = mField.get_moab();
3293  MeshsetsManager *meshset_manager_ptr;
3295  CHKERR mField.getInterface(meshset_manager_ptr);
3296 
3297  Range level_tris;
3298  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
3299  bit, mask, MBTRI, level_tris);
3300  Range crack_surface;
3301  crack_surface = intersect(oneSideCrackFaces, level_tris);
3302  if (proc_only) {
3303  Range proc_tris;
3304  CHKERR moab.get_adjacencies(bitProcEnts, 2, false, proc_tris,
3305  moab::Interface::UNION);
3306  crack_surface = intersect(crack_surface, proc_tris);
3307  }
3308  Range crack_front_adj_tris;
3309  CHKERR mField.get_moab().get_adjacencies(
3310  crackFrontNodes, 2, false, crack_front_adj_tris, moab::Interface::UNION);
3311  crack_front_adj_tris = intersect(crack_front_adj_tris, crackFaces);
3312  crack_front_adj_tris = intersect(crack_front_adj_tris, level_tris);
3313 
3314  std::string field_name =
3315  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(
3316  getInterface<CPMeshCut>()->getCrackSurfaceId());
3317 
3318  // Add finite elements
3319  CHKERR mField.add_finite_element(fe_name.c_str(), MF_ZERO, verb);
3321  field_name.c_str());
3323  "MESH_NODE_POSITIONS");
3325  field_name.c_str());
3327  "MESH_NODE_POSITIONS");
3329  field_name.c_str());
3331  "MESH_NODE_POSITIONS");
3332  if (proc_only)
3333  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(
3334  crack_surface, QUIET);
3335 
3336  {
3337  // remove ents no longer part of this element
3338  Range ents;
3340  ents = subtract(ents, crack_surface);
3341  if (!ents.empty()) {
3343  }
3344  }
3345 
3346  CHKERR mField.add_ents_to_finite_element_by_type(crack_surface, MBTRI,
3347  fe_name);
3348  CHKERR mField.build_finite_elements(fe_name, &crack_surface, verb);
3349 
3350  if (debug) {
3351  std::ostringstream file;
3352  file << "out_crack_faces_" << mField.get_comm_rank() << ".vtk";
3353  EntityHandle meshset;
3354  CHKERR moab.create_meshset(MESHSET_SET, meshset);
3355  CHKERR moab.add_entities(meshset, crack_surface);
3356  CHKERR moab.write_file(file.str().c_str(), "VTK", "", &meshset, 1);
3357  CHKERR moab.delete_entities(&meshset, 1);
3358  }
3359 
3360  // Add CRACKFRONT_AREA_ELEM
3361  CHKERR mField.add_finite_element("CRACKFRONT_AREA_ELEM", MF_ZERO, verb);
3362  CHKERR mField.modify_finite_element_add_field_row("CRACKFRONT_AREA_ELEM",
3363  "LAMBDA_CRACKFRONT_AREA");
3364  CHKERR mField.modify_finite_element_add_field_row("CRACKFRONT_AREA_ELEM",
3365  "MESH_NODE_POSITIONS");
3366  CHKERR mField.modify_finite_element_add_field_col("CRACKFRONT_AREA_ELEM",
3367  "LAMBDA_CRACKFRONT_AREA");
3368  CHKERR mField.modify_finite_element_add_field_col("CRACKFRONT_AREA_ELEM",
3369  "MESH_NODE_POSITIONS");
3370  CHKERR mField.modify_finite_element_add_field_data("CRACKFRONT_AREA_ELEM",
3371  "MESH_NODE_POSITIONS");
3372  CHKERR mField.modify_finite_element_add_field_data("CRACKFRONT_AREA_ELEM",
3373  "LAMBDA_CRACKFRONT_AREA");
3374  // Add CRACKFRONT_AREA_TANGENT_ELEM
3375  CHKERR mField.add_finite_element("CRACKFRONT_AREA_TANGENT_ELEM", MF_ZERO,
3376  verb);
3378  "CRACKFRONT_AREA_TANGENT_ELEM", "LAMBDA_CRACKFRONT_AREA_TANGENT");
3380  "CRACKFRONT_AREA_TANGENT_ELEM", "MESH_NODE_POSITIONS");
3382  "CRACKFRONT_AREA_TANGENT_ELEM", "LAMBDA_CRACKFRONT_AREA_TANGENT");
3384  "CRACKFRONT_AREA_TANGENT_ELEM", "MESH_NODE_POSITIONS");
3386  "CRACKFRONT_AREA_TANGENT_ELEM", "MESH_NODE_POSITIONS");
3388  "CRACKFRONT_AREA_TANGENT_ELEM", "LAMBDA_CRACKFRONT_AREA_TANGENT");
3389 
3390  if (proc_only)
3391  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(
3392  crack_front_adj_tris, QUIET);
3393 
3394  auto remeve_ents_from_fe =
3395  [this, &crack_front_adj_tris](const std::string fe_name) {
3397  Range ents;
3399  ents = subtract(ents, crack_front_adj_tris);
3400  if (!ents.empty()) {
3402  }
3404  };
3405  CHKERR remeve_ents_from_fe("CRACKFRONT_AREA_ELEM");
3406  CHKERR remeve_ents_from_fe("CRACKFRONT_AREA_TANGENT_ELEM");
3407 
3408  CHKERR mField.add_ents_to_finite_element_by_type(crack_front_adj_tris, MBTRI,
3409  "CRACKFRONT_AREA_ELEM");
3411  crack_front_adj_tris, MBTRI, "CRACKFRONT_AREA_TANGENT_ELEM");
3412 
3413  if (debug) {
3414  std::ostringstream file;
3415  file << "out_crack_front_adj_tris_" << mField.get_comm_rank() << ".vtk";
3416  EntityHandle meshset;
3417  CHKERR moab.create_meshset(MESHSET_SET, meshset);
3418  CHKERR moab.add_entities(meshset, crack_front_adj_tris);
3419  CHKERR moab.write_file(file.str().c_str(), "VTK", "", &meshset, 1);
3420  CHKERR moab.delete_entities(&meshset, 1);
3421  }
3422 
3423  CHKERR mField.build_finite_elements("CRACKFRONT_AREA_ELEM",
3424  &crack_front_adj_tris, verb);
3425  CHKERR mField.build_finite_elements("CRACKFRONT_AREA_TANGENT_ELEM",
3426  &crack_front_adj_tris, verb);
3427 
3429 }

◆ declareEdgeFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareEdgeFE ( std::string  fe_name,
const BitRefLevel  bit,
const BitRefLevel  mask,
const bool  proc_only = true,
const int  verb = QUIET,
const bool  debug = false 
)

Definition at line 3179 of file CrackPropagation.cpp.

3181  {
3182  auto meshset_manager_ptr = mField.getInterface<MeshsetsManager>();
3183  auto bit_ref_manager_ptr = mField.getInterface<BitRefManager>();
3185 
3186  auto get_edges_block_ents = [this, meshset_manager_ptr]() {
3187  EntityHandle edge_block_set = getInterface<CPMeshCut>()->getEdgesBlockSet();
3188  Range meshset_ents;
3189  if (meshset_manager_ptr->checkMeshset(edge_block_set, BLOCKSET)) {
3190  CHKERR meshset_manager_ptr->getEntitiesByDimension(
3191  edge_block_set, BLOCKSET, 1, meshset_ents, true);
3192  }
3193  return meshset_ents;
3194  };
3195 
3196  auto get_skin = [this, bit_ref_manager_ptr]() {
3197  Range tets;
3198  CHKERR bit_ref_manager_ptr->getEntitiesByTypeAndRefLevel(
3199  mapBitLevel["mesh_cut"], BitRefLevel().set(), MBTET, tets);
3200  Skinner skin(&mField.get_moab());
3201  Range skin_faces;
3202  CHKERR skin.find_skin(0, tets, false, skin_faces);
3203  return skin_faces;
3204  };
3205 
3206  auto intersect_with_skin_edges = [this, get_edges_block_ents, get_skin]() {
3207  Range adj_edges;
3208  CHKERR mField.get_moab().get_adjacencies(get_skin(), 1, false, adj_edges,
3209  moab::Interface::UNION);
3210  return intersect(get_edges_block_ents(), adj_edges);
3211  };
3212  Range edges_ents = intersect_with_skin_edges();
3213 
3214  Range contact_faces;
3215  contact_faces.merge(contactSlaveFaces);
3216  contact_faces.merge(contactMasterFaces);
3217 
3219  boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation>(
3220  new FaceOrientation(false, contact_faces, mapBitLevel["mesh_cut"]));
3221 
3223  mField.get_moab(), edges_ents, get_skin());
3225  mField.get_moab(), edges_ents, get_skin(), false, contactOrientation,
3226  &mField);
3227 
3228  if (debug) {
3229  Range faces = get_skin();
3231  mField.get_moab(), "edges_normals.vtk", edges_ents, &faces);
3232  }
3233 
3234  auto intersect_with_bit_level_edges = [bit_ref_manager_ptr, &bit,
3235  &edges_ents]() {
3236  Range level_edges;
3237  CHKERR bit_ref_manager_ptr->getEntitiesByTypeAndRefLevel(
3238  bit, BitRefLevel().set(), MBEDGE, level_edges);
3239  return intersect(edges_ents, level_edges);
3240  };
3241  edges_ents = intersect_with_bit_level_edges();
3242 
3243  auto intersect_with_proc_edges = [this, &edges_ents, proc_only]() {
3244  if (proc_only) {
3245  Range proc_edges;
3246  CHKERR mField.get_moab().get_adjacencies(
3247  bitProcEnts, 1, false, proc_edges, moab::Interface::UNION);
3248  return intersect(edges_ents, proc_edges);
3249  }
3250  return edges_ents;
3251  };
3252  edges_ents = intersect_with_proc_edges();
3253  if (proc_only)
3254  CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(edges_ents,
3255  QUIET);
3256 
3257  CHKERR mField.add_finite_element(fe_name.c_str(), MF_ZERO, verb);
3258 
3259  auto add_field = [this, &fe_name](std::string &&field_name) {
3265  };
3266  CHKERR add_field("MESH_NODE_POSITIONS");
3267  CHKERR add_field("LAMBDA_EDGE");
3268 
3269  if (debug) {
3271  mField.get_moab(),
3272  "edges_normals_on_proc_" +
3273  boost::lexical_cast<std::string>(mField.get_comm_rank()) + ".vtk",
3274  edges_ents);
3275  }
3276 
3277  // remove old ents no longer used as a this element
3278  Range ents_to_remove;
3279  CHKERR mField.get_finite_element_entities_by_handle(fe_name, ents_to_remove);
3280  ents_to_remove = subtract(ents_to_remove, edges_ents);
3281  CHKERR mField.remove_ents_from_finite_element(fe_name, ents_to_remove);
3282  CHKERR mField.add_ents_to_finite_element_by_type(edges_ents, MBEDGE, fe_name);
3283 
3284  CHKERR mField.build_finite_elements(fe_name, &edges_ents, verb);
3285 
3287 }

◆ declareElasticFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareElasticFE ( const BitRefLevel  bit1,
const BitRefLevel  mask1,
const BitRefLevel  bit2,
const BitRefLevel  mask2,
const bool  add_forces = true,
const bool  proc_only = true,
const int  verb = QUIET 
)

declare elastic finite elements

Definition at line 2205 of file CrackPropagation.cpp.

2208  {
2210 
2211  Range tets_level1;
2212  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2213  bit1, mask1, MBTET, tets_level1);
2214  if (proc_only) {
2215  tets_level1 = intersect(bitProcEnts, tets_level1);
2216  }
2217  Range tets_not_level2;
2218  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2219  bit2, mask2, MBTET, tets_not_level2);
2220  tets_not_level2 = subtract(tets_level1, tets_not_level2);
2221 
2222  // Add finite elements
2223  CHKERR mField.add_finite_element("ELASTIC", MF_ZERO, verb);
2225  "SPATIAL_POSITION");
2227  "SPATIAL_POSITION");
2229  "SPATIAL_POSITION");
2231  "MESH_NODE_POSITIONS");
2232  // Add ents and build finite elements. Only build elements which has been
2233  // added.
2234  {
2235  Range current_ents_with_fe;
2237  current_ents_with_fe);
2238  Range ents_to_remove;
2239  ents_to_remove = subtract(current_ents_with_fe, tets_level1);
2240 
2241  CHKERR mField.remove_ents_from_finite_element("ELASTIC", ents_to_remove);
2243  "ELASTIC");
2244  CHKERR mField.build_finite_elements("ELASTIC", &tets_level1, VERBOSE);
2245  }
2246 
2247  // Add finite elements not on crack front
2248  CHKERR mField.add_finite_element("ELASTIC_NOT_ALE", MF_ZERO, verb);
2250  "SPATIAL_POSITION");
2252  "SPATIAL_POSITION");
2254  "SPATIAL_POSITION");
2256  "MESH_NODE_POSITIONS");
2257 
2258  // Add ents and build finite elements
2259  {
2260  Range current_ents_with_fe;
2262  current_ents_with_fe);
2263  Range ents_to_remove;
2264  ents_to_remove = subtract(current_ents_with_fe, tets_not_level2);
2265 
2266  CHKERR mField.remove_ents_from_finite_element("ELASTIC_NOT_ALE",
2267  ents_to_remove);
2268  CHKERR mField.add_ents_to_finite_element_by_type(tets_not_level2, MBTET,
2269  "ELASTIC_NOT_ALE");
2270  CHKERR mField.build_finite_elements("ELASTIC_NOT_ALE", &tets_not_level2,
2271  verb);
2272  }
2273 
2274  // Add skin elements for faster postprocessing
2275  {
2276  CHKERR mField.add_finite_element("SKIN", MF_ZERO, verb);
2277  Skinner skin(&mField.get_moab());
2278  Range proc_tris, skin_tris, tets_level;
2279  CHKERR mField.get_moab().get_adjacencies(bitProcEnts, 2, false, proc_tris,
2280  moab::Interface::UNION);
2281 
2282  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2283  bit1, mask1, MBTET, tets_level);
2284 
2285  CHKERR skin.find_skin(0, tets_level, false, skin_tris);
2286  skin_tris = intersect(skin_tris, proc_tris);
2287 
2288  CHKERR mField.add_ents_to_finite_element_by_type(skin_tris, MBTRI, "SKIN");
2289 
2291  "SPATIAL_POSITION");
2293  "SPATIAL_POSITION");
2295  "SPATIAL_POSITION");
2297  "MESH_NODE_POSITIONS");
2300  "SKIN", "EIGEN_SPATIAL_POSITIONS");
2302  }
2303  // Add spring boundary condition applied on surfaces.
2304  // This is only declaration not implementation.
2305  CHKERR MetaSpringBC::addSpringElements(mField, "SPATIAL_POSITION",
2306  "MESH_NODE_POSITIONS");
2308 
2309  auto cn_value_ptr = boost::make_shared<double>(cnValue);
2310 
2311  contactProblem = boost::shared_ptr<SimpleContactProblem>(
2312  new SimpleContactProblem(mField, cn_value_ptr));
2313  // add fields to the global matrix by adding the element
2314 
2315  CHKERR contactProblem->addContactElement(
2316  "CONTACT", "SPATIAL_POSITION", "LAMBDA_CONTACT", contactElements,
2317  solveEigenStressProblem, "EIGEN_SPATIAL_POSITIONS");
2318 
2319  CHKERR mField.build_finite_elements("CONTACT");
2320 
2322  boost::shared_ptr<MortarContactProblem>(new MortarContactProblem(
2323  mField, contactSearchMultiIndexPtr, cn_value_ptr));
2324 
2325  CHKERR mortarContactProblemPtr->addMortarContactElement(
2326  "MORTAR_CONTACT", "SPATIAL_POSITION", "LAMBDA_CONTACT",
2327  mortarContactElements, "MESH_NODE_POSITIONS", solveEigenStressProblem,
2328  "EIGEN_SPATIAL_POSITIONS");
2329 
2330  CHKERR mField.build_finite_elements("MORTAR_CONTACT");
2331 
2332  Range all_slave_tris;
2333  all_slave_tris.merge(mortarContactSlaveFaces);
2334  all_slave_tris.merge(contactSlaveFaces);
2335 
2336  CHKERR contactProblem->addPostProcContactElement(
2337  "CONTACT_POST_PROC", "SPATIAL_POSITION", "LAMBDA_CONTACT",
2338  "MESH_NODE_POSITIONS", all_slave_tris);
2339  CHKERR mField.build_finite_elements("CONTACT_POST_PROC");
2340 
2342 }

◆ declareExternalForcesFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareExternalForcesFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true 
)

Definition at line 2392 of file CrackPropagation.cpp.

2394  {
2395  moab::Interface &moab = mField.get_moab();
2397 
2398  Range tets_level;
2399  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2400  bit, mask, MBTET, tets_level);
2401  if (proc_only) {
2402  tets_level = intersect(bitProcEnts, tets_level);
2403  }
2404 
2405  // Set approx order
2406  Range dofs_ents;
2407  dofs_ents.merge(tets_level);
2408  for (int dd = 1; dd != 3; dd++) {
2409  CHKERR moab.get_adjacencies(tets_level, dd, false, dofs_ents,
2410  moab::Interface::UNION);
2411  }
2412  Range dofs_nodes;
2413  rval = moab.get_connectivity(tets_level, dofs_nodes, true);
2414  CHKERRQ_MOAB(rval);
2415  Range lower_dim_ents = unite(dofs_ents, dofs_nodes);
2416 
2417 #ifdef __ANALITICAL_TRACTION__
2418  {
2419  CHKERR mField.add_finite_element("ANALITICAL_TRACTION", MF_ZERO);
2420  CHKERR mField.modify_finite_element_add_field_row("ANALITICAL_TRACTION",
2421  "SPATIAL_POSITION");
2422  CHKERR mField.modify_finite_element_add_field_col("ANALITICAL_TRACTION",
2423  "SPATIAL_POSITION");
2424  CHKERR mField.modify_finite_element_add_field_data("ANALITICAL_TRACTION",
2425  "SPATIAL_POSITION");
2426  CHKERR mField.modify_finite_element_add_field_data("ANALITICAL_TRACTION",
2427  "MESH_NODE_POSITIONS");
2428  MeshsetsManager *meshset_manager_ptr;
2429  CHKERR mField.getInterface(meshset_manager_ptr);
2430  if (meshset_manager_ptr->checkMeshset("ANALITICAL_TRACTION")) {
2431  const CubitMeshSets *cubit_meshset_ptr;
2432  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_TRACTION",
2433  &cubit_meshset_ptr);
2434  Range tris;
2435  CHKERR meshset_manager_ptr->getEntitiesByDimension(
2436  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, tris, true);
2437  tris = intersect(tris, lower_dim_ents);
2439  "ANALITICAL_TRACTION");
2440  }
2441  CHKERR mField.build_finite_elements("ANALITICAL_TRACTION", &lower_dim_ents);
2442  }
2443 #endif //__ANALITICAL_TRACTION__
2444 
2445  CHKERR mField.add_finite_element("FORCE_FE", MF_ZERO);
2447  "SPATIAL_POSITION");
2449  "SPATIAL_POSITION");
2451  "SPATIAL_POSITION");
2453  "MESH_NODE_POSITIONS");
2455  it)) {
2456  Range tris;
2457  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2458  true);
2459  Range edges;
2460  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
2461  true);
2462  Range tris_edges;
2463  CHKERR mField.get_moab().get_adjacencies(tris, 1, false, tris_edges,
2464  moab::Interface::UNION);
2465  Range tris_nodes;
2466  CHKERR mField.get_moab().get_connectivity(tris, tris_nodes);
2467  Range edges_nodes;
2468  CHKERR mField.get_moab().get_connectivity(edges, edges_nodes);
2469  Range nodes;
2470  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBVERTEX, nodes,
2471  true);
2472  nodes = subtract(nodes, tris_nodes);
2473  nodes = subtract(nodes, edges_nodes);
2474  nodes = intersect(lower_dim_ents, nodes);
2475  edges = subtract(edges, tris_edges);
2476  edges = intersect(lower_dim_ents, edges);
2477  tris = intersect(lower_dim_ents, tris);
2478  CHKERR mField.add_ents_to_finite_element_by_type(tris, MBTRI, "FORCE_FE");
2479  CHKERR mField.add_ents_to_finite_element_by_type(edges, MBEDGE, "FORCE_FE");
2481  "FORCE_FE");
2482  }
2483 
2484  // Reading forces from BLOCKSET (for bone meshes)
2485  const string block_set_force_name("FORCE");
2486  // search for block named FORCE and add its attributes to FORCE_FE element
2488  if (it->getName().compare(0, block_set_force_name.length(),
2489  block_set_force_name) == 0) {
2490  std::vector<double> mydata;
2491  CHKERR it->getAttributes(mydata);
2492 
2493  VectorDouble force(mydata.size());
2494  for (unsigned int ii = 0; ii < mydata.size(); ii++) {
2495  force[ii] = mydata[ii];
2496  }
2497  if (force.size() != 3) {
2498  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2499  "Force vector not given");
2500  }
2501  Range tris;
2502  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2503  true);
2504  CHKERR mField.add_ents_to_finite_element_by_type(tris, MBTRI, "FORCE_FE");
2505  }
2506  }
2507 
2508  // CHKERR MetaNodalForces::addElement(mField,"SPATIAL_POSITION");
2509  // CHKERR MetaEdgeForces::addElement(mField,"SPATIAL_POSITION");
2510  CHKERR mField.build_finite_elements("FORCE_FE", &lower_dim_ents);
2511  CHKERR mField.add_finite_element("PRESSURE_FE", MF_ZERO);
2513  "SPATIAL_POSITION");
2515  "SPATIAL_POSITION");
2517  "SPATIAL_POSITION");
2519  "MESH_NODE_POSITIONS");
2521  it)) {
2522  Range tris;
2523  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2524  true);
2525  tris = intersect(lower_dim_ents, tris);
2527  "PRESSURE_FE");
2528  }
2529  const string block_set_linear_pressure_name("LINEAR_PRESSURE");
2531  if (it->getName().compare(0, block_set_linear_pressure_name.length(),
2532  block_set_linear_pressure_name) == 0) {
2533  Range tris;
2534  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2535  true);
2536  tris = intersect(lower_dim_ents, tris);
2538  "PRESSURE_FE");
2539  }
2540  }
2541 
2542  // search for block named PRESSURE and add its attributes to PRESSURE_FE
2543  // element (for bone meshes)
2544  const string block_set_pressure_name("PRESSURE");
2546  if (it->getName().compare(0, block_set_pressure_name.length(),
2547  block_set_pressure_name) == 0) {
2548  std::vector<double> mydata;
2549  CHKERR it->getAttributes(mydata);
2550  VectorDouble pressure(mydata.size());
2551  for (unsigned int ii = 0; ii < mydata.size(); ii++) {
2552  pressure[ii] = mydata[ii];
2553  }
2554  if (pressure.empty()) {
2555  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2556  "Pressure not given");
2557  }
2558  Range tris;
2559  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2560  true);
2561 
2562  CHKERR
2563  mField.add_ents_to_finite_element_by_type(tris, MBTRI, "PRESSURE_FE");
2564  }
2565  }
2566 
2567  CHKERR mField.build_finite_elements("PRESSURE_FE", &lower_dim_ents);
2568 
2569 #ifdef __ANALITICAL_DISPLACEMENT__
2570  {
2571  MeshsetsManager *meshset_manager_ptr;
2572  CHKERR mField.getInterface(meshset_manager_ptr);
2573  if (meshset_manager_ptr->checkMeshset("ANALITICAL_DISP")) {
2574  const CubitMeshSets *cubit_meshset_ptr;
2575  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_DISP",
2576  &cubit_meshset_ptr);
2577  Range tris;
2578  CHKERR meshset_manager_ptr->getEntitiesByDimension(
2579  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, tris, true);
2580  if (!tris.empty()) {
2583  "SPATIAL_POSITION");
2585  "SPATIAL_POSITION");
2587  "SPATIAL_POSITION");
2589  "BC_FE", "MESH_NODE_POSITIONS");
2590  tris = intersect(lower_dim_ents, tris);
2591  CHKERR mField.add_ents_to_finite_element_by_type(tris, MBTRI, "BC_FE");
2592  CHKERR mField.build_finite_elements("BC_FE", &tris);
2593  }
2594  }
2595  }
2596 #endif //__ANALITICAL_DISPLACEMENT__
2597 
2599 }

◆ declareFrontFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareFrontFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true,
const bool  verb = QUIET 
)

Definition at line 2917 of file CrackPropagation.cpp.

2920  {
2921  moab::Interface &moab = mField.get_moab();
2923 
2924  CHKERR mField.add_finite_element("GRIFFITH_FORCE_ELEMENT", MF_ZERO, verb);
2925  CHKERR mField.modify_finite_element_add_field_row("GRIFFITH_FORCE_ELEMENT",
2926  "MESH_NODE_POSITIONS");
2927  CHKERR mField.modify_finite_element_add_field_col("GRIFFITH_FORCE_ELEMENT",
2928  "MESH_NODE_POSITIONS");
2929  CHKERR mField.modify_finite_element_add_field_data("GRIFFITH_FORCE_ELEMENT",
2930  "MESH_NODE_POSITIONS");
2931  Range crack_front_adj_tris;
2932  CHKERR mField.get_moab().get_adjacencies(
2933  crackFrontNodes, 2, false, crack_front_adj_tris, moab::Interface::UNION);
2934  crack_front_adj_tris = intersect(crack_front_adj_tris, crackFaces);
2935  Range tris_level;
2936  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2937  bit, mask, MBTRI, tris_level);
2938  crack_front_adj_tris = intersect(crack_front_adj_tris, tris_level);
2939  crackFrontNodesTris = crack_front_adj_tris;
2940  Range ents_to_remove;
2941  CHKERR mField.get_finite_element_entities_by_handle("GRIFFITH_FORCE_ELEMENT",
2942  ents_to_remove);
2943  ents_to_remove = subtract(ents_to_remove, crack_front_adj_tris);
2944  CHKERR mField.remove_ents_from_finite_element("GRIFFITH_FORCE_ELEMENT",
2945  ents_to_remove, verb);
2946 
2947  CHKERR mField.add_ents_to_finite_element_by_type(crack_front_adj_tris, MBTRI,
2948  "GRIFFITH_FORCE_ELEMENT");
2949  CHKERR mField.build_finite_elements("GRIFFITH_FORCE_ELEMENT",
2950  &crack_front_adj_tris, verb);
2951 
2952 #ifdef __ANALITICAL_TRACTION__
2953  {
2954  Range tets_level;
2955  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2956  bit, mask, MBTET, tets_level);
2957  if (proc_only) {
2958  tets_level = intersect(bitProcEnts, tets_level);
2959  }
2960 
2961  Range dofs_ents;
2962  dofs_ents.merge(tets_level);
2963  for (int dd = 1; dd != 3; dd++) {
2964  CHKERR moab.get_adjacencies(tets_level, dd, false, dofs_ents,
2965  moab::Interface::UNION);
2966  }
2967  Range dofs_nodes;
2968  CHKERR moab.get_connectivity(tets_level, dofs_nodes, true);
2969  Range lower_dim_ents = unite(dofs_ents, dofs_nodes);
2970 
2971  CHKERR mField.add_finite_element("ANALITICAL_METERIAL_TRACTION", MF_ZERO);
2973  "ANALITICAL_METERIAL_TRACTION", "MESH_NODE_POSITIONS");
2975  "ANALITICAL_METERIAL_TRACTION", "MESH_NODE_POSITIONS");
2977  "ANALITICAL_METERIAL_TRACTION", "SPATIAL_POSITION");
2979  "ANALITICAL_METERIAL_TRACTION", "MESH_NODE_POSITIONS");
2980  MeshsetsManager *meshset_manager_ptr;
2981  ierr = mField.getInterface(meshset_manager_ptr);
2982  CHKERRQ(ierr);
2983  if (meshset_manager_ptr->checkMeshset("ANALITICAL_TRACTION")) {
2984  const CubitMeshSets *cubit_meshset_ptr;
2985  meshset_manager_ptr->getCubitMeshsetPtr("ANALITICAL_TRACTION",
2986  &cubit_meshset_ptr);
2987  Range tris;
2988  CHKERR meshset_manager_ptr->getEntitiesByDimension(
2989  cubit_meshset_ptr->getMeshsetId(), BLOCKSET, 2, tris, true);
2990  tris = intersect(tris, lower_dim_ents);
2992  tris, MBTRI, "ANALITICAL_METERIAL_TRACTION");
2993  }
2994  CHKERR mField.build_finite_elements("ANALITICAL_METERIAL_TRACTION",
2995  &lower_dim_ents);
2996  }
2997 #endif //__ANALITICAL_TRACTION__
2999 }

◆ declareMaterialFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareMaterialFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true,
const bool  verb = QUIET 
)

declare material finite elements

Definition at line 2872 of file CrackPropagation.cpp.

2875  {
2877 
2878  Range tets_level;
2879  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2880  bit, mask, MBTET, tets_level);
2881  if (proc_only) {
2882  tets_level = intersect(bitProcEnts, tets_level);
2883  }
2884 
2885  // Add finite elements
2886  CHKERR mField.add_finite_element("MATERIAL", MF_ZERO, verb);
2888  "SPATIAL_POSITION");
2890  "SPATIAL_POSITION");
2892  "MESH_NODE_POSITIONS");
2894  "MESH_NODE_POSITIONS");
2896  "SPATIAL_POSITION");
2898  "MESH_NODE_POSITIONS");
2899 
2900  {
2901  Range current_ents_with_fe;
2903  current_ents_with_fe);
2904  Range ents_to_remove;
2905  ents_to_remove = subtract(current_ents_with_fe, tets_level);
2906  CHKERR mField.remove_ents_from_finite_element("MATERIAL", ents_to_remove);
2908  "MATERIAL");
2909  // Range ents_to_build = subtract(tets_level, current_ents_with_fe);
2910  // CHKERR mField.build_finite_elements("MATERIAL", &ents_to_build);
2911  CHKERR mField.build_finite_elements("MATERIAL", &tets_level, verb);
2912  }
2913 
2915 }

◆ declarePressureAleFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declarePressureAleFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true 
)

Declare FE for pressure BC in ALE formulation (in material domain)

Parameters
bitmaterial domain bit ref level
maskbit ref level mask for the problem
Returns
error code

Definition at line 2601 of file CrackPropagation.cpp.

2603  {
2604 
2605  moab::Interface &moab = mField.get_moab();
2607 
2608  Range tets_level;
2609  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2610  bit, mask, MBTET, tets_level);
2611  if (proc_only) {
2612  tets_level = intersect(bitProcEnts, tets_level);
2613  }
2614 
2615  Range dofs_ents;
2616  dofs_ents.merge(tets_level);
2617  for (int dd = 1; dd != 3; dd++) {
2618  CHKERR moab.get_adjacencies(tets_level, dd, false, dofs_ents,
2619  moab::Interface::UNION);
2620  }
2621  Range dofs_nodes;
2622  rval = moab.get_connectivity(tets_level, dofs_nodes, true);
2623  CHKERRQ_MOAB(rval);
2624  Range lower_dim_ents = unite(dofs_ents, dofs_nodes);
2625 
2626  CHKERR mField.add_finite_element("PRESSURE_ALE", MF_ZERO);
2628  "SPATIAL_POSITION");
2630  "SPATIAL_POSITION");
2632  "SPATIAL_POSITION");
2634  "MESH_NODE_POSITIONS");
2636  "MESH_NODE_POSITIONS");
2638  "MESH_NODE_POSITIONS");
2639 
2640  Range ents_to_add;
2642  it)) {
2643  Range tris;
2644  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2645  true);
2646  tris = intersect(lower_dim_ents, tris);
2647  ents_to_add.merge(tris);
2648  }
2649 
2650  Range current_ents_with_fe;
2652  current_ents_with_fe);
2653  Range ents_to_remove;
2654  ents_to_remove = subtract(current_ents_with_fe, ents_to_add);
2655  CHKERR mField.remove_ents_from_finite_element("PRESSURE_ALE", ents_to_remove);
2657  "PRESSURE_ALE");
2658 
2659  CHKERR mField.build_finite_elements("PRESSURE_ALE", &lower_dim_ents);
2661 }

◆ declareSimpleContactAleFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareSimpleContactAleFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true 
)

Declare FE for pressure BC in ALE formulation (in material domain)

Parameters
bitmaterial domain bit ref level
maskbit ref level mask for the problem
Returns
error code

Definition at line 2799 of file CrackPropagation.cpp.

2800  {
2801 
2802  moab::Interface &moab = mField.get_moab();
2804 
2805  Range prisms_level;
2806  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2807  bit, mask, MBPRISM, prisms_level);
2808 
2809  if (proc_only) {
2810  prisms_level = intersect(bitProcEnts, prisms_level);
2811  }
2812 
2813  Range contact_prisms = intersect(prisms_level, contactElements);
2814 
2815  CHKERR contactProblem->addContactElementALE(
2816  "SIMPLE_CONTACT_ALE", "SPATIAL_POSITION", "LAMBDA_CONTACT",
2817  "MESH_NODE_POSITIONS", contact_prisms, solveEigenStressProblem,
2818  "EIGEN_SPATIAL_POSITIONS");
2819 
2820  CHKERR mField.build_finite_elements("SIMPLE_CONTACT_ALE", &contact_prisms);
2821 
2822  Range face_on_prism;
2823  CHKERR moab.get_adjacencies(contact_prisms, 2, false, face_on_prism,
2824  moab::Interface::UNION);
2825 
2826  Range tris_on_prism = face_on_prism.subset_by_type(MBTRI);
2827 
2828  Range check_tris =
2829  intersect(tris_on_prism, unite(contactSlaveFaces, contactMasterFaces));
2830 
2831  Range adj_vols_to_prisms;
2832  CHKERR moab.get_adjacencies(check_tris, 3, false, adj_vols_to_prisms,
2833  moab::Interface::UNION);
2834 
2835  Range tet_level;
2836  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2837  bit, mask, MBTET, tet_level);
2838 
2839  Range contact_tets_from_vols = adj_vols_to_prisms.subset_by_type(MBTET);
2840 
2841  Range contact_tets = intersect(tet_level, contact_tets_from_vols);
2842 
2843  CHKERR mField.add_finite_element("MAT_CONTACT", MF_ZERO);
2845  "SPATIAL_POSITION");
2847  "SPATIAL_POSITION");
2849  "MESH_NODE_POSITIONS");
2851  "MESH_NODE_POSITIONS");
2853  "SPATIAL_POSITION");
2855  "MESH_NODE_POSITIONS");
2856 
2857  Range current_ale_tets;
2859  current_ale_tets);
2860  Range ale_tets_to_remove;
2861  ale_tets_to_remove = subtract(current_ale_tets, contact_tets);
2863  ale_tets_to_remove);
2864 
2865  CHKERR mField.add_ents_to_finite_element_by_type(contact_tets, MBTET,
2866  "MAT_CONTACT");
2867  CHKERR mField.build_finite_elements("MAT_CONTACT", &contact_tets);
2868 
2870 }

◆ declareSmoothingFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareSmoothingFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true,
const bool  verb = QUIET 
)

declare mesh smoothing finite elements

Definition at line 3069 of file CrackPropagation.cpp.

3072  {
3074  Range tets_level;
3075  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
3076  bit, mask, MBTET, tets_level);
3077  if (proc_only) {
3078  tets_level = intersect(bitProcEnts, tets_level);
3079  }
3080 
3081  // Add finite elements
3082  CHKERR mField.add_finite_element("SMOOTHING", MF_ZERO, verb);
3084  "MESH_NODE_POSITIONS");
3086  "MESH_NODE_POSITIONS");
3088  "MESH_NODE_POSITIONS");
3090  "SPATIAL_POSITION");
3092  "SMOOTHING", "LAMBDA_CRACKFRONT_AREA_TANGENT");
3094  "SMOOTHING", "LAMBDA_CRACKFRONT_AREA_TANGENT");
3095 
3096  // remove old ents no longer used as a this element
3097  Range ents_to_remove;
3099  ents_to_remove);
3100  ents_to_remove = subtract(ents_to_remove, tets_level);
3101  CHKERR mField.remove_ents_from_finite_element("SMOOTHING", ents_to_remove);
3102 
3104  "SMOOTHING");
3105  CHKERR mField.build_finite_elements("SMOOTHING", &tets_level, verb);
3106 
3108 }

◆ declareSpringsAleFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareSpringsAleFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true 
)

Declare FE for spring BC in ALE formulation (in material domain)

Parameters
bitmaterial domain bit ref level
maskbit ref level mask for the problem
Returns
error code

Definition at line 2736 of file CrackPropagation.cpp.

2738  {
2739 
2740  moab::Interface &moab = mField.get_moab();
2742 
2743  Range tets_level;
2744  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2745  bit, mask, MBTET, tets_level);
2746  if (proc_only) {
2747  tets_level = intersect(bitProcEnts, tets_level);
2748  }
2749 
2750  Range dofs_ents;
2751  dofs_ents.merge(tets_level);
2752  for (int dd = 1; dd != 3; dd++) {
2753  CHKERR moab.get_adjacencies(tets_level, dd, false, dofs_ents,
2754  moab::Interface::UNION);
2755  }
2756  Range dofs_nodes;
2757  rval = moab.get_connectivity(tets_level, dofs_nodes, true);
2758  CHKERRQ_MOAB(rval);
2759  Range lower_dim_ents = unite(dofs_ents, dofs_nodes);
2760 
2761  CHKERR mField.add_finite_element("SPRING_ALE", MF_ZERO);
2763  "SPATIAL_POSITION");
2765  "SPATIAL_POSITION");
2767  "SPATIAL_POSITION");
2769  "MESH_NODE_POSITIONS");
2771  "MESH_NODE_POSITIONS");
2773  "MESH_NODE_POSITIONS");
2774 
2775  Range ents_to_add;
2777  if (bit->getName().compare(0, 9, "SPRING_BC") == 0) {
2778  Range tris;
2779  CHKERR mField.get_moab().get_entities_by_type(bit->meshset, MBTRI, tris,
2780  true);
2781  tris = intersect(lower_dim_ents, tris);
2782  ents_to_add.merge(tris);
2783  }
2784  }
2785 
2786  Range current_ents_with_fe;
2788  current_ents_with_fe);
2789  Range ents_to_remove;
2790  ents_to_remove = subtract(current_ents_with_fe, ents_to_add);
2791  CHKERR mField.remove_ents_from_finite_element("SPRING_ALE", ents_to_remove);
2793  "SPRING_ALE");
2794 
2795  CHKERR mField.build_finite_elements("SPRING_ALE", &lower_dim_ents);
2797 }

◆ declareSurfaceFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareSurfaceFE ( std::string  fe_name,
const BitRefLevel  bit,
const BitRefLevel  mask,
const std::vector< int > &  ids,
const bool  proc_only = true,
const int  verb = QUIET,
const bool  debug = false 
)

declare surface sliding elements

Definition at line 3110 of file CrackPropagation.cpp.

3113  {
3114  moab::Interface &moab = mField.get_moab();
3115  MeshsetsManager *meshset_manager_ptr;
3117  CHKERR mField.getInterface(meshset_manager_ptr);
3118 
3119  Range level_tris;
3120  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
3121  bit, BitRefLevel().set(), MBTRI, level_tris);
3122  Range surface_ents = intersect(bodySkin, level_tris);
3123 
3124  if (proc_only) {
3125  // Note that some elements are on this proc, but not owned by that proc,
3126  // since
3127  // some tetrahedral share lower dimension entities
3128  Range proc_tris;
3129  CHKERR moab.get_adjacencies(bitProcEnts, 2, false, proc_tris,
3130  moab::Interface::UNION);
3131  surface_ents = intersect(surface_ents, proc_tris);
3132  }
3133 
3134  CHKERR mField.add_finite_element(fe_name.c_str(), MF_ZERO, verb);
3136  "MESH_NODE_POSITIONS");
3138  "MESH_NODE_POSITIONS");
3140  "MESH_NODE_POSITIONS");
3141 
3142  for (std::vector<int>::const_iterator it = ids.begin(); it != ids.end();
3143  it++) {
3144  std::string field_name =
3145  "LAMBDA_SURFACE" + boost::lexical_cast<std::string>(*it);
3147  if (dit->get()->getOwnerProc() == mField.get_comm_rank()) {
3148  EntityHandle ent = dit->get()->getEnt();
3149  Range adj_tris;
3150  CHKERR moab.get_adjacencies(&ent, 1, 2, false, adj_tris);
3151  adj_tris = intersect(adj_tris, bodySkin);
3152  surface_ents.merge(adj_tris);
3153  }
3154  }
3155  // Add finite elements
3157  field_name.c_str());
3159  field_name.c_str());
3161  field_name.c_str());
3162 
3163  // remove old ents no longer used as a this element
3164  Range ents_to_remove;
3166  ents_to_remove);
3167  ents_to_remove = subtract(ents_to_remove, surface_ents);
3168  CHKERR mField.remove_ents_from_finite_element(fe_name, ents_to_remove);
3169  CHKERR mField.add_ents_to_finite_element_by_type(surface_ents, MBTRI,
3170  fe_name);
3171  }
3172 
3173  CHKERR mField.build_finite_elements(fe_name, &surface_ents, verb);
3174 
3176 }

◆ declareSurfaceForceAleFE()

MoFEMErrorCode FractureMechanics::CrackPropagation::declareSurfaceForceAleFE ( const BitRefLevel  bit,
const BitRefLevel  mask = BitRefLevel().set(),
const bool  proc_only = true 
)

Declare FE for pressure BC in ALE formulation (in material domain)

Parameters
bitmaterial domain bit ref level
maskbit ref level mask for the problem
Returns
error code

Definition at line 2663 of file CrackPropagation.cpp.

2664  {
2665 
2666  moab::Interface &moab = mField.get_moab();
2668 
2669  Range tets_level;
2670  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
2671  bit, mask, MBTET, tets_level);
2672  if (proc_only) {
2673  tets_level = intersect(bitProcEnts, tets_level);
2674  }
2675 
2676  Range dofs_ents;
2677  dofs_ents.merge(tets_level);
2678  for (int dd = 1; dd != 3; dd++) {
2679  CHKERR moab.get_adjacencies(tets_level, dd, false, dofs_ents,
2680  moab::Interface::UNION);
2681  }
2682  Range dofs_nodes;
2683  rval = moab.get_connectivity(tets_level, dofs_nodes, true);
2684  CHKERRQ_MOAB(rval);
2685  Range lower_dim_ents = unite(dofs_ents, dofs_nodes);
2686 
2687  CHKERR mField.add_finite_element("FORCE_FE_ALE", MF_ZERO);
2689  "SPATIAL_POSITION");
2691  "SPATIAL_POSITION");
2693  "SPATIAL_POSITION");
2695  "MESH_NODE_POSITIONS");
2697  "MESH_NODE_POSITIONS");
2699  "MESH_NODE_POSITIONS");
2700 
2701  Range ents_to_add;
2703  it)) {
2704  Range tris;
2705  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2706  true);
2707  tris = intersect(lower_dim_ents, tris);
2708  ents_to_add.merge(tris);
2709  }
2710 
2711  const string block_set_force_name("FORCE");
2713  if (it->getName().compare(0, block_set_force_name.length(),
2714  block_set_force_name) == 0) {
2715  Range tris;
2716  CHKERR mField.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
2717  true);
2718  tris = intersect(lower_dim_ents, tris);
2719  ents_to_add.merge(tris);
2720  }
2721  }
2722 
2723  Range current_ents_with_fe;
2725  current_ents_with_fe);
2726  Range ents_to_remove;
2727  ents_to_remove = subtract(current_ents_with_fe, ents_to_add);
2728  CHKERR mField.remove_ents_from_finite_element("FORCE_FE_ALE", ents_to_remove);
2730  "FORCE_FE_ALE");
2731 
2732  CHKERR mField.build_finite_elements("FORCE_FE_ALE", &lower_dim_ents);
2734 }

◆ deleteEntities()

MoFEMErrorCode FractureMechanics::CrackPropagation::deleteEntities ( const int  verb = QUIET,
const bool  debug = false 
)

Definition at line 9615 of file CrackPropagation.cpp.

9616  {
9618  BitRefLevel mask;
9619  mask.set(BITREFLEVEL_SIZE - 1);
9620  mask.set(BITREFLEVEL_SIZE - 2);
9621  mask.flip();
9622 
9623  CHKERR mField.delete_ents_by_bit_ref(mask, mask, false, verb);
9624  CHKERR mField.getInterface<BitRefManager>()->setNthBitRefLevel(0, false);
9625  CHKERR mField.getInterface<BitRefManager>()->setNthBitRefLevel(1, false);
9626  CHKERR mField.getInterface<BitRefManager>()->setNthBitRefLevel(2, false);
9627  if (debug) {
9628  CHKERR mField.get_moab().write_file("after_delete.vtk", "VTK", "");
9629  Range all_ents;
9630  CHKERR mField.get_moab().get_entities_by_handle(0, all_ents, true);
9631  Range bit_ents;
9632  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByRefLevel(
9633  BitRefLevel().set(BITREFLEVEL_SIZE - 1), BitRefLevel().set(), bit_ents);
9634  all_ents = subtract(all_ents, all_ents.subset_by_type(MBENTITYSET));
9635  bit_ents = intersect(bit_ents, all_ents);
9636  all_ents = subtract(all_ents, bit_ents);
9637  const RefEntity_multiIndex *refined_ents_ptr;
9638  CHKERR mField.get_ref_ents(&refined_ents_ptr);
9639  for (Range::iterator eit = all_ents.begin(); eit != all_ents.end(); eit++) {
9640  for (RefEntity_multiIndex::iterator eiit =
9641  refined_ents_ptr->get<Ent_mi_tag>().lower_bound(*eit);
9642  eiit != refined_ents_ptr->get<Ent_mi_tag>().upper_bound(*eit);
9643  eiit++) {
9644  cerr << **eiit << " " << eiit->get()->getBitRefLevel() << endl;
9645  }
9646  }
9647  EntityHandle out_meshset;
9648  CHKERR mField.get_moab().create_meshset(MESHSET_SET, out_meshset);
9649  CHKERR mField.get_moab().add_entities(out_meshset, all_ents);
9650  CHKERR mField.get_moab().write_file("after_delete_spare_ents.vtk", "VTK",
9651  "", &out_meshset, 1);
9652  CHKERR mField.get_moab().delete_entities(&out_meshset, 1);
9653  CHKERR mField.get_moab().create_meshset(MESHSET_SET, out_meshset);
9654  CHKERR mField.get_moab().add_entities(out_meshset, bit_ents);
9655  CHKERR mField.get_moab().write_file("bit_ents.vtk", "VTK", "", &out_meshset,
9656  1);
9657  CHKERR mField.get_moab().delete_entities(&out_meshset, 1);
9658  }
9660 }

◆ getAnalyticalDirichletBc()

boost::shared_ptr<AnalyticalDirichletBC::DirichletBC> FractureMechanics::CrackPropagation::getAnalyticalDirichletBc ( )
inline

Definition at line 923 of file CrackPropagation.hpp.

923  {
924  return analyticalDirichletBc;
925  }

◆ getArcCtx()

boost::shared_ptr<ArcLengthCtx>& FractureMechanics::CrackPropagation::getArcCtx ( )
inline

Definition at line 907 of file CrackPropagation.hpp.

907 { return arcCtx; }

◆ getArcLengthDof()

MoFEMErrorCode FractureMechanics::CrackPropagation::getArcLengthDof ( )

set pointer to arc-length DOF

Definition at line 9662 of file CrackPropagation.cpp.

9662  {
9664  auto *dofs_ptr = mField.get_dofs();
9665  auto dit =
9666  dofs_ptr->get<Unique_mi_tag>().lower_bound(FieldEntity::getLoBitNumberUId(
9667  mField.get_field_bit_number("LAMBDA_ARC_LENGTH")));
9668  auto hi_dit =
9669  dofs_ptr->get<Unique_mi_tag>().upper_bound(FieldEntity::getHiBitNumberUId(
9670  mField.get_field_bit_number("LAMBDA_ARC_LENGTH")));
9671  if (dit == dofs_ptr->get<Unique_mi_tag>().end() &&
9672  std::distance(dit, hi_dit) != 1)
9674  "Arc length lambda field not defined, or not unique");
9675  arcLengthDof = *dit;
9677 }

◆ getEigenArcCtx()

boost::shared_ptr<ArcLengthCtx>& FractureMechanics::CrackPropagation::getEigenArcCtx ( )
inline

Definition at line 908 of file CrackPropagation.hpp.

908  {
909  return arcEigenCtx;
910  }

◆ getFrontArcLengthControl()

boost::shared_ptr<FEMethod> FractureMechanics::CrackPropagation::getFrontArcLengthControl ( boost::shared_ptr< ArcLengthCtx arc_ctx)
inline

Definition at line 913 of file CrackPropagation.hpp.

913  {
914  boost::shared_ptr<FEMethod> arc_method(
915  new GriffithForceElement::FrontArcLengthControl(
916  ARC_LENGTH_TAG, griffithForceElement->blockData[0],
917  griffithForceElement->commonData, "LAMBDA_CRACKFRONT_AREA",
918  arc_ctx));
919  return arc_method;
920  }

◆ getInterfaceVersion()

MoFEMErrorCode FractureMechanics::CrackPropagation::getInterfaceVersion ( Version &  version) const
inline

Definition at line 88 of file CrackPropagation.hpp.

88  {
90  version = Version(FM_VERSION_MAJOR, FM_VERSION_MINOR, FM_VERSION_BUILD);
92  }

◆ getLoadScale() [1/2]

double& FractureMechanics::CrackPropagation::getLoadScale ( )
inline

Definition at line 210 of file CrackPropagation.hpp.

210 { return loadScale; }

◆ getLoadScale() [2/2]

double FractureMechanics::CrackPropagation::getLoadScale ( ) const
inline

Definition at line 211 of file CrackPropagation.hpp.

211 { return loadScale; }

◆ getMWLSApprox()

boost::shared_ptr<MWLSApprox>& FractureMechanics::CrackPropagation::getMWLSApprox ( )
inline

Definition at line 927 of file CrackPropagation.hpp.

927 { return mwlsApprox; }

◆ getNbCutSteps() [1/2]

int& FractureMechanics::CrackPropagation::getNbCutSteps ( )
inline

Definition at line 212 of file CrackPropagation.hpp.

212 { return nbCutSteps; }

◆ getNbCutSteps() [2/2]

int FractureMechanics::CrackPropagation::getNbCutSteps ( ) const
inline

Definition at line 213 of file CrackPropagation.hpp.

213 { return nbCutSteps; }

◆ getNbLoadSteps() [1/2]

int& FractureMechanics::CrackPropagation::getNbLoadSteps ( )
inline

Definition at line 208 of file CrackPropagation.hpp.

208 { return nbLoadSteps; }

◆ getNbLoadSteps() [2/2]

int FractureMechanics::CrackPropagation::getNbLoadSteps ( ) const
inline

Definition at line 209 of file CrackPropagation.hpp.

209 { return nbLoadSteps; }

◆ getOptions()

MoFEMErrorCode FractureMechanics::CrackPropagation::getOptions ( )

Get options form command line.

Returns
error code

Definition at line 588 of file CrackPropagation.cpp.

588  {
590  ierr = PetscOptionsBegin(mField.get_comm(), "", "Fracture options", "none");
591  CHKERRQ(ierr);
592  {
593  CHKERR PetscOptionsBool("-my_propagate_crack",
594  "true if crack is propagated", "", propagateCrack,
595  &propagateCrack, NULL);
596  CHKERR PetscOptionsInt("-my_order", "approximation order", "", approxOrder,
597  &approxOrder, PETSC_NULL);
598  CHKERR PetscOptionsInt("-my_geom_order", "approximation geometry order", "",
599  geometryOrder, &geometryOrder, PETSC_NULL);
600  CHKERR PetscOptionsScalar("-my_gc", "release energy", "", gC, &gC,
601  PETSC_NULL);
602  CHKERR PetscOptionsScalar("-beta_gc", "heterogeneous gc beta coefficient",
604  CHKERR PetscOptionsBool("-my_is_partitioned", "true if mesh is partitioned",
605  "", isPartitioned, &isPartitioned, NULL);
606  CHKERR PetscOptionsInt("-my_ref", "crack tip mesh refinement level", "",
607  refAtCrackTip, &refAtCrackTip, PETSC_NULL);
608  CHKERR PetscOptionsInt("-my_ref_order",
609  "crack tip refinement approximation order level", "",
610  refOrderAtTip, &refOrderAtTip, PETSC_NULL);
611 
612  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -my_order %d",
613  approxOrder);
614  MOFEM_LOG_C("CPWorld", Sev::inform,
615  "### Input parameter: -my_geom_order %d", geometryOrder);
616  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -my_gc %6.4e",
617  gC);
618  MOFEM_LOG_C("CPWorld", Sev::inform,
619  "### Input parameter: -my_propagate_crack %d", propagateCrack);
620  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -my_ref %d",
621  refAtCrackTip);
622  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -my_ref_order %d",
623  refOrderAtTip);
624 
625  onlyHookeFromOptions = PETSC_TRUE;
626  CHKERR PetscOptionsBool(
627  "-my_hook_elastic",
628  "if false force use of nonlinear element for hooke material", "",
630 
631  isPressureAle = PETSC_TRUE;
632  CHKERR PetscOptionsBool("-my_add_pressure_ale",
633  "if set surface pressure is considered in ALE", "",
634  isPressureAle, &isPressureAle, NULL);
635 
636  areSpringsAle = PETSC_TRUE;
637  CHKERR PetscOptionsBool("-my_add_springs_ale",
638  "if set surface springs is considered in ALE", "",
639  areSpringsAle, &areSpringsAle, NULL);
640 
641  isSurfaceForceAle = PETSC_TRUE;
642  CHKERR PetscOptionsBool("-my_add_surface_force_ale",
643  "if set surface force is considered in ALE", "",
645 
646  ignoreMaterialForce = PETSC_FALSE;
647  CHKERR PetscOptionsBool(
648  "-my_ignore_material_surface_force",
649  "if set material forces arising from surface force are ignored", "",
651 
652  addSingularity = PETSC_TRUE;
653  CHKERR PetscOptionsBool("-my_add_singularity",
654  "if set singularity added to crack front", "",
656  MOFEM_LOG_C("CPWorld", Sev::inform,
657  "### Input parameter: -my_add_singularity %d", addSingularity);
658  {
659  PetscBool flg;
660  char file_name[255] = "mwls.med";
661  CHKERR PetscOptionsString(
662  "-my_mwls_approx_file",
663  "file with data from med file (code-aster) with radiation data", "",
664  file_name, file_name, 255, &flg);
665  if (flg == PETSC_TRUE) {
666  mwlsApproxFile = std::string(file_name);
667  MOFEM_LOG_C("CPWorld", Sev::inform,
668  "### Input parameter: -my_mwls_approx_file %s", file_name);
669  }
670  char tag_name[255] = "SIGP";
671  CHKERR PetscOptionsString("-my_internal_stress_name",
672  "name of internal stress tag", "", tag_name,
673  tag_name, 255, &flg);
674  MOFEM_LOG_C("CPWorld", Sev::inform,
675  "### Input parameter: -my_internal_stress_name %s", tag_name);
676  mwlsStressTagName = "MED_" + std::string(tag_name);
677  CHKERR PetscOptionsString("-my_eigen_stress_name",
678  "name of eigen stress tag", "", tag_name,
679  tag_name, 255, &flg);
680  MOFEM_LOG_C("CPWorld", Sev::inform,
681  "### Input parameter: -my_eigen_stress_name %s", tag_name);
682  mwlsEigenStressTagName = "MED_" + std::string(tag_name);
683  }
684  CHKERR PetscOptionsInt(
685  "-my_residual_stress_block",
686  "block in mechanical (i.e. cracked) mesh to which residual stress "
687  "and density mapping are applied",
688  "", residualStressBlock, &residualStressBlock, PETSC_NULL);
689  MOFEM_LOG_C("CPWorld", Sev::inform,
690  "### Input parameter: -my_residual_stress_block %d",
692 
693  CHKERR PetscOptionsInt("-my_density_block",
694  "block to which density is mapped", "",
695  densityMapBlock, &densityMapBlock, PETSC_NULL);
696  MOFEM_LOG_C("CPWorld", Sev::inform,
697  "### Input parameter: -my_density_block %d", densityMapBlock);
698 
699  char density_tag_name[255] = "RHO";
700  CHKERR PetscOptionsString("-my_density_tag_name",
701  "name of density tag (RHO)", "", density_tag_name,
702  density_tag_name, 255, PETSC_NULL);
703  MOFEM_LOG_C("CPWorld", Sev::inform,
704  "### Input parameter: -my_density_tag_name %s",
705  density_tag_name);
706  mwlsRhoTagName = std::string(density_tag_name);
707 
708  {
709  PetscBool flg;
710  char file_name[255] = "add_cubit_meshsets.in";
711  CHKERR PetscOptionsString("-meshsets_config",
712  "meshsets config file name", "", file_name,
713  file_name, 255, &flg);
714  if (flg == PETSC_TRUE) {
715  ifstream f(file_name);
716  if (!f.good()) {
718  "File configuring meshsets ( %s ) cannot be open\n",
719  file_name);
720  }
721  configFile = file_name;
722  }
723  }
724  {
725  PetscBool flg;
727  CHKERR PetscOptionsEList("-material", "Material type", "", materials_list,
729  &flg);
730  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -material %s",
732  }
733  // Set paramaters with bone density like material
734  {
735  CHKERR PetscOptionsScalar("-my_rho0", "release energy", "", rHo0, &rHo0,
736  PETSC_NULL);
737  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -my_rho0 %6.4e",
738  rHo0);
739 
740  CHKERR PetscOptionsScalar("-my_n_bone", "release energy", "", nBone,
741  &nBone, PETSC_NULL);
742  MOFEM_LOG_C("CPWorld", Sev::inform,
743  "### Input parameter: -my_n_bone %6.4e", nBone);
744  }
745  {
746  nbLoadSteps = 1;
747  CHKERR PetscOptionsInt("-nb_load_steps", "number of load steps", "",
748  nbLoadSteps, &nbLoadSteps, PETSC_NULL);
749  nbCutSteps = 0;
750  CHKERR PetscOptionsInt("-nb_cut_steps", "number of cut mesh steps", "",
751  nbCutSteps, &nbCutSteps, PETSC_NULL);
752  loadScale = 1;
753  CHKERR PetscOptionsScalar("-load_scale", "load scale", "", loadScale,
754  &loadScale, PETSC_NULL);
755  MOFEM_LOG_C("CPWorld", Sev::inform,
756  "### Input parameter: -load_scale %6.4e", loadScale);
757  }
758  {
759  otherSideConstrains = PETSC_FALSE;
760  CHKERR PetscOptionsBool(
761  "-other_side_constrain",
762  "Set surface constrain on other side of crack surface", "",
764  }
765  // Parameters for smoothing
766  {
767  smootherAlpha = 1;
768  smootherGamma = 0;
769  CHKERR PetscOptionsReal("-smoother_alpha", "Control mesh smoother", "",
770  smootherAlpha, &smootherAlpha, PETSC_NULL);
771  CHKERR PetscOptionsReal("-my_gamma", "Controls mesh smoother", "",
772  smootherGamma, &smootherGamma, PETSC_NULL);
773 
774  MOFEM_LOG_C("CPWorld", Sev::inform,
775  "### Input parameter: -smoother_alpha %6.4e", smootherAlpha);
776  }
777  // Get Parameters for arc length
778  {
779  arcAlpha = 1;
780  arcBeta = 0;
781  arcS = 0;
782  CHKERR PetscOptionsReal("-arc_alpha", "Arc length alpha", "", arcAlpha,
783  &arcAlpha, PETSC_NULL);
784  CHKERR PetscOptionsReal("-arc_beta", "Arc length beta", "", arcBeta,
785  &arcBeta, PETSC_NULL);
786  CHKERR PetscOptionsReal("-arc_s", "Arc length step size", "", arcS, &arcS,
787  PETSC_NULL);
788  MOFEM_LOG_C("CPWorld", Sev::inform,
789  "### Input parameter: -arc_alpha %6.4e", arcAlpha);
790  MOFEM_LOG_C("CPWorld", Sev::inform,
791  "### Input parameter: -arc_beta %6.4e", arcBeta);
792  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -arc_s %6.4e",
793  arcS);
794  }
795  // Get parameters for contact
796  {
797  contactOrder = 2;
798  contactLambdaOrder = 1;
799  rValue = 1;
800  cnValue = 1;
801  ignoreContact = PETSC_FALSE;
802  fixContactNodes = PETSC_FALSE;
803  printContactState = PETSC_FALSE;
804  contactOutputIntegPts = PETSC_TRUE;
805  CHKERR PetscOptionsBool("-my_ignore_contact", "If true ignore contact",
806  "", ignoreContact, &ignoreContact, NULL);
807  CHKERR PetscOptionsBool("-my_fix_contact_nodes",
808  "If true fix contact nodes", "", fixContactNodes,
809  &fixContactNodes, NULL);
810  CHKERR PetscOptionsBool("-my_print_contact_state",
811  "If true print contact state", "",
813  CHKERR PetscOptionsBool(
814  "-my_contact_output_integ_pts",
815  "If true output data at contact integration points", "",
817  CHKERR PetscOptionsReal("-my_r_value", "Contact regularisation parameter",
818  "", rValue, &rValue, PETSC_NULL);
819  CHKERR PetscOptionsReal("-my_cn_value", "Contact augmentation parameter",
820  "", cnValue, &cnValue, PETSC_NULL);
821  CHKERR PetscOptionsInt("-my_contact_order", "contact approximation order",
822  "", contactOrder, &contactOrder, PETSC_NULL);
823  CHKERR PetscOptionsInt(
824  "-my_contact_lambda_order", "contact Lagrange multipliers order", "",
825  contactLambdaOrder, &contactLambdaOrder, PETSC_NULL);
826  MOFEM_LOG_C("CPWorld", Sev::inform,
827  "### Input parameter: -my_cn_value %6.4e", cnValue);
828  MOFEM_LOG_C("CPWorld", Sev::inform,
829  "### Input parameter: -my_contact_order %d", contactOrder);
830  MOFEM_LOG_C("CPWorld", Sev::inform,
831  "### Input parameter: -my_cn_value %6.4e", cnValue);
832  MOFEM_LOG_C("CPWorld", Sev::inform,
833  "### Input parameter: -my_contact_order %d", contactOrder);
834  }
835  }
836  // Get Regine/Split/Cut options
837  {
838  doCutMesh = PETSC_FALSE;
839  CHKERR PetscOptionsBool("-cut_mesh", "If true mesh is cut by surface", "",
840  doCutMesh, &doCutMesh, NULL);
842  CHKERR PetscOptionsReal("-cut_factor", "Crack acceleration factor", "",
844  PETSC_NULL);
845  doElasticWithoutCrack = PETSC_FALSE;
846  CHKERR PetscOptionsBool(
847  "-run_elastic_without_crack", "If true mesh is cut by surface", "",
849 
850  MOFEM_LOG_C("CPWorld", Sev::inform, "### Input parameter: -cut_mesh %d",
851  doCutMesh);
852  MOFEM_LOG_C("CPWorld", Sev::inform,
853  "### Input parameter: -cut_factor %6.4e",
855  MOFEM_LOG_C("CPWorld", Sev::inform,
856  "### Input parameter: -run_elastic_without_crack %d",
858  }
859  CHKERR PetscOptionsInt("-post_proc_level", "level of output files", "",
860  postProcLevel, &postProcLevel, PETSC_NULL);
861  MOFEM_LOG_C("CPWorld", Sev::verbose,
862  "### Input parameter: -post_proc_level %6.4e", postProcLevel);
863 
865  CHKERR PetscOptionsBool(
866  "-add_analytical_internal_stress_operators",
867  "If true add analytical internal stress operators for mwls test", "",
870 
871  solveEigenStressProblem = PETSC_FALSE;
872  CHKERR PetscOptionsBool("-solve_eigen_problem", "If true solve eigen problem",
874  NULL);
875  useEigenPositionsSimpleContact = PETSC_TRUE;
876  CHKERR PetscOptionsBool(
877  "-use_eigen_pos_simple_contact",
878  "If true use eigen positions for matching meshes contact", "",
880 
881  MOFEM_LOG_C("CPWorld", Sev::inform,
882  "### Input parameter: -solve_eigen_problem %d",
884  MOFEM_LOG_C("CPWorld", Sev::inform,
885  "### Input parameter: -use_eigen_pos_simple_contact %d",
887 
888  // Partitioning
890  CHKERR PetscOptionsScalar("-part_weight_power", "Partitioning weight power",
892  &partitioningWeightPower, PETSC_NULL);
893 
895  CHKERR PetscOptionsBool(
896  "-calc_mwls_coeffs_every_propagation_step",
897  "If true recaulculate MWLS coefficients every propagation step", "",
899  NULL);
900 
901  ierr = PetscOptionsEnd();
902  CHKERRQ(ierr);
903 
905 
906  CHKERRQ(ierr);
907 
908  // adding mums options
909  char mumps_options[] =
910  "-mat_mumps_icntl_14 800 -mat_mumps_icntl_24 1 -mat_mumps_icntl_13 1 "
911  "-propagation_fieldsplit_0_mat_mumps_icntl_14 800 "
912  "-propagation_fieldsplit_0_mat_mumps_icntl_24 1 "
913  "-propagation_fieldsplit_0_mat_mumps_icntl_13 1 "
914  "-propagation_fieldsplit_1_mat_mumps_icntl_14 800 "
915  "-propagation_fieldsplit_1_mat_mumps_icntl_24 1 "
916  "-propagation_fieldsplit_1_mat_mumps_icntl_13 1 "
917  "-mat_mumps_icntl_20 0 "
918  "-propagation_fieldsplit_0_mat_mumps_icntl_20 0 "
919  "-propagation_fieldsplit_1_mat_mumps_icntl_20 0";
920  CHKERR PetscOptionsInsertString(NULL, mumps_options);
921 
922  // Get options for interfaces
923  CHKERR getInterface<CPMeshCut>()->getOptions();
924  CHKERR getInterface<CPSolvers>()->getOptions();
925 
927 }

◆ partitionMesh()

MoFEMErrorCode FractureMechanics::CrackPropagation::partitionMesh ( BitRefLevel  bit1,
BitRefLevel  bit2,
int  verb = QUIET,
const bool  debug = false 
)

partotion mesh

Definition at line 1112 of file CrackPropagation.cpp.

1114  {
1116 
1117  moab::Interface &moab = mField.get_moab();
1119 
1120  // create map with layers with different weights for partitioning
1121  map<int, Range> layers;
1122  Range ref_nodes = crackFrontNodes;
1123  Range tets;
1124  CHKERR moab.get_adjacencies(ref_nodes, 3, false, tets,
1125  moab::Interface::UNION);
1126  CHKERR mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
1127  bit1, BitRefLevel().set(), tets);
1128  layers[0] = tets;
1129  for (int ll = 0; ll != refOrderAtTip; ll++) {
1130 
1131  CHKERR moab.get_connectivity(tets, ref_nodes, false);
1132  CHKERR moab.get_adjacencies(ref_nodes, 3, false, tets,
1133  moab::Interface::UNION);
1134  CHKERR mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
1135  bit1, BitRefLevel().set(), tets);
1136 
1137  layers[ll + 1] = subtract(tets, layers[ll]);
1138  }
1139  Range tets_bit_2;
1140  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1141  bit2, BitRefLevel().set(), MBTET, tets_bit_2);
1142  int last = layers.size();
1143  auto rest_elements_in_the_bubble = subtract(tets_bit_2, layers[last - 1]);
1144  if (rest_elements_in_the_bubble.size())
1145  layers[last] = rest_elements_in_the_bubble;
1146 
1147  // create tag with weights
1148  Tag th_tet_weight;
1149  rval = moab.tag_get_handle("TETS_WEIGHT", th_tet_weight);
1150  if (rval == MB_SUCCESS) {
1151  CHKERR moab.tag_delete(th_tet_weight);
1152  }
1153  int def_val = 1;
1154  CHKERR moab.tag_get_handle("TETS_WEIGHT", 1, MB_TYPE_INTEGER, th_tet_weight,
1155  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
1156 
1157  for (unsigned int ll = 0; ll != layers.size(); ll++) {
1158  int weight = pow(layers.size() + 2 - ll, partitioningWeightPower);
1159  CHKERR moab.tag_clear_data(th_tet_weight, layers[ll], &weight);
1160  }
1161 
1162  // partition mesh
1163  Range ents;
1164  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1165  bit1, BitRefLevel().set(), MBTET, ents);
1166  if (debug) {
1167  CHKERR saveEachPart("out_ents_to_partition_", ents);
1168  }
1170  ents, 3, 0, mField.get_comm_size(), &th_tet_weight, NULL, NULL, verb,
1171  false);
1172  CHKERR moab.tag_delete(th_tet_weight);
1173 
1175 }

◆ postProcessDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::postProcessDM ( DM  dm,
const int  step,
const std::string  fe_name,
const bool  approx_internal_stress 
)

post-process results for elastic solution

Definition at line 9010 of file CrackPropagation.cpp.

9012  {
9014  if (!elasticFe) {
9016  "Pointer to elasticFe is NULL");
9017  }
9018 
9019  auto post_proc = boost::make_shared<
9021 
9022  post_proc->setSingularCoordinates = setSingularCoordinates;
9023  post_proc->crackFrontNodes = crackFrontNodes;
9024  post_proc->crackFrontNodesEdges = crackFrontNodesEdges;
9025  post_proc->crackFrontElements = crackFrontElements;
9026  post_proc->addSingularity = addSingularity;
9027  // addSingularity;
9028  post_proc->meshPositionsFieldName = "NONE";
9029 
9030  CHKERR post_proc->generateReferenceElementMesh();
9031  CHKERR post_proc->addFieldValuesPostProc("MESH_NODE_POSITIONS");
9032  CHKERR post_proc->addFieldValuesGradientPostProc("MESH_NODE_POSITIONS");
9033 
9034  // calculate material positions at integration points
9035  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr(new MatrixDouble());
9036  post_proc->getOpPtrVector().push_back(new OpCalculateVectorFieldValues<3>(
9037  "MESH_NODE_POSITIONS", mat_pos_at_pts_ptr));
9038  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr;
9039 
9040  boost::shared_ptr<MatrixDouble> H(new MatrixDouble());
9041  post_proc->getOpPtrVector().push_back(
9042  new OpCalculateVectorFieldGradient<3, 3>("MESH_NODE_POSITIONS", H));
9043  post_proc->getOpPtrVector().push_back(new OpPostProcDisplacements(
9044  post_proc->singularElement, post_proc->singularDisp,
9045  post_proc->postProcMesh, post_proc->mapGaussPts, H));
9046  post_proc->getOpPtrVector().push_back(
9048  "MESH_NODE_POSITIONS", elasticFe->commonData));
9049  post_proc->getOpPtrVector().push_back(new OpTransfromSingularBaseFunctions(
9050  post_proc->singularElement, post_proc->detS, post_proc->invSJac));
9051  CHKERR post_proc->addFieldValuesPostProc("SPATIAL_POSITION");
9052  CHKERR post_proc->addFieldValuesGradientPostProc("SPATIAL_POSITION");
9053  std::map<int, NonlinearElasticElement::BlockData>::iterator sit =
9054  elasticFe->setOfBlocks.begin();
9055  for (; sit != elasticFe->setOfBlocks.end(); sit++) {
9056  post_proc->getOpPtrVector().push_back(new PostProcStress(
9057  post_proc->postProcMesh, post_proc->mapGaussPts, "SPATIAL_POSITION",
9058  sit->second, post_proc->commonData,
9059  false, // use spatial positions not displacements
9060  false // replace singular value by max double value
9061  ));
9062  }
9063 
9064  boost::shared_ptr<HookeElement::DataAtIntegrationPts>
9065  data_hooke_element_at_pts(new HookeElement::DataAtIntegrationPts());
9066 
9067  PostProcFaceOnRefinedMesh post_proc_skin(mField);
9068  CHKERR post_proc_skin.generateReferenceElementMesh();
9069 
9070  CHKERR post_proc_skin.addFieldValuesPostProc("MESH_NODE_POSITIONS");
9072  CHKERR post_proc_skin.addFieldValuesPostProc("EIGEN_SPATIAL_POSITIONS");
9073  }
9074 
9075  typedef CrackFrontSingularBase<VolumeElementForcesAndSourcesCoreOnSide,
9077  VolSideFe;
9078 
9079  struct OpGetFieldGradientValuesOnSkinWithSingular
9081 
9082  const std::string feVolName;
9083  boost::shared_ptr<VolSideFe> sideOpFe;
9084 
9085  OpGetFieldGradientValuesOnSkinWithSingular(
9086  const std::string field_name, const std::string vol_fe_name,
9087  boost::shared_ptr<VolSideFe> side_fe)
9089  field_name, UserDataOperator::OPCOL),
9090  feVolName(vol_fe_name), sideOpFe(side_fe) {}
9091 
9092  MoFEMErrorCode doWork(int side, EntityType type,
9095  if (type != MBVERTEX)
9097  CHKERR loopSideVolumes(feVolName, *sideOpFe);
9099  }
9100  };
9101 
9102  boost::shared_ptr<VolSideFe> my_vol_side_fe_ptr =
9103  boost::make_shared<VolSideFe>(mField, setSingularCoordinates,
9106 
9107  my_vol_side_fe_ptr->getOpPtrVector().push_back(
9109  "MESH_NODE_POSITIONS", data_hooke_element_at_pts->HMat));
9110  my_vol_side_fe_ptr->getOpPtrVector().push_back(new OpPostProcDisplacements(
9111  my_vol_side_fe_ptr->singularElement, my_vol_side_fe_ptr->singularDisp,
9112  post_proc_skin.postProcMesh, post_proc_skin.mapGaussPts,
9113  data_hooke_element_at_pts->HMat));
9114 
9115  my_vol_side_fe_ptr->getOpPtrVector().push_back(
9116  new OpTransfromSingularBaseFunctions(my_vol_side_fe_ptr->singularElement,
9117  my_vol_side_fe_ptr->detS,
9118  my_vol_side_fe_ptr->invSJac));
9119 
9120  my_vol_side_fe_ptr->getOpPtrVector().push_back(
9122  "SPATIAL_POSITION", data_hooke_element_at_pts->hMat));
9123 
9124  post_proc_skin.getOpPtrVector().push_back(
9125  new OpGetFieldGradientValuesOnSkinWithSingular(
9126  "MESH_NODE_POSITIONS", fe_name.c_str(), my_vol_side_fe_ptr));
9127 
9128  CHKERR post_proc_skin.addFieldValuesPostProc("SPATIAL_POSITION");
9129  CHKERR post_proc_skin.addFieldValuesPostProc("MESH_NODE_POSITIONS");
9130 
9131  post_proc_skin.getOpPtrVector().push_back(
9132  new HookeElement::OpPostProcHookeElement<FaceElementForcesAndSourcesCore>(
9133  "MESH_NODE_POSITIONS", data_hooke_element_at_pts,
9134  elasticFe->setOfBlocks, post_proc_skin.postProcMesh,
9135  post_proc_skin.mapGaussPts,
9136  true, // is_ale = true
9137  false // is_field_disp = false
9138  ));
9139 
9140  post_proc_skin.getOpPtrVector().push_back(new OpSetTagRangeOnSkin(
9141  post_proc_skin.postProcMesh, post_proc_skin.mapGaussPts,
9142  oneSideCrackFaces, "CRACK_SURFACE_TAG", 1.0));
9143  post_proc_skin.getOpPtrVector().push_back(new OpSetTagRangeOnSkin(
9144  post_proc_skin.postProcMesh, post_proc_skin.mapGaussPts,
9145  otherSideCrackFaces, "CRACK_SURFACE_TAG", 2));
9146 
9147  if (residualStressBlock != -1 && approx_internal_stress) {
9148  if (mwlsApprox) {
9149 
9150  // Always should be. Make it false if you need to test how operators
9151  // with precalulated MWLS base coefficients works.
9152  if (true)
9153  post_proc->getOpPtrVector().push_back(
9154  new MWLSApprox::OpMWLSStressAtGaussPts(
9155  mat_pos_at_pts_ptr, H, post_proc, mwlsApprox, mwlsStressTagName,
9156  false, false));
9157  else {
9158  post_proc->getOpPtrVector().push_back(
9160  mat_pos_at_pts_ptr, H, post_proc, mwlsApprox));
9161  post_proc->getOpPtrVector().push_back(
9162  new MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs(
9163  mat_pos_at_pts_ptr, H, post_proc, mwlsApprox, mwlsStressTagName,
9164  false, false));
9165  }
9166 
9167  boost::shared_ptr<moab::Interface> post_proc_mesh_ptr(
9168  mwlsApprox, &post_proc->postProcMesh);
9169  boost::shared_ptr<std::vector<EntityHandle>> map_gauss_pts_ptr(
9170  mwlsApprox, &post_proc->mapGaussPts);
9171  post_proc->getOpPtrVector().push_back(
9172  new MWLSApprox::OpMWLSStressPostProcess(
9173  post_proc_mesh_ptr, map_gauss_pts_ptr, mwlsApprox));
9174 
9175  } else {
9176  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
9177  "mwlsApprox not allocated");
9178  }
9179  }
9180 
9181  if (densityMapBlock != -1 && defaultMaterial == BONEHOOKE &&
9182  approx_internal_stress) {
9183  if (mwlsApprox) {
9184 
9185  if (true)
9186  post_proc->getOpPtrVector().push_back(
9187  new MWLSApprox::OpMWLSRhoAtGaussPts(mat_pos_at_pts_ptr, H,
9188  post_proc, mwlsApprox,
9189  mwlsRhoTagName, true, false));
9190  else {
9191  post_proc->getOpPtrVector().push_back(
9193  mat_pos_at_pts_ptr, H, post_proc, mwlsApprox));
9194  post_proc->getOpPtrVector().push_back(
9195  new MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(
9196  mat_pos_at_pts_ptr, H, post_proc, mwlsApprox, mwlsRhoTagName,
9197  true, false));
9198  }
9199 
9200  boost::shared_ptr<moab::Interface> post_proc_mesh_ptr(
9201  mwlsApprox, &post_proc->postProcMesh);
9202  boost::shared_ptr<std::vector<EntityHandle>> map_gauss_pts_ptr(
9203  mwlsApprox, &post_proc->mapGaussPts);
9204  post_proc->getOpPtrVector().push_back(
9205  new MWLSApprox::OpMWLSRhoPostProcess(
9206  post_proc_mesh_ptr, map_gauss_pts_ptr, mwlsApprox,
9207  reinterpret_cast<PostProcVolumeOnRefinedMesh::CommonData &>(
9208  post_proc->commonData)));
9209  } else {
9210  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
9211  "mwlsApprox not allocated");
9212  }
9213  }
9214 
9215  CHKERR DMoFEMLoopFiniteElements(dm, "SKIN", &post_proc_skin);
9216 
9217  ostringstream ss;
9218  ss << "out_skin_" << step << ".h5m";
9219  if (postProcLevel >= 0)
9220  CHKERR post_proc_skin.writeFile(ss.str());
9221 
9222  if (postProcLevel > 1) {
9223  CHKERR DMoFEMLoopFiniteElements(dm, fe_name.c_str(), post_proc);
9224  ss.str("");
9225  ss << "out_spatial_" << step << ".h5m";
9226  if (postProcLevel < 3) {
9227  // delete tag with gradients, it make problem with post-process on older
9228  // versions of paraview,
9229  // because it consist values at singularity
9230  Tag th;
9231  CHKERR post_proc->postProcMesh.tag_get_handle("SPATIAL_POSITION_GRAD",
9232  th);
9233  CHKERR post_proc->postProcMesh.tag_delete(th);
9234  }
9235  CHKERR post_proc->writeFile(ss.str());
9236  }
9237 
9238  if (!contactElements.empty() || !mortarContactElements.empty()) {
9239  auto fe_post_proc_face_contact =
9240  boost::make_shared<PostProcFaceOnRefinedMesh>(mField);
9241  CHKERR fe_post_proc_face_contact->generateReferenceElementMesh();
9242 
9243  CHKERR fe_post_proc_face_contact->addFieldValuesPostProc("LAMBDA_CONTACT");
9244  CHKERR fe_post_proc_face_contact->addFieldValuesPostProc(
9245  "SPATIAL_POSITION");
9246  CHKERR fe_post_proc_face_contact->addFieldValuesPostProc(
9247  "MESH_NODE_POSITIONS");
9248 
9249  CHKERR DMoFEMLoopFiniteElements(dm, "CONTACT_POST_PROC",
9250  fe_post_proc_face_contact);
9251 
9252  string out_file_name;
9253  std::ostringstream stm;
9254  stm << "out_contact_surface_" << step << ".h5m";
9255  out_file_name = stm.str();
9256  CHKERR PetscPrintf(PETSC_COMM_WORLD, "out file %s\n",
9257  out_file_name.c_str());
9258  CHKERR fe_post_proc_face_contact->postProcMesh.write_file(
9259  out_file_name.c_str(), "MOAB", "PARALLEL=WRITE_PART");
9260 
9261  if (contactOutputIntegPts) {
9262  CHKERR contactPostProcMoab.delete_mesh();
9263 
9264  if (!contactElements.empty())
9266 
9267  if (!mortarContactElements.empty())
9268  CHKERR DMoFEMLoopFiniteElements(dm, "MORTAR_CONTACT",
9270 
9271  std::ostringstream ostrm;
9272  ostrm << "out_contact_integ_pts_" << step << ".h5m";
9273  std::string out_file_name = ostrm.str();
9274  CHKERR PetscPrintf(PETSC_COMM_WORLD, "out file %s\n",
9275  out_file_name.c_str());
9276  CHKERR contactPostProcMoab.write_file(out_file_name.c_str(), "MOAB",
9277  "PARALLEL=WRITE_PART");
9278  }
9279  }
9280 
9282 }

◆ projectGriffithForce()

MoFEMErrorCode FractureMechanics::CrackPropagation::projectGriffithForce ( DM  dm,
Vec  f_griffith,
Vec  f_griffith_proj,
const int  verb = QUIET,
const bool  debug = false 
)

project Griffith forces

Definition at line 8011 of file CrackPropagation.cpp.

8014  {
8015  const MoFEM::Problem *problem_ptr;
8017 
8018  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8019 
8020  // project griffith force
8021  {
8022  if (debug) {
8023  // ierr = VecView(f_griffith,PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(ierr);
8024  double nrm2_griffith_force;
8025  CHKERR VecNorm(f_griffith, NORM_2, &nrm2_griffith_force);
8026  CHKERR PetscPrintf(mField.get_comm(), "nrm2_f_griffith = %6.4e\n",
8027  nrm2_griffith_force);
8028  }
8029  if (doSurfaceProjection) {
8030  int M, m;
8031  CHKERR VecGetSize(f_griffith, &M);
8032  CHKERR VecGetLocalSize(f_griffith, &m);
8033  Mat Q;
8034  CHKERR MatCreateShell(mField.get_comm(), m, m, M, M, projSurfaceCtx.get(),
8035  &Q);
8036  CHKERR MatShellSetOperation(Q, MATOP_MULT,
8037  (void (*)(void))ProjectionMatrixMultOpQ);
8038  CHKERR MatMult(Q, f_griffith, f_griffith_proj);
8039  CHKERR MatDestroy(&Q);
8040  } else {
8041  CHKERR VecCopy(f_griffith, f_griffith_proj);
8042  }
8043  if (debug) {
8044  // ierr = VecView(f_griffith_proj,PETSC_VIEWER_STDOUT_WORLD);
8045  // CHKERRQ(ierr);
8046  }
8047  CHKERR VecGhostUpdateBegin(f_griffith_proj, INSERT_VALUES, SCATTER_FORWARD);
8048  CHKERR VecGhostUpdateEnd(f_griffith_proj, INSERT_VALUES, SCATTER_FORWARD);
8049  PostProcVertexMethod ent_method_prj_griffith_force(
8050  mField, f_griffith_proj, "GRIFFITH_FORCE_PROJECTED");
8051  CHKERR mField.loop_dofs(problem_ptr->getName(), "MESH_NODE_POSITIONS", COL,
8052  ent_method_prj_griffith_force);
8053  if (verb > VERBOSE) {
8054  double nrm2_griffith_force;
8055  CHKERR VecNorm(f_griffith_proj, NORM_2, &nrm2_griffith_force);
8056  CHKERR PetscPrintf(mField.get_comm(), "nrm2_f_griffith_proj = %6.4e\n",
8057  nrm2_griffith_force);
8058  }
8059  }
8060 
8062 }

◆ projectMaterialForcesDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::projectMaterialForcesDM ( DM  dm_project,
Vec  f,
Vec  f_proj,
const int  verb = QUIET,
const bool  debug = false 
)

project material forces along the crack elongation direction

Parameters
dm_projectmaterial forces DM, sub-dm of dm_crack_propagation
f_projRhs sub-vector of projected material forces for material forces DM
fRhs sub-vector for material forces DM
verbcompilation parameter determining the amount of information printed
debugflag for debugging
Returns
error code

Definition at line 7908 of file CrackPropagation.cpp.

7911  {
7912  const MoFEM::Problem *prb_proj_ptr;
7914  CHKERR DMMoFEMGetProblemPtr(dm_project, &prb_proj_ptr);
7915 
7916  if (debug && doSurfaceProjection) {
7917  CHKERR VecView(f, PETSC_VIEWER_STDOUT_WORLD);
7918  CHKERR projSurfaceCtx->initializeQorP(f);
7919  CHKERR VecScatterView(projSurfaceCtx->sCatter, PETSC_VIEWER_STDOUT_WORLD);
7920  Vec x;
7921  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(
7922  projSurfaceCtx->yProblem, COL, &x);
7923  CHKERR VecScatterBegin(projSurfaceCtx->sCatter, f, x, INSERT_VALUES,
7924  SCATTER_FORWARD);
7925  CHKERR VecScatterEnd(projSurfaceCtx->sCatter, f, x, INSERT_VALUES,
7926  SCATTER_FORWARD);
7927  CHKERR VecView(x, PETSC_VIEWER_STDOUT_WORLD);
7928  Vec Cf;
7929  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(
7930  projSurfaceCtx->yProblem, ROW, &Cf);
7931  CHKERR MatMult(projSurfaceCtx->C, x, Cf);
7932  CHKERR VecView(Cf, PETSC_VIEWER_STDOUT_WORLD);
7933  CHKERR VecDestroy(&Cf);
7934  CHKERR VecDestroy(&x);
7935  }
7936 
7937  int M, m;
7938  CHKERR VecGetSize(f, &M);
7939  CHKERR VecGetLocalSize(f, &m);
7940  if (doSurfaceProjection) {
7941  Mat Q;
7942  CHKERR MatCreateShell(PETSC_COMM_WORLD, m, m, M, M, projSurfaceCtx.get(),
7943  &Q);
7944  CHKERR MatShellSetOperation(Q, MATOP_MULT,
7945  (void (*)(void))ProjectionMatrixMultOpQ);
7946  CHKERR MatMult(Q, f, f_proj);
7947  CHKERR MatDestroy(&Q);
7948  } else {
7949  CHKERR VecCopy(f, f_proj);
7950  }
7951  PostProcVertexMethod ent_method_spatial_position(mField, f_proj,
7952  "MATERIAL_FORCE_PROJECTED");
7953  CHKERR VecGhostUpdateBegin(f_proj, INSERT_VALUES, SCATTER_FORWARD);
7954  CHKERR VecGhostUpdateEnd(f_proj, INSERT_VALUES, SCATTER_FORWARD);
7955  CHKERR mField.loop_dofs(prb_proj_ptr->getName(), "MESH_NODE_POSITIONS", ROW,
7956  ent_method_spatial_position, 0,
7957  mField.get_comm_size());
7958 
7960 }

◆ query_interface()

MoFEMErrorCode FractureMechanics::CrackPropagation::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const

Getting interface of core database.

Parameters
uuidunique ID of interface that can be either for CrackPropagation, CPSolvers or CPMeshCut interface
ifacereturned pointer to interface
Returns
error code

Definition at line 498 of file CrackPropagation.cpp.

499  {
501  *iface = NULL;
502 
503  if (type_index == boost::typeindex::type_id<CrackPropagation>()) {
504  *iface = const_cast<CrackPropagation *>(this);
505  return 0;
506  }
507 
508  if (type_index == boost::typeindex::type_id<CPSolvers>()) {
509  CHKERR cpSolversPtr->query_interface(type_index, iface);
510  return 0;
511  }
512 
513  if (type_index == boost::typeindex::type_id<CPMeshCut>()) {
514  CHKERR cpMeshCutPtr->query_interface(type_index, iface);
515  return 0;
516  }
517  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
519 }

◆ readMedFile()

MoFEMErrorCode FractureMechanics::CrackPropagation::readMedFile ( )

read mesh file

◆ resolveShared()

MoFEMErrorCode FractureMechanics::CrackPropagation::resolveShared ( const Range tets,
Range proc_ents,
const int  verb = QUIET,
const bool  debug = false 
)

resolve shared entities

Definition at line 1177 of file CrackPropagation.cpp.

1179  {
1180  moab::Interface &moab = mField.get_moab();
1181  Skinner skin(&mField.get_moab());
1183 
1184  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
1185 
1186  proc_ents.clear();
1187  Range all_proc_ents;
1188 
1189  // get entities on processor
1190  Tag part_tag = pcomm->part_tag();
1191  Range tagged_sets;
1192  CHKERR mField.get_moab().get_entities_by_type_and_tag(
1193  0, MBENTITYSET, &part_tag, NULL, 1, tagged_sets, moab::Interface::UNION);
1194  for (Range::iterator mit = tagged_sets.begin(); mit != tagged_sets.end();
1195  mit++) {
1196  int part;
1197  CHKERR moab.tag_get_data(part_tag, &*mit, 1, &part);
1198  if (part == mField.get_comm_rank()) {
1199  CHKERR moab.get_entities_by_dimension(*mit, 3, proc_ents, true);
1200  CHKERR moab.get_entities_by_handle(*mit, all_proc_ents, true);
1201  }
1202  }
1203  proc_ents = intersect(proc_ents, tets);
1204 
1205  // get body skin
1206  Range tets_skin;
1207  CHKERR skin.find_skin(0, tets, false, tets_skin);
1208 
1209  // get skin on processor
1210  Range proc_ents_skin[4];
1211 
1212  Range contact_tets;
1213  if (!contactElements.empty() && !ignoreContact && !fixContactNodes) {
1214  BitRefLevel bit2_again = mapBitLevel["material_domain"];
1215  Range prisms_level;
1216  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1217  bit2_again, BitRefLevel().set(), MBPRISM, prisms_level);
1218 
1219  Range contact_prisms = intersect(prisms_level, contactElements);
1220 
1221  Range contact_prisms_to_remove =
1222  intersect(prisms_level, mortarContactElements);
1223  prisms_level = subtract(prisms_level, contact_prisms_to_remove);
1224 
1225  Range face_on_prism;
1226  CHKERR moab.get_adjacencies(contact_prisms, 2, false, face_on_prism,
1227  moab::Interface::UNION);
1228 
1229  Range tris_on_prism = face_on_prism.subset_by_type(MBTRI);
1230 
1231  Range adj_vols_to_prisms;
1232  CHKERR moab.get_adjacencies(tris_on_prism, 3, false, adj_vols_to_prisms,
1233  moab::Interface::UNION);
1234 
1235  Range tet_level;
1236  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1237  bit2_again, BitRefLevel().set(), MBTET, tet_level);
1238 
1239  Range contact_tets_from_vols = adj_vols_to_prisms.subset_by_type(MBTET);
1240 
1241  contact_tets = intersect(tet_level, contact_tets_from_vols);
1242 
1243  moab::Interface &moab = mField.get_moab();
1244  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
1245  Range contact_tets_container = contact_tets;
1246  // FIXME: can we delete this?
1247  // Distribute prisms elements
1248  // {
1249 
1250  // Range tris_level;
1251 
1252  // //Find tris of tets
1253  // CHKERR moab.get_adjacencies(contact_tets, 2, false, tris_level,
1254  // moab::Interface::UNION);
1255  // for (Range::iterator mit = tagged_sets.begin(); mit !=
1256  // tagged_sets.end();
1257  // mit++) {
1258  // Range part_tris;
1259  // CHKERR moab.get_entities_by_type(*mit, MBTRI, part_tris);
1260  // part_tris = intersect(part_tris, tris_level);
1261  // Range adj_vols;
1262  // CHKERR moab.get_adjacencies(part_tris, 3, false, adj_vols,
1263  // moab::Interface::UNION);
1264  // adj_vols = intersect(adj_vols, contact_tets_container);
1265  // contact_tets_container = subtract(contact_tets_container, adj_vols);
1266  // int part;
1267  // CHKERR moab.tag_get_data(part_tag, &*mit, 1, &part);
1268  // std::vector<int> tag(adj_vols.size(), part);
1269  // CHKERR moab.tag_set_data(part_tag, adj_vols, &*tag.begin());
1270  // CHKERR moab.add_entities(*mit, adj_vols);
1271  // }
1272  // }
1273  contactTets = contact_tets;
1274  proc_ents.merge(contact_tets);
1275 
1276  Range contact_tets_vert;
1277  CHKERR moab.get_adjacencies(contact_tets, 0, false, contact_tets_vert,
1278  moab::Interface::UNION);
1279  Range contact_tets_edges;
1280  CHKERR moab.get_adjacencies(contact_tets, 1, false, contact_tets_edges,
1281  moab::Interface::UNION);
1282  Range contact_tets_faces;
1283  CHKERR moab.get_adjacencies(contact_tets, 2, false, contact_tets_faces,
1284  moab::Interface::UNION);
1285  proc_ents_skin[2].merge(contact_tets_faces);
1286  proc_ents_skin[1].merge(contact_tets_edges);
1287  proc_ents_skin[0].merge(contact_tets_vert);
1288  }
1289 
1290  proc_ents_skin[3] = proc_ents;
1291  CHKERR skin.find_skin(0, proc_ents, false, proc_ents_skin[2]);
1292  // and get shared entities
1293  proc_ents_skin[2] = subtract(proc_ents_skin[2], tets_skin);
1294  // Note that all crack faces are shared
1295  proc_ents_skin[2].merge(crackFaces);
1296  proc_ents_skin[2].merge(contactSlaveFaces);
1297  proc_ents_skin[2].merge(contactMasterFaces);
1298  proc_ents_skin[2].merge(mortarContactSlaveFaces);
1299  proc_ents_skin[2].merge(mortarContactMasterFaces);
1300 
1301  CHKERR moab.get_adjacencies(proc_ents_skin[2], 1, false, proc_ents_skin[1],
1302  moab::Interface::UNION);
1303  CHKERR moab.get_connectivity(proc_ents_skin[1], proc_ents_skin[0], true);
1304  proc_ents_skin[1].merge(crackFront);
1305  Range crack_faces_nodes;
1306  CHKERR moab.get_connectivity(crackFaces, crack_faces_nodes, true);
1307  proc_ents_skin[0].merge(crack_faces_nodes);
1308  // proc_ents_skin[0].merge(crackFrontNodes);
1309 
1310  if (mField.check_field("LAMBDA_ARC_LENGTH")) {
1311  EntityHandle lambda_meshset = mField.get_field_meshset("LAMBDA_ARC_LENGTH");
1312  Range arc_length_vertices;
1313  CHKERR moab.get_entities_by_type(lambda_meshset, MBVERTEX,
1314  arc_length_vertices, true);
1315  if (arc_length_vertices.size() != 1) {
1317  "Should be one vertex in <LAMBDA_ARC_LENGTH> field but is %d",
1318  arc_length_vertices.size());
1319  }
1320  arcLengthVertex = arc_length_vertices[0];
1321  proc_ents_skin[0].merge(arc_length_vertices);
1322  } else {
1323  const double coords[] = {0, 0, 0};
1324  CHKERR moab.create_vertex(coords, arcLengthVertex);
1325  proc_ents_skin[0].insert(arcLengthVertex);
1326  }
1327  {
1328  Tag th_gid;
1329  CHKERR mField.get_moab().tag_get_handle(GLOBAL_ID_TAG_NAME, th_gid);
1330  int gid;
1331  ierr = mField.get_moab().get_number_entities_by_type(0, MBVERTEX, gid);
1332  CHKERR mField.get_moab().tag_set_data(th_gid, &arcLengthVertex, 1, &gid);
1333  }
1334 
1335  Range all_ents_no_on_part;
1336  CHKERR moab.get_entities_by_handle(0, all_ents_no_on_part, true);
1337  all_ents_no_on_part = subtract(all_ents_no_on_part, all_proc_ents);
1338  for (int dd = 0; dd != 4; ++dd) {
1339  all_ents_no_on_part = subtract(all_ents_no_on_part, proc_ents_skin[dd]);
1340  }
1341  all_ents_no_on_part = subtract(
1342  all_ents_no_on_part, all_ents_no_on_part.subset_by_type(MBENTITYSET));
1343  CHKERR mField.remove_ents_from_finite_element(all_ents_no_on_part);
1344  CHKERR mField.remove_ents_from_field(all_ents_no_on_part);
1345 
1346  {
1347  Range all_ents;
1348  CHKERR moab.get_entities_by_handle(0, all_ents);
1349  std::vector<unsigned char> pstat_tag(all_ents.size(), 0);
1350  CHKERR moab.tag_set_data(pcomm->pstatus_tag(), all_ents,
1351  &*pstat_tag.begin());
1352  }
1353 
1354  CHKERR pcomm->resolve_shared_ents(0, proc_ents, 3, -1, proc_ents_skin);
1355 
1356  const RefEntity_multiIndex *refined_ents_ptr;
1357  ierr = mField.get_ref_ents(&refined_ents_ptr);
1358  if (debug) {
1359  std::ostringstream file_skin;
1360  file_skin << "out_skin_" << mField.get_comm_rank() << ".vtk";
1361  EntityHandle meshset_skin;
1362  CHKERR moab.create_meshset(MESHSET_SET, meshset_skin);
1363  CHKERR moab.add_entities(meshset_skin, proc_ents_skin[2]);
1364  CHKERR moab.add_entities(meshset_skin, proc_ents_skin[1]);
1365  CHKERR moab.add_entities(meshset_skin, proc_ents_skin[0]);
1366 
1367  CHKERR moab.write_file(file_skin.str().c_str(), "VTK", "", &meshset_skin,
1368  1);
1369  std::ostringstream file_owned;
1370  file_owned << "out_owned_" << mField.get_comm_rank() << ".vtk";
1371  EntityHandle meshset_owned;
1372  CHKERR moab.create_meshset(MESHSET_SET, meshset_owned);
1373  CHKERR moab.add_entities(meshset_owned, proc_ents);
1374  CHKERR moab.write_file(file_owned.str().c_str(), "VTK", "", &meshset_owned,
1375  1);
1376  CHKERR moab.delete_entities(&meshset_owned, 1);
1377  }
1378 
1379  if (debug) {
1380  Range shared_ents;
1381  // Get entities shared with all other processors
1382  CHKERR pcomm->get_shared_entities(-1, shared_ents);
1383  std::ostringstream file_shared_owned;
1384  file_shared_owned << "out_shared_owned_" << mField.get_comm_rank()
1385  << ".vtk";
1386  EntityHandle meshset_shared_owned;
1387  CHKERR moab.create_meshset(MESHSET_SET, meshset_shared_owned);
1388  CHKERR moab.add_entities(meshset_shared_owned, shared_ents);
1389  CHKERR moab.write_file(file_shared_owned.str().c_str(), "VTK", "",
1390  &meshset_shared_owned, 1);
1391  CHKERR moab.delete_entities(&meshset_shared_owned, 1);
1392  }
1393 
1395 }

◆ resolveSharedBitRefLevel()

MoFEMErrorCode FractureMechanics::CrackPropagation::resolveSharedBitRefLevel ( const BitRefLevel  bit,
const int  verb = QUIET,
const bool  debug = false 
)

resole shared entities by bit level

Definition at line 1397 of file CrackPropagation.cpp.

1399  {
1400  moab::Interface &moab = mField.get_moab();
1401  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
1403  bitEnts.clear();
1404  bitProcEnts.clear();
1405  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1406  bit, BitRefLevel().set(), MBTET, bitEnts);
1407 
1408  if (debug) {
1409  std::ostringstream file_owned;
1410  file_owned << "out_bit_" << mField.get_comm_rank() << ".vtk";
1411  EntityHandle meshset;
1412  CHKERR moab.create_meshset(MESHSET_SET, meshset);
1413  CHKERR moab.add_entities(meshset, bitEnts.subset_by_dimension(3));
1414  CHKERR moab.write_file(file_owned.str().c_str(), "VTK", "", &meshset, 1);
1415  CHKERR moab.delete_entities(&meshset, 1);
1416  }
1417  // Distribute prisms elements
1418  {
1419  Tag part_tag = pcomm->part_tag();
1420  Range tagged_sets;
1421  CHKERR mField.get_moab().get_entities_by_type_and_tag(
1422  0, MBENTITYSET, &part_tag, NULL, 1, tagged_sets,
1423  moab::Interface::UNION);
1424  Range tris_level;
1425  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1426  bit, BitRefLevel().set(), MBTRI, tris_level);
1427  Range prisms_sides;
1428  prisms_sides.merge(oneSideCrackFaces);
1429  prisms_sides.merge(contactSlaveFaces);
1430  prisms_sides.merge(mortarContactSlaveFaces);
1431 
1432  tris_level = intersect(tris_level, prisms_sides);
1433  Range prisms_level;
1434  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
1435  bit, BitRefLevel().set(), MBPRISM, prisms_level);
1436 
1437  for (Range::iterator mit = tagged_sets.begin(); mit != tagged_sets.end();
1438  mit++) {
1439  Range part_tris;
1440  CHKERR moab.get_entities_by_type(*mit, MBTRI, part_tris);
1441  part_tris = intersect(part_tris, tris_level);
1442  Range adj_prisms;
1443  CHKERR moab.get_adjacencies(part_tris, 3, false, adj_prisms,
1444  moab::Interface::UNION);
1445  adj_prisms = intersect(adj_prisms, prisms_level);
1446  prisms_level = subtract(prisms_level, adj_prisms);
1447 
1448  int part;
1449  CHKERR moab.tag_get_data(part_tag, &*mit, 1, &part);
1450  std::vector<int> tag(adj_prisms.size(), part);
1451  CHKERR moab.tag_set_data(part_tag, adj_prisms, &*tag.begin());
1452  CHKERR moab.add_entities(*mit, adj_prisms);
1453  }
1454  }
1455 
1458 }

◆ saveEachPart()

MoFEMErrorCode FractureMechanics::CrackPropagation::saveEachPart ( const std::string  prefix,
const Range ents 
)

Save entities on ech processor.

Usually used for debugging, to check if meshes are consistent on all processors.

Parameters
prefixfile name prefix
entsentities to save
Returns
MoFEMErrorCode error code

Definition at line 1098 of file CrackPropagation.cpp.

1099  {
1101  std::ostringstream file;
1102  file << prefix << mField.get_comm_rank() << ".vtk";
1103  EntityHandle meshset_out;
1104  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset_out);
1105  CHKERR mField.get_moab().add_entities(meshset_out, ents);
1106  CHKERR mField.get_moab().write_file(file.str().c_str(), "VTK", "",
1107  &meshset_out, 1, NULL, 0);
1108  CHKERR mField.get_moab().delete_entities(&meshset_out, 1);
1110 };

◆ savePositionsOnCrackFrontDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::savePositionsOnCrackFrontDM ( DM  dm,
Vec  q,
const int  verb = QUIET,
const bool  debug = false 
)

Definition at line 8064 of file CrackPropagation.cpp.

8066  {
8068  if (q != PETSC_NULL) {
8069  CHKERR VecGhostUpdateBegin(q, INSERT_VALUES, SCATTER_FORWARD);
8070  CHKERR VecGhostUpdateEnd(q, INSERT_VALUES, SCATTER_FORWARD);
8071  }
8072  const MoFEM::Problem *problem_ptr;
8073  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8074  PostProcVertexMethod ent_method_spatial_position(mField, q,
8075  "SPATIAL_POSITION");
8076  CHKERR mField.loop_dofs(problem_ptr->getName(), "SPATIAL_POSITION", ROW,
8077  ent_method_spatial_position, 0,
8078  mField.get_comm_size());
8079  if (debug) {
8080  EntityHandle meshset;
8081  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
8082  CHKERR mField.get_moab().add_entities(meshset, crackFront);
8083  // cerr << crackFront << endl;
8084  std::ostringstream file_name;
8085  file_name << "out_crack_spatial_position.h5m";
8086  CHKERR mField.get_moab().write_file(file_name.str().c_str(), "MOAB",
8087  "PARALLEL=WRITE_PART", &meshset, 1);
8088  CHKERR mField.get_moab().delete_entities(&meshset, 1);
8089  }
8091 }

◆ setCoordsFromField()

MoFEMErrorCode FractureMechanics::CrackPropagation::setCoordsFromField ( const std::string  field_name = "MESH_NODE_POSITIONS")

set coordinates from field

Definition at line 9304 of file CrackPropagation.cpp.

9304  {
9305  EntityHandle node = 0;
9306  double coords[3];
9309  MBVERTEX, dof_ptr)) {
9310  EntityHandle ent = dof_ptr->get()->getEnt();
9311  int dof_rank = dof_ptr->get()->getDofCoeffIdx();
9312  double fval = dof_ptr->get()->getFieldData();
9313  if (node != ent) {
9314  CHKERR mField.get_moab().get_coords(&ent, 1, coords);
9315  node = ent;
9316  }
9317  coords[dof_rank] = fval;
9318  if (dof_ptr->get()->getName() != field_name) {
9319  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
9320  }
9321  CHKERR mField.get_moab().set_coords(&ent, 1, coords);
9322  }
9324 }

◆ setCrackFrontBitLevel()

MoFEMErrorCode FractureMechanics::CrackPropagation::setCrackFrontBitLevel ( BitRefLevel  from_bit,
BitRefLevel  bit,
const int  nb_levels = 2,
const bool  debug = false 
)

Set bit ref level for entities adjacent to crack front.

Parameters
from_bit
bit
nb_levelsadjacency bridge levels
Returns
MoFEMErrorCode

Definition at line 9413 of file CrackPropagation.cpp.

9416  {
9417  moab::Interface &moab = mField.get_moab();
9419  Range bit_tets;
9420  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByDimAndRefLevel(
9421  from_bit, BitRefLevel().set(), 3, bit_tets);
9422 
9423  Range ents;
9424  CHKERR moab.get_connectivity(crackFrontElements, ents, true);
9425 
9426  Range adj_tets;
9427  for (int ll = 0; ll != nb_levels; ll++) {
9428  // get tets
9429  CHKERR moab.get_adjacencies(ents, 3, false, adj_tets,
9430  moab::Interface::UNION);
9431  // get tets on bit-ref level
9432  adj_tets = intersect(bit_tets, adj_tets);
9433  // get nodes
9434  CHKERR moab.get_connectivity(adj_tets, ents, true);
9435  }
9436 
9437  CHKERR moab.get_adjacencies(adj_tets.subset_by_type(MBTET), 1, false, ents,
9438  moab::Interface::UNION);
9439  CHKERR moab.get_adjacencies(adj_tets.subset_by_type(MBTET), 2, false, ents,
9440  moab::Interface::UNION);
9441  ents.merge(adj_tets);
9442 
9443  CHKERR mField.getInterface<BitRefManager>()->addBitRefLevel(ents, bit);
9444 
9445  if (debug) {
9446  CHKERR mField.getInterface<BitRefManager>()->writeBitLevelByType(
9447  bit, BitRefLevel().set(), MBTET, "bit2_at_crack_front.vtk", "VTK", "");
9448  CHKERR mField.getInterface<BitRefManager>()->writeBitLevelByType(
9449  bit, BitRefLevel().set(), MBPRISM, "bit2_at_crack_front_prisms.vtk",
9450  "VTK", "");
9451  }
9452 
9454 }

◆ setFieldFromCoords()

MoFEMErrorCode FractureMechanics::CrackPropagation::setFieldFromCoords ( const std::string  field_name)

set field from node positions

Definition at line 9285 of file CrackPropagation.cpp.

9285  {
9286  double coords[3];
9289  dof_ptr)) {
9290  if (dof_ptr->get()->getEntType() != MBVERTEX) {
9291  dof_ptr->get()->getFieldData() = 0;
9292  } else {
9293  int dof_rank = dof_ptr->get()->getDofCoeffIdx();
9294  double &fval = dof_ptr->get()->getFieldData();
9295  EntityHandle ent = dof_ptr->get()->getEnt();
9296  CHKERR mField.get_moab().get_coords(&ent, 1, coords);
9297  fval = coords[dof_rank];
9298  }
9299  }
9301 }

◆ setMaterialPositionFromCoords()

MoFEMErrorCode FractureMechanics::CrackPropagation::setMaterialPositionFromCoords ( )

set material field from nodes

Definition at line 9326 of file CrackPropagation.cpp.

9326  {
9327  return setFieldFromCoords("MESH_NODE_POSITIONS");
9328 }

◆ setSingularDofs()

MoFEMErrorCode FractureMechanics::CrackPropagation::setSingularDofs ( const string  field_name,
const int  verb = QUIET 
)

set singular dofs (on edges adjacent to crack front) from geometry

Definition at line 9334 of file CrackPropagation.cpp.

9335  {
9336  const DofEntity_multiIndex *dofs_ptr;
9337  moab::Interface &moab = mField.get_moab();
9339  CHKERR mField.get_dofs(&dofs_ptr);
9340 
9341  for (Range::iterator eit = crackFrontNodesEdges.begin();
9342  eit != crackFrontNodesEdges.end(); eit++) {
9343  int num_nodes;
9344  const EntityHandle *conn;
9345  CHKERR moab.get_connectivity(*eit, conn, num_nodes, false);
9346  double coords[6];
9347  CHKERR moab.get_coords(conn, num_nodes, coords);
9348  const double dir[3] = {coords[3] - coords[0], coords[4] - coords[1],
9349  coords[5] - coords[2]};
9350  double dof[3] = {0, 0, 0};
9351  if (crackFrontNodes.find(conn[0]) != crackFrontNodes.end()) {
9352  for (int dd = 0; dd != 3; dd++) {
9353  dof[dd] = -dir[dd];
9354  }
9355  } else if (crackFrontNodes.find(conn[1]) != crackFrontNodes.end()) {
9356  for (int dd = 0; dd != 3; dd++) {
9357  dof[dd] = +dir[dd];
9358  }
9359  }
9361  dit)) {
9362  const int idx = dit->get()->getEntDofIdx();
9363  if (idx > 2) {
9364  dit->get()->getFieldData() = 0;
9365  } else {
9366  if (verb > 1) {
9367  cerr << **dit << endl;
9368  cerr << dof[idx] << endl;
9369  }
9370  if (dit->get()->getApproxBase() == AINSWORTH_LOBATTO_BASE) {
9371  dof[idx] /= LOBATTO_PHI0(0);
9372  }
9373  dit->get()->getFieldData() = dof[idx];
9374  }
9375  }
9376  }
9378 }

◆ setSingularElementMatrialPositions()

MoFEMErrorCode FractureMechanics::CrackPropagation::setSingularElementMatrialPositions ( const int  verb = QUIET)

set singular dofs of material field (on edges adjacent to crack front) from geometry

Definition at line 9381 of file CrackPropagation.cpp.

9381  {
9383  CHKERR setSingularDofs("MESH_NODE_POSITIONS", verb);
9384  setSingularCoordinates = true;
9386 }

◆ setSpatialPositionFromCoords()

MoFEMErrorCode FractureMechanics::CrackPropagation::setSpatialPositionFromCoords ( )

set spatial field from nodes

Definition at line 9330 of file CrackPropagation.cpp.

9330  {
9331  return setFieldFromCoords("SPATIAL_POSITION");
9332 }

◆ solveElasticDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::solveElasticDM ( DM  dm,
SNES  snes,
Mat  m,
Vec  q,
Vec  f,
bool  snes_set_up,
Mat *  shell_m 
)

solve elastic problem

Parameters
dmelastic DM
snessnes solver for elastic DM
mstiffness sub-matrix for elastic DM
qDoF sub-vector for elastic DM
fRhs sub-vector for material DM
snes_set_upboolean flag wheather to determin snes solver
shell_mstiffness sub-matrix for elastic DM
Returns
error code

Definition at line 8224 of file CrackPropagation.cpp.

8226  {
8228 
8229  const MoFEM::Problem *problem_ptr;
8230  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8231 
8232  auto check_vec_size = [&](auto q) {
8234  int q_size;
8235  CHKERR VecGetSize(q, &q_size);
8236  if (q_size != problem_ptr->nbDofsRow) {
8237  SETERRQ2(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
8238  "MoFEM vector size incomatibile %d != d", q_size,
8239  problem_ptr->nbDofsRow);
8240  }
8242  };
8243  CHKERR check_vec_size(q);
8244  CHKERR check_vec_size(f);
8245 
8246  decltype(arcCtx) arc_ctx;
8247  if (problem_ptr->getName() == "ELASTIC")
8248  arc_ctx = arcCtx;
8249  if (problem_ptr->getName() == "EIGEN_ELASTIC")
8250  arc_ctx = arcEigenCtx;
8251 
8252  if (!arc_ctx)
8253  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY,
8254  "Ctx for arc-length is not created");
8255 
8256  SnesCtx *snes_ctx;
8257  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
8258  auto arc_snes_ctx =
8259  dynamic_cast<CrackPropagation::ArcLengthSnesCtx *>(snes_ctx);
8260  auto diag_m = smartVectorDuplicate(f);
8261  arc_snes_ctx->setVecDiagM(diag_m);
8262  CHKERR VecSet(arc_snes_ctx->getVecDiagM(), 1.);
8263 
8264  auto arc_mat_ctx =
8265  boost::make_shared<ArcLengthMatShell>(m, arc_ctx, problem_ptr->getName());
8266 
8267  auto create_shell_matrix = [&]() {
8269  PetscInt M, N;
8270  CHKERR MatGetSize(m, &M, &N);
8271  PetscInt mm, nn;
8272  CHKERR MatGetLocalSize(m, &mm, &nn);
8273  CHKERR MatCreateShell(mField.get_comm(), mm, nn, M, N,
8274  static_cast<void *>(arc_mat_ctx.get()), shellM);
8275  CHKERR MatShellSetOperation(*shellM, MATOP_MULT,
8276  (void (*)(void))ArcLengthMatMultShellOp);
8277 
8279  };
8280 
8281  auto get_pc = [&]() {
8282  auto pc = createPC(mField.get_comm());
8283  CHKERR PCAppendOptionsPrefix(pc, "elastic_");
8284  CHKERR PCSetFromOptions(pc);
8285  return pc;
8286  };
8287 
8288  boost::shared_ptr<PCArcLengthCtx> pc_arc_length_ctx;
8289 
8290  auto get_pc_arc = [&](auto pc_mg) {
8291  pc_arc_length_ctx =
8292  boost::make_shared<PCArcLengthCtx>(pc_mg, *shellM, m, arc_ctx);
8293  auto pc_arc = createPC(mField.get_comm());
8294  CHKERR PCSetType(pc_arc, PCSHELL);
8295  CHKERR PCShellSetContext(pc_arc, pc_arc_length_ctx.get());
8296  CHKERR PCShellSetApply(pc_arc, PCApplyArcLength);
8297  CHKERR PCShellSetSetUp(pc_arc, PCSetupArcLength);
8298  return pc_arc;
8299  };
8300 
8301  auto setup_snes = [&](auto pc_mg, auto pc_arc) {
8303  KSP ksp;
8304 
8305  CHKERR SNESSetDM(snes, dm);
8306  CHKERR SNESSetFunction(snes, f, elastic_snes_rhs, snes_ctx);
8307  CHKERR SNESSetJacobian(snes, *shellM, m, elastic_snes_mat, snes_ctx);
8308  CHKERR SNESAppendOptionsPrefix(snes, "elastic_");
8309  CHKERR SNESSetFromOptions(snes);
8310  CHKERR SNESGetKSP(snes, &ksp);
8311  CHKERR KSPSetPC(ksp, pc_arc);
8312 
8313 #if PETSC_VERSION_GE(3, 8, 0)
8314  CHKERR PCFactorSetMatSolverType(pc_mg, MATSOLVERMUMPS);
8315 #else
8316  CHKERR PCFactorSetMatSolverPackage(pc_mg, MATSOLVERMUMPS);
8317 #endif
8318 
8319  CHKERR SNESSetUp(snes);
8321  };
8322 
8323  auto calculate_diagonal_scale = [&]() {
8325 
8327  CHKERR SnesRhs(snes, q, f, arc_snes_ctx);
8328 
8329  const double *f_array;
8330  CHKERR VecGetArrayRead(f, &f_array);
8331  auto &rows_index =
8332  problem_ptr->getNumeredRowDofsPtr()->get<Unique_mi_tag>();
8333  const int nb_local = problem_ptr->getNbLocalDofsRow();
8334 
8335  constexpr size_t nb_fields = 2;
8336  std::array<std::string, nb_fields> fields = {"SPATIAL_POSITION",
8337  "LAMBDA_CLOSE_CRACK"};
8338  std::array<double, nb_fields> lnorms = {0, 0};
8339  std::array<double, nb_fields> norms = {0, 0};
8340  std::array<double, nb_fields> loc_nb_dofs = {0, 0};
8341  std::array<double, nb_fields> glob_nb_dofs = {0, 0};
8342 
8343  int nb = mField.check_field("LAMBDA_CLOSE_CRACK") ? nb_fields : 1;
8344 
8345  for (size_t f = 0; f != nb; ++f) {
8346  const auto bit_number = mField.get_field_bit_number(fields[f]);
8347  const auto lo_uid =
8348  rows_index.lower_bound(FieldEntity::getLoBitNumberUId(bit_number));
8349  const auto hi_uid =
8350  rows_index.upper_bound(FieldEntity::getHiBitNumberUId(bit_number));
8351  for (auto lo = lo_uid; lo != hi_uid; ++lo) {
8352  const int local_idx = (*lo)->getPetscLocalDofIdx();
8353  if (local_idx >= 0 && local_idx < nb_local) {
8354  const double val = f_array[local_idx];
8355  lnorms[f] += val * val;
8356  ++loc_nb_dofs[f];
8357  }
8358  }
8359  }
8360 
8361  CHKERR VecRestoreArrayRead(f, &f_array);
8362  CHKERR MPIU_Allreduce(lnorms.data(), norms.data(), nb, MPIU_REAL, MPIU_SUM,
8363  PetscObjectComm((PetscObject)dm));
8364  CHKERR MPIU_Allreduce(loc_nb_dofs.data(), glob_nb_dofs.data(), nb,
8365  MPIU_REAL, MPIU_SUM,
8366  PetscObjectComm((PetscObject)dm));
8367 
8368  for (auto &v : norms)
8369  v = sqrt(v);
8370 
8371  for (size_t f = 0; f != nb; ++f)
8372  MOFEM_LOG_C("CPWorld", Sev::verbose,
8373  "Scaling diaginal for field [ %s ] by %9.8e nb. of dofs %d",
8374  fields[f].c_str(), norms[f],
8375  static_cast<double>(glob_nb_dofs[f]));
8376 
8377  CHKERR VecSet(arc_snes_ctx->getVecDiagM(), 1.);
8378  double *diag_m_array;
8379  CHKERR VecGetArray(arc_snes_ctx->getVecDiagM(), &diag_m_array);
8380 
8381  for (size_t f = 0; f != nb; ++f) {
8382  if (norms[f] > 0) {
8383  const auto bit_number = mField.get_field_bit_number(fields[f]);
8384  const auto lo_uid = FieldEntity::getLoBitNumberUId(bit_number);
8385  const auto hi_uid = FieldEntity::getHiBitNumberUId(bit_number);
8386  for (auto lo = rows_index.lower_bound(lo_uid);
8387  lo != rows_index.upper_bound(hi_uid); ++lo) {
8388  const int local_idx = (*lo)->getPetscLocalDofIdx();
8389  if (local_idx >= 0 && local_idx < nb_local)
8390  diag_m_array[local_idx] = 1. / norms[f];
8391  }
8392  }
8393  }
8394 
8395  CHKERR VecGetArray(arc_snes_ctx->getVecDiagM(), &diag_m_array);
8396 
8398  };
8399 
8400  if (snes_set_up) {
8401  CHKERR create_shell_matrix();
8402  auto pc_base = get_pc();
8403  auto pc_arc = get_pc_arc(pc_base);
8404  CHKERR setup_snes(pc_base, pc_arc);
8405  }
8406 
8407  CHKERR MatZeroEntries(m);
8408  CHKERR VecZeroEntries(f);
8409  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
8410  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
8411 
8412  // if (mwlsApprox) {
8413  // mwlsApprox->invABMap.clear();
8414  // mwlsApprox->influenceNodesMap.clear();
8415  // mwlsApprox->dmNodesMap.clear();
8416  // }
8417 
8418  CHKERR calculate_diagonal_scale();
8419 
8420  auto create_section = [&]() {
8422  PetscSection section;
8423  CHKERR DMGetDefaultSection(dm, &section);
8424  int num_fields;
8425  CHKERR PetscSectionGetNumFields(section, &num_fields);
8426  for (int f = 0; f != num_fields; f++) {
8427  const char *field_name;
8428  CHKERR PetscSectionGetFieldName(section, f, &field_name);
8429  CHKERR PetscPrintf(mField.get_comm(), "Field %d name %s\n", f,
8430  field_name);
8431  }
8433  };
8434 
8435  auto set_monitor = [&]() {
8437  PetscViewerAndFormat *vf;
8438  CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
8439  PETSC_VIEWER_DEFAULT, &vf);
8440  CHKERR SNESMonitorSet(
8441  snes,
8442  (MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
8443  void *))snes_monitor_fields,
8444  vf, (MoFEMErrorCode(*)(void **))PetscViewerAndFormatDestroy);
8446  };
8447 
8448  CHKERR create_section();
8449  CHKERR set_monitor();
8450 
8451  CHKERR SNESSolve(snes, PETSC_NULL, q);
8452  CHKERR VecGhostUpdateBegin(q, INSERT_VALUES, SCATTER_FORWARD);
8453  CHKERR VecGhostUpdateEnd(q, INSERT_VALUES, SCATTER_FORWARD);
8454  CHKERR SNESMonitorCancel(snes);
8455 
8456  double fnorm;
8457  CHKERR VecNorm(q, NORM_2, &fnorm);
8458  MOFEM_LOG_C("CPWorld", Sev::verbose, "solution fnorm = %9.8e", fnorm);
8459 
8460  if (problem_ptr->getName() == "EIGEN_ELASTIC") {
8461  CHKERR mField.getInterface<VecManager>()->setOtherLocalGhostVector(
8462  "EIGEN_ELASTIC", "SPATIAL_POSITION", "EIGEN_SPATIAL_POSITIONS", ROW, q,
8463  INSERT_VALUES, SCATTER_REVERSE);
8464  }
8465 
8467 }

◆ solvePropagationDM()

MoFEMErrorCode FractureMechanics::CrackPropagation::solvePropagationDM ( DM  dm,
DM  dm_elastic,
SNES  snes,
Mat  m,
Vec  q,
Vec  f 
)

solve crack propagation problem

Parameters
dmcrack propagation DM that is composed of elastic DM and material DM
dm_elasticelastic DM
snessnes solver for crack propagation DM
mstiffness sub-matrix for crack propagation DM
qDoF sub-vector for crack propagation DM
fRhs sub-vector for crack propagation DM
snes_set_upboolean flag wheather to determin snes solver
Returns
error code

Definition at line 8494 of file CrackPropagation.cpp.

8496  {
8498 
8499  Mat shell_m;
8500  Mat m_elastic = PETSC_NULL;
8501 
8503 
8504  const MoFEM::Problem *problem_ptr;
8505  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8506  SnesCtx *snes_ctx;
8507  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
8508  auto arc_snes_ctx =
8509  dynamic_cast<CrackPropagation::ArcLengthSnesCtx *>(snes_ctx);
8510  auto diag_m = smartVectorDuplicate(f);
8511  arc_snes_ctx->setVecDiagM(diag_m);
8512  CHKERR VecSet(arc_snes_ctx->getVecDiagM(), 1.);
8513 
8515  MOFEM_LOG("CPWorld", Sev::noisy)
8516  << "SNES problen name " << snes_ctx->problemName;
8517 
8518  if (mwlsApprox) {
8519  mwlsApprox->F_lambda = arc_snes_ctx->getArcPtr()->F_lambda;
8520  mwlsApprox->arcLengthDof = arcLengthDof;
8521  }
8522 
8523  // Surface pressure (ALE)
8524  if (isPressureAle) {
8525  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
8526  surfacePressureAle->begin();
8527  fit != surfacePressureAle->end(); fit++) {
8529  }
8530  }
8531 
8532  if (isSurfaceForceAle) {
8533  for (boost::ptr_map<string, NeumannForcesSurface>::iterator fit =
8534  surfaceForceAle->begin();
8535  fit != surfaceForceAle->end(); fit++) {
8536  commonDataSurfaceForceAle->arcLengthDof = arcLengthDof;
8537  }
8538  }
8539 
8540  auto arc_mat_ctx = boost::make_shared<ArcLengthMatShell>(
8541  m, arc_snes_ctx->getArcPtr(), problem_ptr->getName());
8542 
8543  auto create_shell_matrix = [&]() {
8545  PetscInt M, N;
8546  CHKERR MatGetSize(m, &M, &N);
8547  PetscInt mm, nn;
8548  CHKERR MatGetLocalSize(m, &mm, &nn);
8549  CHKERR MatCreateShell(mField.get_comm(), mm, nn, M, N,
8550  static_cast<void *>(arc_mat_ctx.get()), &shell_m);
8551  CHKERR MatShellSetOperation(shell_m, MATOP_MULT,
8552  (void (*)(void))ArcLengthMatMultShellOp);
8554  };
8555 
8556  auto set_monitor = [&]() {
8558  PetscViewerAndFormat *vf;
8559  CHKERR PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD,
8560  PETSC_VIEWER_DEFAULT, &vf);
8561  CHKERR SNESMonitorSet(
8562  snes,
8563  (MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
8564  void *))snes_monitor_fields,
8565  vf, (MoFEMErrorCode(*)(void **))PetscViewerAndFormatDestroy);
8567  };
8568 
8569  auto zero_matrices_and_vectors = [&]() {
8571  CHKERR MatZeroEntries(m);
8572  CHKERR VecZeroEntries(f);
8573  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
8574  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
8576  };
8577 
8578  auto create_section = [&]() {
8580  PetscSection section;
8581  CHKERR DMGetDefaultSection(dm, &section);
8582  int num_fields;
8583  CHKERR PetscSectionGetNumFields(section, &num_fields);
8584  for (int f = 0; f != num_fields; f++) {
8585  const char *field_name;
8586  CHKERR PetscSectionGetFieldName(section, f, &field_name);
8587  CHKERR PetscPrintf(mField.get_comm(), "Field %d name %s\n", f,
8588  field_name);
8589  }
8591  };
8592 
8593  boost::shared_ptr<PCArcLengthCtx> pc_arc_length_ctx;
8594 
8595  auto create_pc_arc = [&](auto pc_fs) {
8596  pc_arc_length_ctx = boost::make_shared<PCArcLengthCtx>(
8597  pc_fs, shell_m, m, arc_snes_ctx->getArcPtr());
8598  auto pc_arc = createPC(mField.get_comm());
8599  CHKERR PCSetType(pc_arc, PCSHELL);
8600  CHKERR PCShellSetContext(pc_arc, pc_arc_length_ctx.get());
8601  CHKERR PCShellSetApply(pc_arc, PCApplyArcLength);
8602  CHKERR PCShellSetSetUp(pc_arc, PCSetupArcLength);
8603  return pc_arc;
8604  };
8605 
8606  auto set_up_snes = [&](auto pc_arc, auto pc_fs, auto is_pcfs) {
8608 
8609  SnesCtx *snes_ctx;
8610  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
8611  CHKERR SNESSetDM(snes, dm);
8612  CHKERR SNESSetFunction(snes, f, propagation_snes_rhs, snes_ctx);
8613  CHKERR SNESSetJacobian(snes, shell_m, m, propagation_snes_mat, snes_ctx);
8614  CHKERR SNESSetFromOptions(snes);
8615 
8616  KSP ksp;
8617  CHKERR SNESGetKSP(snes, &ksp);
8618  CHKERR KSPSetPC(ksp, pc_arc);
8619  if (is_pcfs) {
8620  KSP *sub_ksp;
8621  PetscInt n;
8622  CHKERR PCFieldSplitGetSubKSP(pc_fs, &n, &sub_ksp);
8623  PC pc_0, pc_1;
8624  CHKERR KSPGetPC(sub_ksp[0], &pc_0);
8625  CHKERR KSPGetPC(sub_ksp[1], &pc_1);
8626 #if PETSC_VERSION_GE(3, 8, 0)
8627  CHKERR PCFactorSetMatSolverType(pc_0, MATSOLVERMUMPS);
8628  CHKERR PCFactorSetMatSolverType(pc_1, MATSOLVERMUMPS);
8629 #else
8630  CHKERR PCFactorSetMatSolverPackage(pc_0, MATSOLVERMUMPS);
8631  CHKERR PCFactorSetMatSolverPackage(pc_1, MATSOLVERMUMPS);
8632 #endif
8633 
8634  } else {
8635 #if PETSC_VERSION_GE(3, 8, 0)
8636  CHKERR PCFactorSetMatSolverType(pc_fs, MATSOLVERMUMPS);
8637 #else
8638  CHKERR PCFactorSetMatSolverPackage(pc_fs, MATSOLVERMUMPS);
8639 #endif
8640  }
8641  CHKERR SNESSetUp(snes);
8643  };
8644 
8645  auto create_pc_fs = [&](auto &is_pcfs) {
8646  auto pc_fs = createPC(mField.get_comm());
8647  CHKERR PCAppendOptionsPrefix(pc_fs, "propagation_");
8648  CHKERR PCSetFromOptions(pc_fs);
8649  PetscObjectTypeCompare((PetscObject)pc_fs, PCFIELDSPLIT, &is_pcfs);
8650  if (is_pcfs) {
8651  const MoFEM::Problem *problem_ptr;
8652  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8653  boost::shared_ptr<ComposedProblemsData> cmp_data_ptr =
8654  problem_ptr->getComposedProblemsData();
8655  for (int ff = 0; ff != static_cast<int>(cmp_data_ptr->rowIs.size());
8656  ++ff) {
8657  CHKERR PCFieldSplitSetIS(pc_fs, NULL, cmp_data_ptr->rowIs[ff]);
8658  }
8659  CHKERR PCSetOperators(pc_fs, m, m);
8660  CHKERR PCSetUp(pc_fs);
8661  }
8662  return pc_fs;
8663  };
8664 
8665  auto calculate_diagonal_scale = [&](bool debug = false) {
8667 
8668  const MoFEM::Problem *problem_ptr;
8669  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
8670  auto &rows_index =
8671  problem_ptr->getNumeredRowDofsPtr()->get<Unique_mi_tag>();
8672  const int nb_local = problem_ptr->getNbLocalDofsRow();
8673 
8674  auto f = smartVectorDuplicate(q);
8675  auto f_lambda = arc_snes_ctx->getArcPtr()->F_lambda;
8676  auto f_griffith = smartVectorDuplicate(q);
8677  auto diag_griffith = smartVectorDuplicate(q);
8678  auto diag_smoothing = smartVectorDuplicate(q);
8679  auto diag_contact = smartVectorDuplicate(q);
8680  auto vec_contact = smartVectorDuplicate(q);
8681 
8682  CHKERR VecSetOption(f_griffith, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
8683 
8684  auto assemble_mat = [&](DM dm, std::string name,
8685  boost::shared_ptr<FEMethod> fe, Mat m) {
8687  fe->snes_ctx = SnesMethod::CTX_SNESSETJACOBIAN;
8688  fe->snes_x = q;
8689  fe->snes_B = m;
8690  CHKERR DMoFEMLoopFiniteElements(dm, name, fe);
8691  fe->snes_ctx = SnesMethod::CTX_SNESNONE;
8693  };
8694 
8695  auto assemble_vec = [&](DM dm, std::string name,
8696  boost::shared_ptr<FEMethod> fe, Vec f) {
8698  fe->snes_ctx = SnesMethod::CTX_SNESSETFUNCTION;
8699  fe->snes_x = q;
8700  fe->snes_f = f;
8701  CHKERR DMoFEMLoopFiniteElements(dm, name, fe);
8702  fe->snes_ctx = SnesMethod::CTX_SNESNONE;
8704  };
8705 
8706  auto calculate_mat_and_vec = [&](double set_arc_alpha,
8707  double set_smoothing_alpha, double set_gc,
8708  double set_e) {
8710  bool stabilised = smootherFe->smootherData.sTabilised;
8711  double arc_alpha = arc_snes_ctx->getArcPtr()->alpha;
8712  double smoother_alpha = volumeLengthDouble->aLpha;
8713  double griffith_E = griffithForceElement->blockData[0].E;
8714  double gc = griffithForceElement->blockData[0].gc;
8715 
8716  smootherFe->smootherData.sTabilised = false;
8717  volumeLengthDouble->aLpha = set_smoothing_alpha;
8718  volumeLengthAdouble->aLpha = set_smoothing_alpha;
8719  arc_snes_ctx->getArcPtr()->alpha = set_arc_alpha;
8720  griffithForceElement->blockData[0].gc = set_gc;
8721  griffithForceElement->blockData[0].E = set_e;
8722 
8723  CHKERR SnesRhs(snes, q, f, arc_snes_ctx);
8724 
8725  CHKERR VecZeroEntries(f_griffith);
8726  CHKERR assemble_vec(dm, "GRIFFITH_FORCE_ELEMENT", feGriffithForceRhs,
8727  f_griffith);
8728  CHKERR VecGhostUpdateBegin(f_griffith, ADD_VALUES, SCATTER_REVERSE);
8729  CHKERR VecGhostUpdateEnd(f_griffith, ADD_VALUES, SCATTER_REVERSE);
8730  CHKERR VecAssemblyBegin(f_griffith);
8731  CHKERR VecAssemblyEnd(f_griffith);
8732 
8733  CHKERR MatZeroEntries(m);
8734  CHKERR assemble_mat(dm, "GRIFFITH_FORCE_ELEMENT", feGriffithForceLhs, m);
8735  CHKERR MatAssemblyBegin(m, MAT_FINAL_ASSEMBLY);
8736  CHKERR MatAssemblyEnd(m, MAT_FINAL_ASSEMBLY);
8737  CHKERR MatGetDiagonal(m, diag_griffith);
8738 
8739  smootherFe->smootherData.sTabilised = true;
8740  CHKERR MatZeroEntries(m);
8741  CHKERR assemble_mat(dm, "SMOOTHING", feSmootherLhs, m);
8742  CHKERR MatAssemblyBegin(m, MAT_FINAL_ASSEMBLY);
8743  CHKERR MatAssemblyEnd(m, MAT_FINAL_ASSEMBLY);
8744  CHKERR MatGetDiagonal(m, diag_smoothing);
8745 
8746  smootherFe->smootherData.sTabilised = stabilised;
8747  arc_snes_ctx->getArcPtr()->alpha = arc_alpha;
8748  volumeLengthDouble->aLpha = smoother_alpha;
8749  volumeLengthAdouble->aLpha = smoother_alpha;
8750  griffithForceElement->blockData[0].E = griffith_E;
8751  griffithForceElement->blockData[0].gc = gc;
8753  };
8754 
8755  auto get_norm_from_vec = [&](Vec vec, std::string field, Range *ents,
8756  bool not_contain) {
8757  double ret_val = 0;
8758  int size = 0;
8759  const double *v_array;
8760  CHKERR VecGetArrayRead(vec, &v_array);
8761 
8762  const auto bit_number = mField.get_field_bit_number(field);
8763  const auto lo_uid = FieldEntity::getLoBitNumberUId(bit_number);
8764  const auto hi_uid = FieldEntity::getHiBitNumberUId(bit_number);
8765 
8766  for (auto lo = rows_index.lower_bound(lo_uid);
8767  lo != rows_index.upper_bound(hi_uid); ++lo) {
8768 
8769  const int local_idx = (*lo)->getPetscLocalDofIdx();
8770  if (local_idx >= 0 && local_idx < nb_local) {
8771 
8772  bool no_skip = true;
8773  if (ents) {
8774  bool contain = ents->find((*lo)->getEnt()) != ents->end();
8775  if (not_contain) {
8776  if (contain)
8777  no_skip = false;
8778  } else {
8779  if (!contain)
8780  no_skip = false;
8781  }
8782  }
8783 
8784  if (no_skip) {
8785  const double val = v_array[local_idx];
8786  ret_val += val * val;
8787  ++size;
8788  }
8789  }
8790  }
8791  CHKERR VecRestoreArrayRead(vec, &v_array);
8792  return std::pair<double, double>(ret_val, size);
8793  };
8794 
8795  auto set_norm_from_vec = [&](Vec vec, std::string field, const double norm,
8796  Range *ents, bool not_contain) {
8798 
8799  if (!std::isnormal(norm))
8800  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
8801  "Wrong scaling value");
8802 
8803  double *v_array;
8804  CHKERR VecGetArray(vec, &v_array);
8805 
8806  const auto bit_number = mField.get_field_bit_number(field);
8807  const auto lo_uid = FieldEntity::getLoBitNumberUId(bit_number);
8808  const auto hi_uid = FieldEntity::getHiBitNumberUId(bit_number);
8809 
8810  for (auto lo = rows_index.lower_bound(lo_uid);
8811  lo != rows_index.upper_bound(hi_uid); ++lo) {
8812 
8813  const int local_idx = (*lo)->getPetscLocalDofIdx();
8814  if (local_idx >= 0 && local_idx < nb_local) {
8815 
8816  bool no_skip = true;
8817  if (ents) {
8818  bool contain = ents->find((*lo)->getEnt()) != ents->end();
8819  if (not_contain) {
8820  if (contain)
8821  no_skip = false;
8822  } else {
8823  if (!contain)
8824  no_skip = false;
8825  }
8826  }
8827 
8828  if (no_skip)
8829  v_array[local_idx] /= norm;
8830  }
8831  }
8832  CHKERR VecRestoreArray(vec, &v_array);
8834  };
8835 
8836  auto calulate_norms = [&](auto &lnorms, auto &lsizes, auto &norms,
8837  auto &sizes) {
8839  const double lambda = arc_snes_ctx->getArcPtr()->getFieldData();
8840  std::pair<double &, double &>(lnorms[0], lsizes[0]) =
8841  get_norm_from_vec(f, "LAMBDA_ARC_LENGTH", nullptr, false);
8842  std::pair<double &, double &>(lnorms[1], lsizes[1]) =
8843  get_norm_from_vec(f_lambda, "SPATIAL_POSITION", nullptr, false);
8844  std::pair<double &, double &>(lnorms[2], lsizes[2]) = get_norm_from_vec(
8845  f_griffith, "MESH_NODE_POSITIONS", &crackFrontNodes, false);
8846  std::pair<double &, double &>(lnorms[3], lsizes[3]) = get_norm_from_vec(
8847  diag_griffith, "MESH_NODE_POSITIONS", &crackFrontNodes, false);
8848  std::pair<double &, double &>(lnorms[4], lsizes[4]) = get_norm_from_vec(
8849  diag_smoothing, "MESH_NODE_POSITIONS", &crackFrontNodes, false);
8850 
8851  CHKERR MPIU_Allreduce(lnorms.data(), norms.data(), lnorms.size(),
8852  MPIU_REAL, MPIU_SUM,
8853  PetscObjectComm((PetscObject)dm));
8854  CHKERR MPIU_Allreduce(lsizes.data(), sizes.data(), lnorms.size(),
8855  MPIU_REAL, MPIU_SUM,
8856  PetscObjectComm((PetscObject)dm));
8857 
8858  for (auto &v : norms)
8859  v = sqrt(v);
8860 
8861  norms[1] *= lambda;
8862  norms[3] /= norms[1];
8863  norms[4] /= norms[1];
8864  norms[3] /= sizes[3];
8865  norms[4] /= sizes[4];
8866 
8868  };
8869 
8870  auto test_scale = [&](auto &fields, auto &lnorms, auto &lsizes, auto &norms,
8871  auto &sizes) {
8873  CHKERR calculate_mat_and_vec(arc_snes_ctx->getArcPtr()->alpha,
8874  volumeLengthDouble->aLpha,
8875  griffithForceElement->blockData[0].gc,
8876  griffithForceElement->blockData[0].E);
8877 
8878  for (auto &v : lnorms)
8879  v = 0;
8880  for (auto &v : lsizes)
8881  v = 0;
8882  for (auto &v : norms)
8883  v = 0;
8884  for (auto &v : sizes)
8885  v = 0;
8886 
8887  CHKERR VecPointwiseMult(f, f, arc_snes_ctx->getVecDiagM());
8888  CHKERR VecPointwiseMult(f_lambda, f_lambda, arc_snes_ctx->getVecDiagM());
8889  CHKERR VecPointwiseMult(f_griffith, f_griffith,
8890  arc_snes_ctx->getVecDiagM());
8891  CHKERR VecPointwiseMult(diag_griffith, diag_griffith,
8892  arc_snes_ctx->getVecDiagM());
8893  CHKERR VecPointwiseMult(diag_smoothing, diag_smoothing,
8894  arc_snes_ctx->getVecDiagM());
8895 
8896  CHKERR calulate_norms(lnorms, lsizes, norms, sizes);
8897 
8898  MOFEM_LOG_CHANNEL("CPWorld");
8900  MOFEM_LOG_TAG("CPWorld", "Testig scaling");
8901  for (size_t f = 0; f != fields.size(); ++f)
8902  MOFEM_LOG_C("CPWorld", Sev::inform,
8903  "Norms for field [ %s ] = %9.8e (%6.0f)", fields[f].c_str(),
8904  norms[f], sizes[f]);
8906  };
8907 
8908  CHKERR calculate_mat_and_vec(1, 1, gC, 1);
8909 
8910  constexpr size_t nb_fields = 5;
8911  std::array<std::string, nb_fields> fields = {
8912  "LAMBDA_ARC_LENGTH", "FLAMBDA", "GRIFFITH_FORCE", "GRIFFITH_FORCE_LHS",
8913  "SMOOTHING_CONSTRAIN_LHS"};
8914  std::array<double, nb_fields> lnorms = {0, 0, 0, 0, 0};
8915  std::array<double, nb_fields> norms = {0, 0, 0, 0, 0};
8916  std::array<double, nb_fields> lsizes = {0, 0, 0, 0, 0};
8917  std::array<double, nb_fields> sizes = {0, 0, 0, 0, 0};
8918 
8919  CHKERR calulate_norms(lnorms, lsizes, norms, sizes);
8920 
8921  constexpr size_t nb_fields_contact = 2;
8922  std::array<std::string, nb_fields> fields_contact = {"LAMBDA_CONTACT"};
8923  std::array<double, nb_fields> lnorms_contact = {0, 0};
8924  std::array<double, nb_fields> norms_contact = {0, 0};
8925  std::array<double, nb_fields> lsizes_contact = {0, 0};
8926  std::array<double, nb_fields> sizes_contact = {0, 0};
8927 
8928  MOFEM_LOG_CHANNEL("CPWorld");
8929  MOFEM_LOG_TAG("CPWorld", "Scaling");
8930  for (size_t f = 0; f != nb_fields; ++f)
8931  MOFEM_LOG_C("CPWorld", Sev::inform,
8932  "Norms for field [ %s ] = %9.8e (%6.0f)", fields[f].c_str(),
8933  norms[f], sizes[f]);
8934 
8935  arc_snes_ctx->getArcPtr()->alpha = arcAlpha / norms[0];
8936  const double scaled_smoother_alpha = smootherAlpha * norms[3] / norms[4];
8937  volumeLengthDouble->aLpha = scaled_smoother_alpha;
8938  volumeLengthAdouble->aLpha = scaled_smoother_alpha;
8939  griffithForceElement->blockData[0].E = griffithE * norms[3];
8940  CHKERR set_norm_from_vec(arc_snes_ctx->getVecDiagM(), "SPATIAL_POSITION",
8941  norms[1], nullptr, false);
8942  CHKERR set_norm_from_vec(arc_snes_ctx->getVecDiagM(), "MESH_NODE_POSITIONS",
8943  norms[1], nullptr, false);
8944 
8945  MOFEM_LOG_CHANNEL("CPWorld");
8946  MOFEM_LOG_TAG("CPWorld", "Scaling");
8947  MOFEM_LOG_C("CPWorld", Sev::inform, "Set scaled arc length alpha = %4.3e",
8948  arc_snes_ctx->getArcPtr()->alpha);
8949  MOFEM_LOG_C("CPWorld", Sev::inform, "Set scaled smoothing alpha = %4.3e",
8950  volumeLengthDouble->aLpha);
8951  MOFEM_LOG_C("CPWorld", Sev::inform, "Set scaled griffith E = %4.3e",
8952  griffithForceElement->blockData[0].E);
8953 
8954  if (debug)
8955  CHKERR test_scale(fields, lnorms, lsizes, norms, sizes);
8956 
8958  };
8959 
8960  if (true) {
8961 
8962  PetscBool is_pcfs = PETSC_FALSE;
8963 
8964  CHKERR create_shell_matrix();
8965  auto pc_fs = create_pc_fs(is_pcfs);
8966  auto pc_arc = create_pc_arc(pc_fs);
8967  CHKERR set_up_snes(pc_arc, pc_fs, is_pcfs);
8968  }
8969 
8970  CHKERR set_monitor();
8971  CHKERR zero_matrices_and_vectors();
8972  CHKERR create_section();
8973 
8974  // if (mwlsApprox) {
8975  // mwlsApprox->invABMap.clear();
8976  // mwlsApprox->influenceNodesMap.clear();
8977  // mwlsApprox->dmNodesMap.clear();
8978  // }
8979 
8980  CHKERR calculate_diagonal_scale(false);
8981 
8982  if (resetMWLSCoeffsEveryPropagationStep == PETSC_TRUE) {
8983  if (mwlsApprox) {
8984  MOFEM_LOG("MWLSWorld", Sev::inform)
8985  << "Resest MWLS approximation coefficients. Coefficients will be "
8986  "recalulated for current material positions.";
8987  mwlsApprox->invABMap.clear();
8988  mwlsApprox->influenceNodesMap.clear();
8989  mwlsApprox->dmNodesMap.clear();
8990  }
8991  }
8992 
8993  CHKERR SNESSolve(snes, PETSC_NULL, q);
8994  CHKERR VecGhostUpdateBegin(q, INSERT_VALUES, SCATTER_FORWARD);
8995  CHKERR VecGhostUpdateEnd(q, INSERT_VALUES, SCATTER_FORWARD);
8996  CHKERR SNESMonitorCancel(snes);
8997 
8998  double fnorm;
8999  CHKERR VecNorm(q, NORM_2, &fnorm);
9000  CHKERR PetscPrintf(mField.get_comm(), "solution fnorm = %9.8e\n", fnorm);
9001 
9002  CHKERR MatDestroy(&shell_m);
9003  if (m_elastic)
9004  CHKERR MatDestroy(&m_elastic);
9005 
9007 }

◆ testJacobians()

MoFEMErrorCode FractureMechanics::CrackPropagation::testJacobians ( const BitRefLevel  bit,
const BitRefLevel  mask,
tangent_tests  test 
)

test LHS Jacobians

Parameters
bitbit level
maskbitref mask
test_nbname of the test

Definition at line 5279 of file CrackPropagation.cpp.

5281  {
5282 
5284 
5285  boost::shared_ptr<CrackFrontElement> fe_rhs;
5286  boost::shared_ptr<CrackFrontElement> fe_lhs;
5287 
5288  switch (test) {
5289  case MWLS_STRESS_TAN:
5290  CHKERR addMWLSStressOperators(fe_rhs, fe_lhs);
5291  break;
5292  case MWLS_DENSITY_TAN:
5293  CHKERR addMWLSDensityOperators(fe_rhs, fe_lhs);
5294  break;
5295  case MWLS_GRIFFITH_TAN:
5296  break;
5297  default:
5298  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
5299  "There is no such test defined");
5300  break;
5301  }
5302 
5303  DM dm;
5304  CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
5305  CHKERR DMSetType(dm, "MOFEM");
5306  CHKERR DMMoFEMCreateMoFEM(dm, &mField, "TEST_MWLS", bit, mask);
5307  CHKERR DMMoFEMAddElement(dm, "GRIFFITH_FORCE_ELEMENT");
5308  CHKERR DMMoFEMAddElement(dm, "SMOOTHING");
5309  CHKERR DMMoFEMAddElement(dm, "BOTH_SIDES_OF_CRACK");
5310  CHKERR DMMoFEMAddElement(dm, "SURFACE");
5311  CHKERR DMMoFEMAddElement(dm, "CRACK_SURFACE");
5312  CHKERR DMMoFEMAddElement(dm, "EDGE");
5313  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_ELEM");
5314  CHKERR DMMoFEMAddElement(dm, "CRACKFRONT_AREA_TANGENT_ELEM");
5315  CHKERR DMMoFEMAddElement(dm, "MATERIAL");
5316  CHKERR DMMoFEMSetIsPartitioned(dm, PETSC_TRUE);
5317  CHKERR DMSetUp(dm);
5318 
5319  // Set up DM specific vectors and data
5320  Vec front_f, tangent_front_f;
5321  CHKERR DMCreateGlobalVector(dm, &front_f);
5322  CHKERR VecDuplicate(front_f, &tangent_front_f);
5323  CHKERR VecSetOption(front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
5324  CHKERR VecSetOption(tangent_front_f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
5325  if (smootherFe->smootherData.ownVectors) {
5326  if (smootherFe->smootherData.frontF != PETSC_NULL)
5327  CHKERR VecDestroy(&smootherFe->smootherData.frontF);
5328  if (smootherFe->smootherData.tangentFrontF != PETSC_NULL)
5329  CHKERR VecDestroy(&smootherFe->smootherData.tangentFrontF);
5330  }
5331  smootherFe->smootherData.frontF = front_f;
5332  smootherFe->smootherData.tangentFrontF = tangent_front_f;
5333  smootherFe->smootherData.ownVectors = true;
5334  if (tangentConstrains->ownVectors) {
5335  if (tangentConstrains->frontF != PETSC_NULL)
5336  VecDestroy(&tangentConstrains->frontF);
5337  if (tangentConstrains->tangentFrontF != PETSC_NULL)
5338  VecDestroy(&tangentConstrains->tangentFrontF);
5339  }
5340  tangentConstrains->frontF = front_f;
5341  tangentConstrains->tangentFrontF = tangent_front_f;
5342  tangentConstrains->ownVectors = false;
5343 
5344  const MoFEM::Problem *problem_ptr;
5345  CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
5346  CHKERR mField.getInterface<VecManager>()->vecCreateGhost(
5347  problem_ptr->getName(), COL, feGriffithConstrainsDelta->deltaVec);
5348  CHKERR VecSetOption(feGriffithConstrainsDelta->deltaVec,
5349  VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
5350  feGriffithConstrainsRhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
5351  feGriffithConstrainsLhs->deltaVec = feGriffithConstrainsDelta->deltaVec;
5352 
5353  boost::shared_ptr<FEMethod> null;
5354  switch (test) {
5355  case MWLS_STRESS_TAN:
5356  case MWLS_DENSITY_TAN:
5357  CHKERR DMMoFEMSNESSetJacobian(dm, "MATERIAL", fe_lhs, null, null);
5358  CHKERR DMMoFEMSNESSetFunction(dm, "MATERIAL", fe_rhs, null, null);
5359  break;
5360  case MWLS_GRIFFITH_TAN:
5361 
5362  // Add to SNES Jacobian
5364  null);
5365  CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feSmootherLhs, null, null);
5366  // CHKERR DMMoFEMSNESSetJacobian(dm, "SMOOTHING", feMaterialLhs, null,
5367  // null);
5368  CHKERR DMMoFEMSNESSetJacobian(dm, "BOTH_SIDES_OF_CRACK",
5369  bothSidesConstrains, null, null);
5370  for (auto &m : surfaceConstrain) {
5371  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
5372  CHKERR DMMoFEMSNESSetJacobian(dm, "SURFACE", m.second->feLhsPtr, null,
5373  null);
5374  } else {
5375  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACK_SURFACE", m.second->feLhsPtr,
5376  null, null);
5377  }
5378  }
5379  for (auto &m : edgeConstrains) {
5380  CHKERR DMMoFEMSNESSetJacobian(dm, "EDGE", m.second->feLhsPtr, null, null);
5381  }
5382  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
5383  feGriffithConstrainsDelta, null, null);
5384  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_ELEM",
5385  feGriffithConstrainsLhs, null, null);
5386  CHKERR DMMoFEMSNESSetJacobian(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
5387  tangentConstrains, null, null);
5388  CHKERR DMMoFEMSNESSetJacobian(dm, "GRIFFITH_FORCE_ELEMENT",
5389  feGriffithForceLhs, null, null);
5391  fixMaterialEnts);
5392 
5393  // Add to SNES residuals
5395  null);
5396  CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feSmootherRhs, null, null);
5397  // CHKERR DMMoFEMSNESSetFunction(dm, "SMOOTHING", feMaterialRhs, null,
5398  // null);
5399  CHKERR DMMoFEMSNESSetFunction(dm, "BOTH_SIDES_OF_CRACK",
5400  bothSidesConstrains, null, null);
5401  for (auto &m : surfaceConstrain) {
5402  if (m.first != getInterface<CPMeshCut>()->getCrackSurfaceId()) {
5403  CHKERR DMMoFEMSNESSetFunction(dm, "SURFACE", m.second->feRhsPtr, null,
5404  null);
5405  } else {
5406  CHKERR DMMoFEMSNESSetFunction(dm, "CRACK_SURFACE", m.second->feRhsPtr,
5407  null, null);
5408  }
5409  }
5410  for (auto &m : edgeConstrains) {
5411  CHKERR DMMoFEMSNESSetFunction(dm, "EDGE", m.second->feRhsPtr, null, null);
5412  }
5413  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
5414  feGriffithConstrainsDelta, null, null);
5415  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_ELEM",
5416  feGriffithConstrainsRhs, null, null);
5417  CHKERR DMMoFEMSNESSetFunction(dm, "CRACKFRONT_AREA_TANGENT_ELEM",
5418  tangentConstrains, null, null);
5419  CHKERR DMMoFEMSNESSetFunction(dm, "GRIFFITH_FORCE_ELEMENT",
5420  feGriffithForceRhs, null, null);
5422  fixMaterialEnts);
5423 
5424  break;
5425  default:
5426  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
5427  "There is no such test defined");
5428  break;
5429  }
5430 
5431  CHKERR mField.getInterface<FieldBlas>()->fieldScale(1.2,
5432  "MESH_NODE_POSITIONS");
5433 
5434  auto m = smartCreateDMMatrix(dm);
5435  // create vectors
5436  auto q = smartCreateDMVector(dm);
5437  auto f = smartVectorDuplicate(q);
5438  CHKERR VecSetOption(f, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
5439  CHKERR VecSetOption(q, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
5440 
5441  CHKERR DMoFEMMeshToLocalVector(dm, q, INSERT_VALUES, SCATTER_FORWARD);
5442  auto q_copy = smartVectorDuplicate(q);
5443  CHKERR VecCopy(q, q_copy);
5444 
5445  if (mwlsApprox) {
5446  mwlsApprox->F_lambda = PETSC_NULL;
5447  }
5448 
5449  CHKERR MatZeroEntries(m);
5450  CHKERR VecZeroEntries(f);
5451  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
5452  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
5453 
5454  PetscBool calculate_fd = PETSC_FALSE;
5455  CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-calculate_fd_matrix",
5456  &calculate_fd, PETSC_NULL);
5457 
5458  SNES snes;
5459  CHKERR SNESCreate(PETSC_COMM_WORLD, &snes);
5460  CHKERR SNESSetDM(snes, dm);
5461  SnesCtx *snes_ctx;
5462  CHKERR DMMoFEMGetSnesCtx(dm, &snes_ctx);
5463  CHKERR SNESAppendOptionsPrefix(snes, "test_mwls_");
5464 
5465  if (calculate_fd == PETSC_FALSE) {
5466  char testing_options[] =
5467  "-test_mwls_snes_test_jacobian "
5468  "-test_mwls_snes_test_jacobian_display "
5469  "-test_mwls_snes_no_convergence_test -test_mwls_snes_atol 0 "
5470  "-test_mwls_snes_rtol 0 -test_mwls_snes_max_it 1 -test_mwls_pc_type "
5471  "none";
5472  CHKERR PetscOptionsInsertString(NULL, testing_options);
5473  } else {
5474  char testing_options[] =
5475  "-test_mwls_snes_no_convergence_test -test_mwls_snes_atol 0 "
5476  "-test_mwls_snes_rtol 0 -test_mwls_snes_max_it 1 -test_mwls_pc_type "
5477  "none";
5478  CHKERR PetscOptionsInsertString(NULL, testing_options);
5479  }
5480 
5481  CHKERR SNESSetFunction(snes, f, SnesRhs, snes_ctx);
5482  CHKERR SNESSetJacobian(snes, m, m, SnesMat, snes_ctx);
5483  CHKERR SNESSetFromOptions(snes);
5484  CHKERR SNESSetUp(snes);
5485 
5486  if (mwlsApprox) {
5487  mwlsApprox->invABMap.clear();
5488  mwlsApprox->influenceNodesMap.clear();
5489  mwlsApprox->dmNodesMap.clear();
5490  }
5491 
5492  CHKERR SNESSolve(snes, PETSC_NULL, q);
5493 
5494  if (calculate_fd == PETSC_TRUE) {
5495  double nrm_m0;
5496  CHKERR MatNorm(m, NORM_INFINITY, &nrm_m0);
5497 
5498  char testing_options_fd[] = "-test_mwls_snes_fd";
5499  CHKERR PetscOptionsInsertString(NULL, testing_options_fd);
5500 
5501  auto fd_m = smartCreateDMMatrix(dm);
5502  CHKERR SNESSetFunction(snes, f, SnesRhs, snes_ctx);
5503  CHKERR SNESSetJacobian(snes, fd_m, fd_m, SnesMat, snes_ctx);
5504  CHKERR SNESSetFromOptions(snes);
5505  CHKERR SNESSetUp(snes);
5506  // Hint: use -test_mwls_snes_compare_explicit_draw -draw_save for matrix
5507  // draw
5508  CHKERR SNESSolve(snes, NULL, q_copy);
5509 
5510  CHKERR MatAXPY(m, -1, fd_m, SUBSET_NONZERO_PATTERN);
5511 
5512  double nrm_m;
5513  CHKERR MatNorm(m, NORM_INFINITY, &nrm_m);
5514  PetscPrintf(PETSC_COMM_WORLD, "Matrix norms %3.4e %3.4e %3.4e\n", nrm_m0,
5515  nrm_m, nrm_m / nrm_m0);
5516  nrm_m /= nrm_m0;
5517 
5518  const double tol = 1e-6;
5519  if (nrm_m > tol) {
5520  SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
5521  "Difference between hand-calculated tangent matrix and finite "
5522  "difference matrix is too big");
5523  }
5524  }
5525 
5526  CHKERR SNESDestroy(&snes);
5527  CHKERR DMDestroy(&dm);
5529 }

◆ tetsingReleaseEnergyCalculation()

MoFEMErrorCode FractureMechanics::CrackPropagation::tetsingReleaseEnergyCalculation ( )

This is run with ctest.

Returns
error code

Definition at line 929 of file CrackPropagation.cpp.

929  {
930  PetscBool flg;
931  enum tests {
932  ANALYTICAL_MODE_1,
933  CIRCULAR_PLATE_IN_INFINITE_BODY,
934  ANGLE_ANALYTICAL_MODE_1,
935  MWLS_INTERNAL_STRESS,
936  MWLS_INTERNAL_STRESS_ANALYTICAL,
937  CUT_CIRCLE_PLATE,
938  NOTCH_WITH_DENSITY,
939  LASTOP
940  };
941  const char *list[] = {"analytical_mode_1",
942  "circular_plate_in_infinite_body",
943  "angle_analytical_mode_1",
944  "mwls_internal_stress",
945  "mwls_internal_stress_analytical",
946  "cut_circle_plate",
947  "notch_with_density"};
948 
949  int choice_value = ANALYTICAL_MODE_1;
950  double test_tol = 0;
952  CHKERR PetscOptionsBegin(mField.get_comm(), "", "Testing code", "none");
953  CHKERR PetscOptionsGetEList(PETSC_NULL, NULL, "-test", list, LASTOP,
954  &choice_value, &flg);
955  CHKERR PetscOptionsScalar("-test_tol", "test tolerance", "", test_tol,
956  &test_tol, PETSC_NULL);
957  ierr = PetscOptionsEnd();
958  CHKERRQ(ierr);
959 
960  if (flg == PETSC_TRUE) {
961 
962  if (mField.get_comm_rank() == 0) {
963 
964  switch (choice_value) {
965  case ANALYTICAL_MODE_1: {
966  double ave_g1 = 0;
967  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
968  mit != mapG1.end(); mit++) {
969  ave_g1 += mit->second;
970  }
971  ave_g1 /= mapG1.size();
972  // Exact solution
973  const double gc = 1e-5;
974  // Tolerance
975  const double error = fabs(ave_g1 - gc) / gc;
976  CHKERR PetscPrintf(
977  PETSC_COMM_SELF,
978  "ave_gc = %6.4e gc = %6.4e tolerance = %6.4e error = %6.4e\n",
979  ave_g1, gc, test_tol, error);
980  if (error > test_tol || error != error) {
981  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
982  "ANALYTICAL_MODE_1 test failed");
983  }
984  } break;
985  case CIRCULAR_PLATE_IN_INFINITE_BODY: {
986  const double gc = 1.1672e+01;
987  double max_error = 0;
988  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
989  mit != mapG1.end(); mit++) {
990  const double g = mit->second;
991  const double error = fabs(g - gc) / gc;
992  max_error = (max_error < error) ? error : max_error;
993  CHKERR PetscPrintf(
994  PETSC_COMM_SELF,
995  "g = %6.4e gc = %6.4e tolerance = %6.4e error = %6.4e\n", g, gc,
996  test_tol, error);
997  }
998  if (max_error > test_tol || max_error != max_error)
999  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1000  "CIRCULAR_PLATE_IN_INFINITE_BODY test failed");
1001 
1002  } break;
1003  case ANGLE_ANALYTICAL_MODE_1: {
1004  const double gc = 1e-5;
1005  double max_error = 0;
1006  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
1007  mit != mapG1.end(); mit++) {
1008  const double g = mit->second;
1009  const double error = fabs(g - gc) / gc;
1010  max_error = (max_error < error) ? error : max_error;
1011  CHKERR PetscPrintf(
1012  PETSC_COMM_SELF,
1013  "g = %6.4e gc = %6.4e tolerance = %6.4e error = %6.4e\n", g, gc,
1014  test_tol, error);
1015  }
1016  if (max_error > test_tol || max_error != max_error) {
1017  SETERRQ2(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1018  "ANGLE_ANALYTICAL_MODE_1 test failed %6.4e > %6.4e",
1019  max_error, test_tol);
1020  }
1021  } break;
1022  case MWLS_INTERNAL_STRESS: {
1023  const double gc =
1024  1.5527e+06; // this is max g1 for big problem (not extact solution)
1025  double max_error = 0;
1026  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
1027  mit != mapG1.end(); mit++) {
1028  const double g = mit->second;
1029  const double error = fabs(g - gc) / gc;
1030  max_error = (max_error < error) ? error : max_error;
1031  CHKERR PetscPrintf(
1032  PETSC_COMM_SELF,
1033  "g = %6.4e gc = %6.4e tolerance = %6.4e error = %6.4e\n", g, gc,
1034  test_tol, error);
1035  }
1036  if (max_error > test_tol || max_error != max_error) {
1037  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1038  "MWLS_INTERNAL_STRESS test failed");
1039  }
1040  } break;
1041  case MWLS_INTERNAL_STRESS_ANALYTICAL: {
1042  const double gc =
1043  1.5698e+06; // this is max g1 for big problem (not extact solution)
1044  double max_error = 0;
1045  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
1046  mit != mapG1.end(); mit++) {
1047  const double g = mit->second;
1048  const double error = fabs(g - gc) / gc;
1049  max_error = (max_error < error) ? error : max_error;
1050  CHKERR PetscPrintf(
1051  PETSC_COMM_SELF,
1052  "g = %6.4e gc = %6.4e tolerance = %6.4e error = %6.4e\n", g, gc,
1053  test_tol, error);
1054  }
1055  if (max_error > test_tol || max_error != max_error) {
1056  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1057  "MWLS_INTERNAL_STRESS_ANALYTICAL test failed");
1058  }
1059  } break;
1060  case CUT_CIRCLE_PLATE: {
1061  // This is simple regression test
1062  double max_g = 0;
1063  for (auto &m : mapG1) {
1064  const double g = m.second;
1065  max_g = fmax(g, max_g);
1066  }
1067  const double gc =
1068  7.5856e-02; // this is max g1 for big problem (not extact solution)
1069  double error = fabs(max_g - gc) / gc;
1070  if (error > test_tol || error != error) {
1071  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1072  "CUT_CIRCLE_PLATE test failed");
1073  }
1074  } break;
1075  case NOTCH_WITH_DENSITY: {
1076  // This is simple regression test
1077  double max_g = 0;
1078  for (map<EntityHandle, double>::iterator mit = mapG1.begin();
1079  mit != mapG1.end(); mit++) {
1080  const double g = mit->second;
1081  max_g = fmax(g, max_g);
1082  }
1083  const double gc = 1.6642e-04; // this is max g1 for a small problem (not
1084  // extact solution)
1085  double error = fabs(max_g - gc) / gc;
1086  if (error > test_tol || error != error) {
1087  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
1088  "NOTCH_WITH_DENSITY test failed");
1089  }
1090  } break;
1091  }
1092  }
1093  }
1094 
1096 }

◆ unsetSingularElementMatrialPositions()

MoFEMErrorCode FractureMechanics::CrackPropagation::unsetSingularElementMatrialPositions ( )

remove singularity

Definition at line 9388 of file CrackPropagation.cpp.

9388  {
9389  const DofEntity_multiIndex *dofs_ptr;
9391  ierr = mField.get_dofs(&dofs_ptr);
9392  CHKERRQ(ierr);
9393  for (Range::iterator eit = crackFrontNodesEdges.begin();
9394  eit != crackFrontNodesEdges.end(); eit++) {
9396  mField, "MESH_NODE_POSITIONS", *eit, dit)) {
9397  dit->get()->getFieldData() = 0;
9398  }
9399  }
9400  setSingularCoordinates = false;
9402 }

◆ updateMaterialFixedNode()

MoFEMErrorCode FractureMechanics::CrackPropagation::updateMaterialFixedNode ( const bool  fix_front,
const bool  fix_small_g,
const bool  debug = false 
)

Update fixed nodes.

Definition at line 6898 of file CrackPropagation.cpp.

6900  {
6902  Range fix_material_nodes;
6903  CHKERR GetSmoothingElementsSkin (*this)(fix_material_nodes, fix_small_g,
6904  debug);
6905  if (fix_front) {
6906  fix_material_nodes.merge(crackFrontNodes);
6907  }
6908 
6909  fixMaterialEnts->eNts = fix_material_nodes;
6910 
6911  fixMaterialEnts->mapZeroRows.clear();
6912  PetscPrintf(mField.get_comm(),
6913  "Number of fixed nodes %d, number of fixed crack front nodes %d "
6914  "(out of %d)\n",
6915  fix_material_nodes.size(),
6916  intersect(crackFrontNodes, fix_material_nodes).size(),
6917  crackFrontNodes.size());
6919 }

◆ writeCrackFont()

MoFEMErrorCode FractureMechanics::CrackPropagation::writeCrackFont ( const BitRefLevel bit,
const int  step 
)

Definition at line 8093 of file CrackPropagation.cpp.

8094  {
8096 
8097  auto make_file_name = [step](const std::string prefix,
8098  const std::string surfix = ".vtk") {
8099  return prefix + boost::lexical_cast<std::string>(step) + surfix;
8100  };
8101 
8102  auto write_file = [this, make_file_name](const std::string prefix,
8103  Range ents) {
8105  EntityHandle meshset;
8106  CHKERR mField.get_moab().create_meshset(MESHSET_SET, meshset);
8107  std::string file_name = make_file_name(prefix);
8108  CHKERR mField.get_moab().add_entities(meshset, ents);
8109  if (mField.get_comm_rank() == 0) {
8110  CHKERR mField.get_moab().write_file(file_name.c_str(), "VTK", "",
8111  &meshset, 1);
8112  }
8113  CHKERR mField.get_moab().delete_entities(&meshset, 1);
8115  };
8116 
8117  Range bit_edges;
8118  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
8119  bit, BitRefLevel().set(), MBEDGE, bit_edges);
8120  Range crack_front_edge = intersect(crackFront, bit_edges);
8121  if (!crack_front_edge.empty())
8122  CHKERR write_file("out_crack_front_", crack_front_edge);
8123 
8124  // Get total length of the crack front
8125  // Store edge nodes coordinates in FTensor
8126  double edge_node_coords[6];
8127  FTensor::Tensor1<double *, 3> t_node_edge[2] = {
8128  FTensor::Tensor1<double *, 3>(edge_node_coords, &edge_node_coords[1],
8129  &edge_node_coords[2]),
8130  FTensor::Tensor1<double *, 3>(&edge_node_coords[3], &edge_node_coords[4],
8131  &edge_node_coords[5])};
8132 
8134 
8135  double sum_crack_front_length = 0;
8136  for (auto edge : crack_front_edge) {
8137  int num_nodes;
8138  const EntityHandle *conn;
8139  CHKERR mField.get_moab().get_connectivity(edge, conn, num_nodes, true);
8140  CHKERR mField.get_moab().get_coords(conn, num_nodes, edge_node_coords);
8141  t_node_edge[0](i) -= t_node_edge[1](i);
8142  double l = sqrt(t_node_edge[0](i) * t_node_edge[0](i));
8143  sum_crack_front_length += l;
8144  }
8145  PetscPrintf(mField.get_comm(), "Crack front length = %6.4e",
8146  sum_crack_front_length);
8147 
8148  double rate_cf = 0.;
8149  if (crackFrontLength > 0) {
8150  rate_cf = (sum_crack_front_length - crackFrontLength) / crackFrontLength;
8151  PetscPrintf(mField.get_comm(), " | Change rate = %6.4e\n", rate_cf);
8152  } else
8153  PetscPrintf(mField.get_comm(), "\n");
8154  crackFrontLength = sum_crack_front_length;
8155 
8156  Range bit_faces;
8157  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
8158  bit, BitRefLevel().set(), MBTRI, bit_faces);
8159  Range crack_surface = intersect(oneSideCrackFaces, bit_faces);
8160 
8161  CHKERR write_file("out_crack_surface_", crack_surface);
8162 
8163  // works for 1st order geometry
8164  auto get_tri_area = [&](const EntityHandle tri) {
8165  double coords[9];
8166  const EntityHandle *conn;
8167  int num_nodes;
8168  CHKERR mField.get_moab().get_connectivity(tri, conn, num_nodes, true);
8169  CHKERR mField.get_moab().get_coords(conn, num_nodes, coords);
8170  FTensor::Tensor1<double, 3> t_normal;
8171  CHKERR Tools::getTriNormal(coords, &t_normal(0));
8173  return sqrt(t_normal(i) * t_normal(i)) * 0.5;
8174  };
8175 
8176  double sum_crack_area = 0;
8177  for (auto tri : crack_surface) {
8178  sum_crack_area += get_tri_area(tri);
8179  }
8180  PetscPrintf(mField.get_comm(), "Crack surface area = %6.4e", sum_crack_area);
8181 
8182  double rate_cs = 0.;
8183  if (crackSurfaceArea > 0) {
8184  rate_cs = (sum_crack_area - crackSurfaceArea) / crackSurfaceArea;
8185  PetscPrintf(mField.get_comm(), " | Change rate = %6.4e\n", rate_cs);
8186  } else
8187  PetscPrintf(mField.get_comm(), "\n");
8188  crackSurfaceArea = sum_crack_area;
8189 
8190  Range bit_tets;
8191  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
8192  bit, BitRefLevel().set(), MBTET, bit_tets);
8193 
8194  if (postProcLevel > 1)
8195  CHKERR write_file("out_volume_", bit_tets);
8196 
8197  Skinner skin(&mField.get_moab());
8198  Range tets_skin;
8199  CHKERR skin.find_skin(0, bit_tets, false, tets_skin);
8200  CHKERR write_file("out_skin_volume_", tets_skin);
8201 
8203 }

◆ zeroLambdaFields()

MoFEMErrorCode FractureMechanics::CrackPropagation::zeroLambdaFields ( )

Zero fields with lagrange multipliers.

Definition at line 9553 of file CrackPropagation.cpp.

9553  {
9555 
9556  const Field_multiIndex *fields_ptr;
9557  CHKERR mField.get_fields(&fields_ptr);
9558  for (auto f : *fields_ptr) {
9559  if (f->getName().compare(0, 6, "LAMBDA") == 0 &&
9560  f->getName() != "LAMBDA_ARC_LENGTH" &&
9561  f->getName() != "LAMBDA_CONTACT" &&
9562  f->getName() != "LAMBDA_CLOSE_CRACK") {
9563  CHKERR mField.getInterface<FieldBlas>()->setField(0, MBVERTEX,
9564  f->getName());
9565  }
9566  }
9567 
9569 }

Member Data Documentation

◆ addAnalyticalInternalStressOperators

PetscBool FractureMechanics::CrackPropagation::addAnalyticalInternalStressOperators

Add analytical internal stress operators for MWLS test

Definition at line 160 of file CrackPropagation.hpp.

◆ addSingularity

PetscBool FractureMechanics::CrackPropagation::addSingularity

Definition at line 122 of file CrackPropagation.hpp.

◆ analiticalSurfaceElement

boost::shared_ptr<boost::ptr_map<string, NeumannForcesSurface> > FractureMechanics::CrackPropagation::analiticalSurfaceElement

Finite element to integrate tractions given by analytical formula

Definition at line 1147 of file CrackPropagation.hpp.

◆ analyticalDirichletBc

boost::shared_ptr<AnalyticalDirichletBC::DirichletBC> FractureMechanics::CrackPropagation::analyticalDirichletBc

apply analytical Dirichlet BC to sparial positions

Definition at line 1084 of file CrackPropagation.hpp.

◆ approxOrder

int FractureMechanics::CrackPropagation::approxOrder

Definition at line 108 of file CrackPropagation.hpp.

◆ arcAlpha

double FractureMechanics::CrackPropagation::arcAlpha

Definition at line 1211 of file CrackPropagation.hpp.

◆ arcBeta

double FractureMechanics::CrackPropagation::arcBeta

Definition at line 1212 of file CrackPropagation.hpp.

◆ arcCtx

boost::shared_ptr<ArcLengthCtx> FractureMechanics::CrackPropagation::arcCtx

Definition at line 1215 of file CrackPropagation.hpp.

◆ arcEigenCtx

boost::shared_ptr<ArcLengthCtx> FractureMechanics::CrackPropagation::arcEigenCtx

Definition at line 1216 of file CrackPropagation.hpp.

◆ arcLengthDof

boost::shared_ptr<DofEntity> FractureMechanics::CrackPropagation::arcLengthDof

Definition at line 902 of file CrackPropagation.hpp.

◆ arcLengthVertex

EntityHandle FractureMechanics::CrackPropagation::arcLengthVertex

Vertex associated with dof for arc-length control.

Definition at line 1170 of file CrackPropagation.hpp.

◆ arcS

double FractureMechanics::CrackPropagation::arcS

Definition at line 1213 of file CrackPropagation.hpp.

◆ areSpringsAle

PetscBool FractureMechanics::CrackPropagation::areSpringsAle

If true surface spring is considered in ALE.

Definition at line 126 of file CrackPropagation.hpp.

◆ assembleFlambda

boost::shared_ptr<FEMethod> FractureMechanics::CrackPropagation::assembleFlambda

assemble F_lambda vector

Definition at line 1103 of file CrackPropagation.hpp.

◆ betaGc

double FractureMechanics::CrackPropagation::betaGc

heterogeneous Griffith energy exponent

Definition at line 115 of file CrackPropagation.hpp.

◆ bitEnts

Range FractureMechanics::CrackPropagation::bitEnts

Definition at line 1157 of file CrackPropagation.hpp.

◆ bitProcEnts

Range FractureMechanics::CrackPropagation::bitProcEnts

Definition at line 1158 of file CrackPropagation.hpp.

◆ bodySkin

Range FractureMechanics::CrackPropagation::bodySkin

Definition at line 1159 of file CrackPropagation.hpp.

◆ bothSidesConstrains

boost::shared_ptr<BothSurfaceConstrains> FractureMechanics::CrackPropagation::bothSidesConstrains

Definition at line 1131 of file CrackPropagation.hpp.

◆ bothSidesContactConstrains

boost::shared_ptr<BothSurfaceConstrains> FractureMechanics::CrackPropagation::bothSidesContactConstrains

Definition at line 1133 of file CrackPropagation.hpp.

◆ closeCrackConstrains

boost::shared_ptr<BothSurfaceConstrains> FractureMechanics::CrackPropagation::closeCrackConstrains

Definition at line 1132 of file CrackPropagation.hpp.

◆ cnValue

double FractureMechanics::CrackPropagation::cnValue

Augmentation parameter in the complementarity function used to enforce KKT constraints

Definition at line 1230 of file CrackPropagation.hpp.

◆ commonDataMortarContact

boost::shared_ptr<MortarContactProblem::CommonDataMortarContact> FractureMechanics::CrackPropagation::commonDataMortarContact

Definition at line 1283 of file CrackPropagation.hpp.

◆ commonDataSimpleContact

boost::shared_ptr<SimpleContactProblem::CommonDataSimpleContact> FractureMechanics::CrackPropagation::commonDataSimpleContact

Definition at line 1274 of file CrackPropagation.hpp.

◆ commonDataSimpleContactALE

boost::shared_ptr<SimpleContactProblem::CommonDataSimpleContact> FractureMechanics::CrackPropagation::commonDataSimpleContactALE

Definition at line 1291 of file CrackPropagation.hpp.

◆ commonDataSpringsALE

boost::shared_ptr<MetaSpringBC::DataAtIntegrationPtsSprings> FractureMechanics::CrackPropagation::commonDataSpringsALE

Definition at line 1266 of file CrackPropagation.hpp.

◆ commonDataSurfaceForceAle

boost::shared_ptr<NeumannForcesSurface::DataAtIntegrationPts> FractureMechanics::CrackPropagation::commonDataSurfaceForceAle

common data at integration points (ALE)

Definition at line 1092 of file CrackPropagation.hpp.

◆ commonDataSurfacePressureAle

boost::shared_ptr<NeumannForcesSurface::DataAtIntegrationPts> FractureMechanics::CrackPropagation::commonDataSurfacePressureAle

common data at integration points (ALE)

Definition at line 1098 of file CrackPropagation.hpp.

◆ configFile

std::string FractureMechanics::CrackPropagation::configFile

Definition at line 139 of file CrackPropagation.hpp.

◆ constrainedInterface

Range FractureMechanics::CrackPropagation::constrainedInterface

Range of faces on the constrained interface.

Definition at line 1301 of file CrackPropagation.hpp.

◆ contactBothSidesMasterFaces

Range FractureMechanics::CrackPropagation::contactBothSidesMasterFaces

Definition at line 1251 of file CrackPropagation.hpp.

◆ contactBothSidesMasterNodes

Range FractureMechanics::CrackPropagation::contactBothSidesMasterNodes

Definition at line 1253 of file CrackPropagation.hpp.

◆ contactBothSidesSlaveFaces

Range FractureMechanics::CrackPropagation::contactBothSidesSlaveFaces

Definition at line 1252 of file CrackPropagation.hpp.

◆ contactElements

Range FractureMechanics::CrackPropagation::contactElements

Definition at line 1241 of file CrackPropagation.hpp.

◆ contactLambdaOrder

int FractureMechanics::CrackPropagation::contactLambdaOrder

Approximation order for field of Lagrange multipliers used to enforce contact

Definition at line 1226 of file CrackPropagation.hpp.

◆ contactMasterFaces

Range FractureMechanics::CrackPropagation::contactMasterFaces

Definition at line 1242 of file CrackPropagation.hpp.

◆ contactMeshsetFaces

Range FractureMechanics::CrackPropagation::contactMeshsetFaces

Definition at line 1239 of file CrackPropagation.hpp.

◆ contactOrder

int FractureMechanics::CrackPropagation::contactOrder

Approximation order for spatial positions used in contact elements

Definition at line 1224 of file CrackPropagation.hpp.

◆ contactOrientation

boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation> FractureMechanics::CrackPropagation::contactOrientation

Definition at line 1127 of file CrackPropagation.hpp.

◆ contactOutputIntegPts

PetscBool FractureMechanics::CrackPropagation::contactOutputIntegPts

Definition at line 1293 of file CrackPropagation.hpp.

◆ contactPostProcCore

moab::Core FractureMechanics::CrackPropagation::contactPostProcCore

Definition at line 1298 of file CrackPropagation.hpp.

◆ contactPostProcMoab

moab::Interface& FractureMechanics::CrackPropagation::contactPostProcMoab

Definition at line 1299 of file CrackPropagation.hpp.

◆ contactProblem

boost::shared_ptr<SimpleContactProblem> FractureMechanics::CrackPropagation::contactProblem

Definition at line 1268 of file CrackPropagation.hpp.

◆ contactSearchMultiIndexPtr

boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex> FractureMechanics::CrackPropagation::contactSearchMultiIndexPtr

Definition at line 1250 of file CrackPropagation.hpp.

◆ contactSlaveFaces

Range FractureMechanics::CrackPropagation::contactSlaveFaces

Definition at line 1243 of file CrackPropagation.hpp.

◆ contactTets

Range FractureMechanics::CrackPropagation::contactTets

Definition at line 1254 of file CrackPropagation.hpp.

◆ cpMeshCutPtr

const boost::scoped_ptr<UnknownInterface> FractureMechanics::CrackPropagation::cpMeshCutPtr

Definition at line 1319 of file CrackPropagation.hpp.

◆ cpSolversPtr

const boost::scoped_ptr<UnknownInterface> FractureMechanics::CrackPropagation::cpSolversPtr

Definition at line 1318 of file CrackPropagation.hpp.

◆ crackAccelerationFactor

double FractureMechanics::CrackPropagation::crackAccelerationFactor

Definition at line 1328 of file CrackPropagation.hpp.

◆ crackFaces

Range FractureMechanics::CrackPropagation::crackFaces

Definition at line 1160 of file CrackPropagation.hpp.

◆ crackFront

Range FractureMechanics::CrackPropagation::crackFront

Definition at line 1163 of file CrackPropagation.hpp.

◆ crackFrontElements

Range FractureMechanics::CrackPropagation::crackFrontElements

Definition at line 1167 of file CrackPropagation.hpp.

◆ crackFrontLength

double FractureMechanics::CrackPropagation::crackFrontLength

Definition at line 170 of file CrackPropagation.hpp.

◆ crackFrontNodes

Range FractureMechanics::CrackPropagation::crackFrontNodes

Definition at line 1164 of file CrackPropagation.hpp.

◆ crackFrontNodesEdges

Range FractureMechanics::CrackPropagation::crackFrontNodesEdges

Definition at line 1165 of file CrackPropagation.hpp.

◆ crackFrontNodesTris

Range FractureMechanics::CrackPropagation::crackFrontNodesTris

Definition at line 1166 of file CrackPropagation.hpp.

◆ crackOrientation

boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation> FractureMechanics::CrackPropagation::crackOrientation

Definition at line 1125 of file CrackPropagation.hpp.

◆ crackSurfaceArea

double FractureMechanics::CrackPropagation::crackSurfaceArea

Definition at line 171 of file CrackPropagation.hpp.

◆ debug

bool CrackPropagation::debug = false
static

Definition at line 79 of file CrackPropagation.hpp.

◆ defaultMaterial

int FractureMechanics::CrackPropagation::defaultMaterial

Definition at line 1178 of file CrackPropagation.hpp.

◆ densityMapBlock

int FractureMechanics::CrackPropagation::densityMapBlock

Block on which density is applied (Note: if used with internal stress, it has to be the same ID!)

Definition at line 137 of file CrackPropagation.hpp.

◆ doCutMesh

PetscBool FractureMechanics::CrackPropagation::doCutMesh

Definition at line 1327 of file CrackPropagation.hpp.

◆ doElasticWithoutCrack

PetscBool FractureMechanics::CrackPropagation::doElasticWithoutCrack

Definition at line 1329 of file CrackPropagation.hpp.

◆ doSurfaceProjection

bool FractureMechanics::CrackPropagation::doSurfaceProjection

If crack surface is immersed in the body do not projection

Definition at line 1197 of file CrackPropagation.hpp.

◆ edgeConstrains

map<int, boost::shared_ptr<EdgeSlidingConstrains> > FractureMechanics::CrackPropagation::edgeConstrains

Definition at line 1129 of file CrackPropagation.hpp.

◆ edgeForces

boost::shared_ptr<boost::ptr_map<string, EdgeForce> > FractureMechanics::CrackPropagation::edgeForces

assemble edge forces

Definition at line 1100 of file CrackPropagation.hpp.

◆ elasticFe

boost::shared_ptr<NonlinearElasticElement> FractureMechanics::CrackPropagation::elasticFe

Integrate spatial stresses, matrix and vector (not only element but all data structure)

Definition at line 1063 of file CrackPropagation.hpp.

◆ feCouplingElasticLhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feCouplingElasticLhs

FE instance to assemble coupling terms.

Definition at line 1107 of file CrackPropagation.hpp.

◆ feCouplingMaterialLhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feCouplingMaterialLhs

FE instance to assemble coupling terms.

Definition at line 1109 of file CrackPropagation.hpp.

◆ feEnergy

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feEnergy

Integrate energy.

Definition at line 1071 of file CrackPropagation.hpp.

◆ feGriffithConstrainsDelta

boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrainsDelta> FractureMechanics::CrackPropagation::feGriffithConstrainsDelta

Definition at line 1140 of file CrackPropagation.hpp.

◆ feGriffithConstrainsLhs

boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrains> FractureMechanics::CrackPropagation::feGriffithConstrainsLhs

Definition at line 1144 of file CrackPropagation.hpp.

◆ feGriffithConstrainsRhs

boost::shared_ptr<GriffithForceElement::MyTriangleFEConstrains> FractureMechanics::CrackPropagation::feGriffithConstrainsRhs

Definition at line 1142 of file CrackPropagation.hpp.

◆ feGriffithForceLhs

boost::shared_ptr<GriffithForceElement::MyTriangleFE> FractureMechanics::CrackPropagation::feGriffithForceLhs

Definition at line 1138 of file CrackPropagation.hpp.

◆ feGriffithForceRhs

boost::shared_ptr<GriffithForceElement::MyTriangleFE> FractureMechanics::CrackPropagation::feGriffithForceRhs

Definition at line 1137 of file CrackPropagation.hpp.

◆ feLhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feLhs

Integrate elastic FE.

Definition at line 1065 of file CrackPropagation.hpp.

◆ feLhsMortarContact

boost::shared_ptr<MortarContactProblem::MortarContactElement> FractureMechanics::CrackPropagation::feLhsMortarContact

Definition at line 1281 of file CrackPropagation.hpp.

◆ feLhsSimpleContact

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::feLhsSimpleContact

Definition at line 1272 of file CrackPropagation.hpp.

◆ feLhsSimpleContactALE

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::feLhsSimpleContactALE

Definition at line 1289 of file CrackPropagation.hpp.

◆ feLhsSimpleContactALEMaterial

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::feLhsSimpleContactALEMaterial

Definition at line 1287 of file CrackPropagation.hpp.

◆ feLhsSpringALE

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feLhsSpringALE

Definition at line 1258 of file CrackPropagation.hpp.

◆ feLhsSpringALEMaterial

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feLhsSpringALEMaterial

Definition at line 1259 of file CrackPropagation.hpp.

◆ feLhsSurfaceForceALEMaterial

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feLhsSurfaceForceALEMaterial

Definition at line 1262 of file CrackPropagation.hpp.

◆ feMaterialAnaliticalTraction

boost::shared_ptr<NeumannForcesSurface::MyTriangleFE> FractureMechanics::CrackPropagation::feMaterialAnaliticalTraction

Surface elment to calculate tractions in material space.

Definition at line 1080 of file CrackPropagation.hpp.

◆ feMaterialLhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feMaterialLhs

Integrate material stresses, assemble matrix.

Definition at line 1070 of file CrackPropagation.hpp.

◆ feMaterialRhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feMaterialRhs

Integrate material stresses, assemble vector.

Definition at line 1068 of file CrackPropagation.hpp.

◆ fePostProcMortarContact

boost::shared_ptr<MortarContactProblem::MortarContactElement> FractureMechanics::CrackPropagation::fePostProcMortarContact

Definition at line 1297 of file CrackPropagation.hpp.

◆ fePostProcSimpleContact

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::fePostProcSimpleContact

Definition at line 1295 of file CrackPropagation.hpp.

◆ feRhs

boost::shared_ptr<CrackFrontElement> FractureMechanics::CrackPropagation::feRhs

Integrate elastic FE.

Definition at line 1066 of file CrackPropagation.hpp.

◆ feRhsMortarContact

boost::shared_ptr<MortarContactProblem::MortarContactElement> FractureMechanics::CrackPropagation::feRhsMortarContact

Definition at line 1279 of file CrackPropagation.hpp.

◆ feRhsSimpleContact

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::feRhsSimpleContact

Definition at line 1270 of file CrackPropagation.hpp.

◆ feRhsSimpleContactALEMaterial

boost::shared_ptr<SimpleContactProblem::SimpleContactElement> FractureMechanics::CrackPropagation::feRhsSimpleContactALEMaterial

Definition at line 1285 of file CrackPropagation.hpp.

◆ feRhsSpringALEMaterial

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feRhsSpringALEMaterial

Definition at line 1260 of file CrackPropagation.hpp.

◆ feRhsSurfaceForceALEMaterial

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feRhsSurfaceForceALEMaterial

Definition at line 1264 of file CrackPropagation.hpp.

◆ feSmootherLhs

boost::shared_ptr<Smoother::MyVolumeFE> FractureMechanics::CrackPropagation::feSmootherLhs

Integrate smoothing operators.

Definition at line 1115 of file CrackPropagation.hpp.

◆ feSmootherRhs

boost::shared_ptr<Smoother::MyVolumeFE> FractureMechanics::CrackPropagation::feSmootherRhs

Integrate smoothing operators.

Definition at line 1113 of file CrackPropagation.hpp.

◆ feSpringLhsPtr

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feSpringLhsPtr

Definition at line 1149 of file CrackPropagation.hpp.

◆ feSpringRhsPtr

boost::shared_ptr<FaceElementForcesAndSourcesCore> FractureMechanics::CrackPropagation::feSpringRhsPtr

Definition at line 1150 of file CrackPropagation.hpp.

◆ fileVersion

Version FractureMechanics::CrackPropagation::fileVersion

Definition at line 86 of file CrackPropagation.hpp.

◆ fixContactNodes

PetscBool FractureMechanics::CrackPropagation::fixContactNodes

If set true, contact nodes are fixed in the material configuration

Definition at line 1235 of file CrackPropagation.hpp.

◆ fixMaterialEnts

boost::shared_ptr<DirichletFixFieldAtEntitiesBc> FractureMechanics::CrackPropagation::fixMaterialEnts

Definition at line 1134 of file CrackPropagation.hpp.

◆ fractionOfFixedNodes

double FractureMechanics::CrackPropagation::fractionOfFixedNodes

Definition at line 1186 of file CrackPropagation.hpp.

◆ gC

double FractureMechanics::CrackPropagation::gC

Griffith energy.

Definition at line 111 of file CrackPropagation.hpp.

◆ geometryOrder

int FractureMechanics::CrackPropagation::geometryOrder

Definition at line 109 of file CrackPropagation.hpp.

◆ griffithE

double FractureMechanics::CrackPropagation::griffithE

Griffith stability parameter.

Definition at line 112 of file CrackPropagation.hpp.

◆ griffithForceElement

boost::shared_ptr<GriffithForceElement> FractureMechanics::CrackPropagation::griffithForceElement

Definition at line 1136 of file CrackPropagation.hpp.

◆ griffithR

double FractureMechanics::CrackPropagation::griffithR

Griffith regularisation parameter.

Definition at line 113 of file CrackPropagation.hpp.

◆ ignoreContact

PetscBool FractureMechanics::CrackPropagation::ignoreContact

If set true, contact interfaces are ignored and prism interfaces are not created

Definition at line 1233 of file CrackPropagation.hpp.

◆ ignoreMaterialForce

PetscBool FractureMechanics::CrackPropagation::ignoreMaterialForce

If true surface pressure is considered in ALE.

Definition at line 130 of file CrackPropagation.hpp.

◆ initialSmootherAlpha

double FractureMechanics::CrackPropagation::initialSmootherAlpha

Controls mesh smoothing, set at start of analysis

Definition at line 1201 of file CrackPropagation.hpp.

◆ isGcHeterogeneous

PetscBool FractureMechanics::CrackPropagation::isGcHeterogeneous

flag for heterogeneous gc

Definition at line 116 of file CrackPropagation.hpp.

◆ isPartitioned

PetscBool FractureMechanics::CrackPropagation::isPartitioned

Definition at line 118 of file CrackPropagation.hpp.

◆ isPressureAle

PetscBool FractureMechanics::CrackPropagation::isPressureAle

If true surface pressure is considered in ALE.

Definition at line 125 of file CrackPropagation.hpp.

◆ isStressTagSavedOnNodes

bool FractureMechanics::CrackPropagation::isStressTagSavedOnNodes

Definition at line 140 of file CrackPropagation.hpp.

◆ isSurfaceForceAle

PetscBool FractureMechanics::CrackPropagation::isSurfaceForceAle

If true surface pressure is considered in ALE.

Definition at line 128 of file CrackPropagation.hpp.

◆ loadScale

double FractureMechanics::CrackPropagation::loadScale

Definition at line 1182 of file CrackPropagation.hpp.

◆ mapBitLevel

std::map<std::string, BitRefLevel> FractureMechanics::CrackPropagation::mapBitLevel

Map associating string literals to bit refinement levels The following convention is currently used: "mesh_cut" : level 0 "spatial_domain" : level 1 "material_domain" : level 2

Definition at line 180 of file CrackPropagation.hpp.

◆ mapG1

map<EntityHandle, double> FractureMechanics::CrackPropagation::mapG1

hashmap of g1 - release energy at nodes

Definition at line 1187 of file CrackPropagation.hpp.

◆ mapG3

map<EntityHandle, double> FractureMechanics::CrackPropagation::mapG3

hashmap of g3 - release energy at nodes

Definition at line 1188 of file CrackPropagation.hpp.

◆ mapGriffith

map<EntityHandle, VectorDouble3> FractureMechanics::CrackPropagation::mapGriffith

hashmap of Griffith energy at nodes

Definition at line 1193 of file CrackPropagation.hpp.

◆ mapJ

map<EntityHandle, double> FractureMechanics::CrackPropagation::mapJ

hashmap of J - release energy at nodes

Definition at line 1189 of file CrackPropagation.hpp.

◆ mapMatForce

map<EntityHandle, VectorDouble3> FractureMechanics::CrackPropagation::mapMatForce

hashmap of material force at nodes

Definition at line 1191 of file CrackPropagation.hpp.

◆ mapSmoothingForceFactor

map<EntityHandle, double> FractureMechanics::CrackPropagation::mapSmoothingForceFactor

Definition at line 1195 of file CrackPropagation.hpp.

◆ materialFe

boost::shared_ptr<NonlinearElasticElement> FractureMechanics::CrackPropagation::materialFe

Definition at line 1064 of file CrackPropagation.hpp.

◆ maxG1

double FractureMechanics::CrackPropagation::maxG1

Definition at line 1184 of file CrackPropagation.hpp.

◆ maxJ

double FractureMechanics::CrackPropagation::maxJ

Definition at line 1185 of file CrackPropagation.hpp.

◆ meshsetFaces

EntityHandle FractureMechanics::CrackPropagation::meshsetFaces

Definition at line 1256 of file CrackPropagation.hpp.

◆ mField

MoFEM::Interface& FractureMechanics::CrackPropagation::mField

Definition at line 106 of file CrackPropagation.hpp.

◆ moabCommWorld

boost::shared_ptr<WrapMPIComm> FractureMechanics::CrackPropagation::moabCommWorld

Definition at line 104 of file CrackPropagation.hpp.

◆ mortarContactElements

Range FractureMechanics::CrackPropagation::mortarContactElements

Definition at line 1245 of file CrackPropagation.hpp.

◆ mortarContactMasterFaces

Range FractureMechanics::CrackPropagation::mortarContactMasterFaces

Definition at line 1246 of file CrackPropagation.hpp.

◆ mortarContactProblemPtr

boost::shared_ptr<MortarContactProblem> FractureMechanics::CrackPropagation::mortarContactProblemPtr

Definition at line 1276 of file CrackPropagation.hpp.

◆ mortarContactSlaveFaces

Range FractureMechanics::CrackPropagation::mortarContactSlaveFaces

Definition at line 1247 of file CrackPropagation.hpp.

◆ mwlsApprox

boost::shared_ptr<MWLSApprox> FractureMechanics::CrackPropagation::mwlsApprox

Data struture for MWLS approximation

Definition at line 1077 of file CrackPropagation.hpp.

◆ mwlsApproxFile

std::string FractureMechanics::CrackPropagation::mwlsApproxFile

Name of file with internal stresses.

Definition at line 132 of file CrackPropagation.hpp.

◆ mwlsEigenStressTagName

std::string FractureMechanics::CrackPropagation::mwlsEigenStressTagName

Name of tag with eigen stresses.

Definition at line 134 of file CrackPropagation.hpp.

◆ mwlsRhoTagName

std::string FractureMechanics::CrackPropagation::mwlsRhoTagName

Name of tag with density.

Definition at line 135 of file CrackPropagation.hpp.

◆ mwlsStressTagName

std::string FractureMechanics::CrackPropagation::mwlsStressTagName

Name of tag with internal stresses.

Definition at line 133 of file CrackPropagation.hpp.

◆ nbCutSteps

int FractureMechanics::CrackPropagation::nbCutSteps

Definition at line 1181 of file CrackPropagation.hpp.

◆ nbLoadSteps

int FractureMechanics::CrackPropagation::nbLoadSteps

Definition at line 1180 of file CrackPropagation.hpp.

◆ nBone

double FractureMechanics::CrackPropagation::nBone

Exponent parameter in bone density.

Definition at line 1310 of file CrackPropagation.hpp.

◆ nodalForces

boost::shared_ptr<boost::ptr_map<string, NodalForce> > FractureMechanics::CrackPropagation::nodalForces

assemble nodal forces

Definition at line 1102 of file CrackPropagation.hpp.

◆ oneSideCrackFaces

Range FractureMechanics::CrackPropagation::oneSideCrackFaces

Definition at line 1161 of file CrackPropagation.hpp.

◆ onlyHooke

bool FractureMechanics::CrackPropagation::onlyHooke

True if only Hooke material is applied.

Definition at line 1058 of file CrackPropagation.hpp.

◆ onlyHookeFromOptions

PetscBool FractureMechanics::CrackPropagation::onlyHookeFromOptions

True if only Hooke material is applied.

Definition at line 1059 of file CrackPropagation.hpp.

◆ otherSideConstrains

PetscBool FractureMechanics::CrackPropagation::otherSideConstrains

Definition at line 123 of file CrackPropagation.hpp.

◆ otherSideCrackFaces

Range FractureMechanics::CrackPropagation::otherSideCrackFaces

Definition at line 1162 of file CrackPropagation.hpp.

◆ parallelReadAndBroadcast

bool CrackPropagation::parallelReadAndBroadcast
static
Initial value:
=
false

That is unstable development, for some meshses (propably generated by cubit) this is not working. Error can be attributed to bug in MOAB.

Definition at line 81 of file CrackPropagation.hpp.

◆ partitioningWeightPower

double FractureMechanics::CrackPropagation::partitioningWeightPower

Weight controling load balance. Elements at the crack front are higher order, also have more fildes, associated with ALE formulation. Higher number put more weight on those elements while partitioning.

Definition at line 143 of file CrackPropagation.hpp.

◆ postProcLevel

int FractureMechanics::CrackPropagation::postProcLevel

level of postprocessing (amount of output files)

Definition at line 167 of file CrackPropagation.hpp.

◆ printContactState

PetscBool FractureMechanics::CrackPropagation::printContactState

Definition at line 1237 of file CrackPropagation.hpp.

◆ projFrontCtx

boost::shared_ptr<ConstrainMatrixCtx> FractureMechanics::CrackPropagation::projFrontCtx

Data structure to project on crack front.

Definition at line 1075 of file CrackPropagation.hpp.

◆ projSurfaceCtx

boost::shared_ptr<ConstrainMatrixCtx> FractureMechanics::CrackPropagation::projSurfaceCtx

Data structure to project on the body surface.

Definition at line 1073 of file CrackPropagation.hpp.

◆ propagateCrack

PetscBool FractureMechanics::CrackPropagation::propagateCrack

If true crack propagation is calculated.

Definition at line 119 of file CrackPropagation.hpp.

◆ refAtCrackTip

int FractureMechanics::CrackPropagation::refAtCrackTip

Definition at line 120 of file CrackPropagation.hpp.

◆ refOrderAtTip

int FractureMechanics::CrackPropagation::refOrderAtTip

Definition at line 121 of file CrackPropagation.hpp.

◆ resetMWLSCoeffsEveryPropagationStep

PetscBool FractureMechanics::CrackPropagation::resetMWLSCoeffsEveryPropagationStep

If true, MWLS coefficients are recalulated every propagaton step.

Definition at line 149 of file CrackPropagation.hpp.

◆ residualStressBlock

int FractureMechanics::CrackPropagation::residualStressBlock

Block on which residual stress is applied.

Definition at line 136 of file CrackPropagation.hpp.

◆ rHo0

double FractureMechanics::CrackPropagation::rHo0

Reference density if bone is analyzed.

Definition at line 1309 of file CrackPropagation.hpp.

◆ rValue

double FractureMechanics::CrackPropagation::rValue

Parameter for regularizing absolute value function in the complementarity function

Definition at line 1228 of file CrackPropagation.hpp.

◆ setSingularCoordinates

bool FractureMechanics::CrackPropagation::setSingularCoordinates

Definition at line 107 of file CrackPropagation.hpp.

◆ skinOrientation

boost::shared_ptr<SurfaceSlidingConstrains::DriverElementOrientation> FractureMechanics::CrackPropagation::skinOrientation

Definition at line 1123 of file CrackPropagation.hpp.

◆ smootherAlpha

double FractureMechanics::CrackPropagation::smootherAlpha

Controls mesh smoothing.

Definition at line 1200 of file CrackPropagation.hpp.

◆ smootherFe

boost::shared_ptr<Smoother> FractureMechanics::CrackPropagation::smootherFe

Definition at line 1111 of file CrackPropagation.hpp.

◆ smootherGamma

double FractureMechanics::CrackPropagation::smootherGamma

Controls mesh smoothing.

Definition at line 1203 of file CrackPropagation.hpp.

◆ solveEigenStressProblem

PetscBool FractureMechanics::CrackPropagation::solveEigenStressProblem

Solve eigen problem.

Definition at line 163 of file CrackPropagation.hpp.

◆ spatialDirichletBc

boost::shared_ptr<DirichletSpatialPositionsBc> FractureMechanics::CrackPropagation::spatialDirichletBc

apply Dirichlet BC to sparial positions

Definition at line 1082 of file CrackPropagation.hpp.

◆ startStep

int FractureMechanics::CrackPropagation::startStep

Definition at line 168 of file CrackPropagation.hpp.

◆ surfaceConstrain

map<int, boost::shared_ptr<SurfaceSlidingConstrains> > FractureMechanics::CrackPropagation::surfaceConstrain

Definition at line 1128 of file CrackPropagation.hpp.

◆ surfaceForceAle

boost::shared_ptr<boost::ptr_map<string, NeumannForcesSurface> > FractureMechanics::CrackPropagation::surfaceForceAle

assemble surface pressure (ALE)

Definition at line 1090 of file CrackPropagation.hpp.

◆ surfaceForces

boost::shared_ptr<boost::ptr_map<string, NeumannForcesSurface> > FractureMechanics::CrackPropagation::surfaceForces

assemble surface forces

Definition at line 1088 of file CrackPropagation.hpp.

◆ surfacePressure

boost::shared_ptr<boost::ptr_map<string, NeumannForcesSurface> > FractureMechanics::CrackPropagation::surfacePressure

assemble surface pressure

Definition at line 1094 of file CrackPropagation.hpp.

◆ surfacePressureAle

boost::shared_ptr<boost::ptr_map<string, NeumannForcesSurface> > FractureMechanics::CrackPropagation::surfacePressureAle

assemble surface pressure (ALE)

Definition at line 1096 of file CrackPropagation.hpp.

◆ tangentConstrains

boost::shared_ptr< ObosleteUsersModules::TangentWithMeshSmoothingFrontConstrain> FractureMechanics::CrackPropagation::tangentConstrains

Constrains crack front in tangent directiona.

Definition at line 1121 of file CrackPropagation.hpp.

◆ useEigenPositionsSimpleContact

PetscBool FractureMechanics::CrackPropagation::useEigenPositionsSimpleContact

Use eigen positions for matching meshes contact

Definition at line 164 of file CrackPropagation.hpp.

◆ volumeLengthAdouble

boost::shared_ptr<VolumeLengthQuality<adouble> > FractureMechanics::CrackPropagation::volumeLengthAdouble

Definition at line 1117 of file CrackPropagation.hpp.

◆ volumeLengthDouble

boost::shared_ptr<VolumeLengthQuality<double> > FractureMechanics::CrackPropagation::volumeLengthDouble

Definition at line 1116 of file CrackPropagation.hpp.

◆ zeroFlambda

boost::shared_ptr<FEMethod> FractureMechanics::CrackPropagation::zeroFlambda

assemble F_lambda vector

Definition at line 1104 of file CrackPropagation.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
FractureMechanics::CrackPropagation::feGriffithConstrainsLhs
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsLhs
Definition: CrackPropagation.hpp:1144
NeumannForcesSurface::MyTriangleFE
Definition: SurfacePressure.hpp:59
MoFEM::addHOOpsFace3D
MoFEMErrorCode addHOOpsFace3D(const std::string field, E &e, bool hcurl, bool hdiv)
Definition: HODataOperators.hpp:699
MoFEM::Ent_mi_tag
Definition: TagMultiIndices.hpp:21
FractureMechanics::CrackPropagation::approxOrder
int approxOrder
Definition: CrackPropagation.hpp:108
PostProcTemplateVolumeOnRefinedMesh
Definition: PostProcOnRefMesh.hpp:268
SIDESET
@ SIDESET
Definition: definitions.h:160
g
constexpr double g
Definition: shallow_wave.cpp:63
MoFEM::DMMoFEMSetSnesCtx
PetscErrorCode DMMoFEMSetSnesCtx(DM dm, boost::shared_ptr< MoFEM::SnesCtx > snes_ctx)
Set MoFEM::SnesCtx data structure.
Definition: DMMoFEM.cpp:1111
Smoother::OpLhsSmoother
Definition: Smoother.hpp:213
FractureMechanics::CrackPropagation::declareSurfaceForceAleFE
MoFEMErrorCode declareSurfaceForceAleFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
Declare FE for pressure BC in ALE formulation (in material domain)
Definition: CrackPropagation.cpp:2663
FractureMechanics::GriffithForceElement::getElementOptions
static MoFEMErrorCode getElementOptions(BlockData &block_data)
Definition: GriffithForceElement.hpp:83
FractureMechanics::CrackPropagation::addMWLSDensityOperators
MoFEMErrorCode addMWLSDensityOperators(boost::shared_ptr< CrackFrontElement > &fe_rhs, boost::shared_ptr< CrackFrontElement > &fe_lhs)
Definition: CrackPropagation.cpp:5027
MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:228
MoFEM::CoreInterface::add_ents_to_finite_element_by_MESHSET
virtual MoFEMErrorCode add_ents_to_finite_element_by_MESHSET(const EntityHandle meshset, const std::string &name, const bool recursive=false)=0
add MESHSET element to finite element database given by name
NeumannForcesSurface::OpNeumannPressure
RHS-operator for pressure element (spatial configuration)
Definition: SurfacePressure.hpp:168
FractureMechanics::CrackPropagation::debug
static bool debug
Definition: CrackPropagation.hpp:79
FractureMechanics::CrackPropagation::analyticalDirichletBc
boost::shared_ptr< AnalyticalDirichletBC::DirichletBC > analyticalDirichletBc
Definition: CrackPropagation.hpp:1084
MoFEM::CoreInterface::loop_dofs
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
FractureMechanics::CrackPropagation::refAtCrackTip
int refAtCrackTip
Definition: CrackPropagation.hpp:120
FractureMechanics::CONSTANT_AREA_TAG
@ CONSTANT_AREA_TAG
Definition: CrackPropagation.hpp:41
FractureMechanics::CrackPropagation::contactLambdaOrder
int contactLambdaOrder
Definition: CrackPropagation.hpp:1226
H1
@ H1
continuous field
Definition: definitions.h:85
FractureMechanics::CrackPropagation::commonDataSimpleContact
boost::shared_ptr< SimpleContactProblem::CommonDataSimpleContact > commonDataSimpleContact
Definition: CrackPropagation.hpp:1274
EdgeForce
Force on edges and lines.
Definition: EdgeForce.hpp:13
MoFEM::DMMoFEMAddSubFieldCol
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:280
FractureMechanics::CrackPropagation::feRhsSimpleContactALEMaterial
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feRhsSimpleContactALEMaterial
Definition: CrackPropagation.hpp:1285
FractureMechanics::CrackPropagation::crackFrontElements
Range crackFrontElements
Definition: CrackPropagation.hpp:1167
FractureMechanics::CrackPropagation::commonDataSpringsALE
boost::shared_ptr< MetaSpringBC::DataAtIntegrationPtsSprings > commonDataSpringsALE
Definition: CrackPropagation.hpp:1266
FractureMechanics::CrackPropagation::resolveSharedBitRefLevel
MoFEMErrorCode resolveSharedBitRefLevel(const BitRefLevel bit, const int verb=QUIET, const bool debug=false)
resole shared entities by bit level
Definition: CrackPropagation.cpp:1397
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
FractureMechanics::CrackPropagation::residualStressBlock
int residualStressBlock
Block on which residual stress is applied.
Definition: CrackPropagation.hpp:136
MOFEM_LOG_CHANNEL
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
FractureMechanics::CrackPropagation::feRhsMortarContact
boost::shared_ptr< MortarContactProblem::MortarContactElement > feRhsMortarContact
Definition: CrackPropagation.hpp:1279
EntityHandle
FractureMechanics::BONEHOOKE
@ BONEHOOKE
Definition: CrackFrontElement.hpp:23
FractureMechanics::CrackPropagation::feLhs
boost::shared_ptr< CrackFrontElement > feLhs
Integrate elastic FE.
Definition: CrackPropagation.hpp:1065
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:21
FractureMechanics::CrackPropagation::surfaceForces
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfaceForces
assemble surface forces
Definition: CrackPropagation.hpp:1088
FractureMechanics::CrackPropagation::feMaterialAnaliticalTraction
boost::shared_ptr< NeumannForcesSurface::MyTriangleFE > feMaterialAnaliticalTraction
Surface elment to calculate tractions in material space.
Definition: CrackPropagation.hpp:1080
MoFEM::Problem::getNbDofsCol
DofIdx getNbDofsCol() const
Definition: ProblemsMultiIndices.hpp:377
FractureMechanics::CrackPropagation::buildCrackFrontFieldId
MoFEMErrorCode buildCrackFrontFieldId(const BitRefLevel bit, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
declare crack surface files
Definition: CrackPropagation.cpp:2145
FractureMechanics::CrackPropagation::edgeForces
boost::shared_ptr< boost::ptr_map< string, EdgeForce > > edgeForces
assemble edge forces
Definition: CrackPropagation.hpp:1100
FractureMechanics::CrackPropagation::crackFaces
Range crackFaces
Definition: CrackPropagation.hpp:1160
NonlinearElasticElement::FunctionsToCalculatePiolaKirchhoffI
Implementation of elastic (non-linear) St. Kirchhoff equation.
Definition: NonLinearElasticElement.hpp:79
NonlinearElasticElement::OpJacobianPiolaKirchhoffStress
Operator performs automatic differentiation.
Definition: NonLinearElasticElement.hpp:370
FractureMechanics::CrackPropagation::fixContactNodes
PetscBool fixContactNodes
Definition: CrackPropagation.hpp:1235
FractureMechanics::CrackPropagation::contactBothSidesMasterNodes
Range contactBothSidesMasterNodes
Definition: CrackPropagation.hpp:1253
FractureMechanics::CrackPropagation::getInterfaceVersion
MoFEMErrorCode getInterfaceVersion(Version &version) const
Definition: CrackPropagation.hpp:88
CHKERRQ_MOAB
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:467
NeumannForcesSurface::OpNeumannForce::F
Vec F
Definition: SurfacePressure.hpp:109
MoFEM::Version::strVersion
std::string strVersion()
Definition: UnknownInterface.hpp:24
PRESSURESET
@ PRESSURESET
Definition: definitions.h:165
FractureMechanics::CrackPropagation::maxG1
double maxG1
Definition: CrackPropagation.hpp:1184
FractureMechanics::CrackPropagation::declareExternalForcesFE
MoFEMErrorCode declareExternalForcesFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
Definition: CrackPropagation.cpp:2392
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
FractureMechanics::CrackPropagation::mapBitLevel
std::map< std::string, BitRefLevel > mapBitLevel
Definition: CrackPropagation.hpp:180
MoFEM::CoreInterface::modify_finite_element_add_field_row
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
EdgeSlidingConstrains::CalculateEdgeBase::setTags
static MoFEMErrorCode setTags(moab::Interface &moab, Range edges, Range tris, bool number_pathes=true, boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientation > surface_orientation=nullptr, MoFEM::Interface *m_field_ptr=nullptr)
Definition: SurfaceSlidingConstrains.hpp:716
NOBASE
@ NOBASE
Definition: definitions.h:59
PostProcCommonOnRefMesh::CommonDataForVolume
Definition: PostProcOnRefMesh.hpp:37
FractureMechanics::CrackPropagation::feGriffithConstrainsRhs
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrains > feGriffithConstrainsRhs
Definition: CrackPropagation.hpp:1142
FractureMechanics::CrackPropagation::surfaceConstrain
map< int, boost::shared_ptr< SurfaceSlidingConstrains > > surfaceConstrain
Definition: CrackPropagation.hpp:1128
NonlinearElasticElement
structure grouping operators and data used for calculation of nonlinear elastic element
Definition: HookeElement.hpp:27
MoFEM::Mat_Elastic
Elastic material data structure.
Definition: MaterialBlocks.hpp:139
MoFEM::DMMoFEMSetSquareProblem
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
Definition: DMMoFEM.cpp:456
FractureMechanics::CrackPropagation::feMaterialLhs
boost::shared_ptr< CrackFrontElement > feMaterialLhs
Integrate material stresses, assemble matrix.
Definition: CrackPropagation.hpp:1070
MoFEM::createSmartDM
DEPRECATED auto createSmartDM(MPI_Comm comm, const std::string dm_type_name)
Definition: PetscSmartObj.hpp:149
FractureMechanics::CrackPropagation::feRhsSpringALEMaterial
boost::shared_ptr< FaceElementForcesAndSourcesCore > feRhsSpringALEMaterial
Definition: CrackPropagation.hpp:1260
FractureMechanics::CrackPropagation::partitionMesh
MoFEMErrorCode partitionMesh(BitRefLevel bit1, BitRefLevel bit2, int verb=QUIET, const bool debug=false)
partotion mesh
Definition: CrackPropagation.cpp:1112
FractureMechanics::CrackPropagation::fePostProcSimpleContact
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > fePostProcSimpleContact
Definition: CrackPropagation.hpp:1295
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
FractureMechanics::CrackPropagation::declareMaterialFE
MoFEMErrorCode declareMaterialFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
declare material finite elements
Definition: CrackPropagation.cpp:2872
MoFEM::CubitMeshSets
this struct keeps basic methods for moab meshset about material and boundary conditions
Definition: BCMultiIndices.hpp:19
FractureMechanics::CrackPropagation::bothSidesConstrains
boost::shared_ptr< BothSurfaceConstrains > bothSidesConstrains
Definition: CrackPropagation.hpp:1131
FractureMechanics::CrackPropagation::commonDataSurfacePressureAle
boost::shared_ptr< NeumannForcesSurface::DataAtIntegrationPts > commonDataSurfacePressureAle
common data at integration points (ALE)
Definition: CrackPropagation.hpp:1098
MoFEM::OpCalculateVectorFieldValues
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:466
_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
Definition: MeshsetsManager.hpp:49
_IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP_
#define _IT_GET_DOFS_FIELD_BY_NAME_AND_ENT_FOR_LOOP_(MFIELD, NAME, ENT, IT)
loop over all dofs from a moFEM field and particular field
Definition: Interface.hpp:1917
FractureMechanics::CrackPropagation::setSingularDofs
MoFEMErrorCode setSingularDofs(const string field_name, const int verb=QUIET)
set singular dofs (on edges adjacent to crack front) from geometry
Definition: CrackPropagation.cpp:9334
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
NeumannForcesSurface::OpNeumannForceAnalytical
Operator for force element.
Definition: SurfacePressure.hpp:142
FractureMechanics::CrackPropagation::solveEigenStressProblem
PetscBool solveEigenStressProblem
Solve eigen problem.
Definition: CrackPropagation.hpp:163
FractureMechanics::CrackPropagation::cnValue
double cnValue
Definition: CrackPropagation.hpp:1230
MoFEM::RefEntityTmp< 0 >
Struct keeps handle to refined handle.
Definition: RefEntsMultiIndices.hpp:141
FractureMechanics::SMOOTHING_TAG
@ SMOOTHING_TAG
Definition: CrackPropagation.hpp:45
MoFEM::CoreInterface::remove_ents_from_field
virtual MoFEMErrorCode remove_ents_from_field(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)=0
remove entities from field
nb_levels
constexpr int nb_levels
Definition: level_set.cpp:58
MoFEM::CoreInterface::get_field_bit_number
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
MoFEM::PetscLocalIdx_mi_tag
Definition: TagMultiIndices.hpp:45
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
FractureMechanics::CrackPropagation::smootherGamma
double smootherGamma
Controls mesh smoothing.
Definition: CrackPropagation.hpp:1203
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
FractureMechanics::SURFACE_SLIDING_TAG
@ SURFACE_SLIDING_TAG
Definition: CrackPropagation.hpp:46
FractureMechanics::CrackPropagation::feGriffithForceRhs
boost::shared_ptr< GriffithForceElement::MyTriangleFE > feGriffithForceRhs
Definition: CrackPropagation.hpp:1137
MoFEM::Problem::getBitFEId
BitFEId getBitFEId() const
Get the BitFEIDs in problem
Definition: ProblemsMultiIndices.cpp:45
NodalForce
Force applied to nodes.
Definition: NodalForce.hpp:13
FractureMechanics::CrackPropagation::arcAlpha
double arcAlpha
Definition: CrackPropagation.hpp:1211
FractureMechanics::CrackPropagation::mapJ
map< EntityHandle, double > mapJ
hashmap of J - release energy at nodes
Definition: CrackPropagation.hpp:1189
FractureMechanics::CrackPropagation::createEigenElasticDM
MoFEMErrorCode createEigenElasticDM(SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
Create elastic problem DM.
Definition: CrackPropagation.cpp:3562
FractureMechanics::CrackPropagation::initialSmootherAlpha
double initialSmootherAlpha
Definition: CrackPropagation.hpp:1201
FieldEntity_multiIndex
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< FieldEntity, UId, &FieldEntity::localUId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity::interface_type_RefEntity, EntityHandle, &FieldEntity::getEnt > > > > FieldEntity_multiIndex
MultiIndex container keeps FieldEntity.
Definition: FieldEntsMultiIndices.hpp:425
FractureMechanics::MWLS_DENSITY_TAN
@ MWLS_DENSITY_TAN
Definition: CrackPropagation.hpp:56
FractureMechanics::CrackPropagation::cpSolversPtr
const boost::scoped_ptr< UnknownInterface > cpSolversPtr
Definition: CrackPropagation.hpp:1318
FractureMechanics::CrackPropagation::saveEachPart
MoFEMErrorCode saveEachPart(const std::string prefix, const Range &ents)
Save entities on ech processor.
Definition: CrackPropagation.cpp:1098
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:523
MoFEM::CoreInterface::get_finite_elements
virtual const FiniteElement_multiIndex * get_finite_elements() const =0
Get the finite elements object.
FractureMechanics::CrackPropagation::fePostProcMortarContact
boost::shared_ptr< MortarContactProblem::MortarContactElement > fePostProcMortarContact
Definition: CrackPropagation.hpp:1297
out_file_name
char out_file_name[255]
Definition: initial_diffusion.cpp:53
FractureMechanics::CrackPropagation::contactOutputIntegPts
PetscBool contactOutputIntegPts
Definition: CrackPropagation.hpp:1293
MoFEM::CoreInterface::get_field_meshset
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
NonlinearElasticElement::OpLhsEshelby_dX
Definition: NonLinearElasticElement.hpp:641
MoFEM::RefEntity_multiIndex
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
Definition: RefEntsMultiIndices.hpp:760
FractureMechanics::CrackPropagation::densityMapBlock
int densityMapBlock
Definition: CrackPropagation.hpp:137
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
FractureMechanics::CrackPropagation::feEnergy
boost::shared_ptr< CrackFrontElement > feEnergy
Integrate energy.
Definition: CrackPropagation.hpp:1071
FractureMechanics::CrackPropagation::spatialDirichletBc
boost::shared_ptr< DirichletSpatialPositionsBc > spatialDirichletBc
apply Dirichlet BC to sparial positions
Definition: CrackPropagation.hpp:1082
FractureMechanics::CrackPropagation::buildSurfaceFields
MoFEMErrorCode buildSurfaceFields(const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
build fields with Lagrange multipliers to constrain surfaces
Definition: CrackPropagation.cpp:1771
FractureMechanics::propagation_snes_rhs
static MoFEMErrorCode propagation_snes_rhs(SNES snes, Vec x, Vec f, void *ctx)
Definition: CrackPropagation.cpp:8469
NonlinearElasticElement::OpRhsEshelbyStress
Definition: NonLinearElasticElement.hpp:622
MoFEM::CoreInterface::add_ents_to_field_by_type
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
MoFEM::DMMoFEMAddElement
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition: DMMoFEM.cpp:497
FractureMechanics::CrackPropagation::volumeLengthAdouble
boost::shared_ptr< VolumeLengthQuality< adouble > > volumeLengthAdouble
Definition: CrackPropagation.hpp:1117
MoFEM::CoreInterface::check_problem
virtual bool check_problem(const std::string name)=0
check if problem exist
FractureMechanics::CrackPropagation::feLhsSimpleContactALEMaterial
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feLhsSimpleContactALEMaterial
Definition: CrackPropagation.hpp:1287
PCSetupArcLength
MoFEMErrorCode PCSetupArcLength(PC pc)
Definition: ArcLengthTools.cpp:326
FractureMechanics::CrackPropagation::contactSearchMultiIndexPtr
boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contactSearchMultiIndexPtr
Definition: CrackPropagation.hpp:1250
FractureMechanics::KIRCHHOFF
@ KIRCHHOFF
Definition: CrackFrontElement.hpp:23
FractureMechanics::CrackPropagation::onlyHooke
bool onlyHooke
True if only Hooke material is applied.
Definition: CrackPropagation.hpp:1058
FractureMechanics::CrackPropagation::configFile
std::string configFile
Definition: CrackPropagation.hpp:139
FractureMechanics::CrackPropagation::mortarContactElements
Range mortarContactElements
Definition: CrackPropagation.hpp:1245
FractureMechanics::CrackPropagation::areSpringsAle
PetscBool areSpringsAle
If true surface spring is considered in ALE.
Definition: CrackPropagation.hpp:126
ROW
@ ROW
Definition: definitions.h:136
FractureMechanics::CrackPropagation::bitEnts
Range bitEnts
Definition: CrackPropagation.hpp:1157
MoFEM::CoreInterface::get_dofs
virtual const DofEntity_multiIndex * get_dofs() const =0
Get the dofs object.
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
FractureMechanics::CrackPropagation::mField
MoFEM::Interface & mField
Definition: CrackPropagation.hpp:106
FractureMechanics::CrackPropagation::commonDataSurfaceForceAle
boost::shared_ptr< NeumannForcesSurface::DataAtIntegrationPts > commonDataSurfaceForceAle
common data at integration points (ALE)
Definition: CrackPropagation.hpp:1092
FractureMechanics::CrackPropagation::nbCutSteps
int nbCutSteps
Definition: CrackPropagation.hpp:1181
MOFEM_LOG_FUNCTION
#define MOFEM_LOG_FUNCTION()
Set scope.
Definition: LogManager.hpp:325
NodalForce::OpNodalForce::F
Vec F
Definition: NodalForce.hpp:37
FractureMechanics::CrackPropagation::surfacePressure
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfacePressure
assemble surface pressure
Definition: CrackPropagation.hpp:1094
ConstrainMatrixMultOpRT
MoFEMErrorCode ConstrainMatrixMultOpRT(Mat RT, Vec x, Vec f)
Multiplication operator for RT = (CCT)^-TC.
Definition: ConstrainMatrixCtx.cpp:247
FractureMechanics::CrackPropagation::ignoreMaterialForce
PetscBool ignoreMaterialForce
If true surface pressure is considered in ALE.
Definition: CrackPropagation.hpp:130
FractureMechanics::CrackPropagation::contactPostProcMoab
moab::Interface & contactPostProcMoab
Definition: CrackPropagation.hpp:1299
FractureMechanics::CrackPropagation::buildBothSidesFieldId
MoFEMErrorCode buildBothSidesFieldId(const BitRefLevel bit_spatial, const BitRefLevel bit_material, const bool proc_only=false, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
Lagrange multipliers field which constrains material displacements.
Definition: CrackPropagation.cpp:1973
MoFEM::DMMoFEMSetDestroyProblem
PetscErrorCode DMMoFEMSetDestroyProblem(DM dm, PetscBool destroy_problem)
Definition: DMMoFEM.cpp:438
FractureMechanics::MATERIAL_TAG
@ MATERIAL_TAG
Definition: CrackPropagation.hpp:38
NODESET
@ NODESET
Definition: definitions.h:159
MoFEM::CoreInterface::add_ents_to_finite_element_by_type
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
MoFEM::Exceptions::rval
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
FractureMechanics::CrackPropagation::nbLoadSteps
int nbLoadSteps
Definition: CrackPropagation.hpp:1180
PlasticOps::M
FTensor::Index< 'M', 3 > M
Definition: PlasticOps.hpp:117
VERBOSE
@ VERBOSE
Definition: definitions.h:222
MoFEM::DMMoFEMAddRowCompositeProblem
PetscErrorCode DMMoFEMAddRowCompositeProblem(DM dm, const char prb_name[])
Add problem to composite DM on row.
Definition: DMMoFEM.cpp:367
VolSideFe
VolumeElementForcesAndSourcesCoreOnSide VolSideFe
Definition: photon_diffusion.cpp:31
NonlinearElasticElement::OpLhsEshelby_dx
Definition: NonLinearElasticElement.hpp:633
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
snes_monitor_fields
static MoFEMErrorCode snes_monitor_fields(SNES snes, PetscInt its, PetscReal fgnorm, PetscViewerAndFormat *vf)
Definition: CrackPropagation.cpp:70
FractureMechanics::CrackPropagation::buildProblemFields
MoFEMErrorCode buildProblemFields(const BitRefLevel &bit1, const BitRefLevel &mask1, const BitRefLevel &bit2, const int verb=QUIET, const bool debug=false)
Build problem fields.
Definition: CrackPropagation.cpp:9456
PostProcStress
Definition: PostProcStresses.hpp:17
MoFEM::CoreInterface::remove_ents_from_finite_element
virtual MoFEMErrorCode remove_ents_from_finite_element(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)=0
remove entities from given refinement level to finite element database
FractureMechanics::CrackPropagation::updateMaterialFixedNode
MoFEMErrorCode updateMaterialFixedNode(const bool fix_front, const bool fix_small_g, const bool debug=false)
Update fixed nodes.
Definition: CrackPropagation.cpp:6898
FractureMechanics::CrackPropagation::feLhsSimpleContactALE
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feLhsSimpleContactALE
Definition: CrackPropagation.hpp:1289
FractureMechanics::CrackPropagation::crackFrontLength
double crackFrontLength
Definition: CrackPropagation.hpp:170
FractureMechanics::CrackPropagation::fixMaterialEnts
boost::shared_ptr< DirichletFixFieldAtEntitiesBc > fixMaterialEnts
Definition: CrackPropagation.hpp:1134
MoFEM::CoreInterface::add_finite_element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
FractureMechanics::CrackPropagation::isSurfaceForceAle
PetscBool isSurfaceForceAle
If true surface pressure is considered in ALE.
Definition: CrackPropagation.hpp:128
EdgeSlidingConstrains::CalculateEdgeBase::saveEdges
static MoFEMErrorCode saveEdges(moab::Interface &moab, std::string name, Range edges, Range *faces=nullptr)
Definition: SurfaceSlidingConstrains.hpp:857
FractureMechanics::CrackPropagation::contactMasterFaces
Range contactMasterFaces
Definition: CrackPropagation.hpp:1242
FractureMechanics::ELASTIC_TAG
@ ELASTIC_TAG
Definition: CrackPropagation.hpp:37
MoFEM::CoreInterface::modify_finite_element_add_field_col
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
ArcLengthMatMultShellOp
MoFEMErrorCode ArcLengthMatMultShellOp(Mat A, Vec x, Vec f)
Definition: ArcLengthTools.cpp:184
FractureMechanics::CrackPropagation::rValue
double rValue
Definition: CrackPropagation.hpp:1228
FractureMechanics::CrackPropagation::declareBothSidesFE
MoFEMErrorCode declareBothSidesFE(const BitRefLevel bit_spatial, const BitRefLevel bit_material, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
Definition: CrackPropagation.cpp:3001
FractureMechanics::CrackPropagation::arcS
double arcS
Definition: CrackPropagation.hpp:1213
MoFEM::SnesCtx::clearLoops
MoFEMErrorCode clearLoops()
Clear loops.
Definition: SnesCtx.cpp:16
MoFEM::ISManager
Section manager is used to create indexes and sections.
Definition: ISManager.hpp:23
FractureMechanics::CrackPropagation::crackSurfaceArea
double crackSurfaceArea
Definition: CrackPropagation.hpp:171
NeumannForcesSurface::OpNeumannSurfaceForceMaterialRhs_dX
RHS-operator for the surface force element (material configuration)
Definition: SurfacePressure.hpp:496
FractureMechanics::CrackPropagation::setCrackFrontBitLevel
MoFEMErrorCode setCrackFrontBitLevel(BitRefLevel from_bit, BitRefLevel bit, const int nb_levels=2, const bool debug=false)
Set bit ref level for entities adjacent to crack front.
Definition: CrackPropagation.cpp:9413
FORCESET
@ FORCESET
Definition: definitions.h:164
FractureMechanics::CrackPropagation::defaultMaterial
int defaultMaterial
Definition: CrackPropagation.hpp:1178
NeumannForcesSurface::OpNeumannForce
Operator for force element.
Definition: SurfacePressure.hpp:107
MoFEM::CoreInterface::build_finite_elements
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
MoFEM::ForcesAndSourcesCore::UserDataOperator
Definition: ForcesAndSourcesCore.hpp:549
FractureMechanics::CrackPropagation::arcLengthDof
boost::shared_ptr< DofEntity > arcLengthDof
Definition: CrackPropagation.hpp:902
MoFEM::MeshsetsManager::getEntitiesByDimension
MoFEMErrorCode getEntitiesByDimension(const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
get entities from CUBIT/meshset of a particular entity dimension
Definition: MeshsetsManager.cpp:669
AnalyticalDirichletBC::DirichletBC
Structure used to enforce analytical boundary conditions.
Definition: AnalyticalDirichlet.hpp:124
FractureMechanics::CrackPropagation::feGriffithForceLhs
boost::shared_ptr< GriffithForceElement::MyTriangleFE > feGriffithForceLhs
Definition: CrackPropagation.hpp:1138
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
default operator for TRI element
Definition: FaceElementForcesAndSourcesCore.hpp:94
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
FractureMechanics::CrackPropagation::bothSidesContactConstrains
boost::shared_ptr< BothSurfaceConstrains > bothSidesContactConstrains
Definition: CrackPropagation.hpp:1133
FractureMechanics::CrackPropagation::closeCrackConstrains
boost::shared_ptr< BothSurfaceConstrains > closeCrackConstrains
Definition: CrackPropagation.hpp:1132
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
FractureMechanics::CrackPropagation::betaGc
double betaGc
heterogeneous Griffith energy exponent
Definition: CrackPropagation.hpp:115
bit
auto bit
set bit
Definition: hanging_node_approx.cpp:75
convert.type
type
Definition: convert.py:64
FractureMechanics::CrackPropagation::loadScale
double loadScale
Definition: CrackPropagation.hpp:1182
MoFEM::Problem::getNbDofsRow
DofIdx getNbDofsRow() const
Definition: ProblemsMultiIndices.hpp:376
FractureMechanics::CrackPropagation::mapG3
map< EntityHandle, double > mapG3
hashmap of g3 - release energy at nodes
Definition: CrackPropagation.hpp:1188
MoFEM::CoreInterface::get_basic_entity_data_ptr
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
MoFEM::Version
Definition: UnknownInterface.hpp:12
FractureMechanics::CrackPropagation::declareElasticFE
MoFEMErrorCode declareElasticFE(const BitRefLevel bit1, const BitRefLevel mask1, const BitRefLevel bit2, const BitRefLevel mask2, const bool add_forces=true, const bool proc_only=true, const int verb=QUIET)
declare elastic finite elements
Definition: CrackPropagation.cpp:2205
FractureMechanics::CrackPropagation::declareSurfaceFE
MoFEMErrorCode declareSurfaceFE(std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const std::vector< int > &ids, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
declare surface sliding elements
Definition: CrackPropagation.cpp:3110
FractureMechanics::CrackPropagation::nBone
double nBone
Exponent parameter in bone density.
Definition: CrackPropagation.hpp:1310
FractureMechanics::CrackPropagation::contactProblem
boost::shared_ptr< SimpleContactProblem > contactProblem
Definition: CrackPropagation.hpp:1268
DM_NO_ELEMENT
#define DM_NO_ELEMENT
Definition: DMMoFEM.hpp:10
MAT_ELASTICSET
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
Definition: definitions.h:172
MOFEM_LOG_SYNCHRONISE
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:345
MoFEM::SnesCtx::problemName
std::string problemName
problem name
Definition: SnesCtx.hpp:18
FractureMechanics::CrackPropagation::declareFrontFE
MoFEMErrorCode declareFrontFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
Definition: CrackPropagation.cpp:2917
NonlinearElasticElement::OpLhsPiolaKirchhoff_dx
Definition: NonLinearElasticElement.hpp:556
FractureMechanics::CrackPropagation::smootherFe
boost::shared_ptr< Smoother > smootherFe
Definition: CrackPropagation.hpp:1111
FractureMechanics::CrackPropagation::createCrackFrontAreaDM
MoFEMErrorCode createCrackFrontAreaDM(SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const bool verb=QUIET)
create DM to calculate Griffith energy
Definition: CrackPropagation.cpp:3776
FractureMechanics::ARC_LENGTH_TAG
@ ARC_LENGTH_TAG
Definition: CrackPropagation.hpp:42
FractureMechanics::CrackPropagation::griffithR
double griffithR
Griffith regularisation parameter.
Definition: CrackPropagation.hpp:113
COL
@ COL
Definition: definitions.h:136
FractureMechanics::CrackPropagation::contactBothSidesMasterFaces
Range contactBothSidesMasterFaces
Definition: CrackPropagation.hpp:1251
_IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_
#define _IT_GET_ENT_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
loop over all dofs from a moFEM field and particular field
Definition: Interface.hpp:1842
FractureMechanics::CrackPropagation::buildProblemFiniteElements
MoFEMErrorCode buildProblemFiniteElements(BitRefLevel bit1, BitRefLevel bit2, std::vector< int > surface_ids, const int verb=QUIET, const bool debug=false)
Build problem finite elements.
Definition: CrackPropagation.cpp:9480
MoFEM::DMMoFEMGetSnesCtx
PetscErrorCode DMMoFEMGetSnesCtx(DM dm, MoFEM::SnesCtx **snes_ctx)
get MoFEM::SnesCtx data structure
Definition: DMMoFEM.cpp:1094
FractureMechanics::MWLS_GRIFFITH_TAN
@ MWLS_GRIFFITH_TAN
Definition: CrackPropagation.hpp:57
MoFEM::createPC
auto createPC(MPI_Comm comm)
Definition: PetscSmartObj.hpp:267
FractureMechanics::CrackPropagation::doCutMesh
PetscBool doCutMesh
Definition: CrackPropagation.hpp:1327
FractureMechanics::CrackPropagation::createMaterialForcesDM
MoFEMErrorCode createMaterialForcesDM(SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const int verb=QUIET)
Create DM for calculation of material forces (sub DM of DM material)
Definition: CrackPropagation.cpp:3724
MoFEM::Problem::getNumeredRowDofsPtr
auto & getNumeredRowDofsPtr() const
get access to numeredRowDofsPtr storing DOFs on rows
Definition: ProblemsMultiIndices.hpp:82
MoFEM::CoreInterface::get_comm_size
virtual int get_comm_size() const =0
FractureMechanics::CrackPropagation::contactPostProcCore
moab::Core contactPostProcCore
Definition: CrackPropagation.hpp:1298
FractureMechanics::CrackPropagation::addAnalyticalInternalStressOperators
PetscBool addAnalyticalInternalStressOperators
Definition: CrackPropagation.hpp:160
MoFEM::Problem::getComposedProblemsData
auto & getComposedProblemsData() const
Het composed problems data structure.
Definition: ProblemsMultiIndices.hpp:131
MoFEM::smartCreateDMMatrix
DEPRECATED auto smartCreateDMMatrix(DM dm)
Definition: DMMoFEM.hpp:1092
FractureMechanics::CrackPropagation::crackFront
Range crackFront
Definition: CrackPropagation.hpp:1163
MoFEM::CoreInterface::get_field_ents
virtual const FieldEntity_multiIndex * get_field_ents() const =0
Get the field ents object.
MoFEM::smartVectorDuplicate
DEPRECATED SmartPetscObj< Vec > smartVectorDuplicate(Vec vec)
Definition: PetscSmartObj.hpp:230
MoFEM::FaceElementForcesAndSourcesCore
Face finite element.
Definition: FaceElementForcesAndSourcesCore.hpp:23
FractureMechanics::CrackPropagation::feSpringLhsPtr
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringLhsPtr
Definition: CrackPropagation.hpp:1149
temp
void temp(int x, int y=10)
Definition: simple.cpp:4
FractureMechanics::CrackPropagation::ignoreContact
PetscBool ignoreContact
Definition: CrackPropagation.hpp:1233
FractureMechanics::CrackPropagation::griffithForceElement
boost::shared_ptr< GriffithForceElement > griffithForceElement
Definition: CrackPropagation.hpp:1136
SimpleContactProblem
Set of functions declaring elements and setting operators to apply contact conditions between surface...
Definition: SimpleContact.hpp:27
FractureMechanics::CrackPropagation::createCrackPropagationDM
MoFEMErrorCode createCrackPropagationDM(SmartPetscObj< DM > &dm, const std::string prb_name, SmartPetscObj< DM > dm_elastic, SmartPetscObj< DM > dm_material, const BitRefLevel bit, const BitRefLevel mask, const std::vector< std::string > fe_list)
Create DM by composition of elastic DM and material DM.
Definition: CrackPropagation.cpp:3431
MoFEM::DMMoFEMSNESSetJacobian
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
Definition: DMMoFEM.cpp:759
FractureMechanics::CrackPropagation::createSurfaceProjectionDM
MoFEMErrorCode createSurfaceProjectionDM(SmartPetscObj< DM > &dm, SmartPetscObj< DM > dm_material, const std::string prb_name, const std::vector< int > surface_ids, const std::vector< std::string > fe_list, const int verb=QUIET)
create DM to calculate projection matrices (sub DM of DM material)
Definition: CrackPropagation.cpp:3747
MoFEM::smartCreateDMVector
DEPRECATED auto smartCreateDMVector(DM dm)
Definition: DMMoFEM.hpp:1107
AINSWORTH_LOBATTO_BASE
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:62
FractureMechanics::EDGE_SLIDING_TAG
@ EDGE_SLIDING_TAG
Definition: CrackPropagation.hpp:47
FractureMechanics::CrackPropagation::arcBeta
double arcBeta
Definition: CrackPropagation.hpp:1212
FractureMechanics::CrackPropagation::addMWLSStressOperators
MoFEMErrorCode addMWLSStressOperators(boost::shared_ptr< CrackFrontElement > &fe_rhs, boost::shared_ptr< CrackFrontElement > &fe_lhs)
Definition: CrackPropagation.cpp:4902
MoFEM::CoreInterface::get_field_entities_by_handle
virtual MoFEMErrorCode get_field_entities_by_handle(const std::string name, Range &ents) const =0
get entities in the field by handle
MoFEM::Mat_Elastic::data
_data_ data
Definition: MaterialBlocks.hpp:155
FractureMechanics::clean_pcomms
MoFEMErrorCode clean_pcomms(moab::Interface &moab, boost::shared_ptr< WrapMPIComm > moab_comm_wrap)
MoFEM::CoreInterface::check_field
virtual bool check_field(const std::string &name) const =0
check if field is in database
VolumeLengthQuality
Volume Length Quality.
Definition: VolumeLengthQuality.hpp:32
FractureMechanics::CrackPropagation::feCouplingElasticLhs
boost::shared_ptr< CrackFrontElement > feCouplingElasticLhs
FE instance to assemble coupling terms.
Definition: CrackPropagation.hpp:1107
MoFEM::CoreInterface::delete_ents_by_bit_ref
virtual MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO)=0
delete entities form mofem and moab database
SurfaceSlidingConstrains
Shape preserving constrains, i.e. nodes sliding on body surface.
Definition: SurfaceSlidingConstrains.hpp:323
FractureMechanics::CrackPropagation::gC
double gC
Griffith energy.
Definition: CrackPropagation.hpp:111
FractureMechanics::CrackPropagation::printContactState
PetscBool printContactState
Definition: CrackPropagation.hpp:1237
NeumannForcesSurface::OpNeumannSurfaceForceMaterialRhs_dX::F
Vec F
Definition: SurfacePressure.hpp:501
NonlinearElasticElement::OpLhsPiolaKirchhoff_dX
Definition: NonLinearElasticElement.hpp:598
FractureMechanics::CrackPropagation::declareSimpleContactAleFE
MoFEMErrorCode declareSimpleContactAleFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
Declare FE for pressure BC in ALE formulation (in material domain)
Definition: CrackPropagation.cpp:2799
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
MoFEM::Problem::getNbLocalDofsRow
DofIdx getNbLocalDofsRow() const
Definition: ProblemsMultiIndices.hpp:378
FractureMechanics::CrackPropagation::propagateCrack
PetscBool propagateCrack
If true crack propagation is calculated.
Definition: CrackPropagation.hpp:119
FractureMechanics::FRONT_TANGENT
@ FRONT_TANGENT
Definition: CrackPropagation.hpp:43
FractureMechanics::CrackPropagation::assembleElasticDM
MoFEMErrorCode assembleElasticDM(const std::string mwls_stress_tag_name, const int verb=QUIET, const bool debug=false)
create elastic finite element instance for spatial assembly
Definition: CrackPropagation.cpp:3795
FractureMechanics::CrackPropagation::crackFrontNodesTris
Range crackFrontNodesTris
Definition: CrackPropagation.hpp:1166
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
FractureMechanics::CrackPropagation::crackAccelerationFactor
double crackAccelerationFactor
Definition: CrackPropagation.hpp:1328
MoFEM::CoreInterface::get_fe_by_name_end
virtual EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator get_fe_by_name_end(const std::string &fe_name) const =0
get end iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(MF...
NeumannForcesSurface::OpNeumannPressure::F
Vec F
Definition: SurfacePressure.hpp:170
ZeroFLmabda
Zero F_lambda.
Definition: ArcLengthTools.hpp:283
MoFEM::DMMoFEMCreateMoFEM
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
Definition: DMMoFEM.cpp:114
MoFEM::CoreInterface::modify_finite_element_add_field_data
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
MoFEM::VolumeElementForcesAndSourcesCore
Volume finite element base.
Definition: VolumeElementForcesAndSourcesCore.hpp:26
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FractureMechanics::MWLS_STRESS_TAN
@ MWLS_STRESS_TAN
Definition: CrackPropagation.hpp:55
FractureMechanics::CrackPropagation::oneSideCrackFaces
Range oneSideCrackFaces
Definition: CrackPropagation.hpp:1161
FractureMechanics::CrackPropagation::cpMeshCutPtr
const boost::scoped_ptr< UnknownInterface > cpMeshCutPtr
Definition: CrackPropagation.hpp:1319
FractureMechanics::CrackPropagation::crackOrientation
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientation > crackOrientation
Definition: CrackPropagation.hpp:1125
t_kd
constexpr auto t_kd
Definition: free_surface.cpp:137
FractureMechanics::CrackPropagation::declareSmoothingFE
MoFEMErrorCode declareSmoothingFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool verb=QUIET)
declare mesh smoothing finite elements
Definition: CrackPropagation.cpp:3069
NodalForce::OpNodalForce
Operator to assemble nodal force into right hand side vector.
Definition: NodalForce.hpp:34
FractureMechanics::CrackPropagation::feRhs
boost::shared_ptr< CrackFrontElement > feRhs
Integrate elastic FE.
Definition: CrackPropagation.hpp:1066
NeumannForcesSurface::OpNeumannPressureMaterialRhs_dX
RHS-operator for the pressure element (material configuration)
Definition: SurfacePressure.hpp:425
MoFEM::VecManager
Vector manager is used to create vectors \mofem_vectors.
Definition: VecManager.hpp:23
FractureMechanics::CrackPropagation::griffithE
double griffithE
Griffith stability parameter.
Definition: CrackPropagation.hpp:112
FractureMechanics::NEOHOOKEAN
@ NEOHOOKEAN
Definition: CrackFrontElement.hpp:23
FractureMechanics::CrackPropagation::feSmootherLhs
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherLhs
Integrate smoothing operators.
Definition: CrackPropagation.hpp:1115
FractureMechanics::CrackPropagation::analyticalStrainFunction
static FTensor::Tensor2_symmetric< double, 3 > analyticalStrainFunction(FTensor::Tensor1< FTensor::PackPtr< double *, 1 >, 3 > &t_coords)
Definition: CrackPropagation.cpp:10030
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
FTensor::Index< 'i', 3 >
FractureMechanics::GRIFFITH_FORCE_TAG
@ GRIFFITH_FORCE_TAG
Definition: CrackPropagation.hpp:39
PostProcFaceOnRefinedMesh
Postprocess on face.
Definition: PostProcOnRefMesh.hpp:1032
MoFEM::CoreInterface::get_finite_element_entities_by_handle
virtual MoFEMErrorCode get_finite_element_entities_by_handle(const std::string name, Range &ents) const =0
get entities in the finite element by handle
FractureMechanics::CrackPropagation::commonDataSimpleContactALE
boost::shared_ptr< SimpleContactProblem::CommonDataSimpleContact > commonDataSimpleContactALE
Definition: CrackPropagation.hpp:1291
MoFEM::OpCalculateVectorFieldGradient
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Definition: UserDataOperators.hpp:1535
convert.n
n
Definition: convert.py:82
MoFEM::CoreInterface::get_fields
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
FractureMechanics::CrackPropagation::bodySkin
Range bodySkin
Definition: CrackPropagation.hpp:1159
FractureMechanics::CrackPropagation::partitioningWeightPower
double partitioningWeightPower
Definition: CrackPropagation.hpp:143
FractureMechanics::CrackPropagation::mwlsEigenStressTagName
std::string mwlsEigenStressTagName
Name of tag with eigen stresses.
Definition: CrackPropagation.hpp:134
MortarContactProblem
Definition: MortarContactProblem.hpp:18
N
const int N
Definition: speed_test.cpp:3
FractureMechanics::CrackPropagation::otherSideConstrains
PetscBool otherSideConstrains
Definition: CrackPropagation.hpp:123
FractureMechanics::HOOKE
@ HOOKE
Definition: CrackFrontElement.hpp:23
MetaSpringBC::setSpringOperatorsMaterial
static MoFEMErrorCode setSpringOperatorsMaterial(MoFEM::Interface &m_field, boost::shared_ptr< FaceElementForcesAndSourcesCore > fe_spring_lhs_ptr_dx, boost::shared_ptr< FaceElementForcesAndSourcesCore > fe_spring_lhs_ptr_dX, boost::shared_ptr< FaceElementForcesAndSourcesCore > fe_spring_rhs_ptr, boost::shared_ptr< DataAtIntegrationPtsSprings > data_at_integration_pts, const std::string field_name, const std::string mesh_nodals_positions, std::string side_fe_name)
Implementation of spring element. Set operators to calculate LHS and RHS.
Definition: SpringElement.cpp:1223
MoFEM::SnesRhs
PetscErrorCode SnesRhs(SNES snes, Vec x, Vec f, void *ctx)
This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.
Definition: SnesCtx.cpp:27
FractureMechanics::CrackPropagation::contactSlaveFaces
Range contactSlaveFaces
Definition: CrackPropagation.hpp:1243
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
FractureMechanics::CrackPropagation::projSurfaceCtx
boost::shared_ptr< ConstrainMatrixCtx > projSurfaceCtx
Data structure to project on the body surface.
Definition: CrackPropagation.hpp:1073
Range
LOBATTO_PHI0
#define LOBATTO_PHI0(x)
Definitions taken from Hermes2d code.
Definition: base_functions.h:126
FractureMechanics::CrackPropagation::feGriffithConstrainsDelta
boost::shared_ptr< GriffithForceElement::MyTriangleFEConstrainsDelta > feGriffithConstrainsDelta
Definition: CrackPropagation.hpp:1140
adouble
ProjectionMatrixMultOpQ
MoFEMErrorCode ProjectionMatrixMultOpQ(Mat Q, Vec x, Vec f)
Multiplication operator for Q = I-CTC(CCT)^-1C.
Definition: ConstrainMatrixCtx.cpp:167
MetaSpringBC::setSpringOperators
static MoFEMErrorCode setSpringOperators(MoFEM::Interface &m_field, boost::shared_ptr< FaceElementForcesAndSourcesCore > fe_spring_lhs_ptr, boost::shared_ptr< FaceElementForcesAndSourcesCore > fe_spring_rhs_ptr, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS", double stiffness_scale=1.)
Implementation of spring element. Set operators to calculate LHS and RHS.
Definition: SpringElement.cpp:1178
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
FractureMechanics::elastic_snes_rhs
static MoFEMErrorCode elastic_snes_rhs(SNES snes, Vec x, Vec f, void *ctx)
Definition: CrackPropagation.cpp:8205
FractureMechanics::CrackPropagation::mapGriffith
map< EntityHandle, VectorDouble3 > mapGriffith
hashmap of Griffith energy at nodes
Definition: CrackPropagation.hpp:1193
MF_ZERO
@ MF_ZERO
Definition: definitions.h:111
FractureMechanics::CrackPropagation::useEigenPositionsSimpleContact
PetscBool useEigenPositionsSimpleContact
Definition: CrackPropagation.hpp:164
FractureMechanics::CrackPropagation::feSpringRhsPtr
boost::shared_ptr< FaceElementForcesAndSourcesCore > feSpringRhsPtr
Definition: CrackPropagation.hpp:1150
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
FractureMechanics::CrackPropagation::mapG1
map< EntityHandle, double > mapG1
hashmap of g1 - release energy at nodes
Definition: CrackPropagation.hpp:1187
FractureMechanics::CrackPropagation::moabCommWorld
boost::shared_ptr< WrapMPIComm > moabCommWorld
Definition: CrackPropagation.hpp:104
FractureMechanics::CrackPropagation::createElasticDM
MoFEMErrorCode createElasticDM(SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set())
Create elastic problem DM.
Definition: CrackPropagation.cpp:3510
NonlinearElasticElement::OpGetCommonDataAtGaussPts
Definition: NonLinearElasticElement.hpp:362
FractureMechanics::CrackPropagation::volumeLengthDouble
boost::shared_ptr< VolumeLengthQuality< double > > volumeLengthDouble
Definition: CrackPropagation.hpp:1116
FractureMechanics::CrackPropagation::setFieldFromCoords
MoFEMErrorCode setFieldFromCoords(const std::string field_name)
set field from node positions
Definition: CrackPropagation.cpp:9285
FractureMechanics::CrackPropagation::feLhsSpringALEMaterial
boost::shared_ptr< FaceElementForcesAndSourcesCore > feLhsSpringALEMaterial
Definition: CrackPropagation.hpp:1259
FractureMechanics::CrackPropagation::setSingularCoordinates
bool setSingularCoordinates
Definition: CrackPropagation.hpp:107
NonlinearElasticElement::OpRhsPiolaKirchhoff
Definition: NonLinearElasticElement.hpp:520
_IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_
#define _IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(MFIELD, NAME, IT)
Definition: Interface.hpp:1878
MoFEM::CommInterface
Managing BitRefLevels.
Definition: CommInterface.hpp:21
FractureMechanics::CrackPropagation::surfaceForceAle
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfaceForceAle
assemble surface pressure (ALE)
Definition: CrackPropagation.hpp:1090
FractureMechanics::CrackPropagation::otherSideCrackFaces
Range otherSideCrackFaces
Definition: CrackPropagation.hpp:1162
FractureMechanics::CrackPropagation::mapMatForce
map< EntityHandle, VectorDouble3 > mapMatForce
hashmap of material force at nodes
Definition: CrackPropagation.hpp:1191
_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
Definition: MeshsetsManager.hpp:71
EdgeSlidingConstrains::CalculateEdgeBase::numberSurfaces
static MoFEMErrorCode numberSurfaces(moab::Interface &moab, Range edges, Range tris)
Definition: SurfaceSlidingConstrains.hpp:662
FractureMechanics::CrackPropagation::nodalForces
boost::shared_ptr< boost::ptr_map< string, NodalForce > > nodalForces
assemble nodal forces
Definition: CrackPropagation.hpp:1102
FractureMechanics::CrackPropagation::contactOrder
int contactOrder
Definition: CrackPropagation.hpp:1224
FractureMechanics::CrackPropagation::elasticFe
boost::shared_ptr< NonlinearElasticElement > elasticFe
Definition: CrackPropagation.hpp:1063
FractureMechanics::CrackPropagation::mwlsApproxFile
std::string mwlsApproxFile
Name of file with internal stresses.
Definition: CrackPropagation.hpp:132
FractureMechanics::CrackPropagation::buildElasticFields
MoFEMErrorCode buildElasticFields(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
Declate fields for elastic analysis.
Definition: CrackPropagation.cpp:1460
FractureMechanics::CrackPropagation::refOrderAtTip
int refOrderAtTip
Definition: CrackPropagation.hpp:121
FractureMechanics::CrackPropagation::buildCrackSurfaceFieldId
MoFEMErrorCode buildCrackSurfaceFieldId(const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
declare crack surface files
Definition: CrackPropagation.cpp:1911
Field_multiIndex
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Field_multiIndex for Field.
Definition: FieldMultiIndices.hpp:508
FractureMechanics::CrackPropagation::contactOrientation
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientation > contactOrientation
Definition: CrackPropagation.hpp:1127
MoFEM::CoreInterface::clear_inactive_dofs
virtual MoFEMErrorCode clear_inactive_dofs(int verb=DEFAULT_VERBOSITY)=0
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
FractureMechanics::GRIFFITH_CONSTRAINS_TAG
@ GRIFFITH_CONSTRAINS_TAG
Definition: CrackPropagation.hpp:40
NonlinearElasticElement::OpEnergy
Definition: NonLinearElasticElement.hpp:540
FractureMechanics::CrackPropagation::feLhsMortarContact
boost::shared_ptr< MortarContactProblem::MortarContactElement > feLhsMortarContact
Definition: CrackPropagation.hpp:1281
MoFEM::CubitMeshSets::getMeshsetId
int getMeshsetId() const
get meshset id as it set in preprocessing software
Definition: BCMultiIndices.hpp:43
FractureMechanics::CrackPropagation::feMaterialRhs
boost::shared_ptr< CrackFrontElement > feMaterialRhs
Integrate material stresses, assemble vector.
Definition: CrackPropagation.hpp:1068
MoFEM::CoreInterface::get_fe_by_name_begin
virtual EntFiniteElement_multiIndex::index< Unique_mi_tag >::type::iterator get_fe_by_name_begin(const std::string &fe_name) const =0
get begin iterator of finite elements of given name (instead you can use IT_GET_FES_BY_NAME_FOR_LOOP(...
BLOCKSET
@ BLOCKSET
Definition: definitions.h:161
FractureMechanics::CrackPropagation::declareSpringsAleFE
MoFEMErrorCode declareSpringsAleFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
Declare FE for spring BC in ALE formulation (in material domain)
Definition: CrackPropagation.cpp:2736
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
BITREFLEVEL_SIZE
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:232
FractureMechanics::CrackPropagation::buildEdgeFields
MoFEMErrorCode buildEdgeFields(const BitRefLevel bit, const bool proc_only=true, const bool build_fields=true, const int verb=QUIET, const bool debug=false)
build fields with Lagrange multipliers to constrain edges
Definition: CrackPropagation.cpp:1836
FractureMechanics::CrackPropagation::mapSmoothingForceFactor
map< EntityHandle, double > mapSmoothingForceFactor
Definition: CrackPropagation.hpp:1195
FractureMechanics::CrackPropagation::mwlsStressTagName
std::string mwlsStressTagName
Name of tag with internal stresses.
Definition: CrackPropagation.hpp:133
approx_order
int approx_order
Definition: test_broken_space.cpp:50
MoFEM::CoreInterface::get_ref_ents
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
FractureMechanics::CrackPropagation::smootherAlpha
double smootherAlpha
Controls mesh smoothing.
Definition: CrackPropagation.hpp:1200
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
FractureMechanics::CrackPropagation::buildArcLengthField
MoFEMErrorCode buildArcLengthField(const BitRefLevel bit, const bool build_fields=true, const int verb=QUIET)
Declate field for arc-length.
Definition: CrackPropagation.cpp:1726
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::Problem::nbDofsRow
DofIdx nbDofsRow
Global number of DOFs in row.
Definition: ProblemsMultiIndices.hpp:65
lambda
static double lambda
Definition: incompressible_elasticity.cpp:199
FractureMechanics::CrackPropagation::rHo0
double rHo0
Reference density if bone is analyzed.
Definition: CrackPropagation.hpp:1309
FractureMechanics::CrackPropagation::isPartitioned
PetscBool isPartitioned
Definition: CrackPropagation.hpp:118
FractureMechanics::CrackPropagation::mortarContactProblemPtr
boost::shared_ptr< MortarContactProblem > mortarContactProblemPtr
Definition: CrackPropagation.hpp:1276
FractureMechanics::CrackPropagation::onlyHookeFromOptions
PetscBool onlyHookeFromOptions
True if only Hooke material is applied.
Definition: CrackPropagation.hpp:1059
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
FractureMechanics::CrackPropagation::contactTets
Range contactTets
Definition: CrackPropagation.hpp:1254
FractureMechanics::CrackPropagation::skinOrientation
boost::shared_ptr< SurfaceSlidingConstrains::DriverElementOrientation > skinOrientation
Definition: CrackPropagation.hpp:1123
FractureMechanics::CrackPropagation::assembleFlambda
boost::shared_ptr< FEMethod > assembleFlambda
assemble F_lambda vector
Definition: CrackPropagation.hpp:1103
FractureMechanics::CrackPropagation::declareArcLengthFE
MoFEMErrorCode declareArcLengthFE(const BitRefLevel bits, const int verb=QUIET)
create arc-length element entity and declare elemets
Definition: CrackPropagation.cpp:2344
FractureMechanics::CrackPropagation::mortarContactMasterFaces
Range mortarContactMasterFaces
Definition: CrackPropagation.hpp:1246
MoFEM::DMMoFEMGetProblemPtr
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
Definition: DMMoFEM.cpp:426
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
NonlinearElasticElement::OpJacobianEshelbyStress
Definition: NonLinearElasticElement.hpp:613
MoFEM::BlockData
Definition: MeshsetsManager.cpp:755
MoFEM::PetscOptionsGetEList
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
Definition: DeprecatedPetsc.hpp:203
FractureMechanics::materials_list
const char * materials_list[]
Definition: CrackPropagation.cpp:494
MoFEM::CoreInterface::build_fields
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
EdgeForce::OpEdgeForce::F
Vec F
Definition: EdgeForce.hpp:39
FractureMechanics::CrackPropagation::postProcLevel
int postProcLevel
level of postprocessing (amount of output files)
Definition: CrackPropagation.hpp:167
FractureMechanics::CrackPropagation::zeroFlambda
boost::shared_ptr< FEMethod > zeroFlambda
assemble F_lambda vector
Definition: CrackPropagation.hpp:1104
FractureMechanics::CrackPropagation::feRhsSimpleContact
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feRhsSimpleContact
Definition: CrackPropagation.hpp:1270
FractureMechanics::CrackPropagation::getArcLengthDof
MoFEMErrorCode getArcLengthDof()
set pointer to arc-length DOF
Definition: CrackPropagation.cpp:9662
EdgeForce::OpEdgeForce
Definition: EdgeForce.hpp:36
FractureMechanics::CrackPropagation::feCouplingMaterialLhs
boost::shared_ptr< CrackFrontElement > feCouplingMaterialLhs
FE instance to assemble coupling terms.
Definition: CrackPropagation.hpp:1109
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MoFEM::Problem::getNbLocalDofsCol
DofIdx getNbLocalDofsCol() const
Definition: ProblemsMultiIndices.hpp:379
NeumannForcesSurface::OpNeumannForceAnalytical::F
Vec F
Definition: SurfacePressure.hpp:155
MoFEM::Problem::getNumeredColDofsPtr
auto & getNumeredColDofsPtr() const
get access to numeredColDofsPtr storing DOFs on cols
Definition: ProblemsMultiIndices.hpp:87
FiniteElement_multiIndex
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
Definition: FEMultiIndices.hpp:849
FractureMechanics::CrackPropagation::feLhsSpringALE
boost::shared_ptr< FaceElementForcesAndSourcesCore > feLhsSpringALE
Definition: CrackPropagation.hpp:1258
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
Smoother::OpRhsSmoother
Definition: Smoother.hpp:159
MoFEM::BitRefManager
Managing BitRefLevels.
Definition: BitRefManager.hpp:21
FTensor::Kronecker_Delta_symmetric
Kronecker Delta class symmetric.
Definition: Kronecker_Delta.hpp:49
FractureMechanics::CrackPropagation::analiticalSurfaceElement
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > analiticalSurfaceElement
Definition: CrackPropagation.hpp:1147
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEM::CoreInterface::build_adjacencies
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
PCApplyArcLength
MoFEMErrorCode PCApplyArcLength(PC pc, Vec pc_f, Vec pc_x)
Definition: ArcLengthTools.cpp:243
FractureMechanics::CrackPropagation::geometryOrder
int geometryOrder
Definition: CrackPropagation.hpp:109
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
FractureMechanics::CrackPropagation::arcCtx
boost::shared_ptr< ArcLengthCtx > arcCtx
Definition: CrackPropagation.hpp:1215
QUIET
@ QUIET
Definition: definitions.h:221
MoFEM::SnesCtx
Interface for nonlinear (SNES) solver.
Definition: SnesCtx.hpp:13
MoFEM::Unique_mi_tag
Definition: TagMultiIndices.hpp:18
MoFEM::Problem
keeps basic data about problem
Definition: ProblemsMultiIndices.hpp:54
FractureMechanics::CrackPropagation::contactElements
Range contactElements
Definition: CrackPropagation.hpp:1241
MoFEM::CoreInterface::check_finite_element
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPts
OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl< VolumeElementForcesAndSourcesCore > OpMWLSCalculateBaseCoeffcientsAtGaussPts
Definition: MWLS.hpp:296
FractureMechanics::CrackPropagation::CrackPropagation
CrackPropagation(MoFEM::Interface &m_field, const int approx_order=2, const int geometry_order=1)
Constructor of Crack Propagation, prints fracture module version and registers the three interfaces u...
Definition: CrackPropagation.cpp:521
MoFEM::DMMoFEMAddSubFieldRow
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
Definition: DMMoFEM.cpp:238
FractureMechanics::CrackPropagation::tangentConstrains
boost::shared_ptr< ObosleteUsersModules::TangentWithMeshSmoothingFrontConstrain > tangentConstrains
Constrains crack front in tangent directiona.
Definition: CrackPropagation.hpp:1121
MoFEM::VolumeElementForcesAndSourcesCoreOnSide
Base volume element used to integrate on skeleton.
Definition: VolumeElementForcesAndSourcesCoreOnSide.hpp:22
FractureMechanics::CrackPropagation::resetMWLSCoeffsEveryPropagationStep
PetscBool resetMWLSCoeffsEveryPropagationStep
Definition: CrackPropagation.hpp:149
MoFEM::CoreInterface::set_field_order
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
MoFEM::MeshsetsManager::getCubitMeshsetPtr
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
Definition: MeshsetsManager.cpp:578
DofEntity_multiIndex
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< DofEntity, UId, &DofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
Definition: DofsMultiIndices.hpp:317
FractureMechanics::CrackPropagation::crackFrontNodes
Range crackFrontNodes
Definition: CrackPropagation.hpp:1164
MoFEM::SmartPetscObj< Vec >
NeumannForcesSurface
Finite element and operators to apply force/pressures applied to surfaces.
Definition: SurfacePressure.hpp:14
FractureMechanics::CrackPropagation::arcEigenCtx
boost::shared_ptr< ArcLengthCtx > arcEigenCtx
Definition: CrackPropagation.hpp:1216
ConstrainMatrixCtx
structure for projection matrices
Definition: ConstrainMatrixCtx.hpp:16
FractureMechanics::CrackPropagation::crackFrontNodesEdges
Range crackFrontNodesEdges
Definition: CrackPropagation.hpp:1165
FractureMechanics::CrackPropagation::feLhsSimpleContact
boost::shared_ptr< SimpleContactProblem::SimpleContactElement > feLhsSimpleContact
Definition: CrackPropagation.hpp:1272
MoFEM::SnesMat
PetscErrorCode SnesMat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver.
Definition: SnesCtx.cpp:139
FractureMechanics::CrackPropagation::declareEdgeFE
MoFEMErrorCode declareEdgeFE(std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
Definition: CrackPropagation.cpp:3179
MoFEM::MeshsetsManager::checkMeshset
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
Definition: MeshsetsManager.cpp:360
FractureMechanics::CrackPropagation::createMaterialDM
MoFEMErrorCode createMaterialDM(SmartPetscObj< DM > &dm, const std::string prb_name, const BitRefLevel bit, const BitRefLevel mask, const std::vector< std::string > fe_list, const bool debug=false)
Create DM fto calculate material problem.
Definition: CrackPropagation.cpp:3659
MoFEM::Problem::getName
auto getName() const
Definition: ProblemsMultiIndices.hpp:372
FractureMechanics::CrackPropagation::mwlsRhoTagName
std::string mwlsRhoTagName
Name of tag with density.
Definition: CrackPropagation.hpp:135
FractureMechanics::CrackPropagation::arcLengthVertex
EntityHandle arcLengthVertex
Vertex associated with dof for arc-length control.
Definition: CrackPropagation.hpp:1170
_IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP_
#define _IT_GET_DOFS_FIELD_BY_NAME_AND_TYPE_FOR_LOOP_(MFIELD, NAME, TYPE, IT)
loop over all dofs from a moFEM field and particular field
Definition: Interface.hpp:1960
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition: DMMoFEM.cpp:586
FractureMechanics::CrackPropagation::bitProcEnts
Range bitProcEnts
Definition: CrackPropagation.hpp:1158
FractureMechanics::LASTOP
@ LASTOP
Definition: CrackFrontElement.hpp:23
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
FractureMechanics::CrackPropagation::declareCrackSurfaceFE
MoFEMErrorCode declareCrackSurfaceFE(std::string fe_name, const BitRefLevel bit, const BitRefLevel mask, const bool proc_only=true, const int verb=QUIET, const bool debug=false)
Definition: CrackPropagation.cpp:3289
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
FractureMechanics::CrackPropagation::maxJ
double maxJ
Definition: CrackPropagation.hpp:1185
FractureMechanics::CrackPropagation::materialFe
boost::shared_ptr< NonlinearElasticElement > materialFe
Definition: CrackPropagation.hpp:1064
MoFEM::FieldBlas
Basic algebra on fields.
Definition: FieldBlas.hpp:21
Smoother::OpJacobianSmoother
Definition: Smoother.hpp:131
ObosleteUsersModules::TangentWithMeshSmoothingFrontConstrain
Definition: ComplexConstArea.hpp:583
FractureMechanics::CrackPropagation::edgeConstrains
map< int, boost::shared_ptr< EdgeSlidingConstrains > > edgeConstrains
Definition: CrackPropagation.hpp:1129
FractureMechanics::CrackPropagation::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: CrackPropagation.hpp:1077
EntFiniteElement_multiIndex
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< EntFiniteElement, UId, &EntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityHandle, &EntFiniteElement::getEnt > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
Definition: FEMultiIndices.hpp:800
FractureMechanics::CrackPropagation::doSurfaceProjection
bool doSurfaceProjection
Definition: CrackPropagation.hpp:1197
FractureMechanics::CrackPropagation::isGcHeterogeneous
PetscBool isGcHeterogeneous
flag for heterogeneous gc
Definition: CrackPropagation.hpp:116
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
H
double H
Hardening.
Definition: plastic.cpp:124
FractureMechanics::CrackPropagation::mortarContactSlaveFaces
Range mortarContactSlaveFaces
Definition: CrackPropagation.hpp:1247
MoFEM::CoreInterface::add_field
virtual MoFEMErrorCode add_field(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
MetaSpringBC::addSpringElements
static MoFEMErrorCode addSpringElements(MoFEM::Interface &m_field, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
Declare spring element.
Definition: SpringElement.cpp:1127
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
FractureMechanics::CrackPropagation::doElasticWithoutCrack
PetscBool doElasticWithoutCrack
Definition: CrackPropagation.hpp:1329
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FractureMechanics::CrackPropagation::declarePressureAleFE
MoFEMErrorCode declarePressureAleFE(const BitRefLevel bit, const BitRefLevel mask=BitRefLevel().set(), const bool proc_only=true)
Declare FE for pressure BC in ALE formulation (in material domain)
Definition: CrackPropagation.cpp:2601
MOFEM_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36
FractureMechanics::CrackPropagation::resolveShared
MoFEMErrorCode resolveShared(const Range &tets, Range &proc_ents, const int verb=QUIET, const bool debug=false)
resolve shared entities
Definition: CrackPropagation.cpp:1177
BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME
@ BARRIER_AND_CHANGE_QUALITY_SCALED_BY_VOLUME
Definition: VolumeLengthQuality.hpp:19
FractureMechanics::CrackPropagation::projFrontCtx
boost::shared_ptr< ConstrainMatrixCtx > projFrontCtx
Data structure to project on crack front.
Definition: CrackPropagation.hpp:1075
FractureMechanics::CrackPropagation::surfacePressureAle
boost::shared_ptr< boost::ptr_map< string, NeumannForcesSurface > > surfacePressureAle
assemble surface pressure (ALE)
Definition: CrackPropagation.hpp:1096
FractureMechanics::elastic_snes_mat
static MoFEMErrorCode elastic_snes_mat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
Definition: CrackPropagation.cpp:8214
MoFEM::DMMoFEMSetVerbosity
PetscErrorCode DMMoFEMSetVerbosity(DM dm, const int verb)
Set verbosity level.
Definition: DMMoFEM.cpp:1525
FractureMechanics::CrackPropagation::addSingularity
PetscBool addSingularity
Definition: CrackPropagation.hpp:122
BlockData
NonlinearElasticElement::BlockData BlockData
Definition: elasticity.cpp:74
tol
double tol
Definition: mesh_smoothing.cpp:26
F
@ F
Definition: free_surface.cpp:394
FractureMechanics::CrackPropagation::commonDataMortarContact
boost::shared_ptr< MortarContactProblem::CommonDataMortarContact > commonDataMortarContact
Definition: CrackPropagation.hpp:1283
FractureMechanics::CrackPropagation::startStep
int startStep
Definition: CrackPropagation.hpp:168
EdgeSlidingConstrains
Definition: SurfaceSlidingConstrains.hpp:639
NOFIELD
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
MoFEM::DMMoFEMSetIsPartitioned
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition: DMMoFEM.cpp:1123
MoFEM::DMMoFEMSNESSetFunction
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
Definition: DMMoFEM.cpp:718
DirichletSpatialPositionsBc
Set Dirichlet boundary conditions on spatial displacements.
Definition: DirichletBC.hpp:211
FractureMechanics::propagation_snes_mat
static MoFEMErrorCode propagation_snes_mat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
Definition: CrackPropagation.cpp:8478
MoFEM::PetscOptionsGetBool
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:182
FractureMechanics::CrackPropagation::isPressureAle
PetscBool isPressureAle
If true surface pressure is considered in ALE.
Definition: CrackPropagation.hpp:125
FractureMechanics::CrackPropagation::feSmootherRhs
boost::shared_ptr< Smoother::MyVolumeFE > feSmootherRhs
Integrate smoothing operators.
Definition: CrackPropagation.hpp:1113