OOFEM 3.0
Loading...
Searching...
No Matches
latticedamageviscoelastic.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 - 2025 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 program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (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
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 */
34
36#include "gausspoint.h"
37#include "floatmatrix.h"
38#include "floatarray.h"
40#include "datastream.h"
41#include "contextioerr.h"
42#include "classfactory.h"
43#include "math.h"
44
45
46namespace oofem {
48
49LatticeDamageViscoelastic :: LatticeDamageViscoelastic(int n, Domain *d) : LatticeDamage(n, d)
50{}
51
52void
53LatticeDamageViscoelastic :: initializeFrom(InputRecord &ir)
54{
55 LatticeDamage :: initializeFrom(ir);
56
57 IR_GIVE_FIELD(ir, viscoMat, _IFT_LatticeDamageViscoelastic_viscoMat); // number of slave material
58
59 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
60
61 // override elastic modulus by the one given by the compliance function
62 double timeFactor = 0.;
63 IR_GIVE_FIELD(ir, timeFactor, _IFT_LatticeDamageViscoelastic_timeFactor); // timeConversion equal to 1 day in current time units of the analysis
64
65 double E28 = 1. / rheoMat->computeCreepFunction(timeFactor * 28.01, timeFactor * 28., NULL, NULL); // modulus of elasticity evaluated at 28 days, duration of loading 15 min
66 this->e0Mean *= ( this->eNormalMean / E28 ); // transform strain at peak stress accordingly
67 this->eNormalMean = E28; // swap elastic modulus/stiffness
68}
69
70
71std::unique_ptr<MaterialStatus>
72LatticeDamageViscoelastic :: CreateStatus(GaussPoint *gp) const
73{
74 return std::make_unique<LatticeDamageViscoelasticStatus>(gp);
75}
76
77
79LatticeDamageViscoelastic :: giveLatticeStress3d(const FloatArrayF< 6 > &totalStrain,
80 GaussPoint *gp,
81 TimeStep *tStep)
82{
83 double tol = 1.e-12; // error in order of Pascals
84
85 auto *status = static_cast< LatticeDamageViscoelasticStatus * >( this->giveStatus(gp) );
86
87 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
88
89 GaussPoint *rChGP = status->giveSlaveGaussPointVisco();
90 // just a dummy yet essential call to create a status of viscomaterial. Otherwise initTempStatus() would fail.
91 rheoMat->giveStatus(rChGP);
92
93 // the value from the status seems to be unused except for printout
94 status->setE0(this->give(e0_ID, gp) * this->e0Mean);
95 status->initTempStatus();
96
97 FloatArrayF< 6 >reducedStrain;
98 FloatArrayF< 6 >quasiReducedStrain;
99
100 FloatArrayF< 6 >stress;
101 FloatArrayF< 6 >tempStress;
102 FloatArray viscoStress;
103
104 FloatArray indepStrain;
105
106 int itercount = 1;
107 double tolerance = 1.;
108
109 // componentes which do not change during iterations
110 indepStrain = this->computeStressIndependentStrainVector(gp, tStep, VM_Total);
111 auto elasticStiffnessMatrix = LatticeLinearElastic :: give3dLatticeStiffnessMatrix(ElasticStiffness, gp, tStep);
112
113 do {
114 if ( itercount > 100 ) {
115 printf("tolerance = %e and itercount = %d\n", tolerance, itercount);
116 OOFEM_ERROR("Algorithm not converging");
117 }
118
119 //total strain
120 reducedStrain = totalStrain;
121
122 if ( indepStrain.giveSize() > 0 ) {
123 reducedStrain -= FloatArrayF< 6 >(indepStrain);
124 }
125
126 FloatArrayF< 6 >tempDamageLatticeStrain = status->giveTempDamageLatticeStrain();
127 reducedStrain -= FloatArrayF< 6 >(tempDamageLatticeStrain);
128
129 rheoMat->giveRealStressVector(viscoStress, rChGP, reducedStrain, tStep);
130 tempStress = FloatArrayF< 6 >(viscoStress);
131
132 for ( int i = 1; i <= 6; i++ ) { // only diagonal terms matter
133 quasiReducedStrain.at(i) = tempStress.at(i) / elasticStiffnessMatrix.at(i, i);
134 }
135
136 quasiReducedStrain += tempDamageLatticeStrain;
137
138 LatticeDamage :: performDamageEvaluation(gp, quasiReducedStrain);
139 double tempDamage = status->giveTempDamage();
140
141 for ( int i = 1; i <= 6; i++ ) { // only diagonal terms matter
142 stress.at(i) = elasticStiffnessMatrix.at(i, i) * quasiReducedStrain.at(i) * ( 1. - tempDamage );
143 }
144
145 tolerance = norm(stress - tempStress) / this->eNormalMean;
146
147 itercount++;
148 } while ( tolerance >= tol );
149
150 status->letTempLatticeStrainBe(totalStrain);
151 status->letTempLatticeStressBe(tempStress);
152 status->letTempReducedLatticeStrainBe(quasiReducedStrain);
153
154 return tempStress;
155}
156
157
158
160LatticeDamageViscoelastic :: give3dLatticeStiffnessMatrix(MatResponseMode rmode,
161 GaussPoint *gp,
162 TimeStep *tStep) const
163{
164 LatticeDamageViscoelasticStatus *status = static_cast< LatticeDamageViscoelasticStatus * >( this->giveStatus(gp) );
165 GaussPoint *slaveGp;
166
167
168 // get status of the slave viscoelastic material
169 slaveGp = status->giveSlaveGaussPointVisco();
170 // get viscoelastic material
171 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
172
173 double Eincr = rheoMat->giveEModulus(slaveGp, tStep);
174
175 auto answer = LatticeLinearElastic :: give3dLatticeStiffnessMatrix(ElasticStiffness, gp, tStep);
176
177 answer *= ( Eincr / this->eNormalMean );
178
179 return answer;
180}
181
183LatticeDamageViscoelastic :: give2dLatticeStiffnessMatrix(MatResponseMode rmode,
184 GaussPoint *gp,
185 TimeStep *tStep) const
186{
187 LatticeDamageViscoelasticStatus *status = static_cast< LatticeDamageViscoelasticStatus * >( this->giveStatus(gp) );
188 GaussPoint *slaveGp;
189
190
191 // get status of the slave viscoelastic material
192 slaveGp = status->giveSlaveGaussPointVisco();
193 // get viscoelastic material
194 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
195
196 double Eincr = rheoMat->giveEModulus(slaveGp, tStep);
197
198 auto answer = LatticeLinearElastic :: give2dLatticeStiffnessMatrix(ElasticStiffness, gp, tStep);
199
200 answer *= ( Eincr / this->eNormalMean );
201
202 return answer;
203}
204
205
206
207int
208LatticeDamageViscoelastic :: giveIPValue(FloatArray &answer,
209 GaussPoint *gp,
211 TimeStep *tStep)
212{
213 if ( ( type == IST_DryingShrinkageTensor ) ||
214 ( type == IST_AutogenousShrinkageTensor ) ||
215 ( type == IST_TotalShrinkageTensor ) ||
216 ( type == IST_CreepStrainTensor ) ||
217 ( type == IST_DryingShrinkageTensor ) ||
218 ( type == IST_ThermalStrainTensor ) ) {
219 LatticeDamageViscoelasticStatus *status = static_cast< LatticeDamageViscoelasticStatus * >( this->giveStatus(gp) );
220
221 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
222 return rheoMat->giveIPValue(answer, status->giveSlaveGaussPointVisco(), type, tStep);
223 }
224
225 return LatticeDamage :: giveIPValue(answer, gp, type, tStep);
226}
227
228
229int LatticeDamageViscoelastic :: checkConsistency()
230{
231 RheoChainMaterial *rheoMat = static_cast< RheoChainMaterial * >( domain->giveMaterial(this->viscoMat) );
232
233 if ( rheoMat->giveAlphaOne() != this->alphaOne ) {
234 OOFEM_ERROR("a1 must be set to the same value in both master and viscoelastic slave materials");
235 }
236
237 if ( rheoMat->giveAlphaTwo() != this->alphaTwo ) {
238 OOFEM_ERROR("a2 must be set to the same value in both master and viscoelastic slave materials");
239 }
240
241 GaussPoint *noGP = NULL;
242 if ( rheoMat->give(tAlpha, noGP) != 0. ) {
243 OOFEM_ERROR("tAlpha must be set to 0. in slave viscoelastic material");
244 }
245
246 return FEMComponent :: checkConsistency();
247}
248
249
250LatticeDamageViscoelasticStatus :: LatticeDamageViscoelasticStatus(GaussPoint *g) :
251 LatticeDamageStatus(g), slaveGpVisco(std :: make_unique< GaussPoint >(gp->giveIntegrationRule(), 0, gp->giveNaturalCoordinates(), 0., gp->giveMaterialMode() ) )
252{}
253
254
255void
256LatticeDamageViscoelasticStatus :: initTempStatus()
257{
258 LatticeDamageStatus :: initTempStatus();
259
260 // at this point rheomat :: giveStatus (viscoGP) has to be called first
261 RheoChainMaterialStatus *rheoStatus = static_cast< RheoChainMaterialStatus * >( this->giveSlaveGaussPointVisco()->giveMaterialStatus() );
262
263 rheoStatus->initTempStatus();
264}
265
266
267void
268LatticeDamageViscoelasticStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
269{
270 LatticeDamageStatus :: printOutputAt(file, tStep);
271 fprintf(file, "\nViscoelastic material:");
272
273 this->giveSlaveGaussPointVisco()->giveMaterialStatus()->printOutputAt(file, tStep);
274
275 fprintf(file, "\n");
276}
277
278
279void
280LatticeDamageViscoelasticStatus :: updateYourself(TimeStep *tStep)
281{
282 this->giveSlaveGaussPointVisco()->giveMaterialStatus()->updateYourself(tStep);
283
284 LatticeDamageStatus :: updateYourself(tStep);
285}
286
287void
288LatticeDamageViscoelasticStatus :: saveContext(DataStream &stream, ContextMode mode)
289{
290 // save parent class status
291 LatticeDamageStatus :: saveContext(stream, mode);
292
293 this->giveSlaveGaussPointVisco()->giveMaterialStatus()->saveContext(stream, mode);
294}
295
296void
297LatticeDamageViscoelasticStatus :: restoreContext(DataStream &stream, ContextMode mode)
298{
299 // read parent class status
300 LatticeDamageStatus :: restoreContext(stream, mode);
301
302 this->giveSlaveGaussPointVisco()->giveMaterialStatus()->restoreContext(stream, mode);
303}
304} // end namespace oofem
#define REGISTER_Material(class)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
double & at(std::size_t i)
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
GaussPoint * gp
Associated integration point.
LatticeDamageStatus(GaussPoint *g)
int viscoMat
'slave' (= viscoelastic) material model number.
LatticeDamage(int n, Domain *d)
double give(int aProperty, GaussPoint *gp) const override
double e0Mean
max effective strain at peak
double eNormalMean
Normal modulus.
MaterialStatus * giveStatus(GaussPoint *gp) const override
virtual void initTempStatus()
Definition matstatus.h:99
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
virtual double give(int aProperty, GaussPoint *gp) const
Definition material.C:51
void initTempStatus() override
Definition rheoChM.C:742
virtual double giveEModulus(GaussPoint *gp, TimeStep *tStep) const =0
Evaluation of the incremental modulus.
double giveAlphaTwo() const
Definition rheoChM.h:312
void giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep) const override
Definition rheoChM.C:72
virtual double computeCreepFunction(double t, double t_prime, GaussPoint *gp, TimeStep *tStep) const =0
Evaluation of the creep compliance function at time t when loading is acting from time t_prime.
double giveAlphaOne() const
Definition rheoChM.h:311
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
Definition rheoChM.C:657
virtual FloatArray computeStressIndependentStrainVector(GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_LatticeDamageViscoelastic_timeFactor
#define _IFT_LatticeDamageViscoelastic_viscoMat
#define e0_ID
Definition matconst.h:83
#define tAlpha
Definition matconst.h:67
long ContextMode
Definition contextmode.h:43
double norm(const FloatArray &x)
const double tolerance

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011