Xfem
The Xfem Plugin
xfemMechanic.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2017 by Geomechanic group - Tecgraf/Puc-Rio
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
25 #ifndef _GEMA_XFEM_MECHANIC_H_
26 #define _GEMA_XFEM_MECHANIC_H_
27 
28 #include <gmpFemPhysicsCoupled.h>
29 #include <gmpMechanicalPhysics.h>
30 #include <gmpMechanicPoint.h>
31 
32 #include "xfemMesh.h"
33 
34 class GmpMechanicalPhysics;
35 class GmpHydraulic;
36 class GmGaussAccessor;
37 
45 template <class T, class F> class XfemPhysicsWrapper: public T
46 {
47 public:
48  XfemPhysicsWrapper(const char* physicsType, const char* objType, GmSimulationData* simulation, QString id, const GmLogCategory& logger)
49  : T(objType, simulation, id, "",
50  dynamic_cast<F*>(simulation->loader()->objectFactory(physicsType))->matFactory(simulation),
51  logger) {}
52 
53 protected:
57  virtual GmGaussAccessor* createGaussAttributeAccessor(GmElementMesh* mesh, QString id, int snum, bool locked,
58  Unit desiredUnit, const GmLogCategory& logger) const
59  {
60  XfemMesh* xmesh = dynamic_cast<XfemMesh*>(mesh);
61  assert(xmesh);
62  return xmesh->enrichedGaussAttributeAccessor(id, snum, locked, desiredUnit, logger);
63  }
64 };
65 
68 class XfemMechanic : public GmpFemPhysicsCoupled
69 {
70 public:
71  // constructor
72  XfemMechanic(const char* pluginType, GmSimulationData* simulation, QString id, QString description,
73  const GmpFemPhysicsCommonMaterialFactory* matFactory, const GmLogCategory& logger);
74  // destructor
75  virtual ~XfemMechanic();
76 
77  // Comments on the base class
78  virtual const char* pluginName() const { return "Xfem"; }
79 
80  virtual const char* pluginType() const { return _pluginType; }
81 
82  // set physic map
83  virtual const QVariantMap* physicsMetaDataMap();
84 
85  // returns the list of elements that had their dofs changed since the physics was create
86  virtual QList<int> changedElements() const;
87 
88  // clear the internal list used to track dof changes
89  virtual void clearChangedElements();
90  // clear the internal list used to track dof changes
91  virtual bool fillFixedEnrichedBC(QList<int>& nodes, QList<int>&dof, QList<double>& values) const;
92 
93  // Comments on the base class
94  virtual bool dofByElement(bool* fixed, bool* addOnly, bool* trackChanges) const;
95 
96  virtual const GmElementDof* dofMapping(const GmElement* e) const;
97 
98  virtual bool fixedNodalDofsBc(QList<int>& nodes, QList<int>&dof, QList<double>& values, bool* constantValues) const;
99 
100  virtual bool fixedNodalForcesBc(QList<int>& nodes, QList<int>&dof, QList<double>& values) const;
101 
102  virtual FemResultType fillElementDataForBc(const GmElement* e, const GmBoundaryCondition* bc, int bcIndex, int bcListIndex,
103  int border, GmpFemMatrixSet& elemMatrices, GmpFemVectorSet& elemVectors);
104 
105  virtual FemResultType fillElementData(const GmElement* e, GmpFemMatrixSet& elemMatrices, GmpFemVectorSet& elemVectors);
106 
107 protected:
108 
111  {
114 
115  // ------ NO ADDING BELOW THIS LINE
117  };
118 
121  {
124 
125 
126  // ------ NO ADDING BELOW THIS LINE
128  };
129 
130 
133  {
135 
136 
137  // ------ NO ADDING BELOW THIS LINE
139  };
140 
143  {
147 
148  // ------ NO ADDING BELOW THIS LINE
150  };
151 
152  virtual bool beforeElementStiffnessLoop(const GmpFemMatrixSet& elemMatrices, const GmpFemVectorSet& elemVectors);
153  virtual bool checkAndLoadPrivateData(LuaTable& table);
154  virtual void fillElementDisplacements(const GmElement* e, GmVector& ue, const int& nEnrich);
155  void fillEnhancedNuJumpMatrix(const GmElement* e, GmMatrix& Nu, const GmVector& N, const QList<int>& BottomLevelSet, const QList<int>& TopLevelSet, const GmVector& nodes, GmElementDof* dofMap, XfemEnrichedElementData* exData, const int& iSubCrack);
156  void fillEnhancedBuMatrix(const GmElement* e, const GmShape* shape, const GmVector& ncoord, const GmMatrix& X,
157  const GmMatrix& J, GmMatrix& Bu, const QList<int>& gaussLevelSet, const int& nEnrich, const GmVector& nodes, GmElementDof* dofMap, XfemEnrichedElementData* exData, const int& gaussIP);
158  virtual void fillEnhancedDof(const XfemElement* xe, QList<int>& iUe, const int& np);
159  void tipDOFTreat(const int& nelem, GmVector& nodes);
162  void fillInteractingCraksNodalLevelSets(const GmElement* e, XfemEnrichedElementData* exData, int nEnrich, int nCracks, QList<double>crackIndex, QList<GmMatrix>& nodalLevelSet);
163  void fillInteractingCraksGaussLevelSets(const GmElement* e, XfemEnrichedElementData* exData, int nEnrich, int nCracks, QList<double>crackIndex, QList<GmMatrix>& gaussLevelSet);
164  // computes the fracture rotation matrix
165  virtual void fillFractureRotationMatrix(const GmElement* e, const GmShape* shp, GmMatrix Je, GmMatrix &Rot);
166  //Return a list with the pair of ghost nodes of each fracture segment contained in this element
167  virtual bool getCrackNodePair(XfemEnrichedElementData* exData, QList<QList<int>>& pfNodes);
168  // remove repeted values
169  virtual bool insertionSortWORepeatedint(QList<int>& a, double tol);
170  // Sort vector values
171  virtual bool insertionSortint(QList<int>& tVec);
172  //Returns cossines of perpendicular unit vector of segment a-b
173  void unitVectSegment(const GmMatrix& Xg, GmMatrix& uVec, GmMatrix& uVec2, GmMatrix& uVec3, GmMatrix& ROT);
174  // Returns the elastic constitutive matrix for the fracture segment
175  virtual bool fillNaturalCrackStiffnessMatrix(const GmElement* e, GmMatrix& Dep, GmVector coord, const int& ip, const GmVector& S_tn, const GmVector& Etn_old, const GmVector& v_w_tn, const GmMatrix& ROT, GmMatrix& D_xy, bool open);
176  // Returns the Cohesive constitutive matrix for the fracture segment
177  virtual bool fillCohesiveCrackStiffnessMatrix(const GmElement* e, GmMatrix& Dep, GmVector coord, const int& ip, const GmVector& nrd, const GmVector& trd, const GmVector& Etn_old, const GmVector& v_w_tn, const GmVector& sold,
178  const GmMatrix& ROT, GmMatrix& D_xy, const double& rockStrength, bool open);
179  // Returns fracture segment stresses
180  virtual bool naturalFractureReturnMapping(const GmElement* e, XfemEnrichedElementData* exData, const GmVector& sold, const GmMatrix& Dep, const GmVector& enew, const GmVector& eold, GmVector& Stn_new, const GmMatrix& ROT, GmVector& S_w_xy, bool open, const int& iFracSubElement, const GmVector& ip, const int& k);
181  // Returns fracture cohesive segment stresses
182  virtual bool cohesiveFractureReturnMapping(const GmElement* e, const GmVector& sold, const GmMatrix& Dep, const GmVector& enew, const GmVector& eold, GmVector& Stn_new, const GmMatrix& ROT, GmVector& S_w_xy, const double& rockStrength, bool open, const GmVector& ip, const int& k);
183  virtual bool assemblyCrackStiffnessMatrix(const GmElement* e, GmMatrix& elemK, const GmMatrix& Kfr, const QList<int>& iUe, const QList<int>& pfList, const int& numDof);
184  virtual void assemblyCrackInternalForceVector(const GmElement* e, GmMatrix& elemFi, const GmVector& Fint_St, const QList<int>& iUe, const QList<int>& pfList, const int& numDof);
185  // Split tensor to interface or Join interface to tensor
186  virtual bool splitJoinTensorToInterface(GmVector& Tensor, GmVector& Cohesive, bool type);
187 
188 
193  virtual GmGaussAccessor* createGaussAttributeAccessor(GmElementMesh* mesh, QString id, int snum, bool locked,
194  Unit desiredUnit, const GmLogCategory& logger) const
195  {
196  XfemMesh* xmesh = dynamic_cast<XfemMesh*>(mesh);
197  assert(xmesh);
198  return xmesh->enrichedGaussAttributeAccessor(id, snum, locked, desiredUnit, logger);
199  }
200 
201  const char* _pluginType;
203  GmpMechanicalPhysics* _mechPhys;
204  GmpHydraulic* _hydroPhys;
205  //GmSimulationData* _SimulationData; //!< Simulation data
206 };
207 #endif
virtual const QVariantMap * physicsMetaDataMap()
Returns a reference for the Xfem mechanical physics attribute map, built when the function is called ...
Definition: xfemMechanic.cpp:106
virtual FemResultType fillElementData(const GmElement *e, GmpFemMatrixSet &elemMatrices, GmpFemVectorSet &elemVectors)
Fills the element matrices and vectors for a generic elements.
Definition: xfemMechanic.cpp:751
virtual ~XfemMechanic()
Destructor.
Definition: xfemMechanic.cpp:100
virtual QList< int > changedElements() const
Fills the list of elements that had their dofs changed since the physics was create.
Definition: xfemMechanic.cpp:662
GmPluginObjectFactory * objectFactory(QString pluginName, QString category="", QString objType="")
virtual const GmElementDof * dofMapping(const GmElement *e) const
Definition: xfemMechanic.cpp:187
Id for retrieving the accessor to the enriched state var.
Definition: xfemMechanic.h:113
virtual bool splitJoinTensorToInterface(GmVector &Tensor, GmVector &Cohesive, bool type)
Split tensor to interface or Join interface to tensor type = true ==> split tensor to interface compo...
Definition: xfemMechanic.cpp:2859
Basic class for the standard plane strain physics plugin object.
Definition: xfemMechanic.h:68
GmpHydraulic * _hydroPhys
The hydraulic physics providing parameters and matrices to the coupling equation.
Definition: xfemMechanic.h:204
Auxiliar class wrapping a plugin physics object. Its only purpose is to override the creation of Gaus...
Definition: xfemMechanic.h:45
The number of physics attribute ids above.
Definition: xfemMechanic.h:127
Nodal enriched displacement for fixed node enriched displacement boundary condition in z.
Definition: xfemMechanic.h:146
void fillInteractingCraksNodalLevelSets(const GmElement *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &nodalLevelSet)
computation of Additional enrichment fuctions for cracks intersection considering element nodes and i...
Definition: xfemMechanic.cpp:1791
virtual bool fixedNodalDofsBc(QList< int > &nodes, QList< int > &dof, QList< double > &values, bool *constantValues) const
See comments on base class. Fills vectors with prescribed node pore pressures.
Definition: xfemMechanic.cpp:429
void unitVectSegment(const GmMatrix &Xg, GmMatrix &uVec, GmMatrix &uVec2, GmMatrix &uVec3, GmMatrix &ROT)
Definition: xfemMechanic.cpp:2729
const char * _pluginType
The plugin type name.
Definition: xfemMechanic.h:201
The number of boundary conditions value ids above.
Definition: xfemMechanic.h:149
virtual GmGaussAccessor * createGaussAttributeAccessor(GmElementMesh *mesh, QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
Overrides the standard GmpFemPhysics::createGaussAttributeAccessor() implementation to create an enri...
Definition: xfemMechanic.h:57
virtual void fillEnhancedDof(const XfemElement *xe, QList< int > &iUe, const int &np)
Fills the position index with the degreee of freedo, both the mechanical and hydraulic physics....
Definition: xfemMechanic.cpp:2801
Basic interface for an XFEM element.
Definition: xfemElement.h:43
void fillInteractingCraksGaussLevelSets(const GmElement *e, XfemEnrichedElementData *exData, int nEnrich, int nCracks, QList< double >crackIndex, QList< GmMatrix > &gaussLevelSet)
computation of Additional enrichment fuctions for cracks intersection considering element nodes and i...
Definition: xfemMechanic.cpp:1860
void fillEnhancedNuJumpMatrix(const GmElement *e, GmMatrix &Nu, const GmVector &N, const QList< int > &BottomLevelSet, const QList< int > &TopLevelSet, const GmVector &nodes, GmElementDof *dofMap, XfemEnrichedElementData *exData, const int &iSubCrack)
Calculates the enhanced strain displacement matrix (B) and the Jacobian determinant in a specified (x...
Definition: xfemMechanic.cpp:2226
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition: xfemMesh.h:49
xfemBoundaryConditionIds
IDs for accepted boundary condition types.
Definition: xfemMechanic.h:132
Id for retrieving the accessor to the displacement state var.
Definition: xfemMechanic.h:112
void fillEnhancedBuMatrix(const GmElement *e, const GmShape *shape, const GmVector &ncoord, const GmMatrix &X, const GmMatrix &J, GmMatrix &Bu, const QList< int > &gaussLevelSet, const int &nEnrich, const GmVector &nodes, GmElementDof *dofMap, XfemEnrichedElementData *exData, const int &gaussIP)
Calculates the enhanced strain displacement matrix (B) and the Jacobian determinant in a specified (x...
Definition: xfemMechanic.cpp:2374
Declaration of the XfemMesh class.
GmPluginLoader * loader() const
void fillNodalLevelSetMatrix(GmMatrix X, GmMatrix Xg, GmMatrix &H)
Compute nodal levelset function (H) The minimum distance between a point(nodes or integration point) ...
Definition: xfemMechanic.cpp:2105
The number of state var ids above.
Definition: xfemMechanic.h:116
GmpMechanicalPhysics * _mechPhys
The mechanical physics providing parameters and matrices to the coupling equation.
Definition: xfemMechanic.h:203
Nodal enriched displacement for fixed node enriched displacement boundary condition in x.
Definition: xfemMechanic.h:144
void fillGaussLevelSetMatrix(GmMatrix X, GmMatrix Xg, GmMatrix &H)
Compute Gauss levelset function (H) The minimum distance between a point(integration point) and a seg...
Definition: xfemMechanic.cpp:2165
Id for retrieving the fixed enrichment physics attribute.
Definition: xfemMechanic.h:123
Id for fixed node enriched displacement boundary condition.
Definition: xfemMechanic.h:134
virtual void clearChangedElements()
The assembler calls to clear the internal list used to track dof changes.
Definition: xfemMechanic.cpp:729
virtual bool fillFixedEnrichedBC(QList< int > &nodes, QList< int > &dof, QList< double > &values) const
Definition: xfemMechanic.cpp:463
The number of boundary conditions ids above.
Definition: xfemMechanic.h:138
virtual bool checkAndLoadPrivateData(LuaTable &table)
Overloads default checkAndLoadPrivateData() to be able to setup materials.
Definition: xfemMechanic.cpp:155
virtual GmGaussAccessor * createGaussAttributeAccessor(GmElementMesh *mesh, QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
Overrides the standard GmpFemPhysics::createGaussAttributeAccessor() implementation to create an enri...
Definition: xfemMechanic.h:193
virtual XfemGaussAccessor * enrichedGaussAttributeAccessor(QString id, Unit desiredUnit, const GmLogCategory &logger) const
Equivalent to call enrichedGaussAttributeAccessor(id, 0, true, desiredUnit, logger)
Definition: xfemMesh.h:86
Nodal enriched displacement for fixed node enriched displacement boundary condition in y.
Definition: xfemMechanic.h:145
XfemMechanic(const char *pluginType, GmSimulationData *simulation, QString id, QString description, const GmpFemPhysicsCommonMaterialFactory *matFactory, const GmLogCategory &logger)
Constructor. Will be called by the plugin loading code.
Definition: xfemMechanic.cpp:62
arma::vec GmVector
A class used to store per element data needed only in enriched elements.
Definition: xfemEnrichedElementData.h:37
xfemBoundaryConditionValueIds
IDs for property values from accepted boundary condition types.
Definition: xfemMechanic.h:142
void tipDOFTreat(const int &nelem, GmVector &nodes)
treat tip degrees of freedom
Definition: xfemMechanic.cpp:2552
xfemStateVarIds
IDs for Mechanical xfem state vars.
Definition: xfemMechanic.h:110
arma::mat GmMatrix
virtual void fillElementDisplacements(const GmElement *e, GmVector &ue, const int &nEnrich)
See comments on base class. Fills the vector ue with nodal displacements.
Definition: xfemMechanic.cpp:1929
xfemPhysicsAttributeIds
IDs for physics attributes.
Definition: xfemMechanic.h:120
GmMatrix _Dsn
Constitutive tangent matrix (2 x 2)
Definition: xfemMechanic.h:202
Id for retrieving the isoParametric physics attribute.
Definition: xfemMechanic.h:122