OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
kelvinChM.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## ## ## ## ##
6  * ## ## ## ## ## ## ## ##
7  * ##### ##### ## ###### ## ##
8  *
9  *
10  * OOFEM : Object Oriented Finite Element Code
11  *
12  * Copyright (C) 1993 - 2013 Borek Patzak
13  *
14  *
15  *
16  * Czech Technical University, Faculty of Civil Engineering,
17  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU Lesser General Public
21  * License as published by the Free Software Foundation; either
22  * version 2.1 of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public
30  * License along with this library; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32  */
33 
34 #include "mathfem.h"
35 #include "kelvinChM.h"
36 #include "floatarray.h"
37 #include "floatmatrix.h"
38 #include "gausspoint.h"
39 #include "timestep.h"
40 #include "contextioerr.h"
41 
42 
43 namespace oofem {
45 { }
46 
47 void
49 {
50  /*
51  * This function computes the moduli of individual Kelvin units
52  * such that the corresponding Dirichlet series gives the best
53  * approximation of the actual compliance function J(t,t0) with t0 fixed.
54  *
55  * The optimal moduli are obtained using the least-square method.
56  *
57  * INPUTS:
58  * tPrime = age of material when load is applied
59  */
60 
61  FloatArray rhs(this->nUnits);
62  FloatMatrix A(this->nUnits, this->nUnits);
63 
64  const FloatArray &rTimes = this->giveDiscreteTimes();
65  int rSize = rTimes.giveSize();
66  FloatArray discreteComplianceFunctionVal(rSize);
67 
68  // compute values of the compliance function at specified times rTimes
69  // (can be done directly, since the compliance function is available)
70 
71  for ( int i = 1; i <= rSize; i++ ) {
72  discreteComplianceFunctionVal.at(i) = this->computeCreepFunction(tPrime + rTimes.at(i), tPrime, gp, tStep);
73  }
74 
75  // assemble the matrix of the set of linear equations
76  // for computing the optimal compliances
77  // !!! chartime exponents are assumed to be equal to 1 !!!
78  for ( int i = 1; i <= this->nUnits; i++ ) {
79  double taui = this->giveCharTime(i);
80  for ( int j = 1; j <= this->nUnits; j++ ) {
81  double tauj = this->giveCharTime(j);
82  double sum = 0.;
83  for ( int r = 1; r <= rSize; r++ ) {
84  double tti = rTimes.at(r) / taui;
85  double ttj = rTimes.at(r) / tauj;
86  sum += ( 1. - exp(-tti) ) * ( 1. - exp(-ttj) );
87  }
88 
89  A.at(i, j) = sum;
90  }
91 
92  // assemble rhs
93  // !!! chartime exponents are assumed to be equal to 1 !!!
94  double sumRhs = 0.;
95  for ( int r = 1; r <= rSize; r++ ) {
96  double tti = rTimes.at(r) / taui;
97  sumRhs += ( 1. - exp(-tti) ) * discreteComplianceFunctionVal.at(r);
98  }
99 
100  rhs.at(i) = sumRhs;
101  }
102 
103  // solve the linear system
104  A.solveForRhs(rhs, answer);
105 
106  // convert compliances into moduli
107  for ( int i = 1; i <= this->nUnits; i++ ) {
108  answer.at(i) = 1. / answer.at(i);
109  }
110 }
111 
112 double
114 {
115  /*
116  * This function returns the incremental modulus for the given time increment.
117  * Return value is the incremental E modulus of non-aging Kelvin chain without the first unit (elastic spring)
118  * The modulus may also depend on the specimen geometry (gp - dependence).
119  *
120  * Note: time -1 refers to the previous time.
121  */
122 
123  double sum = 0.0; // return value
124 
125  if ( (tStep->giveIntrinsicTime() < this->castingTime) ) {
126  OOFEM_ERROR("Attempted to evaluate E modulus at time lower than casting time");
127  }
128 
130  double tPrime = relMatAge + ( tStep->giveTargetTime() - 0.5 * tStep->giveTimeIncrement() );
131  this->updateEparModuli(tPrime, gp, tStep);
132 
133  double deltaT = tStep->giveTimeIncrement();
134 
135  // EparVal values were determined using the least-square method
136  for ( int mu = 1; mu <= nUnits; mu++ ) {
137  double tauMu = this->giveCharTime(mu);
138  double lambdaMu;
139  if ( deltaT / tauMu < 1.e-5 ) {
140  lambdaMu = 1 - 0.5 * ( deltaT / tauMu ) + 1 / 6 * ( pow(deltaT / tauMu, 2) ) - 1 / 24 * ( pow(deltaT / tauMu, 3) );
141  } else if ( deltaT / tauMu > 30 ) {
142  lambdaMu = tauMu / deltaT;
143  } else {
144  lambdaMu = ( 1.0 - exp(-deltaT / tauMu) ) * tauMu / deltaT;
145  }
146 
147  double Dmu = this->giveEparModulus(mu);
148  sum += ( 1 - lambdaMu ) / Dmu;
149  }
150 
151  // return sum;
152  // changed formulation to return stiffness instead of compliance
153  return 1. / sum;
154 
155 }
156 
157 void
159 //
160 // computes the strain due to creep at constant stress during the increment
161 // (in fact, the INCREMENT of creep strain is computed for mode == VM_Incremental)
162 //
163 {
164  KelvinChainMaterialStatus *status = static_cast< KelvinChainMaterialStatus * >( this->giveStatus(gp) );
165 
166  // !!! chartime exponents are assumed to be equal to 1 !!!
167 
168  if ( tStep->giveIntrinsicTime() < this->castingTime ) {
169  OOFEM_ERROR("Attempted to evaluate creep strain for time lower than casting time");
170  }
171 
172  if ( mode == VM_Incremental ) {
173  FloatArray reducedAnswer;
174 
175  for ( int mu = 1; mu <= nUnits; mu++ ) {
176  double beta;
177  if ( tStep->giveTimeIncrement() / this->giveCharTime(mu) > 30 ) {
178  beta = 0;
179  } else {
180  beta = exp( - tStep->giveTimeIncrement() / this->giveCharTime(mu) );
181  }
182 
183  FloatArray *gamma = & status->giveHiddenVarsVector(mu); // JB
184  if ( gamma ) {
185  reducedAnswer.add(1.0 - beta, * gamma);
186  }
187  }
188 
189  answer = reducedAnswer;
190  } else {
191  /* error - total mode not implemented yet */
192  OOFEM_ERROR("mode is not supported");
193  }
194 }
195 
196 
197 void
199 {
200  RheoChainMaterial :: giveRealStressVector(answer, gp, reducedStrain, tStep);
201 
202  this->computeHiddenVars(gp, tStep);
203 }
204 
205 void
207 {
208  /*
209  * Updates hidden variables used to effectively trace the load history
210  */
211 
212  // !!! chartime exponents are assumed to be equal to 1 !!!
213 
214  FloatArray help, deltaEps0, delta_sigma;
215  KelvinChainMaterialStatus *status = static_cast< KelvinChainMaterialStatus * >( this->giveStatus(gp) );
216 
217  // if ( !this->isActivated(tStep) ) {
218  if ( tStep->giveIntrinsicTime() < this->castingTime ) {
220  help.zero();
221  for ( int mu = 1; mu <= nUnits; mu++ ) {
222  status->letTempHiddenVarsVectorBe(mu, help);
223  }
224  return;
225  }
226 
227  delta_sigma = status->giveTempStrainVector(); // gives updated strain vector (at the end of time-step)
228  delta_sigma.subtract( status->giveStrainVector() ); // strain increment in current time-step
229 
230  // Subtract the stress-independent part of strain
231  this->computeStressIndependentStrainVector(deltaEps0, gp, tStep, VM_Incremental);
232  if ( deltaEps0.giveSize() ) {
233  delta_sigma.subtract(deltaEps0); // should be equal to zero if there is no stress change during the time-step
234  }
235 
236  // no need to worry about "zero-stiffness" for time < castingTime - this is done above
237  delta_sigma.times( this->giveEModulus(gp, tStep) ); // = delta_sigma
238 
239  double deltaT = tStep->giveTimeIncrement();
240 
241  for ( int mu = 1; mu <= nUnits; mu++ ) {
242  double betaMu;
243  double lambdaMu;
244  help = delta_sigma;
245  double tauMu = this->giveCharTime(mu);
246 
247  if ( deltaT / tauMu < 1.e-5 ) {
248  betaMu = exp(-( deltaT ) / tauMu);
249  lambdaMu = 1 - 0.5 * ( deltaT / tauMu ) + 1 / 6 * ( pow(deltaT / tauMu, 2) ) - 1 / 24 * ( pow(deltaT / tauMu, 3) );
250  } else if ( deltaT / tauMu > 30 ) {
251  betaMu = 0;
252  lambdaMu = tauMu / deltaT;
253  } else {
254  betaMu = exp(-( deltaT ) / tauMu);
255  lambdaMu = ( 1.0 - betaMu ) * tauMu / deltaT;
256  }
257 
258  help.times( lambdaMu / ( this->giveEparModulus(mu) ) );
259 
260  FloatArray muthHiddenVarsVector = status->giveHiddenVarsVector(mu); //gamma_mu
261  if ( muthHiddenVarsVector.giveSize() ) {
262  muthHiddenVarsVector.times(betaMu);
263  muthHiddenVarsVector.add(help);
264  status->letTempHiddenVarsVectorBe(mu, muthHiddenVarsVector);
265  } else {
266  status->letTempHiddenVarsVectorBe(mu, help);
267  }
268  }
269 }
270 
271 
274 {
275  return new KelvinChainMaterialStatus(1, this->giveDomain(), gp, nUnits);
276 }
277 
280 {
282  if ( result != IRRT_OK ) return result;
283 
284  this->giveDiscreteTimes(); // Makes sure the new discrete times are evaluated.
285  return IRRT_OK;
286 }
287 
288 /****************************************************************************************/
289 
291  GaussPoint *g, int nunits) :
292  RheoChainMaterialStatus(n, d, g, nunits) { }
293 
294 void
296 {
298 }
299 
300 
301 void
303 {
305 }
306 
307 void
309 {
311 }
312 
315 {
316  contextIOResultType iores;
317 
318  if ( ( iores = RheoChainMaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
319  THROW_CIOERR(iores);
320  }
321 
322  return CIO_OK;
323 }
324 
325 
328 {
329  contextIOResultType iores;
330 
331  if ( ( iores = RheoChainMaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
332  THROW_CIOERR(iores);
333  }
334 
335  return CIO_OK;
336 }
337 } // end namespace oofem
static int giveSizeOfVoigtSymVector(MaterialMode mmode)
Returns the size of symmetric part of a reduced stress/strain vector according to given mode...
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
double relMatAge
Physical age of the material at simulation time = 0.
Definition: rheoChM.h:138
void subtract(const FloatArray &src)
Subtracts array src to receiver.
Definition: floatarray.C:258
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
double giveCharTime(int) const
Access to the characteristic time of a given unit.
Definition: rheoChM.C:397
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: kelvinChM.C:295
Class and object Domain.
Definition: domain.h:115
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Solves the system of linear equations .
Definition: floatmatrix.C:1112
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: rheoChM.C:781
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: rheoChM.C:751
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
KelvinChainMaterial(int n, Domain *d)
Definition: kelvinChM.C:44
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual void giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep)
Computes the real stress vector for given total strain and integration point.
Definition: rheoChM.C:81
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: rheoChM.C:802
This class implements associated Material Status to RheoChainMaterial.
Definition: rheoChM.h:71
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: rheoChM.C:829
double giveTargetTime()
Returns target time.
Definition: timestep.h:146
virtual double computeCreepFunction(double t, double t_prime, GaussPoint *gp, TimeStep *tStep)=0
Evaluation of the creep compliance function at time t when loading is acting from time t_prime...
This class implements a rheologic chain model describing a viscoelastic material. ...
Definition: rheoChM.h:130
virtual double giveEModulus(GaussPoint *gp, TimeStep *tStep)
Evaluation of the incremental modulus.
Definition: kelvinChM.C:113
const FloatArray & giveDiscreteTimes()
Definition: rheoChM.C:260
void computeHiddenVars(GaussPoint *gp, TimeStep *tStep)
Definition: kelvinChM.C:206
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
double giveEparModulus(int iChain)
Access to partial modulus of a given unit.
Definition: rheoChM.C:303
void letTempHiddenVarsVectorBe(int i, FloatArray &valueArray)
Definition: rheoChM.C:739
double giveTimeIncrement()
Returns solution step associated time increment.
Definition: timestep.h:150
virtual void computeCharCoefficients(FloatArray &answer, double tPrime, GaussPoint *gp, TimeStep *tStep)
Evaluation of the moduli of individual units.
Definition: kelvinChM.C:48
virtual void giveEigenStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, ValueModeType mode)
Computes, for the given integration point, the strain vector induced by the stress history (typically...
Definition: kelvinChM.C:158
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: kelvinChM.C:314
#define OOFEM_ERROR(...)
Definition: error.h:61
const FloatArray & giveTempStrainVector() const
Returns the const pointer to receiver&#39;s temporary strain vector.
Definition: structuralms.h:115
This class implements associated Material Status to KelvinChainMaterial.
Definition: kelvinChM.h:44
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
double giveIntrinsicTime()
Returns intrinsic time, e.g. time in which constitutive model is evaluated.
Definition: timestep.h:148
FloatArray & giveHiddenVarsVector(int i)
Definition: rheoChM.h:99
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: kelvinChM.C:302
Abstract base class representing a material status information.
Definition: matstatus.h:84
virtual void updateEparModuli(double tPrime, GaussPoint *gp, TimeStep *tStep)
Update of partial moduli of individual chain units.
Definition: rheoChM.C:313
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
Definition: kelvinChM.C:273
KelvinChainMaterialStatus(int n, Domain *d, GaussPoint *g, int nunits)
Definition: kelvinChM.C:290
virtual void computeStressIndependentStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, ValueModeType mode)
Computes reduced strain vector in given integration point, generated by internal processes in materia...
Definition: rheoChM.C:371
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: kelvinChM.C:327
virtual void giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep)
Computes the real stress vector for given total strain and integration point.
Definition: kelvinChM.C:198
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: rheoChM.C:796
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: rheoChM.C:583
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: kelvinChM.C:279
Domain * giveDomain() const
Definition: femcmpnn.h:100
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: kelvinChM.C:308
double castingTime
Casting time.
Definition: material.h:113
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
const FloatArray & giveStrainVector() const
Returns the const pointer to receiver&#39;s strain vector.
Definition: structuralms.h:105
int nUnits
Number of (Maxwell or Kelvin) units in the rheologic chain.
Definition: rheoChM.h:136
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011