OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
trabboneembed.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 "trabboneembed.h"
36 #include "floatmatrix.h"
37 #include "floatarray.h"
38 #include "mathfem.h"
39 #include "contextioerr.h"
40 #include "classfactory.h"
41 
42 namespace oofem {
43 REGISTER_Material(TrabBoneEmbed);
44 
46 { }
47 
48 
49 void TrabBoneEmbed :: computeCumPlastStrain(double &tempAlpha, GaussPoint *gp, TimeStep *tStep)
50 {
51  tempAlpha = 0.;
52 }
53 
54 
55 void
57  MatResponseMode mode, GaussPoint *gp,
58  TimeStep *tStep)
59 {
60  TrabBoneEmbedStatus *status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
61 
62  FloatMatrix elasticity, compliance;
63 
64  this->constructIsoComplTensor(compliance, eps0, nu0);
65  elasticity.beInverseOf(compliance);
66 
67  answer.resize(6, 6);
68  answer = elasticity;
69 
70  status->setSmtrx(answer);
71 }
72 
73 
74 void
76 {
77  double tempAlpha;
78  FloatArray tempPlasDef;
79 
80  TrabBoneEmbedStatus *status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
81 
82  tempPlasDef.resize(6);
83  tempAlpha = 0.;
84 
85  status->setTempPlasDef(tempPlasDef);
86  status->setTempAlpha(tempAlpha);
87 }
88 
89 
90 double
92 {
93  double tempDam = 0.0;
94 
95  return tempDam;
96 }
97 
98 
99 double
101 {
102  double tempAlpha;
103 
104  computeCumPlastStrain(tempAlpha, gp, tStep);
105 
106  double tempDam = computeDamageParam(tempAlpha, gp);
107 
108  // double dam=0.0;
109 
110  return tempDam;
111 }
112 
113 
114 void
116  const FloatArray &totalStrain,
117  TimeStep *tStep)
118 {
119  double tempDam, tempTSED;
120  FloatArray plasDef;
121  FloatArray totalStress;
122  FloatMatrix compliance, elasticity;
123 
124  this->constructIsoComplTensor(compliance, eps0, nu0);
125  elasticity.beInverseOf(compliance);
126 
127  TrabBoneEmbedStatus *status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
128  this->initTempStatus(gp);
129 
130  performPlasticityReturn(gp, totalStrain);
131 
132  tempDam = computeDamage(gp, tStep);
133 
134  plasDef.resize(6);
135 
136  totalStress.beProductOf(elasticity, totalStrain);
137 
138  tempTSED = 0.5 * totalStrain.dotProduct(totalStress);
139 
140  answer.resize(6);
141  answer = totalStress;
142  status->setTempDam(tempDam);
143  status->letTempStrainVectorBe(totalStrain);
144  status->letTempStressVectorBe(answer);
145  status->setTempTSED(tempTSED);
146 }
147 
148 
149 void
150 TrabBoneEmbed :: constructIsoComplTensor(FloatMatrix &answer, const double eps0, const double nu0)
151 {
152  double mu0 = eps0 / ( 2 * ( 1 + nu0 ) );
153 
154  answer.resize(6, 6);
155  answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = 1 / eps0;
156  answer.at(1, 2) = answer.at(2, 1) = answer.at(1, 3) = -nu0 / eps0;
157  answer.at(3, 1) = answer.at(2, 3) = answer.at(3, 2) = -nu0 / eps0;
158  answer.at(4, 4) = answer.at(5, 5) = answer.at(6, 6) = 1 / mu0;
159 }
160 
161 
164 {
165  IRResultType result; // Required by IR_GIVE_FIELD macro
166 
167  // Read material properties here
168 
171 
173 }
174 
175 
176 int
178 {
179  TrabBoneEmbedStatus *status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
180  if ( type == IST_DamageScalar ) {
181  answer.resize(1);
182  answer.at(1) = 0.;
183  OOFEM_WARNING("No damage is exported (why?!)");
184  return 1;
185  } else if ( type == IST_PlasticStrainTensor ) {
186  answer = status->givePlasDef();
187  OOFEM_WARNING("Unsure what components are stored in the plastic strain tensor");
188  return 1;
189  } else if ( type == IST_MaxEquivalentStrainLevel ) {
190  answer.resize(1);
191  answer.at(1) = 0.;
192  return 1;
193  } else if ( type == IST_BoneVolumeFraction ) {
194  answer.resize(1);
195  answer.at(1) = 1.;
196  return 1;
197  } else if ( type == IST_PlasStrainEnerDens ) {
198  answer.resize(1);
199  answer.at(1) = 0.;
200  return 1;
201  } else if ( type == IST_ElasStrainEnerDens ) {
202  answer.resize(1);
203  answer.at(1) = status->giveTempTSED();
204  return 1;
205  } else if ( type == IST_TotalStrainEnerDens ) {
206  answer.resize(1);
207  answer.at(1) = status->giveTempTSED();
208  return 1;
209  } else {
210  return StructuralMaterial :: giveIPValue(answer, gp, type, tStep);
211  }
212 }
213 
214 
218 
220 {
221  alpha = 0.0;
222  dam = 0.0;
223  tsed = 0.0;
224  tempAlpha = 0.0;
225  tempDam = 0.0;
226  tempTSED = 0.0;
227  smtrx.resize(6, 6);
228 }
229 
230 
232 { }
233 
234 
235 double
237 {
238  return tempTSED;
239 }
240 
241 
242 void
244 {
246  fprintf(file, "status { ");
247  fprintf( file, "plastrains: %f %f %f %f %f %f", this->tempPlasDef.at(1), this->tempPlasDef.at(2), this->tempPlasDef.at(3), this->tempPlasDef.at(4), this->tempPlasDef.at(5), this->tempPlasDef.at(6) );
248  fprintf(file, " , alpha 0. , dam 0. , esed %f , psed 0. , tsed %f ", this->tempTSED, this->tempTSED);
249  fprintf(file, "}\n");
250 }
251 
252 
253 void
255 {
257  this->tempAlpha = this->alpha;
258  this->tempDam = this->dam;
259  this->tempTSED = this->tsed;
260  this->tempPlasDef = this->plasDef;
261 }
262 
263 
264 void
266 {
268  this->alpha = this->tempAlpha;
269  this->dam = this->tempDam;
270  this->tsed = this->tempTSED;
271  this->plasDef = this->tempPlasDef;
272 }
273 
274 
277 {
278  contextIOResultType iores;
279 
280  // save parent class status
281  if ( ( iores = StructuralMaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
282  THROW_CIOERR(iores);
283  }
284 
285  // write a raw data
286  //if (fwrite(&kappa,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
287  //if (fwrite(&damage,sizeof(double),1,stream)!= 1) THROW_CIOERR(CIO_IOERR);
288 
289  return CIO_OK;
290 }
291 
292 
295 {
296  contextIOResultType iores;
297 
298  // read parent class status
299  if ( ( iores = StructuralMaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
300  THROW_CIOERR(iores);
301  }
302 
303  // read raw data
304  //if (fread (&kappa,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
305  //if (fread (&damage,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
306 
307  return CIO_OK;
308 }
309 
310 
312 {
313  TrabBoneEmbedStatus *status =
315  return status;
316 }
317 } // end namespace oofem
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: structuralms.C:96
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
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
const FloatArray & givePlasDef() const
Definition: trabboneembed.h:82
GaussPoint * gp
Associated integration point.
Class and object Domain.
Definition: domain.h:115
void setTempDam(double da)
Definition: trabboneembed.h:76
void setSmtrx(FloatMatrix smt)
Definition: trabboneembed.h:80
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
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.
This class implements a structural material status information.
Definition: structuralms.h:65
void constructIsoComplTensor(FloatMatrix &answer, const double eps0, const double nu0)
Constructs the anisotropic compliance tensor.
void setTempAlpha(double al)
Definition: trabboneembed.h:78
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
MatResponseMode
Describes the character of characteristic material matrix.
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
void performPlasticityReturn(GaussPoint *gp, const FloatArray &totalStrain)
Definition: trabboneembed.C:75
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void give3dMaterialStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes full 3d material stiffness matrix at given integration point, time, respecting load history ...
Definition: trabboneembed.C:56
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
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
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
TrabBoneEmbedStatus(int n, Domain *d, GaussPoint *g)
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: structuralms.C:157
double computeDamage(GaussPoint *gp, TimeStep *tStep)
Abstract base class representing a material status information.
Definition: matstatus.h:84
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
virtual void computeCumPlastStrain(double &alpha, GaussPoint *gp, TimeStep *tStep)
Definition: trabboneembed.C:49
void letTempStressVectorBe(const FloatArray &v)
Assigns tempStressVector to given vector v.
Definition: structuralms.h:135
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
TrabBoneEmbed(int n, Domain *d)
Definition: trabboneembed.C:45
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
Abstract base class for all "structural" constitutive models.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: structuralms.C:108
Domain * giveDomain() const
Definition: femcmpnn.h:100
virtual void giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep)
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
REGISTER_Material(DummyMaterial)
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
void setTempTSED(double tse)
Definition: trabboneembed.h:77
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: structuralms.C:133
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
void beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
Definition: floatmatrix.C:835
double computeDamageParam(double alpha, GaussPoint *gp)
Definition: trabboneembed.C:91
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
#define _IFT_TrabBoneEmbed_nu0
Definition: trabboneembed.h:51
Class representing integration point in finite element program.
Definition: gausspoint.h:93
#define OOFEM_WARNING(...)
Definition: error.h:62
Class representing solution step.
Definition: timestep.h:80
#define _IFT_TrabBoneEmbed_eps0
Definition: trabboneembed.h:50
void setTempPlasDef(FloatArray epsip)
Definition: trabboneembed.h:79
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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