OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
trabbonenlembed.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 "trabbonenlembed.h"
36 #include "gausspoint.h"
37 #include "floatmatrix.h"
38 #include "floatarray.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(TrabBoneNLEmbed);
53 
55 {
56  R = 0.;
57 }
58 
60 { }
61 
62 void
64 {
65  FloatArray SDstrainVector;
66  double cumPlastStrain;
67  TrabBoneNLEmbedStatus *nlstatus = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(gp) );
68 
69  this->initTempStatus(gp);
70  this->giveStressDependentPartOfStrainVector(SDstrainVector, gp, strainVector, tStep, VM_Total);
71 
72  nlstatus->letTempStrainVectorBe(strainVector);
73 
74  this->performPlasticityReturn(gp, strainVector);
75  this->computeLocalCumPlastStrain(cumPlastStrain, strainVector, gp, tStep);
76 
77  nlstatus->setLocalCumPlastStrainForAverage(cumPlastStrain);
78 }
79 
80 void
82  GaussPoint *gp,
83  const FloatArray &strainVector,
84  TimeStep *tStep)
85 {
86  TrabBoneNLEmbedStatus *nlStatus = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(gp) );
87 
88  double tempDam, tempTSED;
89  FloatArray plasDef, totalStress;
90  FloatMatrix compliance, elasticity;
91 
92  compliance.resize(6, 6);
93  this->constructIsoComplTensor(compliance, eps0, nu0);
94  elasticity.beInverseOf(compliance);
95 
96  tempDam = 0;
97  plasDef.resize(6);
98 
99  totalStress.beProductOf(elasticity, strainVector);
100 
101  tempTSED = 0.5 * strainVector.dotProduct(totalStress);
102 
103  answer.resize(6);
104  answer = totalStress;
105 
106  nlStatus->setTempDam(tempDam);
107  nlStatus->letTempStrainVectorBe(strainVector);
108  nlStatus->letTempStressVectorBe(answer);
109  nlStatus->setTempTSED(tempTSED);
110 }
111 
112 void
114 {
115  double nonlocalContribution, nonlocalCumPlastStrain = 0.0;
116  TrabBoneNLEmbedStatus *nonlocStatus, *status = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(gp) );
117 
118  this->buildNonlocalPointTable(gp);
119  this->updateDomainBeforeNonlocAverage(tStep);
120 
121  auto list = status->giveIntegrationDomainList();
122 
123  for ( auto &lir: *list ) {
124  nonlocStatus = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(lir.nearGp) );
125  nonlocalContribution = nonlocStatus->giveLocalCumPlastStrainForAverage();
126  nonlocalContribution *= lir.weight;
127  nonlocalCumPlastStrain += nonlocalContribution;
128  }
129 
130  nonlocalCumPlastStrain /= status->giveIntegrationScale();
131 
132  // double localCumPlastStrain = status->giveLocalCumPlastStrainForAverage();
133  // alpha = mParam*nonlocalCumPlastStrain +(1-mParam)*localCumPlastStrain ;
134  alpha = 0.;
135 }
136 
137 Interface *
139 {
141  return static_cast< StructuralNonlocalMaterialExtensionInterface * >(this);
142  } else {
143  return NULL;
144  }
145 }
146 
149 {
150  IRResultType result; // Required by IR_GIVE_FIELD macro
151 
152  result = TrabBoneEmbed :: initializeFrom(ir);
153  if ( result != IRRT_OK ) {
154  return result;
155  }
156 
158  if ( result != IRRT_OK ) {
159  return result;
160  }
161 
163  if ( R < 0.0 ) {
164  R = 0.0;
165  }
166 
167  mParam = 1.5;
169 
170  return IRRT_OK;
171 }
172 
173 
174 void
176 {
178  input.setField(this->R, _IFT_TrabBoneNLEmbed_r);
179  input.setField(this->mParam, _IFT_TrabBoneNLEmbed_m);
180 }
181 
182 
183 double
185 {
186  double dist = src.distance(coord);
187 
188  if ( ( dist >= 0. ) && ( dist <= this->R ) ) {
189  double help = ( 1. - dist * dist / ( R * R ) );
190  return help * help;
191  }
192 
193  return 0.0;
194 }
195 
198 {
200 }
201 
203 { }
204 
205 void
207 {
209  fprintf(file, "status {");
210  fprintf(file, " plastrains ");
211  for ( auto &val : plasDef ) {
212  fprintf( file, " %.4e", val );
213  }
214 
215  fprintf(file, " ,");
216  fprintf(file, " alpha %.4e ,", alpha);
217  fprintf(file, " dam %.4e ,", dam);
218  fprintf(file, " esed %.4e ,", this->tempTSED);
219  fprintf(file, " psed 0. ,");
220  fprintf(file, " tsed %.4e ,", this->tempTSED);
221  fprintf(file, "}\n");
222 }
223 
224 void
226 {
228 }
229 
230 void
232 {
234 }
235 
238 {
239  return TrabBoneEmbedStatus :: saveContext(stream, mode, obj);
240 }
241 
244 {
245  return TrabBoneEmbedStatus :: restoreContext(stream, mode, obj);
246 }
247 
248 
249 Interface *
251 {
253  return this;
254  } else {
255  return NULL;
256  }
257 }
258 } // 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 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.
#define _IFT_TrabBoneNLEmbed_m
Class and object Domain.
Definition: domain.h:115
virtual void computeCumPlastStrain(double &alpha, GaussPoint *gp, TimeStep *tStep)
void setTempDam(double da)
Definition: trabboneembed.h:76
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
virtual void giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &strainVector, TimeStep *tStep)
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
void buildNonlocalPointTable(GaussPoint *gp)
Builds list of integration points which take part in nonlocal average in given integration point...
void setLocalCumPlastStrainForAverage(double ls)
Sets the local cumulative plastic strain.
std::vector< localIntegrationRecord > * giveIntegrationDomainList()
Returns integration list of receiver.
void constructIsoComplTensor(FloatMatrix &answer, const double eps0, const double nu0)
Constructs the anisotropic compliance tensor.
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...
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
void performPlasticityReturn(GaussPoint *gp, const FloatArray &totalStrain)
Definition: trabboneembed.C:75
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
#define _IFT_TrabBoneNLEmbed_r
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 updateBeforeNonlocAverage(const FloatArray &strainVector, GaussPoint *gp, TimeStep *tStep)
Declares the service updating local variables in given integration points, which take part in nonloca...
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
This class implements associated Material Status to TrabBoneEmbed.
Definition: trabboneembed.h:58
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
TrabBoneNLEmbedStatus(int n, Domain *d, GaussPoint *g)
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Trabecular bone nonlocal material status.
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
Trabecular bone embedding material model.
Definition: trabboneembed.h:98
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
virtual double computeWeightFunction(const FloatArray &src, const FloatArray &coord)
Evaluates the basic nonlocal weight function for two points with given coordinates.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Class representing the general Input Record.
Definition: inputrecord.h:101
Base class for all nonlocal structural material statuses.
Class Interface.
Definition: interface.h:82
Class representing the a dynamic Input Record.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
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
void setTempTSED(double tse)
Definition: trabboneembed.h:77
the oofem namespace is to define a context or scope in which all oofem names are defined.
void computeLocalCumPlastStrain(double &alpha, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
#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
void beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
Definition: floatmatrix.C:835
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
TrabBoneNLEmbed(int n, Domain *d)
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
double localCumPlastStrainForAverage
Equivalent strain for averaging.
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
double giveLocalCumPlastStrainForAverage()
Gives the local cumulative plastic strain.

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