Xfem
The Xfem Plugin
Public Member Functions | Protected Attributes | List of all members
XfemTools Class Reference

A simple class to provide xfem tools. More...

#include <xfemTools.h>

Inheritance diagram for XfemTools:
Inheritance graph
[legend]
Collaboration diagram for XfemTools:
Collaboration graph
[legend]

Public Member Functions

 XfemTools (XfemMesh *xmesh, XfemOptions &xfemOptions, GmSimulationData *simulation, QList< GmpFemPhysics * > &physics, const GmLogCategory &logger)
 Constructor for a Xfem tools used in Xfem process. More...
 
virtual ~XfemTools ()
 Destructor.
 
int pointDimension () const
 Returns the dimension of each fracture point. Equal to the mesh dimension.
 
virtual bool unitVectSegment (GmMatrix Xg, GmMatrix &uVec) const
 
virtual bool unitVectPlane (const GmMatrix &Xg, GmMatrix &uVec, GmMatrix &uVec2, GmMatrix &uVec3, GmMatrix &ROT) const
 
virtual bool intersect3D_2Planes (const GmMatrix &Xg, GmMatrix &uVec, const GmMatrix &uVec2, GmMatrix &uVec3, GmMatrix &ROT, int &inter, const double &characteristicLength) const
 
virtual bool intersect3D_SegmentPlane (const GmMatrix &P0, const GmMatrix &P1, const GmMatrix &Pn2, GmMatrix &n2, GmMatrix &Line, int &inter) const
 
virtual bool testIntersect3D_2Planes (const GmMatrix &Pn1, GmMatrix &n1, const GmMatrix &Pn2, GmMatrix &n2, GmMatrix &Line, int &inter, XfemMesh *xmesh, XfemElement *xe, XfemElement *xe2) const
 
virtual bool intersectVolume (GmMatrix &nodes, QList< GmVector > &element, QList< GmVector > &fracData, GmMatrix &iNodes, QList< GmVector > &iData) const
 returns the intersection between volume and fracture More...
 
virtual bool RectangularRegion (double Lch, GmMatrix Xg, GmMatrix uVec, GmMatrix &polygonVert) const
 
virtual bool pointInConvexPolygon (double tol, GmMatrix polygonVert, GmVector Xip, int &nIn) const
 
virtual bool polygonCentroid (const GmMatrix &polygonVert, GmVector &Xc) const
 Computes the polygon centroid.
 
virtual bool defIPinRegion (XfemMesh *xmesh, GmMatrix polygonVert, QList< GmVector > &IPInfo, GmVector crackInfo) const
 
virtual bool CutPolygonWithPolyline (XfemMesh *xmesh, GmVector crackInfo, GmMatrix &polygonVert, int idCrack) const
 
virtual bool defIPinCircle (XfemMesh *xmesh, GmVector crackInfo, QList< GmVector > &IPInfo) const
 
virtual bool cycInc (int iVert, int nVert, int &nCycInc) const
 
virtual bool parametricDist (GmVector S1, GmVector S2, GmVector N1, GmVector N2, double tol, double &tValue, bool &bIntersects) const
 
virtual bool CutPLineWithPLine (XfemMesh *xmesh, double tol, GmVector Seg1node1, GmVector Seg1node2, GmVector Seg2node1, GmVector Seg2node2, GmVector &NewCrackTip, bool &bCut, bool &bCutHeadVertexA, bool &bCutTailVertexA, bool &bCutHeadVertexB, bool &bCutTailVertexB) const
 
virtual bool CoordsFromParam (GmVector Seg2node1, GmVector Seg2node2, double tValue, GmVector &NewCrackTip) const
 
virtual bool principalStresses2D (GmVector stress, GmVector &Ps) const
 
virtual bool principalStressDirection2D (GmVector aStress, GmVector aPStress, int nPS, GmVector &uPs) const
 
virtual bool compPropagExtension (XfemMesh *xmesh, XfemFracture *fracture, int nside, GmMatrix Xnodes, GmVector Xg, GmVector aPropDirection, QList< GmVector > &aCrack, bool isHead, GmMatrix crackInfo) const
 
virtual bool testCompPropagExtension3D (XfemMesh *xmesh, XfemElement *xe, QList< int > elemList, GmVector v_n, GmMatrix planeCoord, GmMatrix Xg, QList< GmVector > &aCrack, int &elemId, bool &next) const
 
virtual bool compPropagExtension3D (XfemMesh *xmesh, XfemElement *xe, QList< int > elemList, GmVector v_n, GmMatrix &planeCoord, GmMatrix Xg, QList< GmVector > &aCrack, int &elemId, bool &next) const
 
virtual bool caracteristiclength (GmMatrix Xnodes, double &Lch) const
 get caracteristic length
 
virtual bool setZeroVeriTol (GmMatrix &Xnodes, double &Lch) const
 set zero verifying tolerance
 
virtual bool parametricSegmentInMesh (XfemMesh *xmesh, XfemFracture *fracture, double tol) const
 \ class XfemTools Purpose : Checks the intersection between segment C {(xc1, yc1), (xc2, yc2)} and a unstructured xfemMesh tVector contains all intersection coordinates ordered from minimum to maximum value
 
virtual bool checkAndInsertTips (QList< double > &tVec) const
 
virtual bool insertionSortWORepeated (QList< double > &a, double tol) const
 
virtual bool insertionSort (QList< double > &tVec) const
 
virtual bool insertionSortWORepeatedint (QList< int > &a, double tol) const
 
virtual bool insertionSortint (QList< int > &tVec) const
 
virtual bool orient2D (double xa, double ya, double xb, double yb, double xc, double yc, double &det) const
 
virtual bool defElemCuts (XfemMesh *xmesh) const
 
virtual bool defElemSets (XfemMesh *xmesh) const
 
virtual bool setIntPoints (XfemMesh *xmesh, GmCell *e, QList< GmMatrix > subElem) const
 
virtual bool createSubElem (XfemMesh *xmesh, GmCell *e, QList< GmMatrix > &subElem) const
 
virtual bool setEnrichedData (XfemMesh *xmesh, GmCell *e) const
 
virtual bool setGhostNodes (XfemMesh *xmesh) const
 
virtual bool setGhostNodes3D (XfemMesh *xmesh) const
 
virtual bool loadSubElement (XfemMesh *xmesh, GmCell *e, GmMatrix subElemNode, int type, int rule, bool isFracture) const
 
void setIntegrationRule (int rule)
 
virtual bool checkSegmentInRegularMesh (XfemMesh *xmesh, GmMatrix segCrackCoord, GmVector &mElemCutPos, double tol) const
 
virtual bool intPointLine (GmVector N1, GmVector N2, GmVector crack, double tol, int &nInter) const
 
virtual bool intSegment (GmVector N1, GmVector N2, GmVector crack, double tol, int &nInter) const
 
virtual bool inSphere (GmMatrix crack, GmVector Ip, double characteristicLength, double tol, int &nInter) const
 
virtual bool dividePolygonWithSegment (GmCell *e, GmMatrix S, QList< GmMatrix > &subElemData, double tol) const
 
virtual bool dividePolygonWithSeveralSegments (XfemMesh *xmesh, GmCell *e, QList< GmMatrix > &subElemData, double tol) const
 
virtual bool addEnrichedDof (XfemMesh *xmesh, int numDof, const QString type) const
 
virtual bool setCrackFrontData (XfemMesh *xmesh) const
 
virtual bool defDofSets (XfemMesh *xmesh) const
 Define elements DOF.
 
virtual bool mechanicDofSets (XfemMesh *xmesh, int old, int &numDof, QList< GmVector > aCrack) const
 
virtual bool hydroMecDofSets (XfemMesh *xmesh, int old, int &numDof, QList< GmVector > aCrack) const
 
virtual bool subElemDiv (XfemMesh *xmesh) const
 
virtual bool subElemDiv3D (XfemMesh *xmesh) const
 
void test () const
 
void test2 () const
 
void fillFractureRotationMatrix (GmCell *e, const GmShape *shp, GmMatrix J, GmMatrix &R) const
 
virtual bool pointOnSide (GmCell *e, GmMatrix xGhost, GmVector &xIp, int side) const
 
virtual bool fillInterCrackNodalLevelSet (GmVector Seg1node1, GmVector Seg1node2, GmVector Seg2node1, GmVector &interactingCraks) const
 
void fillNodalLevelSetMatrix (GmMatrix X, GmMatrix Xg, GmMatrix &H) const
 Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM. More...
 
void fillGaussLevelSetMatrix (GmMatrix X, GmMatrix Xg, GmMatrix &H) const
 Compute Gauss levelset function (H) The minimum distance between a point(integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM. More...
 
void fillInteractingCraksNodalLevelSets (GmCell *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &nodalLevelSet) const
 computation of Additional enrichment fuctions for cracks intersection considering element nodes and integration point
 
void fillInteractingCraksGaussLevelSets (GmCell *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &gaussLevelSet) const
 computation of Additional enrichment fuctions for cracks intersection considering element nodes and integration point
 
virtual bool correctDOF (XfemMesh *xmesh, GmCell *e, XfemElement *xe, XfemEnrichedElementData *exData, QList< XfemFracture * > fractureData, QList< GmVector > &aCrack, int &old, bool &add) const
 Add DOFs to adjacent elements to an intersection.
 
virtual bool deleteNodeDOF (XfemMesh *xmesh, double value) const
 
virtual bool checkDOF (XfemMesh *xmesh, double value, QList< int > &enrichList) const
 
virtual bool addChangedElem (XfemMesh *xmesh, double value, QList< int > &enrichList) const
 
virtual bool saveEnrichmentFunctions (XfemMesh *xmesh, double value) const
 
virtual bool alterEnrichmentFunctions (XfemMesh *xmesh, double value) const
 
virtual bool createDofList (XfemMesh *xmesh, const QString type) const
 
virtual bool checkData (XfemMesh *xmesh) const
 check DOFs and Enrichment Functions of adjacent elements to an intersection More...
 
virtual bool getCrackPlaneStresses (GmVector Sxy, GmMatrix ROT, GmVector &Stn) const
 
virtual bool getCrackPlaneStrains (GmVector Exy, GmMatrix ROT, GmVector &Etn) const
 
virtual bool vectorialToTensorial (GmVector &Av, GmMatrix &Am, unsigned sc, QString type="strain", bool mode=true) const
 

Protected Attributes

GmValueAccessor_nodeAcc
 Node accessor.
 
XfemGaussAccessor_stressAcc
 Sets enriched gauss accessor for stress.
 
XfemGaussAccessor_strainAcc
 Sets enriched gauss accessor for strain.
 
GmCellAccessor_strengthAcc
 Sets enriched gauss accessor for strength.
 
int _ruleSet
 sets integration rule
 
XfemOptions _xfemOptions
 The set of xfem options.
 
GmSimulationData_SimulationData
 Simulation data.
 
QList< GmpFemPhysics * > _physics
 
int _ndim
 The dimension of each coordinate.
 
const GmLogCategory_logger
 The logger object used to emmit messages.
 

Detailed Description

A simple class to provide xfem tools.

Divides several Polygons by several segments for cases of multiple fractures in a element.

Divides Polygon X by a segment S { S1(xs1,ys1); S2(xs2,ys2)} into two different polygons.

Purpose : define if a point is inside a sphere Return: 1 = P is inside S 0 = P is not inside S The general equation of a sphere is: (x - a)² + (y - b)² + (z - c)² = r², where (a, b, c) represents the center of the sphere, r represents the radius, and x, y, and z are the coordinates of the points on the surface of the sphere.

Purpose : Compute the intersection between point crack (xc, yc,zc) and segment S = node1(xs1, ys1,zs1) , Node2(xs2, ys2,zs2) nInter = 0 - No Intersection nInter = 3 - Intersection in segment nInter = 1 - Intersection in segment's first point (s1) nInter = 2 - Intersection in segment's second point (s2)

Purpose : Compute the intersection between point crack (xc, yc) and segment S = node1(xs1, ys1) , Node2(xs2, ys2) nInter = 0 - No Intersection nInter = 3 - Intersection in segment nInter = 1 - Intersection in segment's first point (s1) nInter = 2 - Intersection in segment's second point (s2)

Purpose: Checks the position of nodes of a segment C (crackPoint1, crackPoint2) in a regular grid mesh.

Check and insert the crack tips Define crack tips in tail and head values.

Computes area of triangle defined by segment a,b and point c The signal of the area indicates the position of the point relative to the segment.

Compute the parametric position of line C (Seg1(xc1,yc1), Seg2(xc2,yc2)) on intersection with segment S (Node1(xs1,ys1), Node2(xs2,ys2))

Returns cartesian coordinates of parametric position (tValue) in segment (x1,y1),(x2,y2)

Checks the intersection between Polyline A and B and cuts B.

Sort vector values from minimum to maximum.

Clear repeated value.

Computes the polygon centroid

Checks point relative position with convex polygon

This is done by checking if segment that connects point xc1,yc1 and the polygon centroid (xc2,yc2) intersects any of the polygon sides

outside polygon: nPointInConvexPolygon = -1 in polygon border: nPointInConvexPolygon = 0 inside polygon: nPointInConvexPolygon = 1

Compute the cycle parameter

bCut is true if a cut was made

aPLsubB1 and aPLsubB2 are the coords of the two resulting PLines

bCutInVertexA is true if intersection is in a vertex of polyline A

bCutInVertexB is true if intersection is in a vertex of polyline B

Warning: doesn't work for more than one intersection (finishes in the first intersection)

check and divide polygon if is cut by a segment

Verify the integration points inside semicircle to check propagation criterion

Principal stresses determination

The propagation direction is the direction of minimum principle stress of the computed average !Get the direction perpendicular to the maximum principal stress (ie, perpendicular to the compressive stress)

For each region with propagation, computes new fracture paths

nInter is defined for each node of the segment nInter = 0 - Outside the element nInter = 1 to 4 - Intersection in Edge (number of edge) nInter = -1 to -4 - Intersection in Node (number of node) nInter = 10 - In the element

Both nodes must intersect/be inside the same element (nInterElem) for the output to be generated

Matrix polygVert has the vertex coordinated which is ordered in counterclockwise Matrix S has the crack segment coordinates {S1; S2}

Set integration points for each sub elements

create sub elements with TetGen Library

creates and loads subelements

save cut element for each crack segement (Elem, {side 1, side 2} (+) or {node1 , node 2} (-))

Fills _elemCutInfo vector with global informations about the number of fracture crossing each element

_elemCutInfo = {iElem, nFrac, Type, # 1st frac, # 2nd frac,...}

Adds ghost nodes into xfemMesh and inserts index for each crackPoints

set Crack Front Data

Create global DOF list

Add enriched DOF due to cracks interaction

Define DOF sets for Mechanic physics

Define DOF sets for HydroMechanic physics

divide elements and load integration points

Return the fracture rotation matrix

c Returns point C, with is immediatelly (dist=tol) to the positive c or the negative side (depending on nSign) of segment a-b c Point C is located perpendicular to the paremetric position tVal of the segment a-b

Constructor & Destructor Documentation

◆ XfemTools()

XfemTools::XfemTools ( XfemMesh _xmesh,
XfemOptions xfemOptions,
GmSimulationData simulation,
QList< GmpFemPhysics * > &  physics,
const GmLogCategory logger 
)

Constructor for a Xfem tools used in Xfem process.

Provides functions used in pre() and pos().

IMPORTANT: The XfemTools takes ownership of the given data vector and will destroy it on its destructor.

Member Function Documentation

◆ addChangedElem()

bool XfemTools::addChangedElem ( XfemMesh xmesh,
double  value,
QList< int > &  enrichList 
) const
virtual

Add adjacent elements to an intersection to the list to be updated for the assembler

◆ alterEnrichmentFunctions()

bool XfemTools::alterEnrichmentFunctions ( XfemMesh xmesh,
double  value 
) const
virtual

alter Enrichment Functions

◆ checkData()

bool XfemTools::checkData ( XfemMesh xmesh) const
virtual

check DOFs and Enrichment Functions of adjacent elements to an intersection

< check if a Crack DOF set changed due to fracture intersection or coexistence with other one

◆ checkDOF()

bool XfemTools::checkDOF ( XfemMesh xmesh,
double  value,
QList< int > &  enrichList 
) const
virtual

check DOFs to adjacent elements to an intersection

◆ compPropagExtension()

bool XfemTools::compPropagExtension ( XfemMesh xmesh,
XfemFracture fracture,
int  nside,
GmMatrix  Xnodes,
GmVector  Xg,
GmVector  aPropDirection,
QList< GmVector > &  aCrack,
bool  isHead,
GmMatrix  crackInfo 
) const
virtual

\ class XfemTools For each region with propagation, computes new fracture paths

Define a segment C that starts in the fracture tip and ends outside 4*Lch !with the propagation angle

Define a segment C that starts in the fracture tip and ends outside 4*Lch !with the propagation angle

◆ compPropagExtension3D()

bool XfemTools::compPropagExtension3D ( XfemMesh xmesh,
XfemElement xe2,
QList< int >  elemList,
GmVector  v_n,
GmMatrix planeCoord,
GmMatrix  Xg,
QList< GmVector > &  aCrack,
int &  elemId,
bool &  next 
) const
virtual

\ class XfemTools For each region with propagation, computes new fracture paths

◆ CutPolygonWithPolyline()

bool XfemTools::CutPolygonWithPolyline ( XfemMesh xmesh,
GmVector  crackInfo,
GmMatrix polygonVert,
int  idCrack 
) const
virtual

Checks if 1st and last node of PolyLine is inside polygon

If polygon is cut in first vertex

◆ deleteNodeDOF()

bool XfemTools::deleteNodeDOF ( XfemMesh xmesh,
double  value 
) const
virtual

Delete old specific node DOF to be modified by the following subroutines

◆ fillGaussLevelSetMatrix()

void XfemTools::fillGaussLevelSetMatrix ( GmMatrix  X,
GmMatrix  Xg,
GmMatrix H 
) const

Compute Gauss levelset function (H) The minimum distance between a point(integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM.

Param X The integration point coordinates matrix (xi,yi) Param Xg The ghost nodal coordinates matrix (xi,yi) Param H The level set vector (xi,yi)

◆ fillNodalLevelSetMatrix()

void XfemTools::fillNodalLevelSetMatrix ( GmMatrix  X,
GmMatrix  Xg,
GmMatrix H 
) const

Compute levelset function (H) The minimum distance between a point(nodes or integration point) and a segment (fracture) is determined. This function returns the signed distance function used to enrich the element for XFEM.

Param X The nodal coordinates matrix (xi,yi) Param Xg The ghost nodal coordinates matrix (xi,yi) Param H The level set vector (xi,yi)

◆ getCrackPlaneStrains()

bool XfemTools::getCrackPlaneStrains ( GmVector  Exy,
GmMatrix  ROT,
GmVector Etn 
) const
virtual

Transform Strains in global XY coordinate system to local crack plane coordinate system

◆ getCrackPlaneStresses()

bool XfemTools::getCrackPlaneStresses ( GmVector  Sxy,
GmMatrix  ROT,
GmVector Stn 
) const
virtual

Transform stresses in global XY coordinate system to local crack plane coordinate system

◆ intersect3D_2Planes()

bool XfemTools::intersect3D_2Planes ( const GmMatrix Pn1,
GmMatrix n1,
const GmMatrix Pn2,
GmMatrix n2,
GmMatrix Line,
int &  inter,
const double &  characteristicLength 
) const
virtual

Compute intersection of two planes Input: two planes Pn1 and Pn2 Output: Line = the intersection line (when it exists) Return inter: 0 = disjoint (no intersection) 1 = the two planes coincide 2 = intersection in the unique line

◆ intersect3D_SegmentPlane()

bool XfemTools::intersect3D_SegmentPlane ( const GmMatrix P0,
const GmMatrix P1,
const GmMatrix Pn2,
GmMatrix n2,
GmMatrix Point,
int &  inter 
) const
virtual

find the 3D intersection of a segment and a plane Input: S = a segment, and Pn = a plane = {Point V0; Vector n;} Output: *I0 = the intersect point (when it exists) Return: 0 = disjoint (no intersection) 1 = intersection in the unique point *I0 2 = the segment lies in the plane

◆ intersectVolume()

bool XfemTools::intersectVolume ( GmMatrix nodes,
QList< GmVector > &  element,
QList< GmVector > &  fracData,
GmMatrix iNodes,
QList< GmVector > &  iData 
) const
virtual

returns the intersection between volume and fracture

Compute the intersection between the Volume Mesh and all Fractures. @input : nodes, element and fracData @output: iNodes and iData Return true if the the intersection was successfully or False otherwise

◆ pointOnSide()

bool XfemTools::pointOnSide ( GmCell e,
GmMatrix  xGhost,
GmVector xIp,
int  side 
) const
virtual

Get point of segment based on parametric position

◆ saveEnrichmentFunctions()

bool XfemTools::saveEnrichmentFunctions ( XfemMesh xmesh,
double  value 
) const
virtual

fill Enrichment Functions

◆ setIntPoints()

bool XfemTools::setIntPoints ( XfemMesh xmesh,
GmCell e,
QList< GmMatrix subElem 
) const
virtual

< A linear quadrilateral cell with only 4 nodes

< A tetrahedron with 4 nodes

< A linear hexahedron (brick) with 8 nodes

< A bar cell with 2 nodes

< A linear quadrilateral cell with only 4 nodes

◆ testIntersect3D_2Planes()

bool XfemTools::testIntersect3D_2Planes ( const GmMatrix Pn1,
GmMatrix n1,
const GmMatrix Pn2,
GmMatrix n2,
GmMatrix Line,
int &  inter,
XfemMesh xmesh,
XfemElement xe,
XfemElement xe2 
) const
virtual

Compute intersection of two planes Input: two planes Pn1 and Pn2 Output: Line = the intersection line (when it exists) Return inter: 0 = disjoint (no intersection) 1 = the two planes coincide 2 = intersection in the unique line

◆ unitVectPlane()

bool XfemTools::unitVectPlane ( const GmMatrix Xg,
GmMatrix uVec,
GmMatrix uVec2,
GmMatrix uVec3,
GmMatrix ROT 
) const
virtual

Compute Unit Vector of a plane

◆ unitVectSegment()

bool XfemTools::unitVectSegment ( GmMatrix  Xg,
GmMatrix uVec 
) const
virtual

\Returns cossines of perpendicular unit vector of segment a-b

Parameters
XgThe ghost nodal coordinates matrix (xi,yi)
uVecThe perpendicular unit vector of segment (vx,vy)

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