OOFEM 3.0
Loading...
Searching...
No Matches
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"
19#include "xfem/enrichmentitem.h"
20#include "feinterpol.h"
21#include "xfem/xfemmanager.h"
23
24#include "engngm.h"
25
26namespace oofem {
28
29PLMaterialForce :: PLMaterialForce():
30 mRadius(0.0),
31 mIncrementLength(0.0),
32 mCrackPropThreshold(0.0),
33 mpMaterialForceEvaluator( new MaterialForceEvaluator() )
34{}
35
36PLMaterialForce :: ~PLMaterialForce()
37{}
38
45
46void PLMaterialForce :: giveInputRecord(DynamicInputRecord &input)
47{
48 int number = 1;
49 input.setRecordKeywordField(this->giveInputRecordName(), number);
50
54}
55
56bool PLMaterialForce :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp)
57{
58// printf("Entering PLMaterialForce :: propagateInterface().\n");
59
60 if ( !iEnrFront.propagationIsAllowed() ) {
61 return false;
62 }
63
64 // Fetch crack tip data
65 const TipInfo &tipInfo = iEnrFront.giveTipInfo();
66
67 // Check if the tip is located in the domain
68 SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer();
69 FloatArray lCoords, closest;
70// printf("tipInfo.mGlobalCoord: \n"); tipInfo.mGlobalCoord.printYourself();
71 if ( tipInfo.mGlobalCoord.giveSize() == 0 ) {
72 return false;
73 }
74
75 localizer->giveElementClosestToPoint(lCoords, closest, tipInfo.mGlobalCoord);
76
77 if ( distance(closest, tipInfo.mGlobalCoord) > 1.0e-9 ) {
78// printf("Tip is outside all elements.\n");
79 return false;
80 }
81
82
83 FloatArray matForce;
84 TimeStep *tStep = iDomain.giveEngngModel()->giveCurrentStep();
85 mpMaterialForceEvaluator->computeMaterialForce(matForce, iDomain, tipInfo, tStep, mRadius);
86
87// printf("matForce: "); matForce.printYourself();
88
89 if(matForce.giveSize() == 0) {
90 return false;
91 }
92
93 double forceNorm = matForce.computeNorm();
94// printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold);
95
96 if(forceNorm < mCrackPropThreshold || forceNorm < 1.0e-20) {
97 return false;
98 }
99
100 printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold);
101 printf("Propagating crack in PLMaterialForce :: propagateInterface.\n");
102// printf("Tip coord: "); tipInfo.mGlobalCoord.printYourself();
103
104 FloatArray dir(matForce);
105 dir.times(1.0/forceNorm);
106// printf("dir: "); dir.printYourself();
107
108 const double cosAngTol = 1.0/sqrt(2.0);
109 if ( tipInfo.mTangDir.dotProduct(dir) < cosAngTol ) {
110 // Do not allow sharper turns than 45 degrees
111
112 if( tipInfo.mNormalDir.dotProduct(dir) > 0.0 ) {
113 dir = tipInfo.mTangDir;
114 dir.add(tipInfo.mNormalDir);
115 dir.normalize();
116 }
117 else {
118// dir = tipInfo.mNormalDir;
119// dir.times(-1.0);
120 dir = tipInfo.mTangDir;
121 dir.add(-1.0,tipInfo.mNormalDir);
122 dir.normalize();
123 }
124
125 printf("//////////////////////////////////////////// Resticting crack propagation direction.\n");
126// printf("tipInfo.mTangDir: "); tipInfo.mTangDir.printYourself();
127// printf("dir: "); dir.printYourself();
128 }
129
130 // Fill up struct
131 oTipProp.mTipIndex = tipInfo.mTipIndex;
132 oTipProp.mPropagationDir = dir;
134
135
136 return true;
137}
138
139} /* namespace oofem */
#define REGISTER_PropagationLaw(class)
SpatialLocalizer * giveSpatialLocalizer()
Definition domain.C:1255
EngngModel * giveEngngModel()
Definition domain.C:419
void setRecordKeywordField(std ::string keyword, int number)
void setField(int item, InputFieldType id)
virtual TimeStep * giveCurrentStep(bool force=false)
Definition engngm.h:717
const TipInfo & giveTipInfo() const
virtual bool propagationIsAllowed() const
double computeNorm() const
Definition floatarray.C:861
double dotProduct(const FloatArray &x) const
Definition floatarray.C:524
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void add(const FloatArray &src)
Definition floatarray.C:218
void times(double s)
Definition floatarray.C:834
std ::unique_ptr< MaterialForceEvaluator > mpMaterialForceEvaluator
const char * giveInputRecordName() const override
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
FloatArray mTangDir
Definition tipinfo.h:32
FloatArray mNormalDir
Definition tipinfo.h:33
FloatArray mGlobalCoord
Definition tipinfo.h:30
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
double distance(const FloatArray &x, const FloatArray &y)
#define _IFT_PLMaterialForce_IncLength
Increment length per time step.
#define _IFT_PLMaterialForce_CrackPropThreshold
Threshold for crack propagation.
#define _IFT_PLMaterialForce_Radius
Radius of region for domain integral.
double mPropagationLength
Definition tipinfo.h:45
FloatArray mPropagationDir
Definition tipinfo.h:44

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