OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
plasticmaterial.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 "plasticmaterial.h"
36 #include "gausspoint.h"
37 #include "floatmatrix.h"
38 #include "floatarray.h"
39 #include "intarray.h"
40 #include "../sm/CrossSections/structuralcrosssection.h"
41 #include "datastream.h"
42 #include "contextioerr.h"
43 
44 namespace oofem {
45 #define YIELD_TOL 1.e-5
46 #define RES_TOL 1.e-5
47 #define PLASTIC_MATERIAL_MAX_ITERATIONS 40
48 
50  //
51  // constructor
52  //
53 {
54  linearElasticMaterial = NULL;
55 }
56 
57 
59 //
60 // destructor
61 //
62 {
63  delete linearElasticMaterial;
64 }
65 
66 
67 int
69 //
70 // returns whether receiver supports given mode
71 //
72 {
73  return mode == _3dMat ||
74  mode == _1dMat ||
75  //<RESTRICTED_SECTION>
76  mode == _PlaneStress ||
77  //</RESTRICTED_SECTION>
78  mode == _PlaneStrain ||
79  mode == _PlateLayer ||
80  mode == _2dBeamLayer ||
81  mode == _Fiber;
82 }
83 
84 
87 {
88  return new PlasticMaterialStatus(1, this->giveDomain(), gp, this->giveSizeOfReducedHardeningVarsVector(gp));
89 }
90 
91 
92 void
94  GaussPoint *gp,
95  const FloatArray &totalStrain,
96  TimeStep *tStep)
97 //
98 // returns real stress vector in 3d stress space of receiver according to
99 // previous level of stress and current
100 // strain increment, the only way, how to correctly update gp records
101 //
102 // completely formulated in Reduced stress-strain space
103 {
104  FloatArray strainSpaceHardeningVariables;
105  FloatArray fullStressVector, *fullStressSpaceHardeningVars, *residualVectorR;
106  FloatArray elasticStrainVectorR;
107  FloatArray strainVectorR, plasticStrainVectorR, *gradientVectorR;
108  FloatArray helpVec, helpVec2;
109  double yieldValue, Gamma, dGamma, helpVal1, helpVal2;
110  int strSize, totSize, nIterations = 0;
111  FloatMatrix elasticModuli, hardeningModuli, consistentModuli;
112  FloatMatrix elasticModuliInverse, hardeningModuliInverse;
113  FloatMatrix helpMtrx, helpMtrx2;
114 
115  PlasticMaterialStatus *status = static_cast< PlasticMaterialStatus * >( this->giveStatus(gp) );
116 
117  this->initTempStatus(gp);
118 
119  // subtract stress independent part
120  // note: eigenStrains (temperature) is not contained in mechanical strain stored in gp
121  // therefore it is necessary to subtract always the total eigen strain value
122  this->giveStressDependentPartOfStrainVector(strainVectorR, gp, totalStrain,
123  tStep, VM_Total);
124 
125  plasticStrainVectorR = status->givePlasticStrainVector();
126  strainSpaceHardeningVariables = status->giveStrainSpaceHardeningVars();
127 
128  // tady konec debugovani - strainSpaceHardeningVariables ve statusu neinicializovany
129  // to musi udelat material.
130 
131  Gamma = 0.;
132  strSize = strainVectorR.giveSize(); // size of reducedStrain Vector
133  totSize = strSize + strainSpaceHardeningVariables.giveSize();
134 
135  // compute elastic moduli and its inverse
136  this->computeReducedElasticModuli(elasticModuli, gp, tStep);
137  elasticModuliInverse.beInverseOf(elasticModuli);
138 
139  do {
140  elasticStrainVectorR.beDifferenceOf(strainVectorR, plasticStrainVectorR);
141  // stress vector in full form due to computational convenience
142  this->computeTrialStressIncrement(fullStressVector, gp, elasticStrainVectorR, tStep);
143  fullStressSpaceHardeningVars = this->ComputeStressSpaceHardeningVars(gp, & strainSpaceHardeningVariables);
144  yieldValue = this->computeYieldValueAt(gp, & fullStressVector, fullStressSpaceHardeningVars);
145  gradientVectorR = this->ComputeGradientVector(gp, & fullStressVector, fullStressSpaceHardeningVars);
146  residualVectorR = this->ComputeResidualVector(gp, Gamma, & plasticStrainVectorR,
147  & strainSpaceHardeningVariables,
148  gradientVectorR);
149 
150  // check for end of iteration
151  if ( ( yieldValue < YIELD_TOL ) && ( residualVectorR->computeNorm() < RES_TOL ) ) {
152  delete fullStressSpaceHardeningVars;
153  delete gradientVectorR;
154  delete residualVectorR;
155  break;
156  }
157 
158  // compute consistent tangent moduli
159  this->computeHardeningReducedModuli(hardeningModuli, gp, & strainSpaceHardeningVariables, tStep);
160  if ( hardeningModuli.giveNumberOfRows() ) {
161  hardeningModuliInverse.beInverseOf(hardeningModuli);
162  } else {
163  hardeningModuliInverse.clear();
164  }
165 
166  this->computeConsistentModuli(consistentModuli, gp, elasticModuliInverse,
167  hardeningModuliInverse, Gamma,
168  fullStressVector, * fullStressSpaceHardeningVars);
169 
170  // obtain increment to consistency parameter
171  helpMtrx.initFromVector(* gradientVectorR, 1);
172  helpMtrx2.beProductOf(helpMtrx, consistentModuli);
173  helpVec.beProductOf(helpMtrx2, * gradientVectorR);
174  helpVal1 = helpVec.at(1);
175  helpVec.beProductOf(helpMtrx2, * residualVectorR);
176  helpVal2 = helpVec.at(1);
177  dGamma = ( yieldValue - helpVal2 ) / helpVal1;
178 
179  // obtain incremental plastic strains and internal variables
180  // we overwrite residualVectorR and gradientVectorR vectors
181  // but they are computed once again when iteration continues
182  gradientVectorR->times(dGamma);
183  residualVectorR->add(* gradientVectorR);
184  helpVec.beProductOf(consistentModuli, * residualVectorR);
185  // note elasticModuli and hardeningModuli are yet inverted
186  this->computeDiagModuli(helpMtrx, gp, elasticModuliInverse, hardeningModuliInverse);
187  helpVec2.beProductOf(helpMtrx, helpVec);
188 
189  // Update state variables and consistency parameter
190  for ( int i = 1; i <= strSize; i++ ) {
191  plasticStrainVectorR.at(i) += helpVec2.at(i);
192  }
193 
194  for ( int i = strSize + 1; i <= totSize; i++ ) {
195  strainSpaceHardeningVariables.at(i - strSize) += helpVec2.at(i);
196  }
197 
198  Gamma += dGamma;
199 
200  // increment iteration count
201  nIterations++;
202 
203  // free allocated memory inside loop
204  delete fullStressSpaceHardeningVars;
205  delete gradientVectorR;
206  delete residualVectorR;
207 
208  if ( nIterations > PLASTIC_MATERIAL_MAX_ITERATIONS ) {
209  OOFEM_WARNING("local equlibrium not reached in %d iterations\nElement %d, gp %d, continuing",
211  break;
212  }
213  } while ( 1 );
214 
215  // update temp state variables in gp and associted material status
216 
217  status->letTempStrainVectorBe(totalStrain);
218  StructuralMaterial :: giveReducedSymVectorForm( helpVec, fullStressVector, gp->giveMaterialMode() );
219  status->letTempStressVectorBe(helpVec);
220  status->letTempPlasticStrainVectorBe(plasticStrainVectorR);
221  status->letTempStrainSpaceHardeningVarsVectorBe(strainSpaceHardeningVariables);
222  // update plastic consistency parameter
224 
225  // update state flag
226  int newState, state = status->giveStateFlag();
227  if ( Gamma > 0. ) {
228  newState = PM_Yielding; // test if plastic loading occur
229  }
230  // no plastic loading - check for unloading
231  else if ( ( state == PM_Yielding ) || ( state == PM_Unloading ) ) {
232  newState = PM_Unloading;
233  } else {
234  newState = PM_Elastic;
235  }
236 
237  status->letTempStateFlagBe(newState);
238 
239  answer = status->giveTempStressVector();
240 }
241 
242 
243 FloatArray *
245  FloatArray *fullStressVector,
246  FloatArray *fullStressSpaceHardeningVars)
247 {
248  /*
249  * Computes gradient vector R in reduced form.
250  * R = {\der{\sigma}{f_{n+1}}, \der{q}{f_{n+1}}}^T
251  * Gradient vector contains partial derivatives of yield function
252  * with respect to stresses and with respect to
253  * strain space hardening variables
254  *
255  * Note: variablex with R posfix are in reduced stress-space.
256  */
257  FloatArray *stressGradient, stressGradientR;
258  FloatArray *stressSpaceHardVarGradient, *answer;
259  int isize, size;
260 
261  stressGradient = this->ComputeStressGradient(gp, fullStressVector,
262  fullStressSpaceHardeningVars);
263 
264  StructuralMaterial :: giveReducedSymVectorForm( stressGradientR, * stressGradient, gp->giveMaterialMode() );
265 
266  stressSpaceHardVarGradient = this->ComputeStressSpaceHardeningVarsReducedGradient(gp, fullStressVector, fullStressSpaceHardeningVars);
267 
268  isize = stressGradientR.giveSize();
269  if ( stressSpaceHardVarGradient ) {
270  size = isize + stressSpaceHardVarGradient->giveSize();
271  } else {
272  size = isize;
273  }
274 
275  answer = new FloatArray(size);
276  for ( int i = 1; i <= isize; i++ ) {
277  answer->at(i) = stressGradientR.at(i);
278  }
279 
280  for ( int i = isize + 1; i <= size; i++ ) {
281  answer->at(i) = stressSpaceHardVarGradient->at(i - isize);
282  }
283 
284  delete stressSpaceHardVarGradient;
285  delete stressGradient;
286 
287  return answer;
288 }
289 
290 
291 FloatArray *
293  FloatArray *plasticStrainVectorR,
294  FloatArray *strainSpaceHardeningVariables,
295  FloatArray *gradientVectorR)
296 {
297  /* Computes Residual vector for closes point projection algorithm */
298 
299  FloatArray oldPlasticStrainVectorR, oldStrainSpaceHardeningVariables;
300  FloatArray *answer;
301  int isize, size;
302  PlasticMaterialStatus *status = static_cast< PlasticMaterialStatus * >( this->giveStatus(gp) );
303 
304  isize = plasticStrainVectorR->giveSize();
305  size = gradientVectorR->giveSize();
306 
307  answer = new FloatArray(size);
308  oldPlasticStrainVectorR = status->givePlasticStrainVector();
309  oldStrainSpaceHardeningVariables = status->giveStrainSpaceHardeningVars();
310 
311  for ( int i = 1; i <= isize; i++ ) {
312  answer->at(i) = oldPlasticStrainVectorR.at(i) - plasticStrainVectorR->at(i) + Gamma *gradientVectorR->at(i);
313  }
314 
315  for ( int i = isize + 1; i <= size; i++ ) {
316  answer->at(i) = oldStrainSpaceHardeningVariables.at(i - isize) - strainSpaceHardeningVariables->at(i - isize) + Gamma *gradientVectorR->at(i);
317  }
318 
319  return answer;
320 }
321 
322 
323 void
325  const FloatArray &elasticStrainVectorR,
326  TimeStep *tStep)
327 {
328  /* Computes the full trial elastic stress vector */
329 
330  OOFEM_ERROR("Unable to compute trial stress increment");
331 }
332 
333 
334 void
336  GaussPoint *gp,
337  FloatMatrix &elasticModuliInverse,
338  FloatMatrix &hardeningModuliInverse,
339  double Gamma,
340  const FloatArray &fullStressVector,
341  const FloatArray &fullStressSpaceHardeningVars)
342 {
343  /* returns consistent moduli in reduced form.
344  * Note: elasticModuli and hardeningModuli will be inverted
345  *
346  * stressVector in full form
347  */
348  FloatMatrix gradientMatrix;
349  FloatMatrix helpInverse;
350  int isize, size;
351 
352  isize = elasticModuliInverse.giveNumberOfRows();
353  if ( this->hasHardening() ) {
354  size = isize + hardeningModuliInverse.giveNumberOfRows();
355  } else {
356  size = isize;
357  }
358 
359  // ask gradientMatrix
360  this->computeReducedGradientMatrix(gradientMatrix, gp, fullStressVector,
361  fullStressSpaceHardeningVars);
362 
363  // assemble consistent moduli
364  helpInverse.resize(size, size);
365 
366  for ( int i = 1; i <= isize; i++ ) {
367  for ( int j = 1; j <= isize; j++ ) {
368  helpInverse.at(i, j) = elasticModuliInverse.at(i, j) + Gamma *gradientMatrix.at(i, j);
369  }
370 
371  for ( int j = isize + 1; j <= size; j++ ) {
372  helpInverse.at(i, j) = Gamma * gradientMatrix.at(i, j);
373  }
374  }
375 
376  for ( int i = isize + 1; i <= size; i++ ) {
377  for ( int j = 1; j <= isize; j++ ) {
378  helpInverse.at(i, j) = Gamma * gradientMatrix.at(i, j);
379  }
380 
381  for ( int j = isize + 1; j <= size; j++ ) {
382  helpInverse.at(i, j) = hardeningModuliInverse.at(i - isize, j - isize) + Gamma *gradientMatrix.at(i, j);
383  }
384  }
385 
386  answer.beInverseOf(helpInverse);
387 }
388 
389 // ----------------------------------------------------------------------------//
390 
391 void
393  MatResponseMode mode,
394  GaussPoint *gp,
395  TimeStep *tStep)
396 {
397  //
398  // returns receiver material matrix for given reached state
399  // described by temp variables.
400  //
401 
402  FloatMatrix consistentModuli, elasticModuli, hardeningModuli;
403  FloatMatrix elasticModuliInverse, hardeningModuliInverse;
404  FloatMatrix consistentSubModuli, answerR;
405  FloatArray *gradientVector, stressVector, fullStressVector;
406  FloatArray *stressSpaceHardeningVars;
407  FloatArray strainSpaceHardeningVariables, helpVector;
408  double s, Gamma;
409  int sizeR;
410  PlasticMaterialStatus *status = static_cast< PlasticMaterialStatus * >( this->giveStatus(gp) );
411 
412  // ask for plastic consistency parameter
413  Gamma = status->giveTempPlasticConsistencyPrameter();
414 
415  // check for elastic cases
416  if ( ( status->giveTempStateFlag() == PM_Elastic ) || ( status->giveTempStateFlag() == PM_Unloading ) ) {
417  this->computeReducedElasticModuli(elasticModuli, gp, tStep);
418  answer = elasticModuli;
419  return;
420  }
421 
422  //
423  // plastic case
424  //
425  // compute elastic moduli and its inverse
426  this->computeReducedElasticModuli(elasticModuli, gp, tStep);
427  elasticModuliInverse.beInverseOf(elasticModuli);
428  sizeR = elasticModuliInverse.giveNumberOfRows();
429 
430  // compute hardening moduli and its inverse
431  this->computeHardeningReducedModuli(hardeningModuli, gp, & strainSpaceHardeningVariables, tStep);
432  if ( hardeningModuli.giveNumberOfRows() ) {
433  hardeningModuliInverse.beInverseOf(hardeningModuli);
434  } else {
435  hardeningModuliInverse.clear();
436  }
437 
438  stressVector = status->giveStressVector();
439  StructuralMaterial :: giveFullSymVectorForm( fullStressVector, stressVector, gp->giveMaterialMode() );
440  strainSpaceHardeningVariables = status->giveStrainSpaceHardeningVars();
441  stressSpaceHardeningVars = this->ComputeStressSpaceHardeningVars(gp, & strainSpaceHardeningVariables);
442 
443  this->computeConsistentModuli(consistentModuli, gp,
444  elasticModuliInverse,
445  hardeningModuliInverse,
446  Gamma,
447  fullStressVector,
448  * stressSpaceHardeningVars);
449 
450  gradientVector = this->ComputeGradientVector(gp, & fullStressVector, stressSpaceHardeningVars);
451  helpVector.beProductOf(consistentModuli, * gradientVector);
452  s = ( -1. ) * gradientVector->dotProduct(helpVector);
453 
454  answerR.beSubMatrixOf(consistentModuli, 1, sizeR, 1, sizeR);
455  //consistentSubModuli.beSubMatrixOf (consistentModuli, 1,gradientVector->giveSize(), 1, sizeR);
456  consistentSubModuli.beSubMatrixOf( consistentModuli, 1, sizeR, 1, gradientVector->giveSize() );
457  helpVector.beProductOf(consistentSubModuli, * gradientVector);
458 
459  for ( int i = 1; i <= sizeR; i++ ) {
460  for ( int j = 1; j <= sizeR; j++ ) {
461  answerR.at(i, j) += ( 1. / s ) * helpVector.at(i) * helpVector.at(j);
462  }
463  }
464 
465  delete gradientVector;
466  delete stressSpaceHardeningVars;
467 
468  answer = answerR;
469 }
470 
471 void
473  GaussPoint *gp, FloatMatrix &elasticModuliInverse,
474  FloatMatrix &hardeningModuliInverse)
475 {
476  //
477  // assembles diagonal moduli from elasticModuliInverse and hardeningModuliInverse
478  //
479  int size1, size2;
480 
481  size1 = elasticModuliInverse.giveNumberOfRows();
482  if ( hardeningModuliInverse.giveNumberOfRows() ) {
483  size2 = size1 + hardeningModuliInverse.giveNumberOfRows();
484  } else {
485  size2 = size1;
486  }
487 
488  answer.resize(size2, size2);
489  answer.zero();
490 
491  for ( int i = 1; i <= size1; i++ ) {
492  for ( int j = 1; j <= size1; j++ ) {
493  answer.at(i, j) = elasticModuliInverse.at(i, j);
494  }
495  }
496 
497  for ( int i = size1 + 1; i <= size2; i++ ) {
498  for ( int j = size1 + 1; j <= size2; j++ ) {
499  answer.at(i, j) = hardeningModuliInverse.at(i - size1, j - size1);
500  }
501  }
502 }
503 
504 
505 void
507  GaussPoint *gp,
508  TimeStep *tStep)
509 { /* Returns elastic moduli in reduced stress-strain space*/
511  ElasticStiffness,
512  gp, tStep);
513 }
514 
515 
516 // overloaded from structural material
517 
518 void
520  MatResponseMode mode,
521  GaussPoint *gp,
522  TimeStep *tStep)
523 //
524 //
525 //
526 // computes full 3d constitutive matrix for case of 3d stress-strain state.
527 // it returns elasto-plastic stiffness material matrix.
528 // if strainIncrement == NULL a loading is assumed
529 // for detailed description see (W.F.Chen: Plasticity in Reinforced Concrete, McGraw-Hill, 1982,
530 // chapter 6.)
531 //
532 // if derived material would like to implement failure behaviour
533 // it must redefine basic Give3dMaterialStiffnessMatrix function
534 // in order to take possible failure (tension cracking) into account
535 //
536 //
537 //
538 {
539  MaterialMode originalMode = gp->giveMaterialMode();
540  if ( originalMode != _3dMat ) {
541  OOFEM_ERROR("Different stressStrain mode encountered");
542  }
543 
544  // we can force 3d response, and we obtain correct 3d tangent matrix,
545  // but in fact, stress integration algorithm will not work
546  // because in stress integration algorithm we are unable to recognize
547  // which reduction from 3d case should be performed to obtain correct result.
548  // so for new stressStrain state, instead of programming 3d reduction,
549  // you should enhance imposeConstraints functions for ne state, and
550  // then programming simple inteface function for you stressstrain state
551  // calling GiveMaterailStiffenssMatrix, which imposes constrains correctly.
552  if ( mode == ElasticStiffness ) {
553  this->giveLinearElasticMaterial()->give3dMaterialStiffnessMatrix(answer, mode, gp, tStep);
554  } else {
555  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
556  }
557 }
558 
559 
560 void
562  MatResponseMode mode,
563  GaussPoint *gp,
564  TimeStep *tStep)
565 
566 //
567 // returns receiver's 2dPlaneStressMtrx
568 // (2dPlaneStres ==> sigma_z = tau_xz = tau_yz = 0.)
569 //
570 // standard method from Material Class overloaded, because no inversion is needed.
571 // the reduction from 3d case will not work
572 // this implementation should be faster.
573 {
574  if ( mode == ElasticStiffness ) {
575  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
576  } else {
577  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
578  }
579 }
580 
581 
582 void
584  MatResponseMode mode,
585  GaussPoint *gp,
586  TimeStep *tStep)
587 
588 //
589 // return receiver's 2dPlaneStrainMtrx constructed from
590 // general 3dMatrialStiffnessMatrix
591 // (2dPlaneStrain ==> eps_z = gamma_xz = gamma_yz = 0.)
592 //
593 {
594  if ( mode == ElasticStiffness ) {
595  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
596  } else {
597  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
598  }
599 }
600 
601 
602 void
604  MatResponseMode mode,
605  GaussPoint *gp,
606  TimeStep *tStep)
607 
608 //
609 // returns receiver's 1dMaterialStiffnessMAtrix
610 // (1d case ==> sigma_y = sigma_z = tau_yz = tau_zx = tau_xy = 0.)
611 {
612  if ( mode == ElasticStiffness ) {
613  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
614  } else {
615  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
616  }
617 }
618 
619 
620 void
622  MatResponseMode mode,
623  GaussPoint *gp,
624  TimeStep *tStep)
625 //
626 // returns receiver's 2dBeamLayerStiffMtrx.
627 // (2dPlaneStres ==> sigma_z = tau_xz = tau_yz = 0.)
628 //
629 // standard method from Material Class overloaded, because no inversion is needed.
630 // the reduction from 3d case will not work
631 // this implementation should be faster.
632 {
633  if ( mode == ElasticStiffness ) {
634  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
635  } else {
636  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
637  }
638 }
639 
640 
641 void
643  MatResponseMode mode,
644  GaussPoint *gp,
645  TimeStep *tStep)
646 //
647 // returns receiver's 2dPlateLayerMtrx
648 // (2dPlaneStres ==> sigma_z = tau_xz = tau_yz = 0.)
649 //
650 // standard method from Material Class overloaded, because no inversion is needed.
651 // the reduction from 3d case will not work
652 // this implementation should be faster.
653 {
654  if ( mode == ElasticStiffness ) {
655  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
656  } else {
657  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
658  }
659 }
660 
661 
662 void
664  MatResponseMode mode,
665  GaussPoint *gp,
666  TimeStep *tStep)
667 //
668 // returns receiver's Fiber
669 // (1dFiber ==> sigma_y = sigma_z = tau_yz = 0.)
670 //
671 // standard method from Material Class overloaded, because no inversion is needed.
672 // the reduction from 3d case will not work
673 // this implementation should be faster.
674 {
675  if ( mode == ElasticStiffness ) {
676  this->giveLinearElasticMaterial()->giveStiffnessMatrix(answer, mode, gp, tStep);
677  } else {
678  this->giveConsistentStiffnessMatrix(answer, mode, gp, tStep);
679  }
680 }
681 
682 
683 int
685 {
686  PlasticMaterialStatus *status = static_cast< PlasticMaterialStatus * >( this->giveStatus(gp) );
687  if ( type == IST_PlasticStrainTensor ) {
688  const FloatArray ep = status->givePlasticStrainVector();
691  return 1;
692  } else if ( type == IST_PrincipalPlasticStrainTensor ) {
693  FloatArray st(6);
694  const FloatArray &s = status->givePlasticStrainVector();
695 
698 
699  this->computePrincipalValues(answer, st, principal_strain);
700  return 1;
701  } else {
702  return StructuralMaterial :: giveIPValue(answer, gp, type, tStep);
703  }
704 }
705 
706 
708  StructuralMaterialStatus(n, d, g), plasticStrainVector(), tempPlasticStrainVector(),
709  strainSpaceHardeningVarsVector(statusSize), tempStrainSpaceHardeningVarsVector(statusSize)
710 {
712  gamma = temp_gamma = 0.;
713 }
714 
715 
717 { }
718 
719 
720 void
722 {
724  fprintf(file, "status { ");
725  if ( ( state_flag == PM_Yielding ) || ( state_flag == PM_Unloading ) ) {
726  if ( state_flag == PM_Yielding ) {
727  fprintf(file, " Yielding, ");
728  } else {
729  fprintf(file, " Unloading, ");
730  }
731 
732  fprintf(file, " plastic strains ");
733  for ( auto &val : plasticStrainVector ) {
734  fprintf( file, " %.4e", val );
735  }
736 
738  fprintf(file, ", strain space hardening vars ");
739  for ( auto &val : strainSpaceHardeningVarsVector ) {
740  fprintf( file, " %.4e", val );
741  }
742  }
743  }
744 
745  fprintf(file, "}\n");
746 }
747 
748 
750 //
751 // initializes temp variables according to variables form previous equlibrium state.
752 //
753 {
755 
756  if ( plasticStrainVector.giveSize() == 0 ) {
759  }
760 
762 
764 
766  temp_gamma = gamma;
767 }
768 
769 
770 void
772 //
773 // updates variables (nonTemp variables describing situation at previous equilibrium state)
774 // after a new equilibrium state has been reached
775 // temporary variables are having values corresponding to newly reched equilibrium.
776 //
777 {
779 
782 
784  gamma = temp_gamma;
785 }
786 
787 
790 //
791 // saves full information stored in this Status
792 // no temp variables stored
793 //
794 {
795  contextIOResultType iores;
796 
797  // save parent class status
798  if ( ( iores = StructuralMaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
799  THROW_CIOERR(iores);
800  }
801 
802  // write a raw data
803  if ( ( iores = plasticStrainVector.storeYourself(stream) ) != CIO_OK ) {
804  THROW_CIOERR(iores);
805  }
806 
807  if ( ( iores = strainSpaceHardeningVarsVector.storeYourself(stream) ) != CIO_OK ) {
808  THROW_CIOERR(iores);
809  }
810 
811  if ( !stream.write(state_flag) ) {
813  }
814 
815  if ( !stream.write(gamma) ) {
817  }
818 
819  return CIO_OK;
820 }
821 
822 
825 //
826 // restores full information stored in stream to this Status
827 //
828 {
829  contextIOResultType iores;
830 
831  // read parent class status
832  if ( ( iores = StructuralMaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
833  THROW_CIOERR(iores);
834  }
835 
836  if ( ( iores = plasticStrainVector.restoreYourself(stream) ) != CIO_OK ) {
837  THROW_CIOERR(iores);
838  }
839 
840  if ( ( iores = strainSpaceHardeningVarsVector.restoreYourself(stream) ) != CIO_OK ) {
841  THROW_CIOERR(iores);
842  }
843 
844  if ( !stream.read(state_flag) ) {
846  }
847 
848  if ( !stream.read(gamma) ) {
850  }
851 
852  return CIO_OK; // return success
853 }
854 
856 {
858 
859  MaterialStatus &tmpStat = const_cast< MaterialStatus & >(iStatus);
860  const PlasticMaterialStatus &plastStatus = dynamic_cast< PlasticMaterialStatus & >(tmpStat);
861 
864 
867 
868  state_flag = plastStatus.giveStateFlag();
869  temp_state_flag = plastStatus.giveTempStateFlag();
870 
871  gamma = plastStatus.givePlasticConsistencyPrameter();
873 }
874 
876 {
877  printf("Entering PlasticMaterialStatus :: copyAddVariables().\n");
878 }
879 
881 {
882  printf("I am a PlasticMaterialStatus. plasticStrainVector: \n");
884 }
885 } // end namespace oofem
static int giveSizeOfVoigtSymVector(MaterialMode mmode)
Returns the size of symmetric part of a reduced stress/strain vector according to given mode...
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
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.
static void computePrincipalValues(FloatArray &answer, const FloatArray &s, stressStrainPrincMode mode)
Common functions for convenience.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
void initFromVector(const FloatArray &vector, bool transposed)
Assigns to receiver one column or one row matrix containing vector.
Definition: floatmatrix.C:1308
virtual int hasHardening()
#define RES_TOL
void letTempStrainVectorBe(const FloatArray &v)
Assigns tempStrainVector to given vector v.
Definition: structuralms.h:137
virtual void giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep)
Computes the real stress vector for given total strain and integration point.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
GaussPoint * gp
Associated integration point.
Class and object Domain.
Definition: domain.h:115
virtual FloatArray * ComputeStressSpaceHardeningVars(GaussPoint *gp, FloatArray *strainSpaceHardeningVariables)
For computing principal strains from engineering strains.
virtual void givePlaneStrainStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing plane strain stiffness matrix of receiver.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
contextIOResultType storeYourself(DataStream &stream) const
Definition: floatarray.C:872
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
void beSubMatrixOf(const FloatMatrix &src, int topRow, int bottomRow, int topCol, int bottomCol)
Assigns to the receiver the sub-matrix of another matrix.
Definition: floatmatrix.C:962
This class implements a structural material status information.
Definition: structuralms.h:65
PlasticMaterialStatus(int n, Domain *d, GaussPoint *g, int statusSize)
virtual void computeTrialStressIncrement(FloatArray &answer, GaussPoint *gp, const FloatArray &strainIncrement, TimeStep *tStep)
void computeDiagModuli(FloatMatrix &answer, GaussPoint *gp, FloatMatrix &elasticModuliInverse, FloatMatrix &hardeningModuliInverse)
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
General IO error.
FloatArray plasticStrainVector
Plastic strain vector (reduced form).
virtual double computeYieldValueAt(GaussPoint *gp, FloatArray *stressVector, FloatArray *stressSpaceHardeningVars)
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
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...
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
MatResponseMode
Describes the character of characteristic material matrix.
virtual void givePlaneStressStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing plane stress stiffness matrix of receiver.
virtual void give1dStressStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing 1d stiffness matrix of receiver.
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be a - b.
Definition: floatarray.C:341
static void giveFullSymVectorForm(FloatArray &answer, const FloatArray &vec, MaterialMode matMode)
Converts the reduced unsymmetric Voigt vector (2nd order tensor) to full form.
FloatArray * ComputeGradientVector(GaussPoint *gp, FloatArray *fullStressVector, FloatArray *fullStressSpaceHardeningVars)
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
virtual void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the stiffness matrix for giveRealStressVector of receiver in given integration point...
virtual int hasMaterialModeCapability(MaterialMode mode)
Tests if material supports material mode.
static void giveReducedSymVectorForm(FloatArray &answer, const FloatArray &vec, MaterialMode matMode)
Converts the full unsymmetric Voigt vector (2nd order tensor) to reduced form.
virtual FloatArray * ComputeStressSpaceHardeningVarsReducedGradient(GaussPoint *gp, FloatArray *stressVector, FloatArray *stressSpaceHardeningVars)
virtual FloatArray * ComputeStressGradient(GaussPoint *gp, FloatArray *stressVector, FloatArray *stressSpaceHardeningVars)
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
#define OOFEM_ERROR(...)
Definition: error.h:61
PlasticMaterial(int n, Domain *d)
LinearElasticMaterial * linearElasticMaterial
Reference to bulk (undamaged) material.
FloatArray tempStrainSpaceHardeningVarsVector
int giveNumber()
Returns number of receiver.
Definition: gausspoint.h:184
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 ...
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
virtual void copyStateVariables(const MaterialStatus &iStatus)
Functions for MaterialStatusMapperInterface.
Definition: structuralms.C:180
contextIOResultType restoreYourself(DataStream &stream)
Definition: floatarray.C:895
virtual void giveFiberStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing 1d fiber stiffness matrix of receiver.
FloatArray * ComputeResidualVector(GaussPoint *gp, double Gamma, FloatArray *plasticStrainVectorR, FloatArray *strainSpaceHardeningVariables, FloatArray *gradientVectorR)
virtual void computeReducedElasticModuli(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep)
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
void computeConsistentModuli(FloatMatrix &answer, GaussPoint *gp, FloatMatrix &elasticModuliInverse, FloatMatrix &hardeningModuliInverse, double Gamma, const FloatArray &fullStressVector, const FloatArray &fullStressSpaceHardeningVars)
#define PLASTIC_MATERIAL_MAX_ITERATIONS
#define YIELD_TOL
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
double gamma
Plastic consistency parameter.
LinearElasticMaterial * giveLinearElasticMaterial()
Returns reference to undamaged (bulk) material.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: structuralms.C:157
void letTempStrainSpaceHardeningVarsVectorBe(FloatArray v)
virtual void copyStateVariables(const MaterialStatus &iStatus)
Functions for MaterialStatusMapperInterface.
const FloatArray & giveTempPlasticStrainVector() const
double giveTempPlasticConsistencyPrameter() const
Abstract base class representing a material status information.
Definition: matstatus.h:84
double givePlasticConsistencyPrameter() const
void letTempPlasticStrainVectorBe(FloatArray v)
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void letTempStressVectorBe(const FloatArray &v)
Assigns tempStressVector to given vector v.
Definition: structuralms.h:135
const FloatArray & giveStressVector() const
Returns the const pointer to receiver&#39;s stress vector.
Definition: structuralms.h:107
void letTempPlasticConsistencyPrameterBe(double v)
virtual void giveConsistentStiffnessMatrix(FloatMatrix &answer, MatResponseMode, GaussPoint *gp, TimeStep *tStep)
virtual void givePlateLayerStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing 2d plate layer stiffness matrix of receiver.
friend class PlasticMaterialStatus
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
virtual void computeReducedGradientMatrix(FloatMatrix &answer, GaussPoint *gp, const FloatArray &stressVector, const FloatArray &stressSpaceHardeningVars)=0
virtual void printYourself() const
Print receiver on stdout.
Definition: floatarray.C:747
const FloatArray & givePlasticStrainVector() const
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
virtual int giveSizeOfReducedHardeningVarsVector(GaussPoint *) const
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
FloatArray strainSpaceHardeningVarsVector
Strain space hardening variables.
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.
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
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 give2dBeamLayerStiffMtrx(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Method for computing 2d beam layer stiffness matrix of receiver.
This class implements associated Material Status to PlasticMaterial.
virtual void addStateVariables(const MaterialStatus &iStatus)
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:337
const FloatArray & giveTempStressVector() const
Returns the const pointer to receiver&#39;s temporary stress vector.
Definition: structuralms.h:117
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
int state_flag
Yield function status indicator.
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.
const FloatArray & givetempStrainSpaceHardeningVarsVector() const
void clear()
Sets size of receiver to be an empty matrix. It will have zero rows and zero columns size...
Definition: floatmatrix.h:516
virtual void initTempStatus(GaussPoint *gp)
Initializes temporary variables stored in integration point status at the beginning of new time step...
Definition: material.C:267
int giveNumber() const
Definition: femcmpnn.h:107
void beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
Definition: floatmatrix.C:835
const FloatArray & giveStrainSpaceHardeningVars() const
virtual void printYourself()
Prints receiver state on stdout. Useful for debugging.
int giveNumberOfRows() const
Returns number of rows of receiver.
Definition: floatmatrix.h:156
Class representing integration point in finite element program.
Definition: gausspoint.h:93
#define OOFEM_WARNING(...)
Definition: error.h:62
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 ...
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void computeHardeningReducedModuli(FloatMatrix &answer, GaussPoint *gp, FloatArray *strainSpaceHardeningVariables, TimeStep *tStep)=0
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011