OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
enrichmentfrontlinbranchfunconeel.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 
36 #include "dynamicinputrecord.h"
37 #include "classfactory.h"
38 #include "xfem/xfemmanager.h"
39 #include "domain.h"
40 #include "spatiallocalizer.h"
41 #include "element.h"
42 #include "gausspoint.h"
43 #include "mathfem.h"
44 
45 namespace oofem {
47 
48 
50 {
51  mpBranchFunc = new LinElBranchFunction();
52 }
53 
55 {
56  if ( mpBranchFunc != NULL ) {
57  delete mpBranchFunc;
58  mpBranchFunc = NULL;
59  }
60 }
61 
62 
63 void EnrFrontLinearBranchFuncOneEl :: 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)
64 {
65  MarkTipElementNodesAsFront(ioNodeEnrMarkerMap, ixFemMan, iLevelSetNormalDirMap, iLevelSetTangDirMap, iTipInfo);
66 }
67 
69 {
70  return 4;
71 }
72 
73 void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const EfInput &iEfInput) const
74 {
75  FloatArray xTip = {
77  };
78 
79  FloatArray pos = {
80  iEfInput.mPos.at(1), iEfInput.mPos.at(2)
81  };
82 
83  // Crack tangent and normal
84  FloatArray t, n;
85  bool flipTangent = false;
86  computeCrackTangent(t, n, flipTangent, iEfInput);
87 
88  double r = 0.0, theta = 0.0;
89  EnrichmentItem :: calcPolarCoord(r, theta, xTip, pos, n, t, iEfInput, flipTangent);
90 
91  mpBranchFunc->evaluateEnrFuncAt(oEnrFunc, r, theta);
92 
93 #ifdef DEBUG
94  for ( double val:oEnrFunc ) {
95  if ( !std :: isfinite(val) ) {
96  printf("r: %e theta: %e\n", r, theta);
97  OOFEM_ERROR("!std::isfinite(val)")
98  }
99  }
100 #endif
101 }
102 
103 void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
104 {
105  const FloatArray &xTip = mTipInfo.mGlobalCoord;
106 
107  // Crack tangent and normal
108  FloatArray t, n;
109  bool flipTangent = false;
110  computeCrackTangent(t, n, flipTangent, iEfInput);
111 
112  double r = 0.0, theta = 0.0;
113  EnrichmentItem :: calcPolarCoord(r, theta, xTip, iEfInput.mPos, n, t, iEfInput, flipTangent);
114 
115 
116  size_t sizeStart = oEnrFuncDeriv.size();
117  mpBranchFunc->evaluateEnrFuncDerivAt(oEnrFuncDeriv, r, theta);
118 
122  FloatMatrix E;
123  E.resize(2, 2);
124  E.setColumn(t, 1);
125  E.setColumn(n, 2);
126 
127 
128  for ( size_t j = sizeStart; j < oEnrFuncDeriv.size(); j++ ) {
129  FloatArray enrFuncDerivGlob;
130  enrFuncDerivGlob.beProductOf(E, oEnrFuncDeriv [ j ]);
131  oEnrFuncDeriv [ j ] = enrFuncDerivGlob;
132  }
133 }
134 
135 void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncJumps(std :: vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
136 {
137  const FloatArray &xTip = mTipInfo.mGlobalCoord;
138  const FloatArray &gpCoord = iGP.giveGlobalCoordinates();
139 
140  double radius = gpCoord.distance(xTip);
141 
142  std :: vector< double >jumps;
143  mpBranchFunc->giveJump(jumps, radius);
144 
145  oEnrFuncJumps.insert( oEnrFuncJumps.end(), jumps.begin(), jumps.end() );
146 }
147 
149 {
150  return IRRT_OK;
151 }
152 
154 {
155  int number = 1;
156  input.setRecordKeywordField(this->giveInputRecordName(), number);
157 }
158 } // end namespace oofem
virtual IRResultType initializeFrom(InputRecord *ir)
TipInfo mTipInfo
reference to the associated enrichment item
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
Base class for dof managers.
Definition: dofmanager.h:113
virtual int giveNumEnrichments(const DofManager &iDMan) const
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
#define OOFEM_ERROR(...)
Definition: error.h:61
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 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...
const FloatArray & giveGlobalCoordinates()
Definition: gausspoint.h:160
virtual void evaluateEnrFuncAt(std::vector< double > &oEnrFunc, const EfInput &iEfInput) const
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
virtual void giveInputRecord(DynamicInputRecord &input)
virtual void evaluateEnrFuncDerivAt(std::vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
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.
void setRecordKeywordField(std::string keyword, int number)
REGISTER_EnrichmentFront(EnrFrontCohesiveBranchFuncOneEl)
virtual void evaluateEnrFuncJumps(std::vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
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.
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