Xfem
The Xfem Plugin
Loading...
Searching...
No Matches
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
34class GmpMechanicalPhysics;
35class GmpHydraulic;
36class GmGaussAccessor;
37
45template <class T, class F> class XfemPhysicsWrapper: public T
46{
47public:
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
53protected:
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
68class XfemMechanic : public GmpFemPhysicsCoupled
69{
70public:
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(QVector<int>& nodes, QVector<int>&dof, QVector<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(QVector<int>& nodes, QVector<int>&dof, QVector<double>& values, bool* constantValues) const;
99
100 virtual bool fixedNodalForcesBc(QVector<int>& nodes, QVector<int>&dof, QVector<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
107protected:
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, QVector<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 QVector<int>& iUe, const QVector<int>& pfList, const int& numDof);
184 virtual void assemblyCrackInternalForceVector(const GmElement* e, GmMatrix& elemFi, const GmVector& Fint_St, const QVector<int>& iUe, const QVector<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
GmPluginObjectFactory * objectFactory(QString pluginName, QString category="", QString objType="")
GmPluginLoader * loader() const
Basic interface for an XFEM element.
Definition xfemElement.h:44
A class used to store per element data needed only in enriched elements.
Definition xfemEnrichedElementData.h:38
Basic class for the standard plane strain physics plugin object.
Definition xfemMechanic.h:69
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:2115
const char * _pluginType
The plugin type name.
Definition xfemMechanic.h:201
xfemBoundaryConditionValueIds
IDs for property values from accepted boundary condition types.
Definition xfemMechanic.h:143
@ BC_AY_ID
Nodal enriched displacement for fixed node enriched displacement boundary condition in y.
Definition xfemMechanic.h:145
@ BC_AZ_ID
Nodal enriched displacement for fixed node enriched displacement boundary condition in z.
Definition xfemMechanic.h:146
@ BC_AX_ID
Nodal enriched displacement for fixed node enriched displacement boundary condition in x.
Definition xfemMechanic.h:144
@ NUM_BCV_IDS
The number of boundary conditions value ids above.
Definition xfemMechanic.h:149
virtual void fillEnhancedDof(const XfemElement *xe, QVector< int > &iUe, const int &np)
Fills the position index with the degreee of freedo, both the mechanical and hydraulic physics....
Definition xfemMechanic.cpp:2803
virtual const GmElementDof * dofMapping(const GmElement *e) const
Definition xfemMechanic.cpp:189
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:2858
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
virtual ~XfemMechanic()
Destructor.
Definition xfemMechanic.cpp:100
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 bool checkAndLoadPrivateData(LuaTable &table)
Overloads default checkAndLoadPrivateData() to be able to setup materials.
Definition xfemMechanic.cpp:157
xfemStateVarIds
IDs for Mechanical xfem state vars.
Definition xfemMechanic.h:111
@ NUM_STATEVAR_IDS
The number of state var ids above.
Definition xfemMechanic.h:116
@ U_ID
Id for retrieving the accessor to the displacement state var.
Definition xfemMechanic.h:112
@ A_ID
Id for retrieving the accessor to the enriched state var
Definition xfemMechanic.h:113
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:1939
xfemPhysicsAttributeIds
IDs for physics attributes.
Definition xfemMechanic.h:121
@ ISOPARAMETRIC_ID
Id for retrieving the isoParametric physics attribute.
Definition xfemMechanic.h:122
@ NUM_ATTRI_IDS
The number of physics attribute ids above.
Definition xfemMechanic.h:127
@ FIXEDENRICHEDDOF_ID
Id for retrieving the fixed enrichment physics attribute.
Definition xfemMechanic.h:123
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:1870
virtual void clearChangedElements()
The assembler calls to clear the internal list used to track dof changes.
Definition xfemMechanic.cpp:735
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
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:2380
GmpMechanicalPhysics * _mechPhys
The mechanical physics providing parameters and matrices to the coupling equation.
Definition xfemMechanic.h:203
GmMatrix _Dsn
Constitutive tangent matrix (2 x 2)
Definition xfemMechanic.h:202
void tipDOFTreat(const int &nelem, GmVector &nodes)
treat tip degrees of freedom
Definition xfemMechanic.cpp:2554
GmpHydraulic * _hydroPhys
The hydraulic physics providing parameters and matrices to the coupling equation.
Definition xfemMechanic.h:204
virtual bool fillFixedEnrichedBC(QVector< int > &nodes, QVector< int > &dof, QVector< double > &values) const
Definition xfemMechanic.cpp:470
virtual bool fixedNodalDofsBc(QVector< int > &nodes, QVector< int > &dof, QVector< double > &values, bool *constantValues) const
See comments on base class. Fills vectors with prescribed node pore pressures.
Definition xfemMechanic.cpp:431
virtual FemResultType fillElementData(const GmElement *e, GmpFemMatrixSet &elemMatrices, GmpFemVectorSet &elemVectors)
Fills the element matrices and vectors for a generic elements.
Definition xfemMechanic.cpp:757
void unitVectSegment(const GmMatrix &Xg, GmMatrix &uVec, GmMatrix &uVec2, GmMatrix &uVec3, GmMatrix &ROT)
Definition xfemMechanic.cpp:2731
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:2175
xfemBoundaryConditionIds
IDs for accepted boundary condition types.
Definition xfemMechanic.h:133
@ FIXED_A_BC_ID
Id for fixed node enriched displacement boundary condition.
Definition xfemMechanic.h:134
@ NUM_BC_IDS
The number of boundary conditions ids above.
Definition xfemMechanic.h:138
virtual QList< int > changedElements() const
Fills the list of elements that had their dofs changed since the physics was create.
Definition xfemMechanic.cpp:668
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:1801
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:2236
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition xfemMesh.h:50
virtual XfemGaussAccessor * enrichedGaussAttributeAccessor(QString id, Unit desiredUnit, const GmLogCategory &logger) const
Equivalent to call enrichedGaussAttributeAccessor(id, 0, true, desiredUnit, logger)
Definition xfemMesh.h:86
Auxiliar class wrapping a plugin physics object. Its only purpose is to override the creation of Gaus...
Definition xfemMechanic.h:46
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
arma::mat GmMatrix
arma::vec GmVector
Declaration of the XfemMesh class.