www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CrackFrontDefinition Class Reference

Class used in fracture integrals to define geometric characteristics of the crack front. More...

#include <CrackFrontDefinition.h>

Inheritance diagram for CrackFrontDefinition:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 
enum  TEST_TYPE
 

Public Member Functions

 CrackFrontDefinition (const InputParameters &parameters)
 
virtual ~CrackFrontDefinition ()
 
virtual void initialSetup () override
 
virtual void initialize () override
 
virtual void finalize () override
 
virtual void execute () override
 
void updateNumberOfCrackFrontPoints (const std::size_t num_points)
 Change the number of crack front nodes. More...
 
const Node * getCrackFrontNodePtr (const std::size_t node_index) const
 Get the node pointer for a specified node on the crack front. More...
 
const Point * getCrackFrontPoint (const std::size_t point_index) const
 Get a Point object for a specified point on the crack front. More...
 
const RealVectorValuegetCrackFrontTangent (const std::size_t point_index) const
 Get the vector tangent to the crack front at a specified position. More...
 
Real getCrackFrontForwardSegmentLength (const std::size_t point_index) const
 Get the length of the line segment on the crack front ahead of the specified position. More...
 
Real getCrackFrontBackwardSegmentLength (const std::size_t point_index) const
 Get the length of the line segment on the crack front behind the specified position. More...
 
const RealVectorValuegetCrackDirection (const std::size_t point_index) const
 Get the unit vector of the crack extension direction at the specified position. More...
 
Real getDistanceAlongFront (const std::size_t point_index) const
 Get the distance along the crack front from the beginning of the crack to the specified position. More...
 
bool hasAngleAlongFront () const
 Whether the distance along the crack front is available as an angle. More...
 
Real getAngleAlongFront (const std::size_t point_index) const
 Get the angle along the crack front from the beginning of the crack to the specified position. More...
 
std::size_t getNumCrackFrontPoints () const
 Get the number of points defining the crack front as a set of line segments. More...
 
bool treatAs2D () const
 Whether the fracture computations are treated as 2D for the model. More...
 
bool usingMeshCutter () const
 Is the crack defined by a mesh cutter object. More...
 
RealVectorValue rotateToCrackFrontCoords (const RealVectorValue vector, const std::size_t point_index) const
 Rotate a vector in the global coordinate coordinate system to the crack front local coordinate system at a specified point on the crack. More...
 
RankTwoTensor rotateToCrackFrontCoords (const RankTwoTensor tensor, const std::size_t point_index) const
 Rotate a RankTwoTensor in the global coordinate coordinate system to the crack front local coordinate system at a specified point on the crack. More...
 
RealVectorValue rotateFromCrackFrontCoordsToGlobal (const RealVectorValue vector, const std::size_t point_index) const
 Rotate a vector from crack front cartesian coordinate to global cartesian coordinate. More...
 
void calculateRThetaToCrackFront (const Point qp, const std::size_t point_index, Real &r, Real &theta) const
 Calculate r and theta of a point in the crack front polar coordinates for a given crack point index. More...
 
std::size_t calculateRThetaToCrackFront (const Point qp, Real &r, Real &theta) const
 Calculate r and theta of a point in the crack front polar coordinate relative to the closest crack front point. More...
 
bool isNodeOnIntersectingBoundary (const Node *const node) const
 Determine whether a given node is on one of the boundaries that intersects an end of the crack front. More...
 
bool isPointWithIndexOnIntersectingBoundary (const std::size_t point_index) const
 Determine whether a given crack front point is on one of the boundaries that intersects an end of the crack front. More...
 
Real getCrackFrontTangentialStrain (const std::size_t node_index) const
 Get the strain in the direction tangent to the crack front at a given point. More...
 
bool hasCrackFrontNodes () const
 Determine whether the crack front was defined using nodes. More...
 
bool isNodeInRing (const std::size_t ring_index, const dof_id_type connected_node_id, const std::size_t node_index) const
 Determine whether a node is contained within a specified volume integral element ring for a given node on the crack front. More...
 
Real DomainIntegralQFunction (std::size_t crack_front_point_index, std::size_t ring_index, const Node *const current_node) const
 Compute the q function for the case where it is defined geometrically. More...
 
Real DomainIntegralTopologicalQFunction (std::size_t crack_front_point_index, std::size_t ring_index, const Node *const current_node) const
 Compute the q function for the case where it is defined through element connectivity. More...
 
void isCutterModified (const bool is_cutter_modified)
 Set the value of _is_cutter_modified. More...
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () const
 
void gatherSum (T &value)
 
void gatherMax (T &value)
 
void gatherMin (T &value)
 
void gatherProxyValueMax (T1 &value, T2 &proxy)
 
void gatherProxyValueMin (T1 &value, T2 &proxy)
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
std::set< UserObjectName > getDependObjects () const
 
virtual bool needThreadedCopy () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &name, const std::string *param=nullptr) const
 
virtual void timestepSetup ()
 
virtual void jacobianSetup ()
 
virtual void residualSetup ()
 
virtual void customSetup (const ExecFlagType &)
 
const ExecFlagEnumgetExecuteOnEnum () const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const T & getUserObject (const std::string &param_name, bool is_dependency=true) const
 
const T & getUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty ()
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName (const std::string &prop_name)
 
const MaterialProperty< T > & getZeroMaterialProperty (Ts... args)
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< MaterialBase > discrete)
 
std::unordered_map< SubdomainID, std::vector< MaterialBase *> > buildRequiredMaterials (bool allow_stateful=true)
 
void statefulPropertiesAllowed (bool)
 
bool getMaterialPropertyCalled () const
 
const std::unordered_set< unsigned int > & getMatPropDependencies () const
 
virtual void resolveOptionalProperties ()
 
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName (const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
 
bool isImplicit ()
 
virtual void threadJoin (const UserObject &) override
 
virtual void threadJoin (const UserObject &) override
 
virtual void subdomainSetup () override
 
virtual void subdomainSetup () override
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 
T & getSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
T & getSamplerByName (const SamplerName &name)
 
SamplergetSamplerByName (const SamplerName &name)
 
virtual void meshChanged ()
 
const std::vector< MooseVariableScalar *> & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
PerfGraphperfGraph ()
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
virtual const std::set< BoundaryID > & boundaryIDs () const
 
const std::vector< BoundaryName > & boundaryNames () const
 
unsigned int numBoundaryIDs () const
 
bool hasBoundary (const BoundaryName &name) const
 
bool hasBoundary (const std::vector< BoundaryName > &names) const
 
bool hasBoundary (const BoundaryID &id) const
 
bool hasBoundary (const std::vector< BoundaryID > &ids, TEST_TYPE type=ALL) const
 
bool hasBoundary (const std::set< BoundaryID > &ids, TEST_TYPE type=ALL) const
 
bool isBoundarySubset (const std::set< BoundaryID > &ids) const
 
bool isBoundarySubset (const std::vector< BoundaryID > &ids) const
 
bool hasBoundaryMaterialProperty (const std::string &prop_name) const
 
virtual bool boundaryRestricted () const
 
const std::set< BoundaryID > & meshBoundaryIDs () const
 
virtual bool checkVariableBoundaryIntegrity () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void sort (typename std::vector< T > &vector)
 
static void sortDFS (typename std::vector< T > &vector)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header)
 
static bool restricted (const std::set< BoundaryID > &ids)
 

Public Attributes

const ConsoleStream _console
 
 ALL
 
 ANY
 

Static Public Attributes

static constexpr PropertyValue::id_type default_property_id
 
static constexpr PropertyValue::id_type zero_property_id
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Types

enum  DIRECTION_METHOD { DIRECTION_METHOD::CRACK_DIRECTION_VECTOR, DIRECTION_METHOD::CRACK_MOUTH, DIRECTION_METHOD::CURVED_CRACK_FRONT }
 Enum used to define the method for computing the crack extension direction. More...
 
enum  END_DIRECTION_METHOD { END_DIRECTION_METHOD::NO_SPECIAL_TREATMENT, END_DIRECTION_METHOD::END_CRACK_DIRECTION_VECTOR, END_DIRECTION_METHOD::END_CRACK_TANGENT_VECTOR }
 Enum used to define the method for computing the crack extension direction at the ends of the crack. More...
 
enum  CRACK_NODE_TYPE { MIDDLE_NODE, END_1_NODE, END_2_NODE }
 Enum used to define the type of the nodes on the crack front (end or middle) More...
 
enum  CRACK_GEOM_DEFINITION { CRACK_GEOM_DEFINITION::CRACK_FRONT_NODES, CRACK_GEOM_DEFINITION::CRACK_FRONT_POINTS }
 Enum used to define whether the crack front is defined using nodes or points. More...
 

Protected Member Functions

void getCrackFrontNodes (std::set< dof_id_type > &nodes)
 Get the set of all crack front nodes. More...
 
void orderCrackFrontNodes (std::set< dof_id_type > &nodes)
 Arrange the crack front nodes by their position along the crack front, and put them in the _ordered_crack_front_nodes member variable. More...
 
void orderEndNodes (std::vector< dof_id_type > &end_nodes)
 Determine which of the end nodes should be the starting point of the crack front. More...
 
void pickLoopCrackEndNodes (std::vector< dof_id_type > &end_nodes, std::set< dof_id_type > &nodes, std::map< dof_id_type, std::vector< dof_id_type >> &node_to_line_elem_map, std::vector< std::vector< dof_id_type >> &line_elems)
 For the case of a crack that is a complete loop, determine which of the nodes should be the start and end nodes in a repeatable way. More...
 
dof_id_type maxNodeCoor (std::vector< Node *> &nodes, unsigned int dir0=0)
 Find the node with the maximum value of its coordinate. More...
 
void updateCrackFrontGeometry ()
 Update the data structures defining the crack front geometry such as the ordered crack front nodes/points and other auxiliary data. More...
 
void updateDataForCrackDirection ()
 Update the data structures used to determine the crack front direction vectors such as crack mouth coordinates. More...
 
RealVectorValue calculateCrackFrontDirection (const Point &crack_front_point, const RealVectorValue &tangent_direction, const CRACK_NODE_TYPE ntype, const std::size_t crack_front_point_index=0) const
 Compute the direction of crack extension for a given point on the crack front. More...
 
void calculateTangentialStrainAlongFront ()
 Compute the strain in the direction tangent to the crack at all points on the crack front. More...
 
void createQFunctionRings ()
 Create the data defining the rings used to define the q function when the topological option is used to define the q function. More...
 
void addNodesToQFunctionRing (std::set< dof_id_type > &nodes_new_ring, const std::set< dof_id_type > &nodes_old_ring, const std::set< dof_id_type > &nodes_all_rings, const std::set< dof_id_type > &nodes_neighbor1, const std::set< dof_id_type > &nodes_neighbor2, std::vector< std::vector< const Elem *>> &nodes_to_elem_map)
 Find nodes that are connected through elements to the nodes in the previous node ring. More...
 
void projectToFrontAtPoint (Real &dist_to_front, Real &dist_along_tangent, std::size_t crack_front_point_index, const Node *const current_node) const
 Project a point to a specified point along the crack front and compute the projected normal and tangential distance to the front. More...
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObject &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
virtual void checkMaterialProperty (const std::string &name, const unsigned int state)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
Moose::StateArg determineState () const
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
bool hasBoundaryMaterialPropertyHelper (const std::string &prop_name) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

enum CrackFrontDefinition::DIRECTION_METHOD _direction_method
 
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
 
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
 
AuxiliarySystem_aux
 Reference to the auxiliary system. More...
 
MooseMesh_mesh
 Reference to the mesh. More...
 
std::vector< dof_id_type_ordered_crack_front_nodes
 Crack front nodes ordered from the start to end of the crack front. More...
 
std::vector< Point > _crack_front_points
 Vector of points along the crack front. More...
 
std::vector< RealVectorValue_tangent_directions
 Vector of tangent directions along the crack front. More...
 
std::vector< RealVectorValue_crack_directions
 Vector of crack extension directions along the crack front. More...
 
std::vector< std::pair< Real, Real > > _segment_lengths
 Vector of segment lengths along the crack front. More...
 
std::vector< Real_distances_along_front
 Vector of distances along the crack front. More...
 
std::vector< Real_angles_along_front
 Vector of angles along the crack front. More...
 
std::vector< Real_strain_along_front
 Vector of tangential strain along the crack front. More...
 
std::vector< RankTwoTensor_rot_matrix
 Vector of rotation matrices along the crack front. More...
 
Real _overall_length
 Overall length of the crack. More...
 
RealVectorValue _crack_direction_vector
 Fixed vector optionally used to define crack extension direction. More...
 
RealVectorValue _crack_direction_vector_end_1
 Fixed vector optionally used to define crack extension direction at end 1 of crack front. More...
 
RealVectorValue _crack_direction_vector_end_2
 Fixed vector optionally used to define crack extension direction at end 2 of crack front. More...
 
RealVectorValue _crack_tangent_vector_end_1
 Fixed vector optionally used to define crack tangent direction at end 1 of crack front. More...
 
RealVectorValue _crack_tangent_vector_end_2
 Fixed vector optionally used to define crack tangent direction at end 2 of crack front. More...
 
std::vector< BoundaryName > _crack_mouth_boundary_names
 Names of boundaries used to define location of crack mouth. More...
 
std::vector< BoundaryID_crack_mouth_boundary_ids
 IDs of boundaries used to define location of crack mouth. More...
 
std::vector< BoundaryName > _intersecting_boundary_names
 Names of boundaries that intersect crack at its ends. More...
 
std::vector< BoundaryID_intersecting_boundary_ids
 IDs of boundaries that intersect crack at its ends. More...
 
RealVectorValue _crack_mouth_coordinates
 Coordinates of crack mouth. More...
 
RealVectorValue _crack_plane_normal
 Vector normal to the crack plane of a planar crack. More...
 
std::vector< RealVectorValue_crack_plane_normals
 Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true. More...
 
bool _treat_as_2d
 Whether to treat the model as 2D for computation of fracture integrals. More...
 
bool _use_mesh_cutter
 Whether to describe the crack as a mesh cutter. More...
 
bool _is_cutter_modified
 Indicator that shows if the cutter mesh is modified or not in the calculation step. More...
 
bool _closed_loop
 Whether the crack forms a closed loop. More...
 
unsigned int _axis_2d
 Out of plane axis when crack is treated as 2D. More...
 
bool _has_symmetry_plane
 Whether the crack plane is also a symmetry plane in the model. More...
 
unsigned int _symmetry_plane
 Which plane is the symmetry plane. More...
 
bool _t_stress
 Whether the T-stress is being computed. More...
 
bool _q_function_rings
 Whether topological rings are used to define the q functions. More...
 
std::size_t _last_ring
 Numer of elements from crack tip to last topological ring. More...
 
std::size_t _first_ring
 Numer of elements from crack tip to first topological ring. More...
 
std::map< std::pair< dof_id_type, std::size_t >, std::set< dof_id_type > > _crack_front_node_to_node_map
 Data structure used to store information about topological rings Key is a pair of the crack front node index and ring id Data is a set of the IDs of the nodes in the ring for that crack front node. More...
 
MooseEnum _q_function_type
 Method used to define the q function. More...
 
std::vector< bool > _is_point_on_intersecting_boundary
 Vector of bools indicating whether individual crack front points are on an intersecting boundary. More...
 
std::vector< Real_j_integral_radius_inner
 Vector of inner radii of the rings used for geometric q functions. More...
 
std::vector< Real_j_integral_radius_outer
 Vector of outer radii of the rings used for geometric q functions. More...
 
const CrackFrontPointsProvider_crack_front_points_provider
 Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points. More...
 
std::size_t _num_points_from_provider
 Number of points coming from the CrackFrontPointsProvider. More...
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
const THREAD_ID _tid
 
Assembly_assembly
 
const Moose::CoordinateSystemType_coord_sys
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real_real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const InputParameters_mi_params
 
const std::string _mi_name
 
const MooseObjectName _mi_moose_object_name
 
FEProblemBase_mi_feproblem
 
SubProblem_mi_subproblem
 
const THREAD_ID _mi_tid
 
const Moose::MaterialDataType _material_data_type
 
MaterialData_material_data
 
bool _stateful_allowed
 
bool _get_material_property_called
 
std::vector< std::unique_ptr< PropertyValue > > _default_properties
 
std::unordered_set< unsigned int_material_property_dependencies
 
const MaterialPropertyName _get_suffix
 
const bool _use_interpolated_state
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real_t
 
int_t_step
 
Real_dt
 
Real_dt_old
 
bool _is_transient
 
const Parallel::Communicator & _communicator
 
std::string _disp_x_var_name
 Names of the x, y, and z displacement variables. More...
 
std::string _disp_y_var_name
 
std::string _disp_z_var_name
 

Static Protected Attributes

static const Real _tol = 1e-10
 Tolerance used in geometric calculations. More...
 
static const std::string _interpolated_old
 
static const std::string _interpolated_older
 

Detailed Description

Class used in fracture integrals to define geometric characteristics of the crack front.

Definition at line 31 of file CrackFrontDefinition.h.

Member Enumeration Documentation

◆ CRACK_GEOM_DEFINITION

Enum used to define whether the crack front is defined using nodes or points.

Enumerator
CRACK_FRONT_NODES 
CRACK_FRONT_POINTS 

Definition at line 280 of file CrackFrontDefinition.h.

281  {
282  CRACK_FRONT_NODES,
283  CRACK_FRONT_POINTS
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method

◆ CRACK_NODE_TYPE

Enum used to define the type of the nodes on the crack front (end or middle)

Enumerator
MIDDLE_NODE 
END_1_NODE 
END_2_NODE 

Definition at line 272 of file CrackFrontDefinition.h.

◆ DIRECTION_METHOD

Enum used to define the method for computing the crack extension direction.

Enumerator
CRACK_DIRECTION_VECTOR 
CRACK_MOUTH 
CURVED_CRACK_FRONT 

Definition at line 257 of file CrackFrontDefinition.h.

257  {
258  CRACK_DIRECTION_VECTOR,
259  CRACK_MOUTH,
260  CURVED_CRACK_FRONT
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ END_DIRECTION_METHOD

Enum used to define the method for computing the crack extension direction at the ends of the crack.

Enumerator
NO_SPECIAL_TREATMENT 
END_CRACK_DIRECTION_VECTOR 
END_CRACK_TANGENT_VECTOR 

Definition at line 265 of file CrackFrontDefinition.h.

265  {
266  NO_SPECIAL_TREATMENT,
267  END_CRACK_DIRECTION_VECTOR,
268  END_CRACK_TANGENT_VECTOR
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method

Constructor & Destructor Documentation

◆ CrackFrontDefinition()

CrackFrontDefinition::CrackFrontDefinition ( const InputParameters parameters)

Definition at line 111 of file CrackFrontDefinition.C.

113  BoundaryRestrictable(this, true), // false means nodesets
114  _direction_method(getParam<MooseEnum>("crack_direction_method").getEnum<DIRECTION_METHOD>()),
116  getParam<MooseEnum>("crack_end_direction_method").getEnum<END_DIRECTION_METHOD>()),
119  _treat_as_2d(getParam<bool>("2d")),
120  _use_mesh_cutter(false),
121  _is_cutter_modified(false),
122  _closed_loop(getParam<bool>("closed_loop")),
123  _axis_2d(getParam<unsigned int>("axis_2d")),
124  _has_symmetry_plane(isParamValid("symmetry_plane")),
125  _symmetry_plane(_has_symmetry_plane ? getParam<unsigned int>("symmetry_plane")
126  : std::numeric_limits<unsigned int>::max()),
127  _t_stress(getParam<bool>("t_stress")),
128  _q_function_rings(getParam<bool>("q_function_rings")),
129  _q_function_type(getParam<MooseEnum>("q_function_type")),
131 {
132  auto boundary = isParamValid("boundary") ? getParam<std::vector<BoundaryName>>("boundary")
133  : std::vector<BoundaryName>{};
134  if (isParamValid("crack_front_points"))
135  {
136  if (boundary.size())
137  paramError("crack_front_points",
138  "CrackFrontDefinition error: since boundary is defined, crack_front_points should "
139  "not be added.");
140  if (isParamValid("crack_front_points_provider"))
141  paramError("crack_front_points_provider",
142  "As crack_front_points have been provided, the crack_front_points_provider will "
143  "not be used and needs to be removed.");
144  _crack_front_points = getParam<std::vector<Point>>("crack_front_points");
146  if (_t_stress)
147  paramError("t_stress", "t_stress not yet supported with crack_front_points");
148  if (_q_function_rings)
149  paramError("q_function_rings", "q_function_rings not supported with crack_front_points");
150  }
151  else if (isParamValid("crack_front_points_provider"))
152  {
153  if (boundary.size())
154  paramError("crack_front_points_provider",
155  "CrackFrontDefinition error: since boundary is defined, "
156  "crack_front_points_provider should not be added.");
157  if (!isParamValid("number_points_from_provider"))
158  paramError("number_points_from_provider",
159  "CrackFrontDefinition error: When crack_front_points_provider is used, the "
160  "number_points_from_provider must be provided.");
161 
162  _num_points_from_provider = getParam<unsigned int>("number_points_from_provider");
164  }
165  else if (isParamValid("number_points_from_provider"))
166  paramError("number_points_from_provider",
167  "CrackFrontDefinition error: number_points_from_provider is provided but "
168  "crack_front_points_provider cannot be found.");
169  else if (boundary.size())
170  {
172  if (parameters.isParamSetByUser("closed_loop"))
173  paramError("closed_loop",
174  "In CrackFrontDefinition, if 'boundary' is defined, 'closed_loop' should not be "
175  "set by user because closed loops are detected automatically");
176  }
177  else
178  mooseError("In CrackFrontDefinition, must define one of 'boundary', 'crack_front_points' "
179  "and 'crack_front_points_provider'");
180 
181  if (isParamValid("crack_mouth_boundary"))
182  _crack_mouth_boundary_names = getParam<std::vector<BoundaryName>>("crack_mouth_boundary");
183 
185  if (_symmetry_plane > 2)
186  paramError("symmetry_plane",
187  "symmetry_plane out of bounds: ",
189  " Must be >=0 and <=2.");
190 
191  switch (_direction_method)
192  {
194  if (!isParamValid("crack_direction_vector"))
195  paramError("crack_direction_vector",
196  "crack_direction_vector must be specified if crack_direction_method = "
197  "CrackDirectionVector");
198  _crack_direction_vector = getParam<RealVectorValue>("crack_direction_vector");
199  break;
201  if (isParamValid("crack_direction_vector"))
202  paramError("crack_direction_vector",
203  "crack_direction_vector must not be specified if crack_direction_method = "
204  "CrackMouthNodes");
205  if (_crack_mouth_boundary_names.size() == 0)
206  paramError(
207  "crack_mouth_boundary",
208  "crack_mouth_boundary must be specified if crack_direction_method = CrackMouthNodes");
209  break;
211  if (isParamValid("crack_direction_vector"))
212  paramError("crack_direction_vector",
213  "crack_direction_vector must not be specified if crack_direction_method = "
214  "CurvedCrackFront");
215  break;
216  default:
217  paramError("crack_direction_method", "Invalid direction_method");
218  }
219 
220  if (isParamValid("intersecting_boundary"))
221  _intersecting_boundary_names = getParam<std::vector<BoundaryName>>("intersecting_boundary");
222 
224  {
225  if (!isParamValid("crack_direction_vector_end_1"))
226  paramError("crack_direction_vector_end_1",
227  "crack_direction_vector_end_1 must be specified if crack_end_direction_method = "
228  "CrackDirectionVector");
229  if (!isParamValid("crack_direction_vector_end_2"))
230  paramError("crack_direction_vector_end_2",
231  "crack_direction_vector_end_2 must be specified if crack_end_direction_method = "
232  "CrackDirectionVector");
233  _crack_direction_vector_end_1 = getParam<RealVectorValue>("crack_direction_vector_end_1");
234  _crack_direction_vector_end_2 = getParam<RealVectorValue>("crack_direction_vector_end_2");
235  }
236 
238  {
239  if (!isParamValid("crack_tangent_vector_end_1"))
240  paramError("crack_tangent_vector_end_1",
241  "crack_tangent_vector_end_1 must be specified if crack_end_tangent_method = "
242  "CrackTangentVector");
243  if (!isParamValid("crack_tangent_vector_end_2"))
244  paramError("crack_tangent_vector_end_2",
245  "crack_tangent_vector_end_2 must be specified if crack_end_tangent_method = "
246  "CrackTangentVector");
247  _crack_tangent_vector_end_1 = getParam<RealVectorValue>("crack_tangent_vector_end_1");
248  _crack_tangent_vector_end_2 = getParam<RealVectorValue>("crack_tangent_vector_end_2");
249  }
250 
251  if (isParamValid("disp_x") && isParamValid("disp_y") && isParamValid("disp_z"))
252  {
253  _disp_x_var_name = getParam<VariableName>("disp_x");
254  _disp_y_var_name = getParam<VariableName>("disp_y");
255  _disp_z_var_name = getParam<VariableName>("disp_z");
256  }
257  else if (_t_stress == true && _treat_as_2d == false)
258  paramError("displacements", "Displacement variables must be provided for T-stress calculation");
259 
260  if (_q_function_rings)
261  {
262  if (!isParamValid("last_ring"))
263  paramError("last_ring",
264  "The max number of rings of nodes to generate must be provided if "
265  "q_function_rings = true");
266  _last_ring = getParam<unsigned int>("last_ring");
267  _first_ring = getParam<unsigned int>("first_ring");
268  }
269  else
270  {
271  _j_integral_radius_inner = getParam<std::vector<Real>>("j_integral_radius_inner");
272  _j_integral_radius_outer = getParam<std::vector<Real>>("j_integral_radius_outer");
273  }
274 }
unsigned int _axis_2d
Out of plane axis when crack is treated as 2D.
virtual MooseMesh & mesh()=0
std::vector< Point > _crack_front_points
Vector of points along the crack front.
bool _has_symmetry_plane
Whether the crack plane is also a symmetry plane in the model.
std::size_t _first_ring
Numer of elements from crack tip to first topological ring.
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
RealVectorValue _crack_direction_vector_end_2
Fixed vector optionally used to define crack extension direction at end 2 of crack front...
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
bool _q_function_rings
Whether topological rings are used to define the q functions.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points...
AuxiliarySystem & _aux
Reference to the auxiliary system.
SubProblem & _subproblem
bool isParamValid(const std::string &name) const
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
bool _closed_loop
Whether the crack forms a closed loop.
bool _is_cutter_modified
Indicator that shows if the cutter mesh is modified or not in the calculation step.
RealVectorValue _crack_direction_vector
Fixed vector optionally used to define crack extension direction.
void paramError(const std::string &param, Args... args) const
std::vector< BoundaryName > _crack_mouth_boundary_names
Names of boundaries used to define location of crack mouth.
MooseMesh & _mesh
Reference to the mesh.
AuxiliarySystem & getAuxiliarySystem()
std::vector< Real > _j_integral_radius_outer
Vector of outer radii of the rings used for geometric q functions.
unsigned int _symmetry_plane
Which plane is the symmetry plane.
std::string _disp_x_var_name
Names of the x, y, and z displacement variables.
bool isParamSetByUser(const std::string &name) const
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.
FEProblemBase & _fe_problem
std::vector< BoundaryName > _intersecting_boundary_names
Names of boundaries that intersect crack at its ends.
GeneralUserObject(const InputParameters &parameters)
void mooseError(Args &&... args) const
const InputParameters & parameters() const
MooseEnum _q_function_type
Method used to define the q function.
bool _t_stress
Whether the T-stress is being computed.
RealVectorValue _crack_tangent_vector_end_2
Fixed vector optionally used to define crack tangent direction at end 2 of crack front.
BoundaryRestrictable(const MooseObject *moose_object, bool nodal)
std::size_t _last_ring
Numer of elements from crack tip to last topological ring.
RealVectorValue _crack_tangent_vector_end_1
Fixed vector optionally used to define crack tangent direction at end 1 of crack front.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
RealVectorValue _crack_direction_vector_end_1
Fixed vector optionally used to define crack extension direction at end 1 of crack front...
std::vector< Real > _j_integral_radius_inner
Vector of inner radii of the rings used for geometric q functions.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ ~CrackFrontDefinition()

CrackFrontDefinition::~CrackFrontDefinition ( )
virtual

Definition at line 276 of file CrackFrontDefinition.C.

276 {}

Member Function Documentation

◆ addNodesToQFunctionRing()

void CrackFrontDefinition::addNodesToQFunctionRing ( std::set< dof_id_type > &  nodes_new_ring,
const std::set< dof_id_type > &  nodes_old_ring,
const std::set< dof_id_type > &  nodes_all_rings,
const std::set< dof_id_type > &  nodes_neighbor1,
const std::set< dof_id_type > &  nodes_neighbor2,
std::vector< std::vector< const Elem *>> &  nodes_to_elem_map 
)
protected

Find nodes that are connected through elements to the nodes in the previous node ring.

Parameters
nodes_new_ringNodes in the new ring – populated by this method
nodes_old_ringNodes in the previous ring
nodes_all_ringsNodes in all other rings to be excluded from the new ring
nodes_neighbor1Nodes in the neighboring ring to one side to be excluded from the new ring
nodes_neighbor2Nodes in the neighboring ring to the other side to be excluded from the new ring
nodes_to_elem_mapMap of nodes to connected elements

Definition at line 1769 of file CrackFrontDefinition.C.

Referenced by createQFunctionRings().

1776 {
1777  for (auto nit = nodes_old_ring.begin(); nit != nodes_old_ring.end(); ++nit)
1778  {
1779  std::vector<const Node *> neighbors;
1780  MeshTools::find_nodal_neighbors(
1781  _mesh.getMesh(), _mesh.nodeRef(*nit), nodes_to_elem_map, neighbors);
1782  for (std::size_t inei = 0; inei < neighbors.size(); ++inei)
1783  {
1784  auto previt = nodes_all_rings.find(neighbors[inei]->id());
1785  auto thisit = nodes_neighbor1.find(neighbors[inei]->id());
1786  auto nextit = nodes_neighbor2.find(neighbors[inei]->id());
1787 
1788  // Add only nodes that are not already present in any of the three sets of nodes
1789  if (previt == nodes_all_rings.end() && thisit == nodes_neighbor1.end() &&
1790  nextit == nodes_neighbor2.end())
1791  nodes_new_ring.insert(neighbors[inei]->id());
1792  }
1793  }
1794 }
virtual const Node & nodeRef(const dof_id_type i) const
MeshBase & getMesh()
MooseMesh & _mesh
Reference to the mesh.

◆ calculateCrackFrontDirection()

RealVectorValue CrackFrontDefinition::calculateCrackFrontDirection ( const Point &  crack_front_point,
const RealVectorValue tangent_direction,
const CRACK_NODE_TYPE  ntype,
const std::size_t  crack_front_point_index = 0 
) const
protected

Compute the direction of crack extension for a given point on the crack front.

Parameters
crack_front_pointPoint on the crack front
tangent_directionTangent direction vector for the crack front point
ntypeNode type such as MIDDLE_NODE, END_1_NODE, END_2_NODE
crack_front_point_indexIndex of the point on the crack front

Definition at line 1116 of file CrackFrontDefinition.C.

Referenced by updateCrackFrontGeometry().

1120 {
1121  RealVectorValue crack_dir;
1122  RealVectorValue zero_vec(0.0);
1123 
1124  bool calc_dir = true;
1126  {
1127  if (ntype == END_1_NODE)
1128  {
1129  crack_dir = _crack_direction_vector_end_1;
1130  calc_dir = false;
1131  }
1132  else if (ntype == END_2_NODE)
1133  {
1134  crack_dir = _crack_direction_vector_end_2;
1135  calc_dir = false;
1136  }
1137  }
1138 
1139  if (calc_dir)
1140  {
1142  {
1143  crack_dir = _crack_direction_vector;
1144  }
1146  {
1147  if (_crack_mouth_coordinates.absolute_fuzzy_equals(crack_front_point, _tol))
1148  {
1149  mooseError("Crack mouth too close to crack front node");
1150  }
1151  RealVectorValue mouth_to_front = crack_front_point - _crack_mouth_coordinates;
1152 
1153  RealVectorValue crack_plane_normal = mouth_to_front.cross(tangent_direction);
1154  if (crack_plane_normal.absolute_fuzzy_equals(zero_vec, _tol))
1155  {
1156  mooseError(
1157  "Vector from crack mouth to crack front node is collinear with crack front segment");
1158  }
1159 
1160  crack_dir = tangent_direction.cross(crack_plane_normal);
1161  Real dotprod = crack_dir * mouth_to_front;
1162  if (dotprod < 0)
1163  {
1164  crack_dir = -crack_dir;
1165  }
1166  }
1168  {
1169  if (_use_mesh_cutter)
1170  crack_dir = tangent_direction.cross(_crack_plane_normals[crack_front_point_index]);
1171  else
1172  crack_dir = tangent_direction.cross(_crack_plane_normal);
1173  }
1174  }
1175  crack_dir = crack_dir.unit();
1176 
1177  return crack_dir;
1178 }
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
RealVectorValue _crack_direction_vector_end_2
Fixed vector optionally used to define crack extension direction at end 2 of crack front...
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true...
static const Real _tol
Tolerance used in geometric calculations.
TypeVector< Real > unit() const
RealVectorValue _crack_direction_vector
Fixed vector optionally used to define crack extension direction.
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
RealVectorValue _crack_plane_normal
Vector normal to the crack plane of a planar crack.
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
RealVectorValue _crack_direction_vector_end_1
Fixed vector optionally used to define crack extension direction at end 1 of crack front...
RealVectorValue _crack_mouth_coordinates
Coordinates of crack mouth.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ calculateRThetaToCrackFront() [1/2]

void CrackFrontDefinition::calculateRThetaToCrackFront ( const Point  qp,
const std::size_t  point_index,
Real r,
Real theta 
) const

Calculate r and theta of a point in the crack front polar coordinates for a given crack point index.

Parameters
qpThe Point for which coordinates are evaluated
point_indexthe crack front point index
rValue of the radial coordinate computed in this function
thetaValue of the theta coordinate computed in this function

Definition at line 1291 of file CrackFrontDefinition.C.

Referenced by calculateRThetaToCrackFront(), InteractionIntegralBenchmarkBC::computeQpValue(), EnrichmentFunctionCalculation::crackTipEnrichementFunctionAtPoint(), EnrichmentFunctionCalculation::crackTipEnrichementFunctionDerivativeAtPoint(), and CrackTipEnrichmentCutOffBC::shouldApply().

1295 {
1296  std::size_t num_points = getNumCrackFrontPoints();
1297  Point closest_point(0.0);
1298  RealVectorValue closest_point_to_p;
1299 
1300  const Point * crack_front_point = getCrackFrontPoint(point_index);
1301  RealVectorValue crack_front_point_rot = rotateToCrackFrontCoords(*crack_front_point, point_index);
1302 
1303  RealVectorValue crack_front_edge =
1304  rotateToCrackFrontCoords(_tangent_directions[point_index], point_index);
1305 
1306  Point p_rot = rotateToCrackFrontCoords(qp, point_index);
1307  p_rot = p_rot - crack_front_point_rot;
1308 
1309  if (_treat_as_2d)
1310  {
1311  // In 2D, the closest node is the crack tip node and the position of the crack tip node is
1312  // (0,0,0) in the crack front coordinate system
1313  // In case this is a 3D mesh treated as 2D, project point onto same plane as crack front node.
1314  // Note: In the crack front coordinate system, z is always in the tangent direction to the crack
1315  // front
1316  p_rot(2) = closest_point(2);
1317  closest_point_to_p = p_rot;
1318 
1319  // Find r, the distance between the qp and the crack front
1320  RealVectorValue r_vec = p_rot;
1321  r = r_vec.norm();
1322  }
1323  else
1324  {
1325  // Loop over crack front points to find the one closest to the point qp
1326  Real min_dist = std::numeric_limits<Real>::max();
1327  for (std::size_t pit = 0; pit != num_points; ++pit)
1328  {
1329  const Point * crack_front_point = getCrackFrontPoint(pit);
1330  RealVectorValue crack_point_to_current_point = qp - *crack_front_point;
1331  Real dist = crack_point_to_current_point.norm();
1332 
1333  if (dist < min_dist)
1334  {
1335  min_dist = dist;
1336  closest_point = *crack_front_point;
1337  }
1338  }
1339 
1340  // Rotate coordinates to crack front coordinate system
1341  closest_point = rotateToCrackFrontCoords(closest_point, point_index);
1342  closest_point = closest_point - crack_front_point_rot;
1343 
1344  // Find r, the distance between the qp and the crack front
1345  Real edge_length_sq = crack_front_edge.norm_sq();
1346  closest_point_to_p = p_rot - closest_point;
1347  Real perp = crack_front_edge * closest_point_to_p;
1348  Real dist_along_edge = perp / edge_length_sq;
1349  RealVectorValue point_on_edge = closest_point + crack_front_edge * dist_along_edge;
1350  RealVectorValue r_vec = p_rot - point_on_edge;
1351  r = r_vec.norm();
1352  }
1353 
1354  // Find theta, the angle between r and the crack front plane
1355  RealVectorValue crack_plane_normal;
1356  if (_use_mesh_cutter)
1357  crack_plane_normal = rotateToCrackFrontCoords(_crack_plane_normals[point_index], point_index);
1358  else
1359  crack_plane_normal = rotateToCrackFrontCoords(_crack_plane_normal, point_index);
1360  Real p_to_plane_dist = std::abs(closest_point_to_p * crack_plane_normal);
1361 
1362  // Determine if qp is above or below the crack plane
1363  Real y_local = p_rot(1) - closest_point(1);
1364 
1365  // Determine if qp is in front of or behind the crack front
1366  RealVectorValue p2(p_rot);
1367  p2(1) = 0;
1368  RealVectorValue p2_vec = p2 - closest_point;
1369  Real ahead = crack_front_edge(2) * p2_vec(0) - crack_front_edge(0) * p2_vec(2);
1370 
1371  Real x_local(0);
1372  if (ahead >= 0)
1373  x_local = 1;
1374  else
1375  x_local = -1;
1376 
1377  // Calculate theta based on in which quadrant in the crack front coordinate
1378  // system the qp is located
1379  if (r > 0)
1380  {
1381  Real theta_quadrant1(0.0);
1382  if (MooseUtils::absoluteFuzzyEqual(r, p_to_plane_dist, _tol))
1383  theta_quadrant1 = 0.5 * libMesh::pi;
1384  else if (p_to_plane_dist > r)
1385  mooseError(
1386  "Invalid distance p_to_plane_dist in CrackFrontDefinition::calculateRThetaToCrackFront");
1387  else
1388  theta_quadrant1 = std::asin(p_to_plane_dist / r);
1389 
1390  if (x_local >= 0 && y_local >= 0)
1391  theta = theta_quadrant1;
1392 
1393  else if (x_local < 0 && y_local >= 0)
1394  theta = libMesh::pi - theta_quadrant1;
1395 
1396  else if (x_local < 0 && y_local < 0)
1397  theta = -(libMesh::pi - theta_quadrant1);
1398 
1399  else if (x_local >= 0 && y_local < 0)
1400  theta = -theta_quadrant1;
1401  }
1402  else if (r == 0)
1403  theta = 0;
1404  else
1405  mooseError("Invalid distance r in CrackFrontDefinition::calculateRThetaToCrackFront");
1406 }
auto norm() const -> decltype(std::norm(Real()))
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
RealVectorValue rotateToCrackFrontCoords(const RealVectorValue vector, const std::size_t point_index) const
Rotate a vector in the global coordinate coordinate system to the crack front local coordinate system...
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true...
static const Real _tol
Tolerance used in geometric calculations.
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
auto norm_sq() const -> decltype(std::norm(Real()))
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
RealVectorValue _crack_plane_normal
Vector normal to the crack plane of a planar crack.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.
void mooseError(Args &&... args) const
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
const Real pi

◆ calculateRThetaToCrackFront() [2/2]

std::size_t CrackFrontDefinition::calculateRThetaToCrackFront ( const Point  qp,
Real r,
Real theta 
) const

Calculate r and theta of a point in the crack front polar coordinate relative to the closest crack front point.

This function loops over all crack front points to find the one closest to the specified point

Parameters
qpThe Point for which coordinates are evaluated
rValue of the radial coordinate computed in this function
thetaValue of the theta coordinate computed in this function
Returns
Index of the closest crack front point

Definition at line 1409 of file CrackFrontDefinition.C.

1410 {
1411  std::size_t num_points = getNumCrackFrontPoints();
1412 
1413  // Loop over crack front points to find the one closest to the point qp
1414  Real min_dist = std::numeric_limits<Real>::max();
1415  std::size_t point_index = 0;
1416  for (std::size_t pit = 0; pit != num_points; ++pit)
1417  {
1418  const Point * crack_front_point = getCrackFrontPoint(pit);
1419  RealVectorValue crack_point_to_current_point = qp - *crack_front_point;
1420  Real dist = crack_point_to_current_point.norm();
1421 
1422  if (dist < min_dist)
1423  {
1424  min_dist = dist;
1425  point_index = pit;
1426  }
1427  }
1428 
1429  calculateRThetaToCrackFront(qp, point_index, r, theta);
1430 
1431  return point_index;
1432 }
auto norm() const -> decltype(std::norm(Real()))
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
void calculateRThetaToCrackFront(const Point qp, const std::size_t point_index, Real &r, Real &theta) const
Calculate r and theta of a point in the crack front polar coordinates for a given crack point index...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ calculateTangentialStrainAlongFront()

void CrackFrontDefinition::calculateTangentialStrainAlongFront ( )
protected

Compute the strain in the direction tangent to the crack at all points on the crack front.

Definition at line 1472 of file CrackFrontDefinition.C.

Referenced by execute().

1473 {
1474  RealVectorValue disp_current_node;
1475  RealVectorValue disp_previous_node;
1476  RealVectorValue disp_next_node;
1477 
1478  RealVectorValue forward_segment0;
1479  RealVectorValue forward_segment1;
1480  Real forward_segment0_len;
1481  Real forward_segment1_len;
1482  RealVectorValue back_segment0;
1483  RealVectorValue back_segment1;
1484  Real back_segment0_len;
1485  Real back_segment1_len;
1486 
1487  std::size_t num_crack_front_nodes = _ordered_crack_front_nodes.size();
1488  const Node * current_node;
1489  const Node * previous_node;
1490  const Node * next_node;
1491 
1492  _strain_along_front.reserve(num_crack_front_nodes);
1493 
1494  // In finalize(), gatherMax builds and distributes the complete strain vector on all processors
1495  // -> reset the vector every time
1496  for (std::size_t i = 0; i < num_crack_front_nodes; ++i)
1497  _strain_along_front[i] = -std::numeric_limits<Real>::max();
1498 
1502 
1503  current_node = getCrackFrontNodePtr(0);
1504  if (current_node->processor_id() == processor_id())
1505  {
1506  disp_current_node(0) = disp_x_var.getNodalValue(*current_node);
1507  disp_current_node(1) = disp_y_var.getNodalValue(*current_node);
1508  disp_current_node(2) = disp_z_var.getNodalValue(*current_node);
1509 
1510  next_node = getCrackFrontNodePtr(1);
1511  disp_next_node(0) = disp_x_var.getNodalValue(*next_node);
1512  disp_next_node(1) = disp_y_var.getNodalValue(*next_node);
1513  disp_next_node(2) = disp_z_var.getNodalValue(*next_node);
1514 
1515  forward_segment0 = *next_node - *current_node;
1516  forward_segment0 = (forward_segment0 * _tangent_directions[0]) * _tangent_directions[0];
1517  forward_segment0_len = forward_segment0.norm();
1518 
1519  forward_segment1 = (*next_node + disp_next_node) - (*current_node + disp_current_node);
1520  forward_segment1 = (forward_segment1 * _tangent_directions[0]) * _tangent_directions[0];
1521  forward_segment1_len = forward_segment1.norm();
1522 
1523  _strain_along_front[0] = (forward_segment1_len - forward_segment0_len) / forward_segment0_len;
1524  }
1525 
1526  for (std::size_t i = 1; i < num_crack_front_nodes - 1; ++i)
1527  {
1528  current_node = getCrackFrontNodePtr(i);
1529  if (current_node->processor_id() == processor_id())
1530  {
1531  disp_current_node(0) = disp_x_var.getNodalValue(*current_node);
1532  disp_current_node(1) = disp_y_var.getNodalValue(*current_node);
1533  disp_current_node(2) = disp_z_var.getNodalValue(*current_node);
1534 
1535  previous_node = getCrackFrontNodePtr(i - 1);
1536  disp_previous_node(0) = disp_x_var.getNodalValue(*previous_node);
1537  disp_previous_node(1) = disp_y_var.getNodalValue(*previous_node);
1538  disp_previous_node(2) = disp_z_var.getNodalValue(*previous_node);
1539 
1540  next_node = getCrackFrontNodePtr(i + 1);
1541  disp_next_node(0) = disp_x_var.getNodalValue(*next_node);
1542  disp_next_node(1) = disp_y_var.getNodalValue(*next_node);
1543  disp_next_node(2) = disp_z_var.getNodalValue(*next_node);
1544 
1545  back_segment0 = *current_node - *previous_node;
1546  back_segment0 = (back_segment0 * _tangent_directions[i]) * _tangent_directions[i];
1547  back_segment0_len = back_segment0.norm();
1548 
1549  back_segment1 = (*current_node + disp_current_node) - (*previous_node + disp_previous_node);
1550  back_segment1 = (back_segment1 * _tangent_directions[i]) * _tangent_directions[i];
1551  back_segment1_len = back_segment1.norm();
1552 
1553  forward_segment0 = *next_node - *current_node;
1554  forward_segment0 = (forward_segment0 * _tangent_directions[i]) * _tangent_directions[i];
1555  forward_segment0_len = forward_segment0.norm();
1556 
1557  forward_segment1 = (*next_node + disp_next_node) - (*current_node + disp_current_node);
1558  forward_segment1 = (forward_segment1 * _tangent_directions[i]) * _tangent_directions[i];
1559  forward_segment1_len = forward_segment1.norm();
1560 
1561  _strain_along_front[i] =
1562  0.5 * ((back_segment1_len - back_segment0_len) / back_segment0_len +
1563  (forward_segment1_len - forward_segment0_len) / forward_segment0_len);
1564  }
1565  }
1566 
1567  current_node = getCrackFrontNodePtr(num_crack_front_nodes - 1);
1568  if (current_node->processor_id() == processor_id())
1569  {
1570  disp_current_node(0) = disp_x_var.getNodalValue(*current_node);
1571  disp_current_node(1) = disp_y_var.getNodalValue(*current_node);
1572  disp_current_node(2) = disp_z_var.getNodalValue(*current_node);
1573 
1574  previous_node = getCrackFrontNodePtr(num_crack_front_nodes - 2);
1575  disp_previous_node(0) = disp_x_var.getNodalValue(*previous_node);
1576  disp_previous_node(1) = disp_y_var.getNodalValue(*previous_node);
1577  disp_previous_node(2) = disp_z_var.getNodalValue(*previous_node);
1578 
1579  back_segment0 = *current_node - *previous_node;
1580  back_segment0 = (back_segment0 * _tangent_directions[num_crack_front_nodes - 1]) *
1581  _tangent_directions[num_crack_front_nodes - 1];
1582  back_segment0_len = back_segment0.norm();
1583 
1584  back_segment1 = (*current_node + disp_current_node) - (*previous_node + disp_previous_node);
1585  back_segment1 = (back_segment1 * _tangent_directions[num_crack_front_nodes - 1]) *
1586  _tangent_directions[num_crack_front_nodes - 1];
1587  back_segment1_len = back_segment1.norm();
1588 
1589  _strain_along_front[num_crack_front_nodes - 1] =
1590  (back_segment1_len - back_segment0_len) / back_segment0_len;
1591  }
1592 }
auto norm() const -> decltype(std::norm(Real()))
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
SubProblem & _subproblem
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0
OutputData getNodalValue(const Node &node) const
std::string _disp_x_var_name
Names of the x, y, and z displacement variables.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.
const THREAD_ID _tid
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
processor_id_type processor_id() const

◆ createQFunctionRings()

void CrackFrontDefinition::createQFunctionRings ( )
protected

Create the data defining the rings used to define the q function when the topological option is used to define the q function.

Definition at line 1611 of file CrackFrontDefinition.C.

Referenced by initialSetup().

1612 {
1613  // In the variable names, "cfn" = crack front node
1614 
1615  if (_treat_as_2d && _use_mesh_cutter == false) // 2D: the q-function defines an integral domain
1616  // that is constant along the crack front
1617  {
1618  std::vector<std::vector<const Elem *>> nodes_to_elem_map;
1619  MeshTools::build_nodes_to_elem_map(_mesh.getMesh(), nodes_to_elem_map);
1620 
1621  std::set<dof_id_type> nodes_prev_ring;
1622  nodes_prev_ring.insert(_ordered_crack_front_nodes.begin(), _ordered_crack_front_nodes.end());
1623 
1624  std::set<dof_id_type> connected_nodes_this_cfn;
1625  connected_nodes_this_cfn.insert(_ordered_crack_front_nodes.begin(),
1627 
1628  std::set<dof_id_type> old_ring_nodes_this_cfn = connected_nodes_this_cfn;
1629 
1630  // The first ring contains only the crack front node(s)
1631  std::pair<dof_id_type, std::size_t> node_ring_index =
1632  std::make_pair(_ordered_crack_front_nodes[0], 1);
1633  _crack_front_node_to_node_map[node_ring_index].insert(connected_nodes_this_cfn.begin(),
1634  connected_nodes_this_cfn.end());
1635 
1636  // Build rings of nodes around the crack front node
1637  for (std::size_t ring = 2; ring <= _last_ring; ++ring)
1638  {
1639 
1640  // Find nodes connected to the nodes of the previous ring
1641  std::set<dof_id_type> new_ring_nodes_this_cfn;
1642  for (auto nit = old_ring_nodes_this_cfn.begin(); nit != old_ring_nodes_this_cfn.end(); ++nit)
1643  {
1644  std::vector<const Node *> neighbors;
1645  MeshTools::find_nodal_neighbors(
1646  _mesh.getMesh(), _mesh.nodeRef(*nit), nodes_to_elem_map, neighbors);
1647  for (std::size_t inei = 0; inei < neighbors.size(); ++inei)
1648  {
1649  auto thisit = connected_nodes_this_cfn.find(neighbors[inei]->id());
1650 
1651  // Add only nodes that are not already present in any of the rings
1652  if (thisit == connected_nodes_this_cfn.end())
1653  new_ring_nodes_this_cfn.insert(neighbors[inei]->id());
1654  }
1655  }
1656 
1657  // Add new nodes to rings
1658  connected_nodes_this_cfn.insert(new_ring_nodes_this_cfn.begin(),
1659  new_ring_nodes_this_cfn.end());
1660  old_ring_nodes_this_cfn = new_ring_nodes_this_cfn;
1661 
1662  std::pair<dof_id_type, std::size_t> node_ring_index =
1663  std::make_pair(_ordered_crack_front_nodes[0], ring);
1664  _crack_front_node_to_node_map[node_ring_index].insert(connected_nodes_this_cfn.begin(),
1665  connected_nodes_this_cfn.end());
1666  }
1667  }
1668  else // 3D: The q-function defines one integral domain around each crack front node
1669  {
1670  std::size_t num_crack_front_points = _ordered_crack_front_nodes.size();
1671  std::vector<std::vector<const Elem *>> nodes_to_elem_map;
1672  MeshTools::build_nodes_to_elem_map(_mesh.getMesh(), nodes_to_elem_map);
1673  for (std::size_t icfn = 0; icfn < num_crack_front_points; ++icfn)
1674  {
1675  std::set<dof_id_type> nodes_prev_ring;
1676  nodes_prev_ring.insert(_ordered_crack_front_nodes[icfn]);
1677 
1678  std::set<dof_id_type> connected_nodes_prev_cfn;
1679  std::set<dof_id_type> connected_nodes_this_cfn;
1680  std::set<dof_id_type> connected_nodes_next_cfn;
1681 
1682  connected_nodes_this_cfn.insert(_ordered_crack_front_nodes[icfn]);
1683 
1684  if (_closed_loop && icfn == 0)
1685  {
1686  connected_nodes_prev_cfn.insert(_ordered_crack_front_nodes[num_crack_front_points - 1]);
1687  connected_nodes_next_cfn.insert(_ordered_crack_front_nodes[icfn + 1]);
1688  }
1689  else if (_closed_loop && icfn == num_crack_front_points - 1)
1690  {
1691  connected_nodes_prev_cfn.insert(_ordered_crack_front_nodes[icfn - 1]);
1692  connected_nodes_next_cfn.insert(_ordered_crack_front_nodes[0]);
1693  }
1694  else if (icfn == 0)
1695  {
1696  connected_nodes_next_cfn.insert(_ordered_crack_front_nodes[icfn + 1]);
1697  }
1698  else if (icfn == num_crack_front_points - 1)
1699  {
1700  connected_nodes_prev_cfn.insert(_ordered_crack_front_nodes[icfn - 1]);
1701  }
1702  else
1703  {
1704  connected_nodes_prev_cfn.insert(_ordered_crack_front_nodes[icfn - 1]);
1705  connected_nodes_next_cfn.insert(_ordered_crack_front_nodes[icfn + 1]);
1706  }
1707 
1708  std::set<dof_id_type> old_ring_nodes_prev_cfn = connected_nodes_prev_cfn;
1709  std::set<dof_id_type> old_ring_nodes_this_cfn = connected_nodes_this_cfn;
1710  std::set<dof_id_type> old_ring_nodes_next_cfn = connected_nodes_next_cfn;
1711 
1712  // The first ring contains only the crack front node
1713  std::pair<dof_id_type, std::size_t> node_ring_index =
1714  std::make_pair(_ordered_crack_front_nodes[icfn], 1);
1715  _crack_front_node_to_node_map[node_ring_index].insert(connected_nodes_this_cfn.begin(),
1716  connected_nodes_this_cfn.end());
1717 
1718  // Build rings of nodes around the crack front node
1719  for (std::size_t ring = 2; ring <= _last_ring; ++ring)
1720  {
1721 
1722  // Find nodes connected to the nodes of the previous ring, but exclude nodes in rings of
1723  // neighboring crack front nodes
1724  std::set<dof_id_type> new_ring_nodes_this_cfn;
1725  addNodesToQFunctionRing(new_ring_nodes_this_cfn,
1726  old_ring_nodes_this_cfn,
1727  connected_nodes_this_cfn,
1728  connected_nodes_prev_cfn,
1729  connected_nodes_next_cfn,
1730  nodes_to_elem_map);
1731 
1732  std::set<dof_id_type> new_ring_nodes_prev_cfn;
1733  addNodesToQFunctionRing(new_ring_nodes_prev_cfn,
1734  old_ring_nodes_prev_cfn,
1735  connected_nodes_prev_cfn,
1736  connected_nodes_this_cfn,
1737  connected_nodes_next_cfn,
1738  nodes_to_elem_map);
1739 
1740  std::set<dof_id_type> new_ring_nodes_next_cfn;
1741  addNodesToQFunctionRing(new_ring_nodes_next_cfn,
1742  old_ring_nodes_next_cfn,
1743  connected_nodes_next_cfn,
1744  connected_nodes_prev_cfn,
1745  connected_nodes_this_cfn,
1746  nodes_to_elem_map);
1747 
1748  // Add new nodes to the three sets of nodes
1749  connected_nodes_prev_cfn.insert(new_ring_nodes_prev_cfn.begin(),
1750  new_ring_nodes_prev_cfn.end());
1751  connected_nodes_this_cfn.insert(new_ring_nodes_this_cfn.begin(),
1752  new_ring_nodes_this_cfn.end());
1753  connected_nodes_next_cfn.insert(new_ring_nodes_next_cfn.begin(),
1754  new_ring_nodes_next_cfn.end());
1755  old_ring_nodes_prev_cfn = new_ring_nodes_prev_cfn;
1756  old_ring_nodes_this_cfn = new_ring_nodes_this_cfn;
1757  old_ring_nodes_next_cfn = new_ring_nodes_next_cfn;
1758 
1759  std::pair<dof_id_type, std::size_t> node_ring_index =
1760  std::make_pair(_ordered_crack_front_nodes[icfn], ring);
1761  _crack_front_node_to_node_map[node_ring_index].insert(connected_nodes_this_cfn.begin(),
1762  connected_nodes_this_cfn.end());
1763  }
1764  }
1765  }
1766 }
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
std::map< std::pair< dof_id_type, std::size_t >, std::set< dof_id_type > > _crack_front_node_to_node_map
Data structure used to store information about topological rings Key is a pair of the crack front nod...
void addNodesToQFunctionRing(std::set< dof_id_type > &nodes_new_ring, const std::set< dof_id_type > &nodes_old_ring, const std::set< dof_id_type > &nodes_all_rings, const std::set< dof_id_type > &nodes_neighbor1, const std::set< dof_id_type > &nodes_neighbor2, std::vector< std::vector< const Elem *>> &nodes_to_elem_map)
Find nodes that are connected through elements to the nodes in the previous node ring.
virtual const Node & nodeRef(const dof_id_type i) const
MeshBase & getMesh()
bool _closed_loop
Whether the crack forms a closed loop.
MooseMesh & _mesh
Reference to the mesh.
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
std::size_t _last_ring
Numer of elements from crack tip to last topological ring.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.

◆ DomainIntegralQFunction()

Real CrackFrontDefinition::DomainIntegralQFunction ( std::size_t  crack_front_point_index,
std::size_t  ring_index,
const Node *const  current_node 
) const

Compute the q function for the case where it is defined geometrically.

Parameters
crack_front_point_indexIndex of the point on the crack front
ring_indexIndex of the volume integral ring
current_nodeNode at which q is evaluated
Returns
q

Definition at line 1820 of file CrackFrontDefinition.C.

Referenced by JIntegral::execute().

1823 {
1824  Real dist_to_crack_front;
1825  Real dist_along_tangent;
1827  dist_to_crack_front, dist_along_tangent, crack_front_point_index, current_node);
1828 
1829  Real q = 1.0;
1830  if (dist_to_crack_front > _j_integral_radius_inner[ring_index] &&
1831  dist_to_crack_front < _j_integral_radius_outer[ring_index])
1832  q = (_j_integral_radius_outer[ring_index] - dist_to_crack_front) /
1833  (_j_integral_radius_outer[ring_index] - _j_integral_radius_inner[ring_index]);
1834  else if (dist_to_crack_front >= _j_integral_radius_outer[ring_index])
1835  q = 0.0;
1836 
1837  if (q > 0.0)
1838  {
1839  Real tangent_multiplier = 1.0;
1840  if (!_treat_as_2d)
1841  {
1842  const Real forward_segment_length =
1843  getCrackFrontForwardSegmentLength(crack_front_point_index);
1844  const Real backward_segment_length =
1845  getCrackFrontBackwardSegmentLength(crack_front_point_index);
1846 
1847  if (dist_along_tangent >= 0.0)
1848  {
1849  if (forward_segment_length > 0.0)
1850  tangent_multiplier = 1.0 - dist_along_tangent / forward_segment_length;
1851  }
1852  else
1853  {
1854  if (backward_segment_length > 0.0)
1855  tangent_multiplier = 1.0 + dist_along_tangent / backward_segment_length;
1856  }
1857  }
1858 
1859  tangent_multiplier = std::max(tangent_multiplier, 0.0);
1860  tangent_multiplier = std::min(tangent_multiplier, 1.0);
1861 
1862  // Set to zero if a node is on a designated free surface and its crack front node is not.
1863  if (isNodeOnIntersectingBoundary(current_node) &&
1864  !_is_point_on_intersecting_boundary[crack_front_point_index])
1865  tangent_multiplier = 0.0;
1866 
1867  q *= tangent_multiplier;
1868  }
1869 
1870  return q;
1871 }
bool isNodeOnIntersectingBoundary(const Node *const node) const
Determine whether a given node is on one of the boundaries that intersects an end of the crack front...
Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front behind the specified position.
std::vector< bool > _is_point_on_intersecting_boundary
Vector of bools indicating whether individual crack front points are on an intersecting boundary...
void projectToFrontAtPoint(Real &dist_to_front, Real &dist_along_tangent, std::size_t crack_front_point_index, const Node *const current_node) const
Project a point to a specified point along the crack front and compute the projected normal and tange...
std::vector< Real > _j_integral_radius_outer
Vector of outer radii of the rings used for geometric q functions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real getCrackFrontForwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front ahead of the specified position.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
std::vector< Real > _j_integral_radius_inner
Vector of inner radii of the rings used for geometric q functions.

◆ DomainIntegralTopologicalQFunction()

Real CrackFrontDefinition::DomainIntegralTopologicalQFunction ( std::size_t  crack_front_point_index,
std::size_t  ring_index,
const Node *const  current_node 
) const

Compute the q function for the case where it is defined through element connectivity.

Parameters
crack_front_point_indexIndex of the point on the crack front
ring_indexIndex of the volume integral ring
current_nodeNode at which q is evaluated
Returns
q

Definition at line 1874 of file CrackFrontDefinition.C.

Referenced by JIntegral::execute().

1877 {
1878  Real q = 0;
1879  bool is_node_in_ring = isNodeInRing(ring_index, current_node->id(), crack_front_point_index);
1880  if (is_node_in_ring)
1881  q = 1;
1882 
1883  return q;
1884 }
bool isNodeInRing(const std::size_t ring_index, const dof_id_type connected_node_id, const std::size_t node_index) const
Determine whether a node is contained within a specified volume integral element ring for a given nod...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ execute()

void CrackFrontDefinition::execute ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 279 of file CrackFrontDefinition.C.

280 {
281  // Because J-Integral is based on original geometry, the crack front geometry
282  // is never updated, so everything that needs to happen is done in initialSetup()
283  // fixme Lynn Help with this Benjamin Spencer. Not suer if this is true after this commit
284  if (_t_stress == true && _treat_as_2d == false)
286 }
void calculateTangentialStrainAlongFront()
Compute the strain in the direction tangent to the crack at all points on the crack front...
bool _t_stress
Whether the T-stress is being computed.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.

◆ finalize()

void CrackFrontDefinition::finalize ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 383 of file CrackFrontDefinition.C.

384 {
385  if (_t_stress)
387 }
const Parallel::Communicator & _communicator
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
void max(const T &r, T &o, Request &req) const
bool _t_stress
Whether the T-stress is being computed.

◆ getAngleAlongFront()

Real CrackFrontDefinition::getAngleAlongFront ( const std::size_t  point_index) const

Get the angle along the crack front from the beginning of the crack to the specified position.

Parameters
point_indexIndex of the point
Returns
Angle along crack

Definition at line 1247 of file CrackFrontDefinition.C.

Referenced by JIntegral::finalize().

1248 {
1249  if (!hasAngleAlongFront())
1250  paramError(
1251  "crack_mouth_boundary",
1252  "In CrackFrontDefinition, Requested angle along crack front, but definition of crack mouth "
1253  "boundary using 'crack_mouth_boundary' parameter is necessary to do that.");
1254  return _angles_along_front[point_index];
1255 }
bool hasAngleAlongFront() const
Whether the distance along the crack front is available as an angle.
void paramError(const std::string &param, Args... args) const
std::vector< Real > _angles_along_front
Vector of angles along the crack front.

◆ getCrackDirection()

const RealVectorValue & CrackFrontDefinition::getCrackDirection ( const std::size_t  point_index) const

Get the unit vector of the crack extension direction at the specified position.

Parameters
point_indexIndex of the point
Returns
Crack extension direction vector

Definition at line 1229 of file CrackFrontDefinition.C.

Referenced by JIntegral::computeQpIntegral().

1230 {
1231  return _crack_directions[point_index];
1232 }
std::vector< RealVectorValue > _crack_directions
Vector of crack extension directions along the crack front.

◆ getCrackFrontBackwardSegmentLength()

Real CrackFrontDefinition::getCrackFrontBackwardSegmentLength ( const std::size_t  point_index) const

Get the length of the line segment on the crack front behind the specified position.

Parameters
point_indexIndex of the point
Returns
Line segment length

Definition at line 1223 of file CrackFrontDefinition.C.

Referenced by JIntegral::computeQpIntegral(), DomainIntegralQFunction::computeValue(), and DomainIntegralQFunction().

1224 {
1225  return _segment_lengths[point_index].first;
1226 }
std::vector< std::pair< Real, Real > > _segment_lengths
Vector of segment lengths along the crack front.

◆ getCrackFrontForwardSegmentLength()

Real CrackFrontDefinition::getCrackFrontForwardSegmentLength ( const std::size_t  point_index) const

Get the length of the line segment on the crack front ahead of the specified position.

Parameters
point_indexIndex of the point
Returns
Line segment length

Definition at line 1217 of file CrackFrontDefinition.C.

Referenced by JIntegral::computeQpIntegral(), DomainIntegralQFunction::computeValue(), and DomainIntegralQFunction().

1218 {
1219  return _segment_lengths[point_index].second;
1220 }
std::vector< std::pair< Real, Real > > _segment_lengths
Vector of segment lengths along the crack front.

◆ getCrackFrontNodePtr()

const Node * CrackFrontDefinition::getCrackFrontNodePtr ( const std::size_t  node_index) const

Get the node pointer for a specified node on the crack front.

Parameters
node_indexIndex of the node
Returns
Pointer to node

Definition at line 1187 of file CrackFrontDefinition.C.

Referenced by calculateTangentialStrainAlongFront(), getCrackFrontPoint(), CrackFrontData::initialize(), and isPointWithIndexOnIntersectingBoundary().

1188 {
1189  mooseAssert(node_index < _ordered_crack_front_nodes.size(), "node_index out of range");
1190  const Node * crack_front_node = _mesh.nodePtr(_ordered_crack_front_nodes[node_index]);
1191  mooseAssert(crack_front_node != nullptr, "invalid crack front node");
1192  return crack_front_node;
1193 }
virtual const Node * nodePtr(const dof_id_type i) const
MooseMesh & _mesh
Reference to the mesh.
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.

◆ getCrackFrontNodes()

void CrackFrontDefinition::getCrackFrontNodes ( std::set< dof_id_type > &  nodes)
protected

Get the set of all crack front nodes.

Parameters
nodesSet of nodes – populated by this method

Definition at line 390 of file CrackFrontDefinition.C.

Referenced by initialSetup().

391 {
393  for (auto nd = bnd_nodes.begin(); nd != bnd_nodes.end(); ++nd)
394  {
395  const BndNode * bnode = *nd;
396  BoundaryID boundary_id = bnode->_bnd_id;
397 
398  if (hasBoundary(boundary_id))
399  nodes.insert(bnode->_node->id());
400  }
401 
402  if (_treat_as_2d && _use_mesh_cutter == false)
403  {
404  if (nodes.size() > 1)
405  {
406  // Check that the nodes are collinear in the axis normal to the 2d plane
407  unsigned int axis0;
408  unsigned int axis1;
409 
410  switch (_axis_2d)
411  {
412  case 0:
413  axis0 = 1;
414  axis1 = 2;
415  break;
416  case 1:
417  axis0 = 0;
418  axis1 = 2;
419  break;
420  case 2:
421  axis0 = 0;
422  axis1 = 1;
423  break;
424  default:
425  mooseError("Invalid axis.");
426  }
427 
428  Real node0coor0 = 0;
429  Real node0coor1 = 0;
430 
431  for (auto sit = nodes.begin(); sit != nodes.end(); ++sit)
432  {
433  Node & curr_node = _mesh.nodeRef(*sit);
434  if (sit == nodes.begin())
435  {
436  node0coor0 = curr_node(axis0);
437  node0coor1 = curr_node(axis1);
438  }
439  else
440  {
441  if (!MooseUtils::absoluteFuzzyEqual(curr_node(axis0), node0coor0, _tol) ||
442  !MooseUtils::absoluteFuzzyEqual(curr_node(axis1), node0coor1, _tol))
443  mooseError("Boundary provided in CrackFrontDefinition contains ",
444  nodes.size(),
445  " nodes, which are not collinear in the ",
446  _axis_2d,
447  " axis. Must contain either 1 node or collinear nodes to treat as 2D.");
448  }
449  }
450  }
451  }
452 }
unsigned int _axis_2d
Out of plane axis when crack is treated as 2D.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
BoundaryID _bnd_id
Node * _node
virtual const Node & nodeRef(const dof_id_type i) const
static const Real _tol
Tolerance used in geometric calculations.
boundary_id_type BoundaryID
MooseMesh & _mesh
Reference to the mesh.
bool hasBoundary(const BoundaryName &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode *> ConstBndNodeRange
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode *> * getBoundaryNodeRange()

◆ getCrackFrontPoint()

const Point * CrackFrontDefinition::getCrackFrontPoint ( const std::size_t  point_index) const

Get a Point object for a specified point on the crack front.

Parameters
point_indexIndex of the point
Returns
Point object

Definition at line 1196 of file CrackFrontDefinition.C.

Referenced by calculateRThetaToCrackFront(), JIntegral::finalize(), DomainIntegralQFunction::projectToFrontAtPoint(), projectToFrontAtPoint(), updateCrackFrontGeometry(), and updateDataForCrackDirection().

1197 {
1199  {
1200  return getCrackFrontNodePtr(point_index);
1201  }
1202  else
1203  {
1204  mooseAssert(point_index < _crack_front_points.size(), "point_index out of range");
1205  return &_crack_front_points[point_index];
1206  }
1207 }
std::vector< Point > _crack_front_points
Vector of points along the crack front.
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method

◆ getCrackFrontTangent()

const RealVectorValue & CrackFrontDefinition::getCrackFrontTangent ( const std::size_t  point_index) const

Get the vector tangent to the crack front at a specified position.

Parameters
point_indexIndex of the point
Returns
tangent vector

Definition at line 1210 of file CrackFrontDefinition.C.

Referenced by DomainIntegralQFunction::projectToFrontAtPoint(), and projectToFrontAtPoint().

1211 {
1212  mooseAssert(point_index < _tangent_directions.size(), "point_index out of range");
1213  return _tangent_directions[point_index];
1214 }
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.

◆ getCrackFrontTangentialStrain()

Real CrackFrontDefinition::getCrackFrontTangentialStrain ( const std::size_t  node_index) const

Get the strain in the direction tangent to the crack front at a given point.

Parameters
node_indexthe crack front node index
Returns
Tangential strain

Definition at line 1595 of file CrackFrontDefinition.C.

1596 {
1597  Real strain;
1598  if (_t_stress)
1599  {
1600  strain = _strain_along_front[node_index];
1601  mooseAssert(strain > -std::numeric_limits<Real>::max(),
1602  "Failure in parallel communication of crack tangential strain");
1603  }
1604  else
1605  mooseError("In CrackFrontDefinition, tangential strain not available");
1606 
1607  return strain;
1608 }
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
bool _t_stress
Whether the T-stress is being computed.

◆ getDistanceAlongFront()

Real CrackFrontDefinition::getDistanceAlongFront ( const std::size_t  point_index) const

Get the distance along the crack front from the beginning of the crack to the specified position.

Parameters
point_indexIndex of the point
Returns
Distance along crack

Definition at line 1235 of file CrackFrontDefinition.C.

Referenced by JIntegral::finalize().

1236 {
1237  return _distances_along_front[point_index];
1238 }
std::vector< Real > _distances_along_front
Vector of distances along the crack front.

◆ getNumCrackFrontPoints()

std::size_t CrackFrontDefinition::getNumCrackFrontPoints ( ) const

Get the number of points defining the crack front as a set of line segments.

Returns
Number of points

Definition at line 1258 of file CrackFrontDefinition.C.

Referenced by calculateRThetaToCrackFront(), JIntegral::initialize(), initialize(), initialSetup(), isPointWithIndexOnIntersectingBoundary(), updateCrackFrontGeometry(), and updateDataForCrackDirection().

1259 {
1261  return _ordered_crack_front_nodes.size();
1262  else
1263  return _crack_front_points.size();
1264 }
std::vector< Point > _crack_front_points
Vector of points along the crack front.
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.

◆ hasAngleAlongFront()

bool CrackFrontDefinition::hasAngleAlongFront ( ) const

Whether the distance along the crack front is available as an angle.

Returns
true if it is available as an angle

Definition at line 1241 of file CrackFrontDefinition.C.

Referenced by getAngleAlongFront(), and updateCrackFrontGeometry().

1242 {
1243  return (_crack_mouth_boundary_names.size() > 0);
1244 }
std::vector< BoundaryName > _crack_mouth_boundary_names
Names of boundaries used to define location of crack mouth.

◆ hasCrackFrontNodes()

bool CrackFrontDefinition::hasCrackFrontNodes ( ) const
inline

Determine whether the crack front was defined using nodes.

Returns
true if it was defined using nodes

Definition at line 211 of file CrackFrontDefinition.h.

Referenced by CrackFrontData::initialize().

◆ initialize()

void CrackFrontDefinition::initialize ( )
overridevirtual

Implements GeneralUserObject.

Definition at line 360 of file CrackFrontDefinition.C.

361 {
362  // Update the crack front for fracture integral calculations
363  // This is only useful for growing cracks which are currently described by the mesh
364  // cutter
366  {
372  std::size_t num_crack_front_points = getNumCrackFrontPoints();
373  if (_q_function_type == "GEOMETRY")
374  for (std::size_t i = 0; i < num_crack_front_points; ++i)
375  {
376  bool is_point_on_intersecting_boundary = isPointWithIndexOnIntersectingBoundary(i);
377  _is_point_on_intersecting_boundary.push_back(is_point_on_intersecting_boundary);
378  }
379  }
380 }
std::vector< Point > _crack_front_points
Vector of points along the crack front.
void updateCrackFrontGeometry()
Update the data structures defining the crack front geometry such as the ordered crack front nodes/po...
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points...
bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const
Determine whether a given crack front point is on one of the boundaries that intersects an end of the...
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true...
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
bool _is_cutter_modified
Indicator that shows if the cutter mesh is modified or not in the calculation step.
virtual const std::vector< Point > getCrackFrontPoints(unsigned int) const =0
get a set of points along a crack front from a XFEM GeometricCutUserObject
std::vector< bool > _is_point_on_intersecting_boundary
Vector of bools indicating whether individual crack front points are on an intersecting boundary...
virtual const std::vector< RealVectorValue > getCrackPlaneNormals(unsigned int) const =0
get a set of normal vectors along a crack front from a XFEM GeometricCutUserObject ...
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.
MooseEnum _q_function_type
Method used to define the q function.

◆ initialSetup()

void CrackFrontDefinition::initialSetup ( )
overridevirtual

Reimplemented from GeneralUserObject.

Definition at line 289 of file CrackFrontDefinition.C.

290 {
291  if (isParamValid("crack_front_points_provider"))
292  {
293  _crack_front_points_provider = &getUserObjectByName<CrackFrontPointsProvider>(
294  getParam<UserObjectName>("crack_front_points_provider"));
296  {
297  _use_mesh_cutter = true;
299  paramError("crack_direction_method",
300  "Using a `crack_front_points_provider` that uses an XFEM cutter mesh also "
301  "requires setting 'crack_direction_method = CurvedCrackFront'");
302  if (isParamValid("crack_mouth_boundary"))
303  paramError("crack_mouth_boundary",
304  "'crack_mouth_boundary' cannot be set when using a "
305  "'crack_front_points_provider' that uses an XFEM cutter mesh");
306  }
307  }
308  if (_crack_front_points_provider != nullptr)
309  {
310  // TODO: For crack nucleation, should call a new method on the _crack_front_points_provider to
311  // get the number of crack front points IF the crack_front_points_provider's initialSetup has
312  // been called
315  if (_use_mesh_cutter)
318  }
319 
322 
324  {
325  std::set<dof_id_type> nodes;
326  getCrackFrontNodes(nodes);
327  orderCrackFrontNodes(nodes);
328  }
329 
330  if (_closed_loop && _intersecting_boundary_names.size() > 0)
331  paramError("intersecting_boundary", "Cannot use intersecting_boundary with closed-loop cracks");
332 
334 
335  if (_q_function_rings)
337 
338  if (_t_stress)
339  {
340  std::size_t num_crack_front_nodes = _ordered_crack_front_nodes.size();
341  for (std::size_t i = 0; i < num_crack_front_nodes; ++i)
342  _strain_along_front.push_back(-std::numeric_limits<Real>::max());
343  }
344 
345  std::size_t num_crack_front_points = getNumCrackFrontPoints();
346  if (_q_function_type == "GEOMETRY")
347  {
348  if (!_treat_as_2d)
349  if (num_crack_front_points < 1)
350  mooseError("num_crack_front_points is not > 0");
351  for (std::size_t i = 0; i < num_crack_front_points; ++i)
352  {
353  bool is_point_on_intersecting_boundary = isPointWithIndexOnIntersectingBoundary(i);
354  _is_point_on_intersecting_boundary.push_back(is_point_on_intersecting_boundary);
355  }
356  }
357 }
void getCrackFrontNodes(std::set< dof_id_type > &nodes)
Get the set of all crack front nodes.
std::vector< BoundaryID > _intersecting_boundary_ids
IDs of boundaries that intersect crack at its ends.
std::vector< Point > _crack_front_points
Vector of points along the crack front.
void updateCrackFrontGeometry()
Update the data structures defining the crack front geometry such as the ordered crack front nodes/po...
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
bool _q_function_rings
Whether topological rings are used to define the q functions.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points...
std::vector< BoundaryID > _crack_mouth_boundary_ids
IDs of boundaries used to define location of crack mouth.
bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const
Determine whether a given crack front point is on one of the boundaries that intersects an end of the...
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true...
bool isParamValid(const std::string &name) const
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
void orderCrackFrontNodes(std::set< dof_id_type > &nodes)
Arrange the crack front nodes by their position along the crack front, and put them in the _ordered_c...
bool _closed_loop
Whether the crack forms a closed loop.
virtual const std::vector< Point > getCrackFrontPoints(unsigned int) const =0
get a set of points along a crack front from a XFEM GeometricCutUserObject
bool usesMesh() const
Getter for if a cutter mesh is used in a derived class.
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
std::vector< bool > _is_point_on_intersecting_boundary
Vector of bools indicating whether individual crack front points are on an intersecting boundary...
void paramError(const std::string &param, Args... args) const
std::vector< BoundaryName > _crack_mouth_boundary_names
Names of boundaries used to define location of crack mouth.
MooseMesh & _mesh
Reference to the mesh.
void createQFunctionRings()
Create the data defining the rings used to define the q function when the topological option is used ...
virtual const std::vector< RealVectorValue > getCrackPlaneNormals(unsigned int) const =0
get a set of normal vectors along a crack front from a XFEM GeometricCutUserObject ...
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
std::vector< BoundaryName > _intersecting_boundary_names
Names of boundaries that intersect crack at its ends.
void mooseError(Args &&... args) const
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
MooseEnum _q_function_type
Method used to define the q function.
bool _t_stress
Whether the T-stress is being computed.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ isCutterModified()

void CrackFrontDefinition::isCutterModified ( const bool  is_cutter_modified)

Set the value of _is_cutter_modified.

Definition at line 1905 of file CrackFrontDefinition.C.

Referenced by MeshCut2DFractureUserObject::initialize(), and CrackMeshCut3DUserObject::initialize().

1906 {
1907  _is_cutter_modified = is_cutter_modified;
1908 }
bool _is_cutter_modified
Indicator that shows if the cutter mesh is modified or not in the calculation step.

◆ isNodeInRing()

bool CrackFrontDefinition::isNodeInRing ( const std::size_t  ring_index,
const dof_id_type  connected_node_id,
const std::size_t  node_index 
) const

Determine whether a node is contained within a specified volume integral element ring for a given node on the crack front.

Parameters
ring_indexIndex of the ring
connected_node_idID of the node
node_indexIndex of the crack front node
Returns
true if the node is in the ring

Definition at line 1797 of file CrackFrontDefinition.C.

Referenced by DomainIntegralTopologicalQFunction::computeValue(), and DomainIntegralTopologicalQFunction().

1800 {
1801  bool is_node_in_ring = false;
1802  std::pair<dof_id_type, std::size_t> node_ring_key =
1803  std::make_pair(_ordered_crack_front_nodes[node_index], ring_index);
1804  auto nnmit = _crack_front_node_to_node_map.find(node_ring_key);
1805 
1806  if (nnmit == _crack_front_node_to_node_map.end())
1807  mooseError("Could not find crack front node ",
1808  _ordered_crack_front_nodes[node_index],
1809  " in the crack front node to q-function ring-node map for ring ",
1810  ring_index);
1811 
1812  std::set<dof_id_type> q_func_nodes = nnmit->second;
1813  if (q_func_nodes.find(connected_node_id) != q_func_nodes.end())
1814  is_node_in_ring = true;
1815 
1816  return is_node_in_ring;
1817 }
std::map< std::pair< dof_id_type, std::size_t >, std::set< dof_id_type > > _crack_front_node_to_node_map
Data structure used to store information about topological rings Key is a pair of the crack front nod...
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
void mooseError(Args &&... args) const

◆ isNodeOnIntersectingBoundary()

bool CrackFrontDefinition::isNodeOnIntersectingBoundary ( const Node *const  node) const

Determine whether a given node is on one of the boundaries that intersects an end of the crack front.

Parameters
nodePointer to node
Returns
true if the node is on an intersecting boundary

Definition at line 1435 of file CrackFrontDefinition.C.

Referenced by DomainIntegralQFunction::computeValue(), DomainIntegralQFunction(), and isPointWithIndexOnIntersectingBoundary().

1436 {
1437  bool is_on_boundary = false;
1438  mooseAssert(node, "Invalid node");
1439  dof_id_type node_id = node->id();
1440  for (std::size_t i = 0; i < _intersecting_boundary_ids.size(); ++i)
1441  {
1443  {
1444  is_on_boundary = true;
1445  break;
1446  }
1447  }
1448  return is_on_boundary;
1449 }
std::vector< BoundaryID > _intersecting_boundary_ids
IDs of boundaries that intersect crack at its ends.
bool isBoundaryNode(dof_id_type node_id) const
MooseMesh & _mesh
Reference to the mesh.
uint8_t dof_id_type

◆ isPointWithIndexOnIntersectingBoundary()

bool CrackFrontDefinition::isPointWithIndexOnIntersectingBoundary ( const std::size_t  point_index) const

Determine whether a given crack front point is on one of the boundaries that intersects an end of the crack front.

Parameters
point_indexthe crack front point index
Returns
true if the point is on an intersecting boundary

Definition at line 1452 of file CrackFrontDefinition.C.

Referenced by initialize(), DomainIntegralQFunction::initialSetup(), and initialSetup().

1453 {
1454  bool is_on_boundary = false;
1456  {
1457  const Node * crack_front_node = getCrackFrontNodePtr(point_index);
1458  is_on_boundary = isNodeOnIntersectingBoundary(crack_front_node);
1459  }
1460  else
1461  {
1462  // If the intersecting boundary option is used with crack front points, the
1463  // first and last points are assumed to be on the intersecting boundaries.
1464  std::size_t num_crack_front_points = getNumCrackFrontPoints();
1465  if (point_index == 0 || point_index == num_crack_front_points - 1)
1466  is_on_boundary = true;
1467  }
1468  return is_on_boundary;
1469 }
bool isNodeOnIntersectingBoundary(const Node *const node) const
Determine whether a given node is on one of the boundaries that intersects an end of the crack front...
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.

◆ maxNodeCoor()

dof_id_type CrackFrontDefinition::maxNodeCoor ( std::vector< Node *> &  nodes,
unsigned int  dir0 = 0 
)
protected

Find the node with the maximum value of its coordinate.

This is used to deterministically find the first node on the crack front. First, the nodes with the maximum coordinate in one direction are found, and then if there are duplicates with that same coordinate, search through the other two coordinates to find the node with the maximum coordinate in all 3 directions.

Parameters
nodesSet of all nodes on the crack front
dir0First coordinate direction in which to order the coordinates

Definition at line 714 of file CrackFrontDefinition.C.

Referenced by pickLoopCrackEndNodes().

715 {
716  Real dirs[3];
717  if (dir0 == 0)
718  {
719  dirs[0] = 0;
720  dirs[1] = 1;
721  dirs[2] = 2;
722  }
723  else if (dir0 == 1)
724  {
725  dirs[0] = 1;
726  dirs[1] = 2;
727  dirs[2] = 0;
728  }
729  else if (dir0 == 2)
730  {
731  dirs[0] = 2;
732  dirs[1] = 0;
733  dirs[2] = 1;
734  }
735  else
736  mooseError("Invalid dir0 in CrackFrontDefinition::maxNodeCoor()");
737 
738  Real max_coor0 = -std::numeric_limits<Real>::max();
739  std::vector<Node *> max_coor0_nodes;
740  for (std::size_t i = 0; i < nodes.size(); ++i)
741  {
742  Real coor0 = (*nodes[i])(dirs[0]);
743  if (coor0 > max_coor0)
744  max_coor0 = coor0;
745  }
746  for (std::size_t i = 0; i < nodes.size(); ++i)
747  {
748  Real coor0 = (*nodes[i])(dirs[0]);
749  if (MooseUtils::absoluteFuzzyEqual(coor0, max_coor0, _tol))
750  max_coor0_nodes.push_back(nodes[i]);
751  }
752  if (max_coor0_nodes.size() > 1)
753  {
754  Real max_coor1 = -std::numeric_limits<Real>::max();
755  std::vector<Node *> max_coor1_nodes;
756  for (std::size_t i = 0; i < nodes.size(); ++i)
757  {
758  Real coor1 = (*nodes[i])(dirs[1]);
759  if (coor1 > max_coor1)
760  max_coor1 = coor1;
761  }
762  for (std::size_t i = 0; i < nodes.size(); ++i)
763  {
764  Real coor1 = (*nodes[i])(dirs[1]);
765  if (MooseUtils::absoluteFuzzyEqual(coor1, max_coor1, _tol))
766  max_coor1_nodes.push_back(nodes[i]);
767  }
768  if (max_coor1_nodes.size() > 1)
769  {
770  Real max_coor2 = -std::numeric_limits<Real>::max();
771  std::vector<Node *> max_coor2_nodes;
772  for (std::size_t i = 0; i < nodes.size(); ++i)
773  {
774  Real coor2 = (*nodes[i])(dirs[2]);
775  if (coor2 > max_coor2)
776  max_coor2 = coor2;
777  }
778  for (std::size_t i = 0; i < nodes.size(); ++i)
779  {
780  Real coor2 = (*nodes[i])(dirs[2]);
781  if (MooseUtils::absoluteFuzzyEqual(coor2, max_coor2, _tol))
782  max_coor2_nodes.push_back(nodes[i]);
783  }
784  if (max_coor2_nodes.size() > 1)
785  mooseError("Multiple nodes with same x,y,z coordinates within tolerance");
786  else
787  return max_coor2_nodes[0]->id();
788  }
789  else
790  return max_coor1_nodes[0]->id();
791  }
792  else
793  return max_coor0_nodes[0]->id();
794 }
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
static const Real _tol
Tolerance used in geometric calculations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const

◆ orderCrackFrontNodes()

void CrackFrontDefinition::orderCrackFrontNodes ( std::set< dof_id_type > &  nodes)
protected

Arrange the crack front nodes by their position along the crack front, and put them in the _ordered_crack_front_nodes member variable.

Parameters
nodesSet of nodes to be ordered

Definition at line 455 of file CrackFrontDefinition.C.

Referenced by initialSetup().

456 {
458  if (nodes.size() < 1)
459  mooseError("No crack front nodes");
460  else if (nodes.size() == 1)
461  {
462  _ordered_crack_front_nodes.push_back(*nodes.begin());
463  if (!_treat_as_2d)
464  mooseError("Boundary provided in CrackFrontDefinition contains 1 node, but model is not "
465  "treated as 2d");
466  }
467  else if (_treat_as_2d && _use_mesh_cutter)
468  {
469  // This is for the 2D case that uses a mesh cutter object so every node is its own crack front
470  // and is not connected to other crack front nodes. Copying the order here makes it the same
471  // as that given in the MeshCut2DFractureUserObject
472  std::copy(nodes.begin(), nodes.end(), _ordered_crack_front_nodes.begin());
473  }
474  else
475  {
476  // Loop through the set of crack front nodes, and create a node to element map for just the
477  // crack front nodes
478  // The main reason for creating a second map is that we need to do a sort prior to the
479  // set_intersection.
480  // The original map contains vectors, and we can't sort them, so we create sets in the local
481  // map.
482  const std::map<dof_id_type, std::vector<dof_id_type>> & node_to_elem_map =
484  std::map<dof_id_type, std::set<dof_id_type>> crack_front_node_to_elem_map;
485 
486  for (const auto & node_id : nodes)
487  {
488  const auto & node_to_elem_pair = node_to_elem_map.find(node_id);
489  mooseAssert(node_to_elem_pair != node_to_elem_map.end(),
490  "Could not find crack front node " << node_id << " in the node to elem map");
491 
492  const std::vector<dof_id_type> & connected_elems = node_to_elem_pair->second;
493  for (std::size_t i = 0; i < connected_elems.size(); ++i)
494  crack_front_node_to_elem_map[node_id].insert(connected_elems[i]);
495  }
496 
497  // Determine which nodes are connected to each other via elements, and construct line elements
498  // to represent
499  // those connections
500  std::vector<std::vector<dof_id_type>> line_elems;
501  std::map<dof_id_type, std::vector<dof_id_type>> node_to_line_elem_map;
502 
503  for (auto cfnemit = crack_front_node_to_elem_map.begin();
504  cfnemit != crack_front_node_to_elem_map.end();
505  ++cfnemit)
506  {
507  auto cfnemit2 = cfnemit;
508  for (++cfnemit2; cfnemit2 != crack_front_node_to_elem_map.end(); ++cfnemit2)
509  {
510 
511  std::vector<dof_id_type> common_elements;
512  std::set<dof_id_type> & elements_connected_to_node1 = cfnemit->second;
513  std::set<dof_id_type> & elements_connected_to_node2 = cfnemit2->second;
514  std::set_intersection(elements_connected_to_node1.begin(),
515  elements_connected_to_node1.end(),
516  elements_connected_to_node2.begin(),
517  elements_connected_to_node2.end(),
518  std::inserter(common_elements, common_elements.end()));
519 
520  if (common_elements.size() > 0)
521  {
522  std::vector<dof_id_type> my_line_elem;
523  my_line_elem.push_back(cfnemit->first);
524  my_line_elem.push_back(cfnemit2->first);
525  node_to_line_elem_map[cfnemit->first].push_back(line_elems.size());
526  node_to_line_elem_map[cfnemit2->first].push_back(line_elems.size());
527  line_elems.push_back(my_line_elem);
528  }
529  }
530  }
531 
532  // Find nodes on ends of line (those connected to only one line element)
533  std::vector<dof_id_type> end_nodes;
534  for (auto nlemit = node_to_line_elem_map.begin(); nlemit != node_to_line_elem_map.end();
535  ++nlemit)
536  {
537  std::size_t num_connected_elems = nlemit->second.size();
538  if (num_connected_elems == 1)
539  end_nodes.push_back(nlemit->first);
540  else if (num_connected_elems != 2)
541  mooseError(
542  "Node ", nlemit->first, " is connected to >2 line segments in CrackFrontDefinition");
543  }
544 
545  // For embedded crack with closed loop of crack front nodes, must pick the end nodes
546  if (end_nodes.size() == 0) // Crack front is a loop. Pick nodes to be end nodes.
547  {
548  pickLoopCrackEndNodes(end_nodes, nodes, node_to_line_elem_map, line_elems);
549  _closed_loop = true;
552  paramError("end_direction_method",
553  "In CrackFrontDefinition, end_direction_method cannot be CrackDirectionVector "
554  "or CrackTangentVector for a closed-loop crack");
555  if (_intersecting_boundary_names.size() > 0)
556  paramError("intersecting_boundary",
557  "In CrackFrontDefinition, intersecting_boundary cannot be specified for a "
558  "closed-loop crack");
559  }
560  else if (end_nodes.size() == 2) // Rearrange the order of the end nodes if needed
561  orderEndNodes(end_nodes);
562  else
563  mooseError("In CrackFrontDefinition wrong number of end nodes. Number end nodes = ",
564  end_nodes.size());
565 
566  // Create an ordered list of the nodes going along the line of the crack front
567  _ordered_crack_front_nodes.push_back(end_nodes[0]);
568 
569  dof_id_type last_node = end_nodes[0];
570  dof_id_type second_last_node = last_node;
571  while (last_node != end_nodes[1])
572  {
573  std::vector<dof_id_type> & curr_node_line_elems = node_to_line_elem_map[last_node];
574  bool found_new_node = false;
575  for (std::size_t i = 0; i < curr_node_line_elems.size(); ++i)
576  {
577  std::vector<dof_id_type> curr_line_elem = line_elems[curr_node_line_elems[i]];
578  for (std::size_t j = 0; j < curr_line_elem.size(); ++j)
579  {
580  dof_id_type line_elem_node = curr_line_elem[j];
581  if (_closed_loop &&
582  (last_node == end_nodes[0] &&
583  line_elem_node == end_nodes[1])) // wrong direction around closed loop
584  continue;
585  if (line_elem_node != last_node && line_elem_node != second_last_node)
586  {
587  _ordered_crack_front_nodes.push_back(line_elem_node);
588  found_new_node = true;
589  break;
590  }
591  }
592  if (found_new_node)
593  break;
594  }
595  second_last_node = last_node;
596  last_node = _ordered_crack_front_nodes.back();
597  }
598  }
599 }
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
void pickLoopCrackEndNodes(std::vector< dof_id_type > &end_nodes, std::set< dof_id_type > &nodes, std::map< dof_id_type, std::vector< dof_id_type >> &node_to_line_elem_map, std::vector< std::vector< dof_id_type >> &line_elems)
For the case of a crack that is a complete loop, determine which of the nodes should be the start and...
bool _closed_loop
Whether the crack forms a closed loop.
void paramError(const std::string &param, Args... args) const
MooseMesh & _mesh
Reference to the mesh.
void orderEndNodes(std::vector< dof_id_type > &end_nodes)
Determine which of the end nodes should be the starting point of the crack front. ...
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
std::vector< BoundaryName > _intersecting_boundary_names
Names of boundaries that intersect crack at its ends.
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
uint8_t dof_id_type
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()

◆ orderEndNodes()

void CrackFrontDefinition::orderEndNodes ( std::vector< dof_id_type > &  end_nodes)
protected

Determine which of the end nodes should be the starting point of the crack front.

Parameters
end_nodesVector containing two end nodes. The order of this is rearranged so that the first end node is the start of the crack front, and the second is at the end.

Definition at line 602 of file CrackFrontDefinition.C.

Referenced by orderCrackFrontNodes().

603 {
604  // Choose the node to be the first node. Do that based on undeformed coordinates for
605  // repeatability.
606  Node & node0 = _mesh.nodeRef(end_nodes[0]);
607  Node & node1 = _mesh.nodeRef(end_nodes[1]);
608 
609  std::size_t num_positive_coor0 = 0;
610  std::size_t num_positive_coor1 = 0;
611  Real dist_from_origin0 = 0.0;
612  Real dist_from_origin1 = 0.0;
613  for (std::size_t i = 0; i < 3; ++i)
614  {
615  dist_from_origin0 += node0(i) * node0(i);
616  dist_from_origin1 += node1(i) * node1(i);
617  if (MooseUtils::absoluteFuzzyGreaterThan(node0(i), 0.0, _tol))
618  ++num_positive_coor0;
619  if (MooseUtils::absoluteFuzzyGreaterThan(node1(i), 0.0, _tol))
620  ++num_positive_coor1;
621  }
622  dist_from_origin0 = std::sqrt(dist_from_origin0);
623  dist_from_origin1 = std::sqrt(dist_from_origin1);
624 
625  bool switch_ends = false;
626  if (num_positive_coor1 > num_positive_coor0)
627  {
628  switch_ends = true;
629  }
630  else
631  {
632  if (!MooseUtils::absoluteFuzzyEqual(dist_from_origin1, dist_from_origin0, _tol))
633  {
634  if (dist_from_origin1 < dist_from_origin0)
635  switch_ends = true;
636  }
637  else
638  {
639  if (end_nodes[1] < end_nodes[0])
640  switch_ends = true;
641  }
642  }
643  if (switch_ends)
644  {
645  std::size_t tmp_node = end_nodes[1];
646  end_nodes[1] = end_nodes[0];
647  end_nodes[0] = tmp_node;
648  }
649 }
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
virtual const Node & nodeRef(const dof_id_type i) const
static const Real _tol
Tolerance used in geometric calculations.
MooseMesh & _mesh
Reference to the mesh.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)

◆ pickLoopCrackEndNodes()

void CrackFrontDefinition::pickLoopCrackEndNodes ( std::vector< dof_id_type > &  end_nodes,
std::set< dof_id_type > &  nodes,
std::map< dof_id_type, std::vector< dof_id_type >> &  node_to_line_elem_map,
std::vector< std::vector< dof_id_type >> &  line_elems 
)
protected

For the case of a crack that is a complete loop, determine which of the nodes should be the start and end nodes in a repeatable way.

Parameters
end_nodesVector containing two end nodes – populated by this method
nodesSet of all nodes on the crack front
node_to_line_elem_mapMap from crack front nodes to line elements on crack front (see line_elems param)
line_elemsLine elements on crack front defined as vectors of the nodes on each end of the line elements.

Definition at line 652 of file CrackFrontDefinition.C.

Referenced by orderCrackFrontNodes().

657 {
658  dof_id_type max_dist_node = 0;
659  Real min_dist = std::numeric_limits<Real>::max();
660  Real max_dist = -std::numeric_limits<Real>::max();
661  // Pick the node farthest from the origin as the end node, or the one with
662  // the greatest x coordinate if the nodes are equidistant from the origin
663  for (auto nit = nodes.begin(); nit != nodes.end(); ++nit)
664  {
665  Node & node = _mesh.nodeRef(*nit);
666  Real dist = node.norm();
667  if (dist > max_dist)
668  {
669  max_dist = dist;
670  max_dist_node = *nit;
671  }
672  else if (dist < min_dist)
673  min_dist = dist;
674  }
675 
676  dof_id_type end_node;
677  if (MooseUtils::absoluteFuzzyGreaterThan(max_dist, min_dist, _tol))
678  end_node = max_dist_node;
679  else
680  {
681  std::vector<Node *> node_vec;
682  for (auto nit = nodes.begin(); nit != nodes.end(); ++nit)
683  node_vec.push_back(_mesh.nodePtr(*nit));
684  end_node = maxNodeCoor(node_vec);
685  }
686 
687  end_nodes.push_back(end_node);
688 
689  // Find the two nodes connected to the node identified as the end node, and pick one of those to
690  // be the other end node
691  auto end_node_line_elems = node_to_line_elem_map[end_node];
692  if (end_node_line_elems.size() != 2)
693  mooseError(
694  "Crack front nodes are in a loop, but crack end node is only connected to one other node");
695  std::vector<Node *> candidate_other_end_nodes;
696 
697  for (std::size_t i = 0; i < 2; ++i)
698  {
699  auto end_line_elem = line_elems[end_node_line_elems[i]];
700  for (std::size_t j = 0; j < end_line_elem.size(); ++j)
701  {
702  auto line_elem_node = end_line_elem[j];
703  if (line_elem_node != end_node)
704  candidate_other_end_nodes.push_back(_mesh.nodePtr(line_elem_node));
705  }
706  }
707  if (candidate_other_end_nodes.size() != 2)
708  mooseError(
709  "Crack front nodes are in a loop, but crack end node is not connected to two other nodes");
710  end_nodes.push_back(maxNodeCoor(candidate_other_end_nodes, 1));
711 }
virtual const Node & nodeRef(const dof_id_type i) const
static const Real _tol
Tolerance used in geometric calculations.
dof_id_type maxNodeCoor(std::vector< Node *> &nodes, unsigned int dir0=0)
Find the node with the maximum value of its coordinate.
virtual const Node * nodePtr(const dof_id_type i) const
MooseMesh & _mesh
Reference to the mesh.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
uint8_t dof_id_type

◆ projectToFrontAtPoint()

void CrackFrontDefinition::projectToFrontAtPoint ( Real dist_to_front,
Real dist_along_tangent,
std::size_t  crack_front_point_index,
const Node *const  current_node 
) const
protected

Project a point to a specified point along the crack front and compute the projected normal and tangential distance to the front.

Parameters
dist_to_frontProjected normal distance to the front – computed by this method
dist_along_tangentProject tangent distance to the front – computed by this method
crack_front_point_indexIndex of the point on the crack front
current_nodeNode to be projected to the front

Definition at line 1887 of file CrackFrontDefinition.C.

Referenced by DomainIntegralQFunction().

1891 {
1892  const Point * crack_front_point = getCrackFrontPoint(crack_front_point_index);
1893 
1894  Point p = *current_node;
1895  const RealVectorValue & crack_front_tangent = getCrackFrontTangent(crack_front_point_index);
1896 
1897  RealVectorValue crack_node_to_current_node = p - *crack_front_point;
1898  dist_along_tangent = crack_node_to_current_node * crack_front_tangent;
1899  RealVectorValue projection_point = *crack_front_point + dist_along_tangent * crack_front_tangent;
1900  RealVectorValue axis_to_current_node = p - projection_point;
1901  dist_to_front = axis_to_current_node.norm();
1902 }
const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const
Get the vector tangent to the crack front at a specified position.
auto norm() const -> decltype(std::norm(Real()))
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.

◆ rotateFromCrackFrontCoordsToGlobal()

RealVectorValue CrackFrontDefinition::rotateFromCrackFrontCoordsToGlobal ( const RealVectorValue  vector,
const std::size_t  point_index 
) const

Rotate a vector from crack front cartesian coordinate to global cartesian coordinate.

Parameters
vectorVector in crack local coordinates
point_indexIndex of the point
Returns
Vector in global coordinates

Definition at line 1274 of file CrackFrontDefinition.C.

Referenced by CrackMeshCut3DUserObject::findActiveBoundaryDirection(), MeshCut2DFractureUserObject::findActiveBoundaryGrowth(), and EnrichmentFunctionCalculation::rotateFromCrackFrontCoordsToGlobal().

1276 {
1277  RealVectorValue vec = _rot_matrix[point_index].transpose() * vector;
1278  return vec;
1279 }
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.

◆ rotateToCrackFrontCoords() [1/2]

RealVectorValue CrackFrontDefinition::rotateToCrackFrontCoords ( const RealVectorValue  vector,
const std::size_t  point_index 
) const

Rotate a vector in the global coordinate coordinate system to the crack front local coordinate system at a specified point on the crack.

Parameters
vectorVector in global coordinates
point_indexIndex of the point
Returns
Vector in crack local coordinates

Definition at line 1267 of file CrackFrontDefinition.C.

Referenced by calculateRThetaToCrackFront().

1269 {
1270  return _rot_matrix[point_index] * vector;
1271 }
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.

◆ rotateToCrackFrontCoords() [2/2]

RankTwoTensor CrackFrontDefinition::rotateToCrackFrontCoords ( const RankTwoTensor  tensor,
const std::size_t  point_index 
) const

Rotate a RankTwoTensor in the global coordinate coordinate system to the crack front local coordinate system at a specified point on the crack.

Parameters
tensorTensor in global coordinates
point_indexIndex of the point
Returns
Tensor in crack local coordinates

Definition at line 1282 of file CrackFrontDefinition.C.

1284 {
1285  RankTwoTensor tmp_tensor(tensor);
1286  tmp_tensor.rotate(_rot_matrix[point_index]);
1287  return tmp_tensor;
1288 }
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.

◆ treatAs2D()

bool CrackFrontDefinition::treatAs2D ( ) const
inline

Whether the fracture computations are treated as 2D for the model.

Returns
true if treated as 2D

Definition at line 124 of file CrackFrontDefinition.h.

Referenced by JIntegral::computeQpIntegral(), JIntegral::initialSetup(), DomainIntegralQFunction::initialSetup(), and DomainIntegralTopologicalQFunction::initialSetup().

124 { return _treat_as_2d; }
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.

◆ updateCrackFrontGeometry()

void CrackFrontDefinition::updateCrackFrontGeometry ( )
protected

Update the data structures defining the crack front geometry such as the ordered crack front nodes/points and other auxiliary data.

Definition at line 797 of file CrackFrontDefinition.C.

Referenced by initialize(), and initialSetup().

798 {
800 
801  _segment_lengths.clear();
802  _tangent_directions.clear();
803  _crack_directions.clear();
804  _overall_length = 0.0;
805  _rot_matrix.clear();
806  _distances_along_front.clear();
807  _angles_along_front.clear();
808  _strain_along_front.clear();
809  _crack_plane_normals.clear();
810 
811  if (_treat_as_2d)
812  {
813  std::size_t num_crack_front_points = getNumCrackFrontPoints();
814  _segment_lengths.reserve(num_crack_front_points);
815  _tangent_directions.reserve(num_crack_front_points);
816  _crack_directions.reserve(num_crack_front_points);
817 
818  for (std::size_t i = 0; i < num_crack_front_points; ++i)
819  {
820  RealVectorValue tangent_direction;
821  RealVectorValue crack_direction;
822  tangent_direction(_axis_2d) = 1.0;
823  _tangent_directions.push_back(tangent_direction);
824  const Point * crack_front_point = getCrackFrontPoint(i);
825  crack_direction =
826  calculateCrackFrontDirection(*crack_front_point, tangent_direction, MIDDLE_NODE, i);
827  _crack_directions.push_back(crack_direction);
828 
829  RankTwoTensor rot_mat;
830  rot_mat.fillRow(0, crack_direction);
831  rot_mat(2, _axis_2d) = 1.0;
832  if (_use_mesh_cutter)
833  {
835  _crack_front_points_provider->getCrackPlaneNormals(num_crack_front_points);
836  mooseAssert(!_crack_plane_normals.empty(), "_crack_plane_normals is empty.");
837  rot_mat.fillRow(1, _crack_plane_normals[i]);
838  }
839  else
840  {
841  _crack_plane_normal = tangent_direction.cross(crack_direction);
842  rot_mat.fillRow(1, _crack_plane_normal);
843  }
844  _rot_matrix.push_back(rot_mat);
845 
846  _segment_lengths.push_back(std::make_pair(0.0, 0.0));
847  _distances_along_front.push_back(0.0);
848  _angles_along_front.push_back(0.0);
849  }
850  }
851  else
852  {
853  std::size_t num_crack_front_points = getNumCrackFrontPoints();
854  _segment_lengths.reserve(num_crack_front_points);
855  _tangent_directions.reserve(num_crack_front_points);
856  _crack_directions.reserve(num_crack_front_points);
857 
858  RealVectorValue back_segment;
859  Real back_segment_len = 0.0;
860  if (_closed_loop)
861  {
862  back_segment = *getCrackFrontPoint(0) - *getCrackFrontPoint(num_crack_front_points - 1);
863  back_segment_len = back_segment.norm();
864  }
865 
866  for (std::size_t i = 0; i < num_crack_front_points; ++i)
867  {
868  CRACK_NODE_TYPE ntype;
869  if (_closed_loop)
870  ntype = MIDDLE_NODE;
871  else if (i == 0)
872  ntype = END_1_NODE;
873  else if (i == num_crack_front_points - 1)
874  ntype = END_2_NODE;
875  else
876  ntype = MIDDLE_NODE;
877 
878  RealVectorValue forward_segment;
879  Real forward_segment_len;
880  if (ntype == END_2_NODE)
881  forward_segment_len = 0.0;
882  else if (_closed_loop && i == num_crack_front_points - 1)
883  {
884  forward_segment = *getCrackFrontPoint(0) - *getCrackFrontPoint(i);
885  forward_segment_len = forward_segment.norm();
886  }
887  else
888  {
889  forward_segment = *getCrackFrontPoint(i + 1) - *getCrackFrontPoint(i);
890  forward_segment_len = forward_segment.norm();
891  _overall_length += forward_segment_len;
892  }
893 
894  _segment_lengths.push_back(std::make_pair(back_segment_len, forward_segment_len));
895  if (i == 0)
896  _distances_along_front.push_back(0.0);
897  else
898  _distances_along_front.push_back(back_segment_len + _distances_along_front[i - 1]);
899 
900  RealVectorValue tangent_direction = back_segment + forward_segment;
901  tangent_direction = tangent_direction / tangent_direction.norm();
902 
903  // If end tangent directions are given, correct the tangent at the end nodes
906  {
907  if (ntype == END_1_NODE)
908  tangent_direction = _crack_tangent_vector_end_1;
909  else if (ntype == END_2_NODE)
910  tangent_direction = _crack_tangent_vector_end_2;
911  }
912 
913  _tangent_directions.push_back(tangent_direction);
914  _crack_directions.push_back(
915  calculateCrackFrontDirection(*getCrackFrontPoint(i), tangent_direction, ntype, i));
916 
917  // correct tangent direction in the case of _use_mesh_cutter
918  if (_use_mesh_cutter)
920 
921  // If the end directions are given by the user, correct also the tangent at the end nodes
924  (ntype == END_1_NODE || ntype == END_2_NODE))
925  {
926  if (_use_mesh_cutter)
928  else
930  }
931 
932  back_segment = forward_segment;
933  back_segment_len = forward_segment_len;
934  }
935 
936  // For CURVED_CRACK_FRONT, _crack_plane_normal gets computed in updateDataForCrackDirection
938  {
939  std::size_t mid_id = (num_crack_front_points - 1) / 2;
941 
942  // Make sure the normal vector is non-zero
943  RealVectorValue zero_vec(0.0);
945  mooseError("Crack plane normal vector evaluates to zero");
946  }
947 
948  // Calculate angles of each point along the crack front for an elliptical crack projected
949  // to a circle.
950  if (hasAngleAlongFront())
951  {
952  RealVectorValue origin_to_first_node = *getCrackFrontPoint(0) - _crack_mouth_coordinates;
953  Real hyp = origin_to_first_node.norm();
954  RealVectorValue norm_origin_to_first_node = origin_to_first_node / hyp;
955  RealVectorValue tangent_to_first_node = -norm_origin_to_first_node.cross(_crack_plane_normal);
956  tangent_to_first_node /= tangent_to_first_node.norm();
957 
958  for (std::size_t i = 0; i < num_crack_front_points; ++i)
959  {
960  RealVectorValue origin_to_curr_node = *getCrackFrontPoint(i) - _crack_mouth_coordinates;
961 
962  Real adj = origin_to_curr_node * norm_origin_to_first_node;
963  Real opp = origin_to_curr_node * tangent_to_first_node;
964 
965  Real angle = acos(adj / hyp) * 180.0 / libMesh::pi;
966  if (opp < 0.0)
967  angle = 360.0 - angle;
968  _angles_along_front.push_back(angle);
969  }
970 
971  // Correct angle on end nodes if they are 0 or 360 to be consistent with neighboring node
972  if (num_crack_front_points > 1)
973  {
975  _angles_along_front[1] > 180.0)
976  _angles_along_front[0] = 360.0;
978  _angles_along_front[1] < 180.0)
979  _angles_along_front[0] = 0.0;
980 
982  _angles_along_front[num_crack_front_points - 1], 0.0, _tol) &&
983  _angles_along_front[num_crack_front_points - 2] > 180.0)
984  _angles_along_front[num_crack_front_points - 1] = 360.0;
986  _angles_along_front[num_crack_front_points - 1], 360.0, _tol) &&
987  _angles_along_front[num_crack_front_points - 2] < 180.0)
988  _angles_along_front[num_crack_front_points - 1] = 0.0;
989  }
990  }
991  else
992  _angles_along_front.resize(num_crack_front_points, 0.0);
993 
994  // Create rotation matrix
995  for (std::size_t i = 0; i < num_crack_front_points; ++i)
996  {
997  RankTwoTensor rot_mat;
998  rot_mat.fillRow(0, _crack_directions[i]);
999  if (_use_mesh_cutter)
1000  rot_mat.fillRow(1, _crack_plane_normals[i]);
1001  else
1002  rot_mat.fillRow(1, _crack_plane_normal);
1003  rot_mat.fillRow(2, _tangent_directions[i]);
1004  _rot_matrix.push_back(rot_mat);
1005  }
1006 
1007  _console << "Summary of crack front geometry (used for fracture integrals):" << std::endl;
1008  _console << "index node id x coord y coord z coord x dir y dir "
1009  " z dir angle position seg length"
1010  << std::endl;
1011  for (std::size_t i = 0; i < num_crack_front_points; ++i)
1012  {
1013  std::size_t point_id;
1015  point_id = _ordered_crack_front_nodes[i];
1016  else
1017  point_id = i;
1018  _console << std::left << std::setw(8) << i + 1 << std::setw(10) << point_id << std::setw(14)
1019  << (*getCrackFrontPoint(i))(0) << std::setw(14) << (*getCrackFrontPoint(i))(1)
1020  << std::setw(14) << (*getCrackFrontPoint(i))(2) << std::setw(14)
1021  << _crack_directions[i](0) << std::setw(14) << _crack_directions[i](1)
1022  << std::setw(14) << _crack_directions[i](2);
1023  if (hasAngleAlongFront())
1024  _console << std::left << std::setw(14) << _angles_along_front[i];
1025  else
1026  _console << std::left << std::setw(14) << "--";
1027  _console << std::left << std::setw(14) << _distances_along_front[i] << std::setw(14)
1028  << (_segment_lengths[i].first + _segment_lengths[i].second) / 2.0 << std::endl;
1029  }
1030  _console << "overall length: " << _overall_length << std::endl;
1031  }
1032 }
unsigned int _axis_2d
Out of plane axis when crack is treated as 2D.
RealVectorValue calculateCrackFrontDirection(const Point &crack_front_point, const RealVectorValue &tangent_direction, const CRACK_NODE_TYPE ntype, const std::size_t crack_front_point_index=0) const
Compute the direction of crack extension for a given point on the crack front.
Real _overall_length
Overall length of the crack.
void fillRow(unsigned int r, const libMesh::TypeVector< Real > &v)
void updateDataForCrackDirection()
Update the data structures used to determine the crack front direction vectors such as crack mouth co...
auto norm() const -> decltype(std::norm(Real()))
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
enum CrackFrontDefinition::END_DIRECTION_METHOD _end_direction_method
std::vector< Real > _distances_along_front
Vector of distances along the crack front.
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
const CrackFrontPointsProvider * _crack_front_points_provider
Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points...
bool hasAngleAlongFront() const
Whether the distance along the crack front is available as an angle.
std::vector< RealVectorValue > _crack_plane_normals
Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true...
static const Real _tol
Tolerance used in geometric calculations.
std::vector< RankTwoTensor > _rot_matrix
Vector of rotation matrices along the crack front.
enum CrackFrontDefinition::CRACK_GEOM_DEFINITION _geom_definition_method
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
CRACK_NODE_TYPE
Enum used to define the type of the nodes on the crack front (end or middle)
bool _closed_loop
Whether the crack forms a closed loop.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
std::vector< Real > _strain_along_front
Vector of tangential strain along the crack front.
std::vector< RealVectorValue > _crack_directions
Vector of crack extension directions along the crack front.
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
RealVectorValue _crack_plane_normal
Vector normal to the crack plane of a planar crack.
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
virtual const std::vector< RealVectorValue > getCrackPlaneNormals(unsigned int) const =0
get a set of normal vectors along a crack front from a XFEM GeometricCutUserObject ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< RealVectorValue > _tangent_directions
Vector of tangent directions along the crack front.
std::vector< dof_id_type > _ordered_crack_front_nodes
Crack front nodes ordered from the start to end of the crack front.
void mooseError(Args &&... args) const
const ConsoleStream _console
RealVectorValue _crack_tangent_vector_end_2
Fixed vector optionally used to define crack tangent direction at end 2 of crack front.
std::vector< Real > _angles_along_front
Vector of angles along the crack front.
std::vector< std::pair< Real, Real > > _segment_lengths
Vector of segment lengths along the crack front.
RealVectorValue _crack_tangent_vector_end_1
Fixed vector optionally used to define crack tangent direction at end 1 of crack front.
bool _treat_as_2d
Whether to treat the model as 2D for computation of fracture integrals.
const Real pi
RealVectorValue _crack_mouth_coordinates
Coordinates of crack mouth.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ updateDataForCrackDirection()

void CrackFrontDefinition::updateDataForCrackDirection ( )
protected

Update the data structures used to determine the crack front direction vectors such as crack mouth coordinates.

Definition at line 1035 of file CrackFrontDefinition.C.

Referenced by updateCrackFrontGeometry().

1036 {
1037  if (_crack_mouth_boundary_ids.size() > 0)
1038  {
1040 
1041  std::set<Node *> crack_mouth_nodes;
1042  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
1043  for (auto nd = bnd_nodes.begin(); nd != bnd_nodes.end(); ++nd)
1044  {
1045  const BndNode * bnode = *nd;
1046  BoundaryID boundary_id = bnode->_bnd_id;
1047 
1048  for (std::size_t ibid = 0; ibid < _crack_mouth_boundary_ids.size(); ++ibid)
1049  {
1050  if (boundary_id == _crack_mouth_boundary_ids[ibid])
1051  {
1052  crack_mouth_nodes.insert(bnode->_node);
1053  break;
1054  }
1055  }
1056  }
1057 
1058  for (auto nit = crack_mouth_nodes.begin(); nit != crack_mouth_nodes.end(); ++nit)
1059  {
1060  _crack_mouth_coordinates += **nit;
1061  }
1062  _crack_mouth_coordinates /= static_cast<Real>(crack_mouth_nodes.size());
1063 
1064  if (_has_symmetry_plane)
1066  }
1067 
1069  {
1071 
1072  // Get 3 nodes on crack front
1073  std::size_t num_points = getNumCrackFrontPoints();
1074  if (num_points < 3)
1075  {
1076  mooseError("Crack front must contain at least 3 nodes to use CurvedCrackFront option");
1077  }
1078  std::size_t start_id;
1079  std::size_t mid_id;
1080  std::size_t end_id;
1081 
1082  if (_closed_loop)
1083  {
1084  start_id = 0;
1085  mid_id = (num_points - 1) / 3;
1086  end_id = 2 * mid_id;
1087  }
1088  else
1089  {
1090  start_id = 0;
1091  mid_id = (num_points - 1) / 2;
1092  end_id = num_points - 1;
1093  }
1094  const Point * start = getCrackFrontPoint(start_id);
1095  const Point * mid = getCrackFrontPoint(mid_id);
1096  const Point * end = getCrackFrontPoint(end_id);
1097 
1098  // Create two vectors connecting them
1099  RealVectorValue v1 = *mid - *start;
1100  RealVectorValue v2 = *end - *mid;
1101 
1102  // Take cross product to get normal
1103  _crack_plane_normal = v1.cross(v2);
1105 
1106  // Make sure they're not collinear
1107  RealVectorValue zero_vec(0.0);
1109  {
1110  mooseError("Nodes on crack front are too close to being collinear");
1111  }
1112  }
1113 }
bool _has_symmetry_plane
Whether the crack plane is also a symmetry plane in the model.
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.
BoundaryID _bnd_id
std::vector< BoundaryID > _crack_mouth_boundary_ids
IDs of boundaries used to define location of crack mouth.
Node * _node
static const Real _tol
Tolerance used in geometric calculations.
std::size_t getNumCrackFrontPoints() const
Get the number of points defining the crack front as a set of line segments.
TypeVector< Real > unit() const
bool _closed_loop
Whether the crack forms a closed loop.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
boundary_id_type BoundaryID
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
RealVectorValue _crack_plane_normal
Vector normal to the crack plane of a planar crack.
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
MooseMesh & _mesh
Reference to the mesh.
unsigned int _symmetry_plane
Which plane is the symmetry plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode *> ConstBndNodeRange
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode *> * getBoundaryNodeRange()
RealVectorValue _crack_mouth_coordinates
Coordinates of crack mouth.
enum CrackFrontDefinition::DIRECTION_METHOD _direction_method

◆ updateNumberOfCrackFrontPoints()

void CrackFrontDefinition::updateNumberOfCrackFrontPoints ( const std::size_t  num_points)

Change the number of crack front nodes.

As the crack grows, the number of crack fronts nodes may keep increasing in many cases.

Definition at line 1181 of file CrackFrontDefinition.C.

Referenced by MeshCut2DFractureUserObject::initialize(), and CrackMeshCut3DUserObject::refineFront().

1182 {
1183  _num_points_from_provider = num_points;
1184 }
std::size_t _num_points_from_provider
Number of points coming from the CrackFrontPointsProvider.

◆ usingMeshCutter()

bool CrackFrontDefinition::usingMeshCutter ( ) const
inline

Is the crack defined by a mesh cutter object.

Returns
true if using a mesh cutter

Definition at line 130 of file CrackFrontDefinition.h.

Referenced by JIntegral::initialSetup(), and DomainIntegralQFunction::initialSetup().

130 { return _use_mesh_cutter; }
bool _use_mesh_cutter
Whether to describe the crack as a mesh cutter.

◆ validParams()

InputParameters CrackFrontDefinition::validParams ( )
static

Definition at line 24 of file CrackFrontDefinition.C.

25 {
27  params.addClassDescription("Used to describe geometric characteristics of the crack front for "
28  "fracture integral calculations");
31  params.set<bool>("use_displaced_mesh") = false;
32 
33  params.addRelationshipManager("ElementSideNeighborLayers",
35  [](const InputParameters &, InputParameters & rm_params)
36  { rm_params.set<unsigned short>("layers") = 2; });
37  return params;
38 }
static InputParameters validParams()
T & set(const std::string &name, bool quiet_mode=false)
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
void addCrackFrontDefinitionParams(InputParameters &params)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _angles_along_front

std::vector<Real> CrackFrontDefinition::_angles_along_front
protected

Vector of angles along the crack front.

Definition at line 306 of file CrackFrontDefinition.h.

Referenced by getAngleAlongFront(), and updateCrackFrontGeometry().

◆ _aux

AuxiliarySystem& CrackFrontDefinition::_aux
protected

Reference to the auxiliary system.

Definition at line 287 of file CrackFrontDefinition.h.

◆ _axis_2d

unsigned int CrackFrontDefinition::_axis_2d
protected

Out of plane axis when crack is treated as 2D.

Definition at line 346 of file CrackFrontDefinition.h.

Referenced by getCrackFrontNodes(), and updateCrackFrontGeometry().

◆ _closed_loop

bool CrackFrontDefinition::_closed_loop
protected

Whether the crack forms a closed loop.

Definition at line 344 of file CrackFrontDefinition.h.

Referenced by createQFunctionRings(), initialSetup(), orderCrackFrontNodes(), updateCrackFrontGeometry(), and updateDataForCrackDirection().

◆ _crack_direction_vector

RealVectorValue CrackFrontDefinition::_crack_direction_vector
protected

Fixed vector optionally used to define crack extension direction.

Definition at line 314 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), and CrackFrontDefinition().

◆ _crack_direction_vector_end_1

RealVectorValue CrackFrontDefinition::_crack_direction_vector_end_1
protected

Fixed vector optionally used to define crack extension direction at end 1 of crack front.

Definition at line 316 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), and CrackFrontDefinition().

◆ _crack_direction_vector_end_2

RealVectorValue CrackFrontDefinition::_crack_direction_vector_end_2
protected

Fixed vector optionally used to define crack extension direction at end 2 of crack front.

Definition at line 318 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), and CrackFrontDefinition().

◆ _crack_directions

std::vector<RealVectorValue> CrackFrontDefinition::_crack_directions
protected

Vector of crack extension directions along the crack front.

Definition at line 300 of file CrackFrontDefinition.h.

Referenced by getCrackDirection(), and updateCrackFrontGeometry().

◆ _crack_front_node_to_node_map

std::map<std::pair<dof_id_type, std::size_t>, std::set<dof_id_type> > CrackFrontDefinition::_crack_front_node_to_node_map
protected

Data structure used to store information about topological rings Key is a pair of the crack front node index and ring id Data is a set of the IDs of the nodes in the ring for that crack front node.

Definition at line 369 of file CrackFrontDefinition.h.

Referenced by createQFunctionRings(), and isNodeInRing().

◆ _crack_front_points

std::vector<Point> CrackFrontDefinition::_crack_front_points
protected

Vector of points along the crack front.

Definition at line 296 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), getCrackFrontPoint(), getNumCrackFrontPoints(), initialize(), and initialSetup().

◆ _crack_front_points_provider

const CrackFrontPointsProvider* CrackFrontDefinition::_crack_front_points_provider
protected

Pointer to a CrackFrontPointsProvider object optionally used to define the crack front points.

Definition at line 381 of file CrackFrontDefinition.h.

Referenced by initialize(), initialSetup(), and updateCrackFrontGeometry().

◆ _crack_mouth_boundary_ids

std::vector<BoundaryID> CrackFrontDefinition::_crack_mouth_boundary_ids
protected

IDs of boundaries used to define location of crack mouth.

Definition at line 326 of file CrackFrontDefinition.h.

Referenced by initialSetup(), and updateDataForCrackDirection().

◆ _crack_mouth_boundary_names

std::vector<BoundaryName> CrackFrontDefinition::_crack_mouth_boundary_names
protected

Names of boundaries used to define location of crack mouth.

Definition at line 324 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), hasAngleAlongFront(), and initialSetup().

◆ _crack_mouth_coordinates

RealVectorValue CrackFrontDefinition::_crack_mouth_coordinates
protected

Coordinates of crack mouth.

Definition at line 332 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), updateCrackFrontGeometry(), and updateDataForCrackDirection().

◆ _crack_plane_normal

RealVectorValue CrackFrontDefinition::_crack_plane_normal
protected

Vector normal to the crack plane of a planar crack.

Definition at line 334 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), calculateRThetaToCrackFront(), updateCrackFrontGeometry(), and updateDataForCrackDirection().

◆ _crack_plane_normals

std::vector<RealVectorValue> CrackFrontDefinition::_crack_plane_normals
protected

Vector normals to a nonplanar crack described by the cutter mesh when _use_mesh_cutter = true.

Definition at line 336 of file CrackFrontDefinition.h.

Referenced by calculateCrackFrontDirection(), calculateRThetaToCrackFront(), initialize(), initialSetup(), and updateCrackFrontGeometry().

◆ _crack_tangent_vector_end_1

RealVectorValue CrackFrontDefinition::_crack_tangent_vector_end_1
protected

Fixed vector optionally used to define crack tangent direction at end 1 of crack front.

Definition at line 320 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and updateCrackFrontGeometry().

◆ _crack_tangent_vector_end_2

RealVectorValue CrackFrontDefinition::_crack_tangent_vector_end_2
protected

Fixed vector optionally used to define crack tangent direction at end 2 of crack front.

Definition at line 322 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and updateCrackFrontGeometry().

◆ _direction_method

enum CrackFrontDefinition::DIRECTION_METHOD CrackFrontDefinition::_direction_method
protected

◆ _disp_x_var_name

std::string CrackFrontDefinition::_disp_x_var_name
protected

Names of the x, y, and z displacement variables.

Definition at line 353 of file CrackFrontDefinition.h.

Referenced by calculateTangentialStrainAlongFront(), and CrackFrontDefinition().

◆ _disp_y_var_name

std::string CrackFrontDefinition::_disp_y_var_name
protected

◆ _disp_z_var_name

std::string CrackFrontDefinition::_disp_z_var_name
protected

◆ _distances_along_front

std::vector<Real> CrackFrontDefinition::_distances_along_front
protected

Vector of distances along the crack front.

Definition at line 304 of file CrackFrontDefinition.h.

Referenced by getDistanceAlongFront(), and updateCrackFrontGeometry().

◆ _end_direction_method

enum CrackFrontDefinition::END_DIRECTION_METHOD CrackFrontDefinition::_end_direction_method
protected

◆ _first_ring

std::size_t CrackFrontDefinition::_first_ring
protected

Numer of elements from crack tip to first topological ring.

Definition at line 364 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition().

◆ _geom_definition_method

enum CrackFrontDefinition::CRACK_GEOM_DEFINITION CrackFrontDefinition::_geom_definition_method
protected

◆ _has_symmetry_plane

bool CrackFrontDefinition::_has_symmetry_plane
protected

Whether the crack plane is also a symmetry plane in the model.

Definition at line 348 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and updateDataForCrackDirection().

◆ _intersecting_boundary_ids

std::vector<BoundaryID> CrackFrontDefinition::_intersecting_boundary_ids
protected

IDs of boundaries that intersect crack at its ends.

Definition at line 330 of file CrackFrontDefinition.h.

Referenced by initialSetup(), and isNodeOnIntersectingBoundary().

◆ _intersecting_boundary_names

std::vector<BoundaryName> CrackFrontDefinition::_intersecting_boundary_names
protected

Names of boundaries that intersect crack at its ends.

Definition at line 328 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), initialSetup(), and orderCrackFrontNodes().

◆ _is_cutter_modified

bool CrackFrontDefinition::_is_cutter_modified
protected

Indicator that shows if the cutter mesh is modified or not in the calculation step.

Definition at line 342 of file CrackFrontDefinition.h.

Referenced by initialize(), and isCutterModified().

◆ _is_point_on_intersecting_boundary

std::vector<bool> CrackFrontDefinition::_is_point_on_intersecting_boundary
protected

Vector of bools indicating whether individual crack front points are on an intersecting boundary.

Definition at line 374 of file CrackFrontDefinition.h.

Referenced by DomainIntegralQFunction(), initialize(), and initialSetup().

◆ _j_integral_radius_inner

std::vector<Real> CrackFrontDefinition::_j_integral_radius_inner
protected

Vector of inner radii of the rings used for geometric q functions.

Definition at line 376 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and DomainIntegralQFunction().

◆ _j_integral_radius_outer

std::vector<Real> CrackFrontDefinition::_j_integral_radius_outer
protected

Vector of outer radii of the rings used for geometric q functions.

Definition at line 378 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and DomainIntegralQFunction().

◆ _last_ring

std::size_t CrackFrontDefinition::_last_ring
protected

Numer of elements from crack tip to last topological ring.

Definition at line 362 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and createQFunctionRings().

◆ _mesh

MooseMesh& CrackFrontDefinition::_mesh
protected

◆ _num_points_from_provider

std::size_t CrackFrontDefinition::_num_points_from_provider
protected

Number of points coming from the CrackFrontPointsProvider.

Definition at line 383 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), initialize(), initialSetup(), and updateNumberOfCrackFrontPoints().

◆ _ordered_crack_front_nodes

std::vector<dof_id_type> CrackFrontDefinition::_ordered_crack_front_nodes
protected

◆ _overall_length

Real CrackFrontDefinition::_overall_length
protected

Overall length of the crack.

Definition at line 312 of file CrackFrontDefinition.h.

Referenced by updateCrackFrontGeometry().

◆ _q_function_rings

bool CrackFrontDefinition::_q_function_rings
protected

Whether topological rings are used to define the q functions.

Definition at line 360 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and initialSetup().

◆ _q_function_type

MooseEnum CrackFrontDefinition::_q_function_type
protected

Method used to define the q function.

Definition at line 371 of file CrackFrontDefinition.h.

Referenced by initialize(), and initialSetup().

◆ _rot_matrix

std::vector<RankTwoTensor> CrackFrontDefinition::_rot_matrix
protected

Vector of rotation matrices along the crack front.

Definition at line 310 of file CrackFrontDefinition.h.

Referenced by rotateFromCrackFrontCoordsToGlobal(), rotateToCrackFrontCoords(), and updateCrackFrontGeometry().

◆ _segment_lengths

std::vector<std::pair<Real, Real> > CrackFrontDefinition::_segment_lengths
protected

Vector of segment lengths along the crack front.

Definition at line 302 of file CrackFrontDefinition.h.

Referenced by getCrackFrontBackwardSegmentLength(), getCrackFrontForwardSegmentLength(), and updateCrackFrontGeometry().

◆ _strain_along_front

std::vector<Real> CrackFrontDefinition::_strain_along_front
protected

Vector of tangential strain along the crack front.

Definition at line 308 of file CrackFrontDefinition.h.

Referenced by calculateTangentialStrainAlongFront(), finalize(), getCrackFrontTangentialStrain(), initialSetup(), and updateCrackFrontGeometry().

◆ _symmetry_plane

unsigned int CrackFrontDefinition::_symmetry_plane
protected

Which plane is the symmetry plane.

Definition at line 350 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), and updateDataForCrackDirection().

◆ _t_stress

bool CrackFrontDefinition::_t_stress
protected

Whether the T-stress is being computed.

Definition at line 358 of file CrackFrontDefinition.h.

Referenced by CrackFrontDefinition(), execute(), finalize(), getCrackFrontTangentialStrain(), and initialSetup().

◆ _tangent_directions

std::vector<RealVectorValue> CrackFrontDefinition::_tangent_directions
protected

Vector of tangent directions along the crack front.

Definition at line 298 of file CrackFrontDefinition.h.

Referenced by calculateRThetaToCrackFront(), calculateTangentialStrainAlongFront(), getCrackFrontTangent(), and updateCrackFrontGeometry().

◆ _tol

const Real CrackFrontDefinition::_tol = 1e-10
staticprotected

◆ _treat_as_2d

bool CrackFrontDefinition::_treat_as_2d
protected

◆ _use_mesh_cutter

bool CrackFrontDefinition::_use_mesh_cutter
protected

The documentation for this class was generated from the following files: