OOFEM 3.0
Loading...
Searching...
No Matches
maxwellChM.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 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 "mathfem.h"
36#include "maxwellChM.h"
37#include "floatarray.h"
38#include "floatmatrix.h"
39#include "gausspoint.h"
40#include "timestep.h"
41#include "contextioerr.h"
42
43namespace oofem {
44MaxwellChainMaterial :: MaxwellChainMaterial(int n, Domain *d) : RheoChainMaterial(n, d)
45{ }
46
47
49MaxwellChainMaterial :: computeCharCoefficients(double tPrime, GaussPoint *gp, TimeStep *tStep) const
50{
51 FloatArray rhs(this->nUnits), discreteRelaxFunctionVal;
52 FloatMatrix A(this->nUnits, this->nUnits);
53
54 const FloatArray &rTimes = this->giveDiscreteTimes();
55 int rSize = rTimes.giveSize();
56
57 // compute discrete values of the relaxation function at times rTimes
58 // from the creep function (by numerically solving integral equations)
59 //
60 // a direct call to the relaxation function could be used, if available
61 this->computeDiscreteRelaxationFunction(discreteRelaxFunctionVal,
62 rTimes,
63 tPrime,
64 tPrime,
65 gp,
66 tStep);
67
68 // assemble the matrix of the set of linear equations
69 // for computing the optimal moduli
70 for ( int i = 1; i <= this->nUnits; i++ ) {
71 double taui = this->giveCharTime(i);
72 for ( int j = 1; j <= this->nUnits; j++ ) {
73 double tauj = this->giveCharTime(j);
74 double sum = 0;
75 for ( int r = 1; r <= rSize; r++ ) {
76 double tti = pow( ( tPrime + rTimes.at(r) ) / taui, giveCharTimeExponent(i) ) -
77 pow( tPrime / taui, giveCharTimeExponent(i) );
78 double ttj = pow( ( tPrime + rTimes.at(r) ) / tauj, giveCharTimeExponent(j) ) -
79 pow( tPrime / tauj, giveCharTimeExponent(j) );
80 sum += exp(-tti - ttj);
81 }
82
83 A.at(i, j) = sum;
84 }
85
86 // assemble rhs
87 double sumRhs = 0;
88 for ( int r = 1; r <= rSize; r++ ) {
89 double tti = pow( ( tPrime + rTimes.at(r) ) / taui, giveCharTimeExponent(i) ) -
90 pow( tPrime / taui, giveCharTimeExponent(i) );
91 sumRhs += exp(-tti) * discreteRelaxFunctionVal.at(r);
92 }
93
94 rhs.at(i) = sumRhs;
95 }
96
97 // solve the linear system
98 FloatArray answer;
99 A.solveForRhs(rhs, answer);
100 return answer;
101}
102
103
104
105double
106MaxwellChainMaterial :: giveEModulus(GaussPoint *gp, TimeStep *tStep) const
107{
108 /*
109 * This function returns the incremental modulus for the given time increment.
110 * The modulus may also depend on the specimen geometry (gp - dependence).
111 *
112 * Note: time -1 refers to the previous time.
113 */
114 double E = 0.0;
115
117
118 // the viscoelastic material does not exist yet
119 if ( ! Material :: isActivated( tStep ) ) {
120 OOFEM_ERROR("Attempted to evaluate E modulus at time lower than casting time");
121 }
122
123 double tPrime = this->relMatAge - this->castingTime + ( tStep->giveTargetTime() - 0.5 * tStep->giveTimeIncrement() ) / timeFactor;
124 #ifdef _OPENMP
125 #pragma omp critical (MaxwellChainMaterial_EModulus)
126 #endif
127 {
128 this->updateEparModuli(tPrime, gp, tStep);
129
130 for ( int mu = 1; mu <= nUnits; mu++ ) {
131 double deltaYmu = tStep->giveTimeIncrement() / timeFactor / this->giveCharTime(mu);
132 if ( deltaYmu <= 0.0 ) {
133 deltaYmu = 1.e-3;
134 }
135
136 deltaYmu = pow( deltaYmu, this->giveCharTimeExponent(mu) );
137
138 double lambdaMu = ( 1.0 - exp(-deltaYmu) ) / deltaYmu;
139 double Emu = this->giveEparModulus(mu); // previously updated by updateEparModuli
140 E += lambdaMu * Emu;
141 }
142 }
143 return E;
144}
145
146
147
148
149void
150MaxwellChainMaterial :: giveEigenStrainVector(FloatArray &answer,
151 GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
152//
153// computes the strain due to creep at constant stress during the increment
154// (in fact, the INCREMENT of creep strain is computed for mode == VM_Incremental)
155//
156{
157 FloatArray help, reducedAnswer;
158 FloatArray sigmaMu;
159 FloatMatrix B;
160 MaxwellChainMaterialStatus *status = static_cast< MaxwellChainMaterialStatus * >( this->giveStatus(gp) );
161
162 if ( ! Material :: isActivated( tStep ) ) {
163 OOFEM_ERROR("Attempted to evaluate creep strain for time lower than casting time");
164 }
165
166 if ( mode == VM_Incremental ) {
167 this->giveUnitComplianceMatrix(B, gp, tStep);
168 reducedAnswer.resize( B.giveNumberOfRows() );
169 reducedAnswer.zero();
170
171 for ( int mu = 1; mu <= nUnits; mu++ ) {
172 double deltaYmu = tStep->giveTimeIncrement() / timeFactor / this->giveCharTime(mu);
173 deltaYmu = pow( deltaYmu, this->giveCharTimeExponent(mu) );
174
175 sigmaMu = status->giveHiddenVarsVector(mu); // JB
176
177 if ( sigmaMu.giveSize() ) {
178 help.beProductOf(B, sigmaMu); // B can be moved before sum !!!
179 help.times( 1.0 - exp(-deltaYmu) );
180 reducedAnswer.add(help);
181 }
182 }
183
184 double E = this->giveEModulus(gp, tStep);
185 // E = this->giveIncrementalModulus(gp, tStep);
186 reducedAnswer.times(1.0 / E);
187
188 answer = reducedAnswer;
189 } else {
190 /* error - total mode not implemented yet */
191 OOFEM_ERROR("mode is not supported");
192 }
193}
194
195
196void
197MaxwellChainMaterial :: giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep) const
198{
199 RheoChainMaterial :: giveRealStressVector(answer, gp, reducedStrain, tStep);
200
201 // Computes hidden variables and stores them as temporary
202 this->computeHiddenVars(gp, tStep);
203}
204
205
206void
207MaxwellChainMaterial :: computeHiddenVars(GaussPoint *gp, TimeStep *tStep) const
208{
209 /*
210 * Updates hidden variables used to effectively trace the load history
211 */
212 FloatArray help, deltaEps0, help1;
213 FloatArray muthHiddenVarsVector;
214
215 FloatMatrix Binv;
217 static_cast< MaxwellChainMaterialStatus * >( this->giveStatus(gp) );
218
219
220 // goes there if the viscoelastic material does not exist yet
221 if ( ! Material :: isActivated( tStep ) ) {
222 help.resize(StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() ) );
223 help.zero();
224 for ( int mu = 1; mu <= nUnits; mu++ ) {
225 status->letTempHiddenVarsVectorBe(mu, help);
226 }
227 return;
228 }
229
230 this->giveUnitStiffnessMatrix(Binv, gp, tStep);
231 help = status->giveTempStrainVector();
232 help.subtract( status->giveStrainVector() );
233
234 // Subtract the stress-independent part of strain
235 this->computeTrueStressIndependentStrainVector(deltaEps0, gp, tStep, VM_Incremental);
236 if ( deltaEps0.giveSize() ) {
237 help.subtract(deltaEps0);
238 }
239
240 help1.beProductOf(Binv, help);
241
243 // redundant two subsequent lines?
244 // double tPrime = relMatAge - this->castingTime + ( tStep->giveTargetTime() - 0.5 * tStep->giveTimeIncrement() ) / timeFactor;
245 // this->updateEparModuli(tPrime, gp, tStep);
246
247 for ( int mu = 1; mu <= nUnits; mu++ ) {
248 double deltaYmu = tStep->giveTimeIncrement() / timeFactor / this->giveCharTime(mu);
249 deltaYmu = pow( deltaYmu, this->giveCharTimeExponent(mu) );
250
251 double lambdaMu = ( 1.0 - exp(-deltaYmu) ) / deltaYmu;
252 double Emu = this->giveEparModulus(mu);
253
254 muthHiddenVarsVector = status->giveHiddenVarsVector(mu);
255 help = help1;
256 help.times(lambdaMu * Emu);
257 if ( muthHiddenVarsVector.giveSize() ) {
258 muthHiddenVarsVector.times( exp(-deltaYmu) );
259 muthHiddenVarsVector.add(help);
260 status->letTempHiddenVarsVectorBe(mu, muthHiddenVarsVector);
261 } else {
262 status->letTempHiddenVarsVectorBe(mu, help);
263 }
264 }
265}
266
267
268std::unique_ptr<MaterialStatus>
269MaxwellChainMaterial :: CreateStatus(GaussPoint *gp) const
270{
271 return std::make_unique<MaxwellChainMaterialStatus>(gp, nUnits);
272}
273
274
275void
276MaxwellChainMaterial :: initializeFrom(InputRecord &ir)
277{
278 RheoChainMaterial :: initializeFrom(ir);
279}
280
281/****************************************************************************************/
282
283MaxwellChainMaterialStatus :: MaxwellChainMaterialStatus(GaussPoint *g, int nunits) :
284 RheoChainMaterialStatus(g, nunits) { }
285
286
287void
288MaxwellChainMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
289{
290 RheoChainMaterialStatus :: printOutputAt(file, tStep);
291}
292
293
294void
295MaxwellChainMaterialStatus :: updateYourself(TimeStep *tStep)
296{
297 RheoChainMaterialStatus :: updateYourself(tStep);
298}
299
300void
301MaxwellChainMaterialStatus :: initTempStatus()
302{
303 RheoChainMaterialStatus :: initTempStatus();
304}
305
306void
307MaxwellChainMaterialStatus :: saveContext(DataStream &stream, ContextMode mode)
308{
309 RheoChainMaterialStatus :: saveContext(stream, mode);
310}
311
312void
313MaxwellChainMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode)
314{
315 RheoChainMaterialStatus :: restoreContext(stream, mode);
316}
317} // end namespace oofem
#define E(a, b)
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void add(const FloatArray &src)
Definition floatarray.C:218
void subtract(const FloatArray &src)
Definition floatarray.C:320
void times(double s)
Definition floatarray.C:834
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
double castingTime
Definition material.h:115
void computeHiddenVars(GaussPoint *gp, TimeStep *tStep) const
Definition maxwellChM.C:207
double giveEModulus(GaussPoint *gp, TimeStep *tStep) const override
Evaluation of the incremental modulus.
Definition maxwellChM.C:106
RheoChainMaterialStatus(GaussPoint *g, int nunits)
Definition rheoChM.C:674
FloatArray & giveHiddenVarsVector(int i)
Definition rheoChM.h:103
void letTempHiddenVarsVectorBe(int i, FloatArray &valueArray)
Definition rheoChM.C:683
const FloatArray & giveDiscreteTimes() const
Definition rheoChM.C:260
int nUnits
Number of (Maxwell or Kelvin) units in the rheologic chain.
Definition rheoChM.h:145
double relMatAge
Physical age of the material at castingTime.
Definition rheoChM.h:147
void computeDiscreteRelaxationFunction(FloatArray &answer, const FloatArray &tSteps, double t0, double tr, GaussPoint *gp, TimeStep *tStep) const
Definition rheoChM.C:197
void giveUnitStiffnessMatrix(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep) const
Evaluation of elastic stiffness matrix for unit Young's modulus.
Definition rheoChM.C:267
double giveCharTime(int) const
Access to the characteristic time of a given unit.
Definition rheoChM.C:396
void giveUnitComplianceMatrix(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep) const
Evaluation of elastic compliance matrix for unit Young's modulus.
Definition rheoChM.C:286
RheoChainMaterial(int n, Domain *d)
Definition rheoChM.C:48
double giveEparModulus(int iChain) const
Access to partial modulus of a given unit.
Definition rheoChM.C:303
virtual double giveCharTimeExponent(int i) const
Exponent to be used with the char time of a given unit, usually = 1.0.
Definition rheoChM.h:389
virtual void updateEparModuli(double tPrime, GaussPoint *gp, TimeStep *tStep) const
Update of partial moduli of individual chain units.
Definition rheoChM.C:313
void computeTrueStressIndependentStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
Definition rheoChM.C:340
const FloatArray & giveStrainVector() const
Returns the const pointer to receiver's strain vector.
const FloatArray & giveTempStrainVector() const
Returns the const pointer to receiver's temporary strain vector.
double giveTimeIncrement()
Returns solution step associated time increment.
Definition timestep.h:168
double giveTargetTime()
Returns target time.
Definition timestep.h:164
#define OOFEM_ERROR(...)
Definition error.h:79
long ContextMode
Definition contextmode.h:43
double sum(const FloatArray &x)

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