OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
enrichmentitem.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #ifndef enrichmentitem_h
36 #define enrichmentitem_h
37 
38 #include "femcmpnn.h"
39 #include "dofiditem.h"
40 #include "tipinfo.h"
41 #include "intarray.h"
42 #include "dofmanager.h"
44 #include "error.h"
45 
46 #include <vector>
47 #include <unordered_map>
48 
50 
51 
52 #define _IFT_EnrichmentItem_domains "enrichmentdomains"
53 #define _IFT_EnrichmentItem_domain "enrichmentdomain"
54 #define _IFT_EnrichmentItem_function "enrichmentfunction"
55 #define _IFT_EnrichmentItem_front "enrichmentfront"
56 #define _IFT_EnrichmentItem_propagationlaw "propagationlaw"
57 
58 #define _IFT_EnrichmentItem_inheritbc "inheritbc"
59 #define _IFT_EnrichmentItem_inheritorderedbc "inheritorderedbc"
60 
62 
63 namespace oofem {
64 class BasicGeometry;
65 class EnrichmentFunction;
66 class EnrichmentDomain;
67 class FractureManager;
68 class FailureCriteriaStatus;
69 class EnrichmentDomain_BG;
70 class DofManList;
71 class WholeDomain;
72 class EnrichmentFront;
73 class LinElBranchFunction;
74 class PropagationLaw;
75 class DynamicDataReader;
76 class Triangle;
77 class GnuplotExportModule;
78 class GaussPoint;
79 class Element;
80 class CrossSection;
81 class Node;
82 class FloatMatrix;
83 class DofManager;
84 class DataReader;
85 
86 enum NodeEnrichmentType : int {
92 };
93 
106 class OOFEM_EXPORT EnrichmentItem : public FEMComponent
107 {
108 public:
110  EnrichmentItem(int n, XfemManager *xm, Domain *aDomain);
111  virtual ~EnrichmentItem();
112 
113  virtual IRResultType initializeFrom(InputRecord *ir);
114 
123  virtual void giveInputRecord(DynamicInputRecord &input) { OOFEM_ERROR("This function must be called with DynamicDataReader as input."); }
124  virtual void appendInputRecords(DynamicDataReader &oDR) = 0;
125 
126  virtual int instanciateYourself(DataReader &dr) = 0;
127  virtual const char *giveClassName() const = 0;
128  const IntArray *giveEnrichesDofsWithIdArray() const { return & mpEnrichesDofsWithIdArray; }
129  int giveNumberOfEnrDofs() const;
130 
131  virtual void writeVtkDebug() const {};
132 
133  // Spatial query
134  bool isElementEnriched(const Element *element) const;
135  inline bool isDofManEnriched(const DofManager &iDMan) const;
136  int giveNumDofManEnrichments(const DofManager &iDMan) const;
137 
138  // Returns true if the enrichment item can assign
139  // a different material to any Gauss point.
140  inline virtual bool canModifyMaterial() const { return false; }
141 
142  // Returns true if the enrichment item assigns a different material to the Gauss point
143  virtual bool isMaterialModified(GaussPoint &iGP, Element &iEl, CrossSection * &opCS) const;
144 
145 
146  // Should update receiver geometry to the state reached at given time step.
147  virtual void updateGeometry(FailureCriteriaStatus *fc, TimeStep *tStep) { }
148  virtual void updateGeometry(TimeStep *tStep) { }
149  virtual void updateGeometry() = 0;
150  virtual void propagateFronts(bool &oFrontsHavePropagated) = 0;
151 
152  virtual bool hasPropagatingFronts() const;
153  virtual bool hasInitiationCriteria() { return false; }
154 
155 
156 
157  int giveStartOfDofIdPool() const { return this->startOfDofIdPool; }
158  int giveEndOfDofIdPool() const { return this->endOfDofIdPool; }
159  virtual int giveDofPoolSize() const;
163  virtual void computeEnrichedDofManDofIdArray(IntArray &oDofIdArray, DofManager &iDMan);
164 
165  virtual void giveEIDofIdArray(IntArray &answer) const; // list of id's for the enrichment dofs
166  virtual void givePotentialEIDofIdArray(IntArray &answer) const; // List of potential IDs for enrichment
167 
168  virtual void evaluateEnrFuncInNode(std :: vector< double > &oEnrFunc, const Node &iNode) const = 0;
169 
170  virtual void evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const = 0;
171  virtual void evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl, const FloatArray &iN, const IntArray &iElNodes) const = 0;
172 
173  virtual void evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const = 0;
174  virtual void evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl, const FloatArray &iN, const FloatMatrix &idNdX, const IntArray &iElNodes) const = 0;
175 
176  bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const;
177  bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const;
178  bool evalNodeEnrMarkerInNode(double &oNodeEnrMarker, int iNodeInd) const;
179 
180 protected:
186  virtual void evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const = 0;
187 
193  virtual void evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const = 0;
194 
200  virtual void evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const = 0;
201 
202 
203  // Level set routines
204  virtual void updateNodeEnrMarker(XfemManager &ixFemMan) = 0;
205 
206 public:
207 
208  virtual void createEnrichedDofs();
209 
210  // Return the coordinates of the tip in element iElIndex,
211  // if the element contains a tip.
212  virtual bool giveElementTipCoord(FloatArray &oCoord, double &oArcPos, Element &iEl, const FloatArray &iElCenter) const = 0;
213 
214  // Help functions
215  static double calcXiZeroLevel(const double &iQ1, const double &iQ2);
216  static void calcPolarCoord(double &oR, double &oTheta, const FloatArray &iOrigin, const FloatArray &iPos, const FloatArray &iN, const FloatArray &iT, const EfInput &iEfInput, bool iFlipTangent);
217 
218  PropagationLaw *givePropagationLaw() { return this->mpPropagationLaw; }
219  void setPropagationLaw(PropagationLaw *ipPropagationLaw);
220  bool hasPropagationLaw() { return this->mPropLawIndex != 0; }
221 
222 
223  virtual void callGnuplotExportModule(GnuplotExportModule &iExpMod, TimeStep *tStep);
224 
225 
226  const std :: unordered_map< int, NodeEnrichmentType > &giveEnrNodeMap() const { return mNodeEnrMarkerMap; }
227 
228  virtual void giveBoundingSphere(FloatArray &oCenter, double &oRadius) = 0;
229 
230  EnrichmentFront *giveEnrichmentFrontStart() { return mpEnrichmentFrontStart; }
231  void setEnrichmentFrontStart(EnrichmentFront *ipEnrichmentFrontStart, bool iDeleteOld = true);
232 
233  EnrichmentFront *giveEnrichmentFrontEnd() { return mpEnrichmentFrontEnd; }
234  void setEnrichmentFrontEnd(EnrichmentFront *ipEnrichmentFrontEnd, bool iDeleteOld = true);
235 
236  bool tipIsTouchingEI(const TipInfo &iTipInfo);
237 
238  void setEnrichmentFunction(EnrichmentFunction *ipEnrichmentFunc) {mpEnrichmentFunc = ipEnrichmentFunc;}
239 
240 protected:
241 
243 
244  EnrichmentFront *mpEnrichmentFrontStart, *mpEnrichmentFrontEnd;
245 
248 
250 
253 
270 
271  int startOfDofIdPool; // points to the first available dofId number associated with the ei
273 
276 
277 
278  // Level set for signed distance to the interface.
279  // The sign is determined by the interface normal direction.
280  // This level set function is relevant for both open and closed interfaces.
281  std :: unordered_map< int, double >mLevelSetNormalDirMap;
282 
283  // Level set for signed distance along the interface.
284  // Only relevant for open interfaces.
285  std :: unordered_map< int, double >mLevelSetTangDirMap;
286 
287 
288  // Field with desired node enrichment types
289  std :: unordered_map< int, NodeEnrichmentType >mNodeEnrMarkerMap;
290 
291  // Enrichment dof IDs used by the enrichment item.
293 
295 
296  static const double mLevelSetTol;
297  static const double mLevelSetRelTol;
298  const double mLevelSetTol2;
299 };
300 
301 inline bool EnrichmentItem :: isDofManEnriched(const DofManager &iDMan) const
302 {
303  auto res = mNodeEnrMarkerMap.find( iDMan.giveGlobalNumber() );
304  return !( res == mNodeEnrMarkerMap.end() );
305 }
306 } // end namespace oofem
307 
308 
309 
310 #endif // enrichmentitem_h
const std::unordered_map< int, NodeEnrichmentType > & giveEnrNodeMap() const
Abstract class representing entity, which is included in the FE model using one (or more) global func...
virtual void updateGeometry(TimeStep *tStep)
EnrichmentFront * giveEnrichmentFrontStart()
Class and object Domain.
Definition: domain.h:115
std::unordered_map< int, NodeEnrichmentType > mNodeEnrMarkerMap
bool isDofManEnriched(const DofManager &iDMan) const
Class representing the implementation of a dynamic data reader for in-code use.
int giveGlobalNumber() const
Definition: dofmanager.h:501
const double mLevelSetTol2
void setEnrichmentFunction(EnrichmentFunction *ipEnrichmentFunc)
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
Definition: tipinfo.h:24
int giveEndOfDofIdPool() const
int mPropLawIndex
mPropLawIndex: nonzero if a propagation law is present, zero otherwise.
Updates the geometry of evolving XFEM interfaces.
Abstract base class for all finite elements.
Definition: element.h:145
virtual void updateGeometry(FailureCriteriaStatus *fc, TimeStep *tStep)
Base class for dof managers.
Definition: dofmanager.h:113
static const double mLevelSetRelTol
Class representing the abstraction for input data source.
Definition: datareader.h:50
Class implementing an array of integers.
Definition: intarray.h:61
Abstract class representing global shape function Base class declares abstract interface common to al...
Base abstract class representing cross section in finite element mesh.
Definition: crosssection.h:107
std::unordered_map< int, double > mLevelSetTangDirMap
PropagationLaw * givePropagationLaw()
virtual void giveInputRecord(DynamicInputRecord &input)
Note the special treatment here, the "normal" syntax would be giveInputRecord(DynamicInputRecord &inp...
bool mInheritBoundaryConditions
If newly created enriched dofs should inherit boundary conditions from the node they are introduced i...
virtual bool canModifyMaterial() const
#define OOFEM_ERROR(...)
Definition: error.h:61
NodeEnrichmentType
Class EnrichmentFront: describes the edge or tip of an XFEM enrichment.
int giveStartOfDofIdPool() const
std::unordered_map< int, double > mLevelSetNormalDirMap
virtual bool hasInitiationCriteria()
const IntArray * giveEnrichesDofsWithIdArray() const
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
PropagationLaw * mpPropagationLaw
This class manages the xfem part.
Definition: xfemmanager.h:109
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
EnrichmentFront * mpEnrichmentFrontStart
EnrichmentFunction * mpEnrichmentFunc
Class representing the general Input Record.
Definition: inputrecord.h:101
int mEnrFrontIndex
mEnrFrontIndex: nonzero if an enrichment front is present, zero otherwise.
Class representing the a dynamic Input Record.
virtual void writeVtkDebug() const
the oofem namespace is to define a context or scope in which all oofem names are defined.
static const double mLevelSetTol
Class implementing node in finite element mesh.
Definition: node.h:87
(Under development) The Gnuplot export module enables OOFEM to export some data in a format that can ...
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
The top abstract class of all classes constituting the finite element mesh.
Definition: femcmpnn.h:76
EnrichmentFront * giveEnrichmentFrontEnd()
IntArray mpEnrichesDofsWithIdArray
Geometry associated with EnrichmentItem.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011