OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
enrichmentfrontlinbranchfuncradius.C
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 
37 #include "dynamicinputrecord.h"
38 #include "classfactory.h"
39 #include "xfem/xfemmanager.h"
40 #include "domain.h"
41 #include "connectivitytable.h"
42 #include "gausspoint.h"
43 
44 namespace oofem {
46 
48  mEnrichmentRadius(0.0)
49 {
50  mpBranchFunc = new LinElBranchFunction();
51 }
52 
54 {
55  if ( mpBranchFunc != NULL ) {
56  delete mpBranchFunc;
57  mpBranchFunc = NULL;
58  }
59 }
60 
61 void EnrFrontLinearBranchFuncRadius :: MarkNodesAsFront(std :: unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std :: unordered_map< int, double > &iLevelSetNormalDirMap, const std :: unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
62 {
63  // Enrich all nodes within a prescribed radius around the crack tips.
64  // TODO: If performance turns out to be an issue, we may wish
65  // to put the nodes in a Kd tree (or similar) to speed up searching.
66  // For now, loop over all nodes.
67 
68  mTipInfo = iTipInfo;
69 
70  Domain *d = ixFemMan.giveDomain();
71  int nNodes = d->giveNumberOfDofManagers();
72 
73  // Make sure that the tip element gets enriched,
74  // even if the radius is smaller than the element size
75  MarkTipElementNodesAsFront(ioNodeEnrMarkerMap, ixFemMan, iLevelSetNormalDirMap, iLevelSetTangDirMap, iTipInfo);
76 
77  for ( int i = 1; i <= nNodes; i++ ) {
78  DofManager *dMan = d->giveDofManager(i);
79  const FloatArray &nodePos = * ( dMan->giveCoordinates() );
80 
81  double radius2 = iTipInfo.mGlobalCoord.distance_square(nodePos);
82 
83  if ( radius2 < mEnrichmentRadius * mEnrichmentRadius ) {
84  if ( ( ioNodeEnrMarkerMap [ i ] == NodeEnr_START_TIP && iTipInfo.mTipIndex == 1 ) ||
85  ( ioNodeEnrMarkerMap [ i ] == NodeEnr_END_TIP && iTipInfo.mTipIndex == 0 ) ) {
86  ioNodeEnrMarkerMap [ i ] = NodeEnr_START_AND_END_TIP;
87  } else {
88  if ( iTipInfo.mTipIndex == 0 ) {
89  ioNodeEnrMarkerMap [ i ] = NodeEnr_START_TIP;
90  }
91 
92  if ( iTipInfo.mTipIndex == 1 ) {
93  ioNodeEnrMarkerMap [ i ] = NodeEnr_END_TIP;
94  }
95  }
96  }
97  }
98 }
99 
101 {
102  return 4;
103 }
104 
105 void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const EfInput &iEfInput) const
106 {
107  FloatArray xTip = {
109  };
110 
111  FloatArray pos = {
112  iEfInput.mPos.at(1), iEfInput.mPos.at(2)
113  };
114 
115  // Crack tangent and normal
116  FloatArray t, n;
117  bool flipTangent = false;
118  computeCrackTangent(t, n, flipTangent, iEfInput);
119 
120  double r = 0.0, theta = 0.0;
121  EnrichmentItem :: calcPolarCoord(r, theta, xTip, pos, n, t, iEfInput, flipTangent);
122 
123  mpBranchFunc->evaluateEnrFuncAt(oEnrFunc, r, theta);
124 }
125 
126 void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
127 {
128  const FloatArray &xTip = mTipInfo.mGlobalCoord;
129 
130  // Crack tangent and normal
131  FloatArray t, n;
132  bool flipTangent = false;
133  computeCrackTangent(t, n, flipTangent, iEfInput);
134 
135  double r = 0.0, theta = 0.0;
136  EnrichmentItem :: calcPolarCoord(r, theta, xTip, iEfInput.mPos, n, t, iEfInput, flipTangent);
137 
138 
139  size_t sizeStart = oEnrFuncDeriv.size();
140  mpBranchFunc->evaluateEnrFuncDerivAt(oEnrFuncDeriv, r, theta);
141 
145  FloatMatrix E;
146  E.resize(2, 2);
147  E.setColumn(t, 1);
148  E.setColumn(n, 2);
149 
150 
151  for ( size_t j = sizeStart; j < oEnrFuncDeriv.size(); j++ ) {
152  FloatArray enrFuncDerivGlob;
153  enrFuncDerivGlob.beProductOf(E, oEnrFuncDeriv [ j ]);
154  oEnrFuncDeriv [ j ] = enrFuncDerivGlob;
155  }
156 }
157 
158 void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncJumps(std :: vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
159 {
160  const FloatArray &xTip = mTipInfo.mGlobalCoord;
161  const FloatArray &gpCoord = iGP.giveGlobalCoordinates();
162  double radius = gpCoord.distance(xTip);
163 
164  std :: vector< double >jumps;
165  mpBranchFunc->giveJump(jumps, radius);
166 
167  oEnrFuncJumps.insert( oEnrFuncJumps.end(), jumps.begin(), jumps.end() );
168 }
169 
171 {
172  IRResultType result;
173 
175 
176  return IRRT_OK;
177 }
178 
180 {
181  int number = 1;
182  input.setRecordKeywordField(this->giveInputRecordName(), number);
183 
185 }
186 } // end namespace oofem
#define _IFT_EnrFrontLinearBranchFuncRadius_Radius
void setField(int item, InputFieldType id)
Class and object Domain.
Definition: domain.h:115
TipInfo mTipInfo
reference to the associated enrichment item
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
int mTipIndex
Definition: tipinfo.h:34
virtual void giveJump(std::vector< double > &oJumps) const
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
Definition: tipinfo.h:24
virtual int giveNumEnrichments(const DofManager &iDMan) const
virtual void evaluateEnrFuncDerivAt(std::vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
Base class for dof managers.
Definition: dofmanager.h:113
virtual void giveInputRecord(DynamicInputRecord &input)
void MarkTipElementNodesAsFront(std::unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std::unordered_map< int, double > &iLevelSetNormalDirMap, const std::unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
Several enrichment fronts enrich all nodes in the tip element.
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
virtual void evaluateEnrFuncAt(std::vector< double > &oEnrFunc, const double &iR, const double &iTheta) const
#define E(p)
Definition: mdm.C:368
FloatArray mPos
virtual IRResultType initializeFrom(InputRecord *ir)
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
virtual void evaluateEnrFuncAt(std::vector< double > &oEnrFunc, const EfInput &iEfInput) const
double distance_square(const FloatArray &iP1, const FloatArray &iP2, double &oXi, double &oXiUnbounded) const
Definition: floatarray.C:499
const FloatArray & giveGlobalCoordinates()
Definition: gausspoint.h:160
Class representing vector of real numbers.
Definition: floatarray.h:82
void computeCrackTangent(FloatArray &oTangent, FloatArray &oNormal, bool &oFlipTangent, const EfInput &iEfInput) const
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
This class manages the xfem part.
Definition: xfemmanager.h:109
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
static void calcPolarCoord(double &oR, double &oTheta, const FloatArray &iOrigin, const FloatArray &iPos, const FloatArray &iN, const FloatArray &iT, const EfInput &iEfInput, bool iFlipTangent)
void setColumn(const FloatArray &src, int c)
Sets the values of the matrix in specified column.
Definition: floatmatrix.C:648
Class representing the a dynamic Input Record.
virtual void evaluateEnrFuncJumps(std::vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
void setRecordKeywordField(std::string keyword, int number)
REGISTER_EnrichmentFront(EnrFrontCohesiveBranchFuncOneEl)
virtual void evaluateEnrFuncDerivAt(std::vector< FloatArray > &oEnrFuncDeriv, const double &iR, const double &iTheta) const
FloatArray mGlobalCoord
Definition: tipinfo.h:30
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain()
Definition: xfemmanager.h:202
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
virtual void MarkNodesAsFront(std::unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std::unordered_map< int, double > &iLevelSetNormalDirMap, const std::unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
MarkNodesAsFront: Intput: -ioNodeEnrMarker: A vector with the same size as the number of nodes in the...
Class representing the four classical linear elastic branch functions.
Class representing integration point in finite element program.
Definition: gausspoint.h:93

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