OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
trabbonenl.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 #include "trabbonenl.h"
36 #include "gausspoint.h"
37 #include "floatarray.h"
38 #include "mathfem.h"
39 #include "nonlocalmaterialext.h"
40 #include "classfactory.h"
41 #include "dynamicinputrecord.h"
42 
43 #ifdef __OOFEG
44  #include "oofeggraphiccontext.h"
45 #endif
46 
47 namespace oofem {
51 
52 REGISTER_Material(TrabBoneNL);
53 
55 // BEGIN: CONSTRUCTOR
56 //
57 
59 {
60  R = 0.;
61 }
62 
63 //
64 // END: CONSTRUCTOR
66 
67 
69 // BEGIN: DESTRUCTOR
70 //
71 
73 { }
74 
75 //
76 // END: DESTRUCTOR
78 
79 
81 // BEGIN: SUBROUTINE FOR UPDATE BEFORE NON LOCAL AVERAGE
82 // update local values of accumulated pastic strain
83 
84 void
86 {
87  FloatArray SDstrainVector;
88  double cumPlastStrain;
89  TrabBoneNLStatus *nlstatus = static_cast< TrabBoneNLStatus * >( this->giveStatus(gp) );
90 
91  this->initTempStatus(gp);
92  this->giveStressDependentPartOfStrainVector(SDstrainVector, gp, strainVector, tStep, VM_Total);
93 
94  nlstatus->letTempStrainVectorBe(strainVector);
95 
96  this->performPlasticityReturn(gp, strainVector);
97  this->computeLocalCumPlastStrain(cumPlastStrain, strainVector, gp, tStep);
98  nlstatus->setLocalCumPlastStrainForAverage(cumPlastStrain);
99 }
100 
101 //
102 // END: SUBROUTINE FOR UPDATE BEFORE NON LOCAL AVERAGE
104 
105 
107 // BEGIN: SUBROUTINE FOR EVALUATION OF TOTAL STRESS
108 //
109 
110 void
112  GaussPoint *gp,
113  const FloatArray &strainVector,
114  TimeStep *tStep)
115 {
116  TrabBoneNLStatus *nlStatus = static_cast< TrabBoneNLStatus * >( this->giveStatus(gp) );
117 
118  double tempDamage = computeDamage(gp, tStep);
119  double plasStrain = nlStatus->giveTempPlasStrainVector().at(1);
120  double elasStrain = strainVector.at(1) - plasStrain;
121  double effStress = E0 * elasStrain;
122  double sigc = nlStatus->giveSigC();
123 
124  answer.resize(1);
125  answer.at(1) = ( 1. - tempDamage ) * effStress + sigc;
126 
127  nlStatus->setTempDam(tempDamage);
128  nlStatus->letTempStrainVectorBe(strainVector);
129  nlStatus->letTempStressVectorBe(answer);
130 }
131 
132 //
133 // END: SUBROUTINE FOR EVALUATION OF TOTAL STRESS
135 
136 
138 // BEGIN: SUBROUTINE OF NONLOCAL ALPHA EVALUATION
139 //
140 
141 void
143 {
144  double nonlocalContribution, nonlocalCumPlastStrain = 0.0;
145  TrabBoneNLStatus *nonlocStatus, *status = static_cast< TrabBoneNLStatus * >( this->giveStatus(gp) );
146 
147  this->buildNonlocalPointTable(gp);
148  this->updateDomainBeforeNonlocAverage(tStep);
149 
150  auto list = status->giveIntegrationDomainList();
151 
152  for ( auto &lir: *list ) {
153  nonlocStatus = static_cast< TrabBoneNLStatus * >( this->giveStatus(lir.nearGp) );
154  nonlocalContribution = nonlocStatus->giveLocalCumPlastStrainForAverage();
155  nonlocalContribution *= lir.weight;
156  nonlocalCumPlastStrain += nonlocalContribution;
157  }
158 
159  nonlocalCumPlastStrain *= 1. / status->giveIntegrationScale();
160 
161  double localCumPlastStrain = status->giveLocalCumPlastStrainForAverage();
162  alpha = mParam * nonlocalCumPlastStrain + ( 1 - mParam ) * localCumPlastStrain;
163 }
164 
165 //
166 // END: SUBROUTINE OF NONLOCAL ALPHA EVALUATION
168 
169 
171 // BEGIN: INTERFACE ????
172 //
173 
174 Interface *
176 {
178  return static_cast< StructuralNonlocalMaterialExtensionInterface * >(this);
179  } else {
180  return NULL;
181  }
182 }
183 
184 //
185 // END: INTERFACE ????
187 
188 
190 // BEGIN: PARAMETERS OF INPUT FILE
191 //
192 
195 {
196  IRResultType result; // Required by IR_GIVE_FIELD macro
197 
199  if ( result != IRRT_OK ) {
200  return result;
201  }
202 
204  if ( result != IRRT_OK ) {
205  return result;
206  }
207 
209  if ( R < 0.0 ) {
210  R = 0.0;
211  }
212 
213  mParam = 1.;
215 
216  return IRRT_OK;
217 }
218 
219 //
220 // END: PARAMETERS OF INPUT FILE
222 
223 
225 // BEGIN: ??????????????
226 //
227 
228 void
230 {
232  input.setField(this->R, _IFT_TrabBoneNL_r);
233  input.setField(this->mParam, _IFT_TrabBoneNL_m);
234 }
235 
236 
237 //
238 // END: ????????????????
240 
241 
243 // BEGIN: WEIGHT FUNCTION FOR NONLOCAL CONTRIBUTION
244 //
245 
246 double
248 {
249  double dist = src.distance(coord);
250 
251  if ( ( dist >= 0. ) && ( dist <= this->R ) ) {
252  double help = ( 1. - dist * dist / ( R * R ) );
253  return help * help;
254  }
255 
256  return 0.0;
257 }
258 
259 //
260 // END: WEIGHT FUNCTION FOR NONLOCAL CONTRIBUTION
262 
263 
267 
268 
270 // BEGIN: CONSTRUCTOR
271 // init state variables
272 
275 {
277 }
278 
279 //
280 // END: CONSTRUCTOR
282 
283 
285 // BEGIN: DESTRUCTOR
286 //
287 
289 { }
290 
291 //
292 // END: DESTRUCTOR
294 
295 
297 // BEGIN: PRINTOUT
298 //
299 
300 void
302 {
304  fprintf(file, "status {");
305  fprintf(file, " plastrains ");
306  for ( auto &val : epsp) {
307  fprintf( file, " %.4e", val );
308  }
309 
310  fprintf(file, ",");
311  fprintf(file, " alpha %.4e,", alpha);
312  fprintf(file, " dam %.4e", dam);
313  fprintf(file, "}\n");
314 }
315 
316 //
317 // END: PRINTOUT
319 
320 
322 // BEGIN: INITIALIZE TEMP VARIABLE (UPDATED DURING ITERATIONS)
323 // initialize temporary state variables according to equilibriated state vars
324 
325 void
327 {
329 }
330 
331 //
332 // END: INITIALIZE TEMP VARIABLE (UPDATED DURING ITERATIONS)
334 
335 
337 // BEGIN: SETS VARIABLE EQUAL TO TEMP VARIABLE AT THE END OF THE STEP
338 // Called when equlibrium reached, set equilibriated vars according to temporary (working) ones.
339 
340 void
342 {
344 }
345 
346 //
347 // END: SETS VARIABLE EQUAL TO TEMP VARIABLE AT THE END OF THE STE
349 
350 
352 // BEGIN: INTERFACE ???????????
353 //
354 
355 Interface *
357 {
359  return this;
360  } else {
361  return NULL;
362  }
363 }
364 
365 //
366 // END: INTERFACE ???????????????
368 } // end namespace oofem
Abstract base class for all nonlocal structural materials.
void setField(int item, InputFieldType id)
void letTempStrainVectorBe(const FloatArray &v)
Assigns tempStrainVector to given vector v.
Definition: structuralms.h:137
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
void updateDomainBeforeNonlocAverage(TimeStep *tStep)
Updates data in all integration points before nonlocal average takes place.
const FloatArray & giveTempPlasStrainVector()
virtual void giveRealStressVector_1d(FloatArray &answer, GaussPoint *gp, const FloatArray &strainVector, TimeStep *tStep)
Default implementation relies on giveRealStressVector_StressControl.
Definition: trabbonenl.C:111
Class and object Domain.
Definition: domain.h:115
void setLocalCumPlastStrainForAverage(double ls)
Definition: trabbonenl.h:67
virtual void computeCumPlastStrain(double &alpha, GaussPoint *gp, TimeStep *tStep)
Definition: trabbonenl.C:142
virtual ~TrabBoneNL()
Definition: trabbonenl.C:72
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
void buildNonlocalPointTable(GaussPoint *gp)
Builds list of integration points which take part in nonlocal average in given integration point...
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: trabbonenl.C:341
std::vector< localIntegrationRecord > * giveIntegrationDomainList()
Returns integration list of receiver.
void computeLocalCumPlastStrain(double &alpha, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
Definition: trabbonenl.h:104
void giveStressDependentPartOfStrainVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrainVector, TimeStep *tStep, ValueModeType mode)
Method for subtracting from reduced space strain vector its stress-independent parts (caused by tempe...
#define _IFT_TrabBoneNL_m
Definition: trabbonenl.h:47
Trabecular bone material model.
virtual ~TrabBoneNLStatus()
Definition: trabbonenl.C:288
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: trabbonenl.C:356
virtual double computeWeightFunction(const FloatArray &src, const FloatArray &coord)
Evaluates the basic nonlocal weight function for two points with given coordinates.
Definition: trabbonenl.C:247
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
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Definition: trabbonenl.C:229
double giveLocalCumPlastStrainForAverage()
Definition: trabbonenl.h:66
#define _IFT_TrabBoneNL_r
Definition: trabbonenl.h:46
This class implements associated Material Status to TrabBoneMaterial.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: trabbonenl.C:326
double localCumPlastStrainForAverage
Equivalent strain for averaging.
Definition: trabbonenl.h:58
void performPlasticityReturn(GaussPoint *gp, const FloatArray &totalStrain)
Class representing vector of real numbers.
Definition: floatarray.h:82
TrabBoneNLStatus(int n, Domain *d, GaussPoint *g)
Definition: trabbonenl.C:273
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void letTempStressVectorBe(const FloatArray &v)
Assigns tempStressVector to given vector v.
Definition: structuralms.h:135
TrabBoneNL(int n, Domain *d)
Definition: trabbonenl.C:58
Class representing the general Input Record.
Definition: inputrecord.h:101
double computeDamage(GaussPoint *gp, TimeStep *tStep)
Base class for all nonlocal structural material statuses.
Class Interface.
Definition: interface.h:82
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Class representing the a dynamic Input Record.
virtual void updateBeforeNonlocAverage(const FloatArray &strainVector, GaussPoint *gp, TimeStep *tStep)
Declares the service updating local variables in given integration points, which take part in nonloca...
Definition: trabbonenl.C:85
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: trabbonenl.C:175
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
double giveIntegrationScale()
Returns associated integration scale.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
REGISTER_Material(DummyMaterial)
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
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
virtual void initTempStatus(GaussPoint *gp)
Initializes temporary variables stored in integration point status at the beginning of new time step...
Definition: material.C:267
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: trabbonenl.C:194
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: trabbonenl.C:301
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
Trabecular bone nonlocal material status.
Definition: trabbonenl.h:54

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