OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
plmaterialforce.C
Go to the documentation of this file.
1 /*
2  * plmaterialforce.C
3  *
4  * Created on: Nov 14, 2014
5  * Author: svennine
6  */
7 
8 #include "plmaterialforce.h"
9 
10 #include "xfem/propagationlaw.h"
11 #include "xfem/tipinfo.h"
12 #include "classfactory.h"
13 #include "mathfem.h"
14 #include "dynamicinputrecord.h"
15 #include "spatiallocalizer.h"
16 #include "floatmatrix.h"
17 #include "gausspoint.h"
18 #include "Materials/structuralms.h"
19 #include "xfem/enrichmentitem.h"
20 #include "feinterpol.h"
21 #include "xfem/xfemmanager.h"
22 #include "xfem/matforceevaluator.h"
23 
24 #include "engngm.h"
25 
26 namespace oofem {
28 
30  mRadius(0.0),
31  mIncrementLength(0.0),
32  mCrackPropThreshold(0.0),
33  mpMaterialForceEvaluator( new MaterialForceEvaluator() )
34 {}
35 
37 {}
38 
40 {
41  IRResultType result;
42 
46 
47  return IRRT_OK;
48 }
49 
51 {
52  int number = 1;
53  input.setRecordKeywordField(this->giveInputRecordName(), number);
54 
58 }
59 
61 {
62 // printf("Entering PLMaterialForce :: propagateInterface().\n");
63 
64  if ( !iEnrFront.propagationIsAllowed() ) {
65  return false;
66  }
67 
68  // Fetch crack tip data
69  const TipInfo &tipInfo = iEnrFront.giveTipInfo();
70 
71  // Check if the tip is located in the domain
72  SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer();
73  FloatArray lCoords, closest;
74 // printf("tipInfo.mGlobalCoord: \n"); tipInfo.mGlobalCoord.printYourself();
75  if( tipInfo.mGlobalCoord.giveSize() == 0 ) {
76  return false;
77  }
78 
79  localizer->giveElementClosestToPoint(lCoords, closest, tipInfo.mGlobalCoord);
80 
81  if(closest.distance(tipInfo.mGlobalCoord) > 1.0e-9) {
82 // printf("Tip is outside all elements.\n");
83  return false;
84  }
85 
86 
87  FloatArray matForce;
88  TimeStep *tStep = iDomain.giveEngngModel()->giveCurrentStep();
89  mpMaterialForceEvaluator->computeMaterialForce(matForce, iDomain, tipInfo, tStep, mRadius);
90 
91 // printf("matForce: "); matForce.printYourself();
92 
93  if(matForce.giveSize() == 0) {
94  return false;
95  }
96 
97  double forceNorm = matForce.computeNorm();
98 // printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold);
99 
100  if(forceNorm < mCrackPropThreshold || forceNorm < 1.0e-20) {
101  return false;
102  }
103 
104  printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold);
105  printf("Propagating crack in PLMaterialForce :: propagateInterface.\n");
106 // printf("Tip coord: "); tipInfo.mGlobalCoord.printYourself();
107 
108  FloatArray dir(matForce);
109  dir.times(1.0/forceNorm);
110 // printf("dir: "); dir.printYourself();
111 
112  const double cosAngTol = 1.0/sqrt(2.0);
113  if(tipInfo.mTangDir.dotProduct(dir) < cosAngTol) {
114  // Do not allow sharper turns than 45 degrees
115 
116  if( tipInfo.mNormalDir.dotProduct(dir) > 0.0 ) {
117  dir = tipInfo.mTangDir;
118  dir.add(tipInfo.mNormalDir);
119  dir.normalize();
120  }
121  else {
122 // dir = tipInfo.mNormalDir;
123 // dir.times(-1.0);
124  dir = tipInfo.mTangDir;
125  dir.add(-1.0,tipInfo.mNormalDir);
126  dir.normalize();
127  }
128 
129  printf("//////////////////////////////////////////// Resticting crack propagation direction.\n");
130 // printf("tipInfo.mTangDir: "); tipInfo.mTangDir.printYourself();
131 // printf("dir: "); dir.printYourself();
132  }
133 
134  // Fill up struct
135  oTipProp.mTipIndex = tipInfo.mTipIndex;
136  oTipProp.mPropagationDir = dir;
138 
139 
140  return true;
141 }
142 
143 } /* namespace oofem */
The base class for all spatial localizers.
void setField(int item, InputFieldType id)
Class and object Domain.
Definition: domain.h:115
FloatArray mPropagationDir
Definition: tipinfo.h:44
#define _IFT_PLMaterialForce_IncLength
Increment length per time step.
int mTipIndex
Definition: tipinfo.h:34
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
Definition: tipinfo.h:24
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
#define _IFT_PLMaterialForce_Radius
Radius of region for domain integral.
virtual const char * giveInputRecordName() const
virtual void giveInputRecord(DynamicInputRecord &input)
virtual IRResultType initializeFrom(InputRecord *ir)
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
Class EnrichmentFront: describes the edge or tip of an XFEM enrichment.
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver&#39;s associated spatial localizer.
Definition: domain.C:1184
virtual bool propagationIsAllowed() const
REGISTER_PropagationLaw(PLDoNothing)
std::unique_ptr< MaterialForceEvaluator > mpMaterialForceEvaluator
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
Returns the element closest to a given point.
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual bool propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp)
#define _IFT_PLMaterialForce_CrackPropThreshold
Threshold for crack propagation.
FloatArray mNormalDir
Definition: tipinfo.h:33
Class representing the a dynamic Input Record.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
#define new
FloatArray mTangDir
Definition: tipinfo.h:32
void setRecordKeywordField(std::string keyword, int number)
const TipInfo & giveTipInfo() const
double mPropagationLength
Definition: tipinfo.h:45
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
Definition: engngm.h:683
Evaluates material forces.
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
FloatArray mGlobalCoord
Definition: tipinfo.h:30
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
double normalize()
Normalizes receiver.
Definition: floatarray.C:828
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
Propagation law that propagates the crack in the direction of the material force. ...

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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011