OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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"
45#include "error.h"
46
47#include <vector>
48#include <unordered_map>
49
51
52
53#define _IFT_EnrichmentItem_domains "enrichmentdomains"
54#define _IFT_EnrichmentItem_domain "enrichmentdomain"
55#define _IFT_EnrichmentItem_function "enrichmentfunction"
56#define _IFT_EnrichmentItem_front "enrichmentfront"
57#define _IFT_EnrichmentItem_propagationlaw "propagationlaw"
58
59#define _IFT_EnrichmentItem_inheritbc "inheritbc"
60#define _IFT_EnrichmentItem_inheritorderedbc "inheritorderedbc"
61
63
64namespace oofem {
65class BasicGeometry;
66class EnrichmentFunction;
67class EnrichmentDomain;
68class FractureManager;
69class FailureCriteriaStatus;
70class EnrichmentDomain_BG;
71class DofManList;
72class WholeDomain;
73class EnrichmentFront;
74class LinElBranchFunction;
75class PropagationLaw;
76class DynamicDataReader;
77class Triangle;
78class GnuplotExportModule;
79class GaussPoint;
80class Element;
81class CrossSection;
82class Node;
83class FloatMatrix;
84class DofManager;
85class DataReader;
86
94
108{
109public:
111 EnrichmentItem(int n, XfemManager *xm, Domain *aDomain);
112 virtual ~EnrichmentItem();
113
114 void initializeFrom(InputRecord &ir) override;
115 virtual int instanciateYourself(DataReader &dr) = 0;
116 //void postInitialize() override = 0;
117
127 { OOFEM_ERROR("This function must be called with DynamicDataReader as input."); }
128 virtual void appendInputRecords(DynamicDataReader &oDR) = 0;
129
131 int giveNumberOfEnrDofs() const;
132
133 virtual void writeVtkDebug() const {};
134
135 // Spatial query
136 bool isElementEnriched(const Element *element) const;
137 inline bool isDofManEnriched(const DofManager &iDMan) const;
138 int giveNumDofManEnrichments(const DofManager &iDMan) const;
139
140 // Returns true if the enrichment item can assign
141 // a different material to any Gauss point.
142 inline virtual bool canModifyMaterial() const { return false; }
143
144 // Returns true if the enrichment item assigns a different material to the Gauss point
145 virtual bool isMaterialModified(GaussPoint &iGP, Element &iEl, CrossSection * &opCS) const;
146
147
148 // Should update receiver geometry to the state reached at given time step.
149 virtual void updateGeometry(FailureCriteriaStatus *fc, TimeStep *tStep) { }
150 virtual void updateGeometry(TimeStep *tStep) { }
151 virtual void updateGeometry() = 0;
152 virtual void propagateFronts(bool &oFrontsHavePropagated) = 0;
153
154 virtual bool hasPropagatingFronts() const;
155 virtual bool hasInitiationCriteria() { return false; }
156
157
158 int giveStartOfDofIdPool() const { return this->startOfDofIdPool; }
159 int giveEndOfDofIdPool() const { return this->endOfDofIdPool; }
160 virtual int giveDofPoolSize() const;
164 virtual void computeEnrichedDofManDofIdArray(IntArray &oDofIdArray, DofManager &iDMan);
165
166 virtual void giveEIDofIdArray(IntArray &answer) const; // list of id's for the enrichment dofs
167 virtual void givePotentialEIDofIdArray(IntArray &answer) const; // List of potential IDs for enrichment
168
169 virtual void evaluateEnrFuncInNode(std :: vector< double > &oEnrFunc, const Node &iNode) const = 0;
170
171 virtual void evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const = 0;
172 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;
173
174 virtual void evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const = 0;
175 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;
176
177 bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const;
178 bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const;
179 bool evalNodeEnrMarkerInNode(double &oNodeEnrMarker, int iNodeInd) const;
180
181protected:
187 virtual void evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const = 0;
188
194 virtual void evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const = 0;
195
201 virtual void evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const = 0;
202
203
204 // Level set routines
205 virtual void updateNodeEnrMarker(XfemManager &ixFemMan) = 0;
206
207public:
208
209 virtual void createEnrichedDofs();
210
211 // Return the coordinates of the tip in element iElIndex,
212 // if the element contains a tip.
213 virtual bool giveElementTipCoord(FloatArray &oCoord, double &oArcPos, Element &iEl, const FloatArray &iElCenter) const = 0;
214
215 // Help functions
216 static double calcXiZeroLevel(const double &iQ1, const double &iQ2);
217 static void calcPolarCoord(double &oR, double &oTheta, const FloatArray &iOrigin, const FloatArray &iPos, const FloatArray &iN, const FloatArray &iT, const EfInput &iEfInput, bool iFlipTangent);
218
220 void setPropagationLaw(std::unique_ptr<PropagationLaw> ipPropagationLaw);
221 bool hasPropagationLaw() { return this->mPropLawIndex != 0; }
222
223
224 virtual void callGnuplotExportModule(GnuplotExportModule &iExpMod, TimeStep *tStep);
225
226
227 const std :: unordered_map< int, NodeEnrichmentType > &giveEnrNodeMap() const { return mNodeEnrMarkerMap; }
228
229 virtual void giveBoundingSphere(FloatArray &oCenter, double &oRadius) = 0;
230
232 void setEnrichmentFrontStart(std::unique_ptr<EnrichmentFront> ipEnrichmentFrontStart, bool iDeleteOld = true);
233
235 void setEnrichmentFrontEnd(std::unique_ptr<EnrichmentFront> ipEnrichmentFrontEnd, bool iDeleteOld = true);
236
237 bool tipIsTouchingEI(const TipInfo &iTipInfo);
238
239 void setEnrichmentFunction(std::unique_ptr<EnrichmentFunction> ipEnrichmentFunc) { mpEnrichmentFunc = std::move(ipEnrichmentFunc); }
240
241protected:
242
243 std::unique_ptr<EnrichmentFunction> mpEnrichmentFunc;
244
245 std::unique_ptr<EnrichmentFront> mpEnrichmentFrontStart, mpEnrichmentFrontEnd;
246
249
250 std::unique_ptr<PropagationLaw> mpPropagationLaw;
251
254
271
272 int startOfDofIdPool; // points to the first available dofId number associated with the ei
274
277
278
279 // Level set for signed distance to the interface.
280 // The sign is determined by the interface normal direction.
281 // This level set function is relevant for both open and closed interfaces.
282 std :: unordered_map< int, double >mLevelSetNormalDirMap;
283
284 // Level set for signed distance along the interface.
285 // Only relevant for open interfaces.
286 std :: unordered_map< int, double >mLevelSetTangDirMap;
287
288
289 // Field with desired node enrichment types
290 std :: unordered_map< int, NodeEnrichmentType >mNodeEnrMarkerMap;
291
292 // Enrichment dof IDs used by the enrichment item.
294
296
297 static const double mLevelSetTol;
298 static const double mLevelSetRelTol;
299 const double mLevelSetTol2;
300
301 std::shared_ptr<InputRecord> thisIr;
302};
303
304inline bool EnrichmentItem :: isDofManEnriched(const DofManager &iDMan) const
305{
306 auto res = mNodeEnrMarkerMap.find( iDMan.giveGlobalNumber() );
307 return !( res == mNodeEnrMarkerMap.end() );
308}
309} // end namespace oofem
310
311
312
313#endif // enrichmentitem_h
int giveGlobalNumber() const
Definition dofmanager.h:515
virtual bool hasInitiationCriteria()
bool evalNodeEnrMarkerInNode(double &oNodeEnrMarker, int iNodeInd) const
void setEnrichmentFunction(std::unique_ptr< EnrichmentFunction > ipEnrichmentFunc)
static const double mLevelSetRelTol
virtual void propagateFronts(bool &oFrontsHavePropagated)=0
static const double mLevelSetTol
EnrichmentFront * giveEnrichmentFrontStart()
int mEnrFrontIndex
mEnrFrontIndex: nonzero if an enrichment front is present, zero otherwise.
virtual void evalLevelSetNormal(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const =0
std::unique_ptr< EnrichmentFront > mpEnrichmentFrontEnd
virtual int instanciateYourself(DataReader &dr)=0
std ::unordered_map< int, NodeEnrichmentType > mNodeEnrMarkerMap
bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
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
virtual void appendInputRecords(DynamicDataReader &oDR)=0
virtual void updateNodeEnrMarker(XfemManager &ixFemMan)=0
virtual void updateGeometry()=0
virtual void evaluateEnrFuncInNode(std ::vector< double > &oEnrFunc, const Node &iNode) const =0
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
std::unique_ptr< EnrichmentFront > mpEnrichmentFrontStart
std::unique_ptr< EnrichmentFunction > mpEnrichmentFunc
virtual void evaluateEnrFuncDerivAt(std ::vector< FloatArray > &oEnrFuncDeriv, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const =0
int mPropLawIndex
mPropLawIndex: nonzero if a propagation law is present, zero otherwise.
std::shared_ptr< InputRecord > thisIr
std ::unordered_map< int, double > mLevelSetTangDirMap
virtual void updateGeometry(TimeStep *tStep)
const std ::unordered_map< int, NodeEnrichmentType > & giveEnrNodeMap() const
std ::unordered_map< int, double > mLevelSetNormalDirMap
const IntArray * giveEnrichesDofsWithIdArray() const
virtual void evalGradLevelSetNormal(FloatArray &oGradLevelSet, const FloatArray &iGlobalCoord, const FloatMatrix &idNdX, const IntArray &iNodeInd) const =0
int giveStartOfDofIdPool() const
IntArray mpEnrichesDofsWithIdArray
Geometry associated with EnrichmentItem.
std::unique_ptr< PropagationLaw > mpPropagationLaw
virtual void updateGeometry(FailureCriteriaStatus *fc, TimeStep *tStep)
void initializeFrom(InputRecord &ir) override
virtual bool hasPropagatingFronts() const
virtual void giveBoundingSphere(FloatArray &oCenter, double &oRadius)=0
static double calcXiZeroLevel(const double &iQ1, const double &iQ2)
virtual void evaluateEnrFuncAt(std ::vector< double > &oEnrFunc, const FloatArray &iGlobalCoord, const FloatArray &iLocalCoord, int iNodeInd, const Element &iEl) const =0
virtual bool giveElementTipCoord(FloatArray &oCoord, double &oArcPos, Element &iEl, const FloatArray &iElCenter) const =0
void giveInputRecord(DynamicInputRecord &input) override
EnrichmentFront * giveEnrichmentFrontEnd()
EnrichmentItem(int n, XfemManager *xm, Domain *aDomain)
Constructor / destructor.
bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
virtual void createEnrichedDofs()
PropagationLaw * givePropagationLaw()
virtual void writeVtkDebug() const
int giveEndOfDofIdPool() const
virtual bool canModifyMaterial() const
virtual void evalLevelSetTangential(double &oLevelSet, const FloatArray &iGlobalCoord, const FloatArray &iN, const IntArray &iNodeInd) const =0
static void calcPolarCoord(double &oR, double &oTheta, const FloatArray &iOrigin, const FloatArray &iPos, const FloatArray &iN, const FloatArray &iT, const EfInput &iEfInput, bool iFlipTangent)
FEMComponent(int n, Domain *d)
Definition femcmpnn.h:88
#define OOFEM_ERROR(...)
Definition error.h:79
@ NodeEnr_START_TIP
@ NodeEnr_END_TIP
@ NodeEnr_START_AND_END_TIP
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011