OOFEM 3.0
Loading...
Searching...
No Matches
kelvinChSolM.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 - 2025 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 "kelvinChSolM.h"
36#include "floatarray.h"
37#include "floatmatrix.h"
38#include "gausspoint.h"
39#include "timestep.h"
40#include "contextioerr.h"
41
42
43namespace oofem {
44KelvinChainSolidMaterial :: KelvinChainSolidMaterial(int n, Domain *d) : RheoChainMaterial(n, d)
45{ }
46
47double
48KelvinChainSolidMaterial :: giveEModulus(GaussPoint *gp, TimeStep *tStep) const
49{
50 /*
51 * This function returns the incremental modulus for the given time increment.
52 * Return value is the incremental E modulus of non-aging Kelvin chain without the first unit (elastic spring)
53 * The modulus may also depend on the specimen geometry (gp - dependence).
54 *
55 * It is stored as "Einc" for further expected requests from other gaussPoints that correspond to the same material.
56 *
57 * Note: time -1 refers to the previous time.
58 */
59
60 if ( ! Material :: isActivated( tStep ) ) {
61 OOFEM_ERROR("Attempted to evaluate E modulus at time lower than casting time");
62 }
63 double sum = 0.0;
64 #ifdef _OPENMP
65 #pragma omp critical (KelvinChainSolidMaterial_EModulus)
66 #endif
67 {
68 if ( this->EparVal.isEmpty() ) {
69 this->updateEparModuli(0., gp, tStep); // stiffnesses are time independent (evaluated at time t = 0.)
70 }
71
72 for ( int mu = 1; mu <= nUnits; mu++ ) {
73 double lambdaMu = this->computeLambdaMu(gp, tStep, mu);
74 double Emu = this->giveEparModulus(mu);
75 sum += ( 1 - lambdaMu ) / Emu;
76 }
77 }
78
79 double v = this->computeSolidifiedVolume(gp, tStep);
80 return sum / v;
81}
82
83void
84KelvinChainSolidMaterial :: giveEigenStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
85//
86// computes the strain due to creep at constant stress during the increment
87// (in fact, the INCREMENT of creep strain is computed for mode == VM_Incremental)
88//
89{
90 KelvinChainSolidMaterialStatus *status = static_cast< KelvinChainSolidMaterialStatus * >( this->giveStatus(gp) );
91
92 if ( ! Material :: isActivated( tStep ) ) {
93 OOFEM_ERROR("Attempted to evaluate creep strain for time lower than casting time");
94 }
95
96 if ( this->EparVal.isEmpty() ) {
97 this->updateEparModuli(0., gp, tStep); // stiffnesses are time independent (evaluated at time t = 0.)
98 }
99
100 if ( mode == VM_Incremental ) {
101 FloatArray *sigmaVMu = nullptr, reducedAnswer;
102 for ( int mu = 1; mu <= nUnits; mu++ ) {
103 double betaMu = this->computeBetaMu(gp, tStep, mu);
104 sigmaVMu = & status->giveHiddenVarsVector(mu); // JB
105
106 if ( sigmaVMu->isNotEmpty() ) {
107 reducedAnswer.add(( 1.0 - betaMu ) / this->giveEparModulus(mu), * sigmaVMu);
108 }
109 }
110
111 if ( sigmaVMu->isNotEmpty() ) {
112 FloatMatrix C;
113 FloatArray help = reducedAnswer;
114 this->giveUnitComplianceMatrix(C, gp, tStep);
115 reducedAnswer.beProductOf(C, help);
116 double v = this->computeSolidifiedVolume(gp, tStep);
117 reducedAnswer.times(1. / v);
118 }
119
120 answer = reducedAnswer;
121 } else {
122 /* error - total mode not implemented yet */
123 OOFEM_ERROR("mode is not supported");
124 }
125}
126
127double
128KelvinChainSolidMaterial :: computeBetaMu(GaussPoint *gp, TimeStep *tStep, int Mu) const
129{
130 double deltaT = tStep->giveTimeIncrement();
131 double tauMu = this->giveCharTime(Mu);
132
133 if ( deltaT / tauMu > 30 ) {
134 return 0;
135 } else {
136 return exp(-( deltaT ) / tauMu);
137 }
138}
139
140double
141KelvinChainSolidMaterial :: computeLambdaMu(GaussPoint *gp, TimeStep *tStep, int Mu) const
142{
143 double deltaT = tStep->giveTimeIncrement();
144 double tauMu = this->giveCharTime(Mu);
145
146 if ( deltaT / tauMu < 1.e-5 ) {
147 return 1 - 0.5 * ( deltaT / tauMu ) + 1 / 6 * ( pow(deltaT / tauMu, 2) ) - 1 / 24 * ( pow(deltaT / tauMu, 3) );
148 } else if ( deltaT / tauMu > 30 ) {
149 return tauMu / deltaT;
150 } else {
151 return ( 1.0 - exp(-( deltaT ) / tauMu) ) * tauMu / deltaT;
152 }
153}
154
155
156void
157KelvinChainSolidMaterial :: giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep) const
158{
159 RheoChainMaterial :: giveRealStressVector(answer, gp, reducedStrain, tStep);
160
161 // Computes hidden variables and stores them as temporary
162 this->computeHiddenVars(gp, tStep);
163}
164
165
166void
167KelvinChainSolidMaterial :: computeHiddenVars(GaussPoint *gp, TimeStep *tStep) const
168{
169 /*
170 * Updates hidden variables used to effectively trace the load history
171 */
172
173 FloatArray help, SigmaVMu, deltaSigma;
174 FloatMatrix D;
175 KelvinChainSolidMaterialStatus *status = static_cast< KelvinChainSolidMaterialStatus * >( this->giveStatus(gp) );
176
177 // goes there if the viscoelastic material does not exist and at the same time the precastingtime mat is not provided
178 // if ( ! this->isActivated( tStep ) ) {
179 // goes there if the viscoelastic material does not exist yet
180 if ( ! Material :: isActivated( tStep ) ) {
181 help.resize(StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() ) );
182 help.zero();
183 for ( int mu = 1; mu <= nUnits; mu++ ) {
184 status->letTempHiddenVarsVectorBe(mu, help);
185 }
186 return;
187 }
188
189 help = status->giveTempStrainVector(); // gives updated strain vector (at the end of time-step)
190 help.subtract( status->giveStrainVector() ); // strain increment in current time-step
191
192 // Subtract the stress-independent part of strain
193 auto deltaEps0 = this->computeStressIndependentStrainVector(gp, tStep, VM_Incremental);
194 if ( deltaEps0.giveSize() ) {
195 help.subtract(deltaEps0); // should be equal to zero if there is no stress change during the time-step
196 }
197
198 this->giveUnitStiffnessMatrix(D, gp, tStep);
199
200 help.times( this->giveEModulus(gp, tStep) );
201 // help.times( this->giveIncrementalModulus(gp, tStep) );
202 deltaSigma.beProductOf(D, help);
203
204 for ( int mu = 1; mu <= nUnits; mu++ ) {
205 double betaMu = this->computeBetaMu(gp, tStep, mu);
206 double lambdaMu = this->computeLambdaMu(gp, tStep, mu);
207
208 help = deltaSigma;
209 help.times(lambdaMu);
210
211 SigmaVMu = status->giveHiddenVarsVector(mu);
212
213 if ( SigmaVMu.giveSize() ) {
214 SigmaVMu.times(betaMu);
215 SigmaVMu.add(help);
216 status->letTempHiddenVarsVectorBe(mu, SigmaVMu);
217 } else {
218 status->letTempHiddenVarsVectorBe(mu, help);
219 }
220 }
221}
222
223
224std::unique_ptr<MaterialStatus>
225KelvinChainSolidMaterial :: CreateStatus(GaussPoint *gp) const
226/*
227 * creates a new material status corresponding to this class
228 */
229{
230 return std::make_unique<KelvinChainSolidMaterialStatus>(gp, nUnits);
231}
232
233void
234KelvinChainSolidMaterial :: initializeFrom(InputRecord &ir)
235{
236 RheoChainMaterial :: initializeFrom(ir);
237}
238
239// useless here
240double
241KelvinChainSolidMaterial :: computeCreepFunction(double t, double t_prime, GaussPoint *gp, TimeStep *tStep) const
242{
243 OOFEM_ERROR("function has not been yet implemented to KelvinChainSolidMaterialStatus.C");
244}
245
246
247/****************************************************************************************/
248
249KelvinChainSolidMaterialStatus :: KelvinChainSolidMaterialStatus(GaussPoint *g, int nunits) :
250 RheoChainMaterialStatus(g, nunits) { }
251
252void
253KelvinChainSolidMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
254{
255 RheoChainMaterialStatus :: printOutputAt(file, tStep);
256}
257
258
259void
260KelvinChainSolidMaterialStatus :: updateYourself(TimeStep *tStep)
261{
262 RheoChainMaterialStatus :: updateYourself(tStep);
263}
264
265void
266KelvinChainSolidMaterialStatus :: initTempStatus()
267{
268 RheoChainMaterialStatus :: initTempStatus();
269}
270
271void
272KelvinChainSolidMaterialStatus :: saveContext(DataStream &stream, ContextMode mode)
273{
274 RheoChainMaterialStatus :: saveContext(stream, mode);
275}
276
277void
278KelvinChainSolidMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode)
279{
280 RheoChainMaterialStatus :: restoreContext(stream, mode);
281}
282} // end namespace oofem
void resize(Index s)
Definition floatarray.C:94
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
bool isNotEmpty() const
Returns true if receiver is not empty.
Definition floatarray.h:263
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
virtual double computeLambdaMu(GaussPoint *gp, TimeStep *tStep, int Mu) const
void computeHiddenVars(GaussPoint *gp, TimeStep *tStep) const
virtual double computeBetaMu(GaussPoint *gp, TimeStep *tStep, int Mu) const
factors for exponential algorithm
double giveEModulus(GaussPoint *gp, TimeStep *tStep) const override
Evaluation of the incremental modulus.
virtual double computeSolidifiedVolume(GaussPoint *gp, TimeStep *tStep) const =0
Evaluation of the relative volume of the solidified material.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
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
int nUnits
Number of (Maxwell or Kelvin) units in the rheologic chain.
Definition rheoChM.h:145
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
FloatArray EparVal
Partial moduli of individual units.
Definition rheoChM.h:166
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 void updateEparModuli(double tPrime, GaussPoint *gp, TimeStep *tStep) const
Update of partial moduli of individual chain units.
Definition rheoChM.C:313
FloatArray computeStressIndependentStrainVector(GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const override
Definition rheoChM.C:370
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
#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