OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
enrichmentfrontcohesivebranchfunconeel.C
Go to the documentation of this file.
1 /*
2  * enrichmentfrontcohesivebranchfunconeel.C
3  *
4  * Created on: Nov 28, 2014
5  * Author: svennine
6  */
7 
9 #include "dynamicinputrecord.h"
10 #include "classfactory.h"
11 #include "xfem/xfemmanager.h"
12 #include "domain.h"
13 #include "connectivitytable.h"
14 #include "spatiallocalizer.h"
15 #include "element.h"
16 #include "gausspoint.h"
17 #include "mathfem.h"
18 
19 namespace oofem {
21 
23 {
24  mpBranchFunc = new CohesiveBranchFunction();
25 }
26 
28 {
29  delete mpBranchFunc;
30 }
31 
32 
33 void EnrFrontCohesiveBranchFuncOneEl :: 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)
34 {
35  MarkTipElementNodesAsFront(ioNodeEnrMarkerMap, ixFemMan, iLevelSetNormalDirMap, iLevelSetTangDirMap, iTipInfo);
36 }
37 
39 {
40  return 1;
41 }
42 
43 void EnrFrontCohesiveBranchFuncOneEl :: evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const EfInput &iEfInput) const
44 {
45  FloatArray xTip = {
47  };
48 
49  FloatArray pos = {
50  iEfInput.mPos.at(1), iEfInput.mPos.at(2)
51  };
52 
53  // Crack tangent and normal
54  FloatArray t, n;
55  bool flipTangent = false;
56  computeCrackTangent(t, n, flipTangent, iEfInput);
57 
58  double r = 0.0, theta = 0.0;
59  EnrichmentItem :: calcPolarCoord(r, theta, xTip, pos, n, t, iEfInput, flipTangent);
60 
61  mpBranchFunc->evaluateEnrFuncAt(oEnrFunc, r, theta);
62 
63 #ifdef DEBUG
64  for ( double val:oEnrFunc ) {
65  if ( !std :: isfinite(val) ) {
66  printf("r: %e theta: %e\n", r, theta);
67  OOFEM_ERROR("!std::isfinite(val)")
68  }
69  }
70 #endif
71 }
72 
73 void EnrFrontCohesiveBranchFuncOneEl :: evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
74 {
75  const FloatArray &xTip = mTipInfo.mGlobalCoord;
76 
77  // Crack tangent and normal
78  FloatArray t, n;
79  bool flipTangent = false;
80  computeCrackTangent(t, n, flipTangent, iEfInput);
81 
82  double r = 0.0, theta = 0.0;
83  EnrichmentItem :: calcPolarCoord(r, theta, xTip, iEfInput.mPos, n, t, iEfInput, flipTangent);
84 
85 
86  size_t sizeStart = oEnrFuncDeriv.size();
87  mpBranchFunc->evaluateEnrFuncDerivAt(oEnrFuncDeriv, r, theta);
88 
92  FloatMatrix E;
93  E.resize(2, 2);
94  E.setColumn(t, 1);
95  E.setColumn(n, 2);
96 
97 
98  for ( size_t j = sizeStart; j < oEnrFuncDeriv.size(); j++ ) {
99  FloatArray enrFuncDerivGlob;
100  enrFuncDerivGlob.beProductOf(E, oEnrFuncDeriv [ j ]);
101  oEnrFuncDeriv [ j ] = enrFuncDerivGlob;
102  }
103 }
104 
105 void EnrFrontCohesiveBranchFuncOneEl :: evaluateEnrFuncJumps(std :: vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
106 {
107  const FloatArray &xTip = mTipInfo.mGlobalCoord;
108  const FloatArray &gpCoord = iGP.giveGlobalCoordinates();
109 
110  double radius = gpCoord.distance(xTip);
111 
112  std :: vector< double >jumps;
113  mpBranchFunc->giveJump(jumps, radius);
114 
115  oEnrFuncJumps.insert( oEnrFuncJumps.end(), jumps.begin(), jumps.end() );
116 }
117 
119 {
120  return IRRT_OK;
121 }
122 
124 {
125  int number = 1;
126  input.setRecordKeywordField(this->giveInputRecordName(), number);
127 }
128 
129 } /* namespace oofem */
TipInfo mTipInfo
reference to the associated enrichment item
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 void evaluateEnrFuncJumps(std::vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
Base class for dof managers.
Definition: dofmanager.h:113
virtual void evaluateEnrFuncDerivAt(std::vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
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...
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 evaluateEnrFuncDerivAt(std::vector< FloatArray > &oEnrFuncDeriv, 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
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
Class representing a branch function for cohesive cracks.
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)
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 evaluateEnrFuncAt(std::vector< double > &oEnrFunc, const EfInput &iEfInput) const
virtual void evaluateEnrFuncAt(std::vector< double > &oEnrFunc, const double &iR, const double &iTheta) const
virtual int giveNumEnrichments(const DofManager &iDMan) const
void setRecordKeywordField(std::string keyword, int number)
virtual void giveJump(std::vector< double > &oJumps) const
REGISTER_EnrichmentFront(EnrFrontCohesiveBranchFuncOneEl)
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 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