OOFEM 3.0
Loading...
Searching...
No Matches
j2mat.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 "j2mat.h"
37#include "gausspoint.h"
38#include "floatmatrix.h"
39#include "floatarray.h"
40#include "intarray.h"
41#include "mathfem.h"
42#include "classfactory.h"
43
44namespace oofem {
46
47J2Mat :: J2Mat(int n, Domain *d) : MPlasticMaterial2(n, d)
48{
50 this->nsurf = 1;
51}
52
53void
54J2Mat :: initializeFrom(InputRecord &ir)
55{
56 double value;
57
58 MPlasticMaterial2 :: initializeFrom(ir);
59 linearElasticMaterial->initializeFrom(ir);
60
61 IR_GIVE_FIELD(ir, value, _IFT_J2Mat_ry);
62 k = value / sqrt(3.0);
63
64 kinematicModuli = 0.0;
66
67 isotropicModuli = 0.0;
69
70 if ( fabs(kinematicModuli) > 1.e-12 ) {
72 }
73
74 if ( fabs(isotropicModuli) > 1.e-12 ) {
76 }
77
78 int rma = 0;
80 if ( rma == 0 ) {
82 } else {
84 }
85}
86
87
88std::unique_ptr<MaterialStatus>
89J2Mat :: CreateStatus(GaussPoint *gp) const
90{
91 return std::make_unique<MPlasticMaterial2Status>(gp, this->giveSizeOfReducedHardeningVarsVector(gp));
92}
93
94int
95J2Mat :: giveSizeOfFullHardeningVarsVector() const
96{
97 /* Returns the size of hardening variables vector */
98 int size = 0;
99
101 size += 6; /* size of full stress vector */
102 }
103
105 size += 1; /* scalar value */
106 }
107
108 return size;
109}
110
111int
112J2Mat :: giveSizeOfReducedHardeningVarsVector(GaussPoint *gp) const
113{
114 /* Returns the size of hardening variables vector */
115 int size = 0;
116
118 size += StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() );
119 }
120
122 size += 1; /* scalar value */
123 }
124
125 return size;
126}
127
128
129double
130J2Mat :: computeYieldValueAt(GaussPoint *gp, int isurf, const FloatArray &stressVector,
131 const FloatArray &strainSpaceHardeningVars) const
132{
133 double f;
134 FloatArray helpVector, backStress;
135
136 if ( this->kinematicHardeningFlag ) {
137 if ( stressVector.isNotEmpty() ) {
138 helpVector = stressVector;
139 this->giveStressBackVector(backStress, gp, strainSpaceHardeningVars);
140 helpVector.add(backStress);
141 } else {
142 return -k;
143 }
144 } else {
145 helpVector = stressVector;
146 }
147
148 f = sqrt( this->computeJ2InvariantAt(helpVector) );
149 return f + sqrt(1. / 3.) * this->giveIsotropicHardeningVar(gp, strainSpaceHardeningVars) - this->k;
150}
151
152
153void
154J2Mat :: computeStressGradientVector(FloatArray &answer, functType ftype, int isurf, GaussPoint *gp, const FloatArray &stressVector,
155 const FloatArray &strainSpaceHardeningVars) const
156{
157 /* stress gradient of yield function in full stress - strain space */
158
159 double f, ax, ay, az, sx, sy, sz;
160 FloatArray helpVector, backStress;
161
162 answer.resize(6);
163 answer.zero();
164 if ( this->kinematicHardeningFlag ) {
165 if ( stressVector.isNotEmpty() ) {
166 this->giveStressBackVector(backStress, gp, strainSpaceHardeningVars);
167 helpVector = stressVector;
168 helpVector.add(backStress);
169 } else {
170 return;
171 }
172 } else {
173 helpVector = stressVector;
174 }
175
176 f = sqrt( this->computeJ2InvariantAt(helpVector) );
177 // check for yield value zero value
178 if ( fabs(f) < 1.e-6 ) {
179 return;
180 }
181
182 ax = helpVector.at(1);
183 ay = helpVector.at(2);
184 az = helpVector.at(3);
185
186 sx = ( 2. / 3. ) * ax - ( 1. / 3. ) * ay - ( 1. / 3. ) * az;
187 sy = ( 2. / 3. ) * ay - ( 1. / 3. ) * ax - ( 1. / 3. ) * az;
188 sz = ( 2. / 3. ) * az - ( 1. / 3. ) * ay - ( 1. / 3. ) * ax;
189
190 answer.at(1) = 0.5 * sx / f;
191 answer.at(2) = 0.5 * sy / f;
192 answer.at(3) = 0.5 * sz / f;
193 answer.at(4) = helpVector.at(4) / f;
194 answer.at(5) = helpVector.at(5) / f;
195 answer.at(6) = helpVector.at(6) / f;
196}
197
198
199void
200J2Mat :: computeStrainHardeningVarsIncrement(FloatArray &answer, GaussPoint *gp,
201 const FloatArray &stress, const FloatArray &dlambda,
202 const FloatArray &dplasticStrain, const IntArray &activeConditionMap) const
203{
204 int size = this->giveSizeOfReducedHardeningVarsVector(gp);
205 answer.resize(size);
206
207 if ( this->kinematicHardeningFlag ) {
208 int sizer = dplasticStrain.giveSize();
209 double coeff = sqrt(2.) * ( 2. / 3. );
210 for ( int i = 1; i <= sizer; i++ ) {
211 answer.at(i) = dplasticStrain.at(i) * coeff;
212 }
213 }
214
216 answer.at(size) = sqrt(1. / 3.) * dlambda.at(1);
217 }
218}
219
220
221void
222J2Mat :: computeKGradientVector(FloatArray &answer, functType ftype, int isurf, GaussPoint *gp, FloatArray &fullStressVector,
223 const FloatArray &strainSpaceHardeningVariables) const
224{
225 int kcount = 0, size = this->giveSizeOfReducedHardeningVarsVector(gp);
226 FloatArray reducedKinematicGrad;
227
228 if ( !hasHardening() ) {
229 answer.clear();
230 return;
231 }
232
233 answer.resize(size);
234
235 /* kinematic hardening variables first */
236 if ( this->kinematicHardeningFlag ) {
237 this->computeReducedStressGradientVector(reducedKinematicGrad, ftype, isurf, gp, fullStressVector, strainSpaceHardeningVariables);
238 kcount = reducedKinematicGrad.giveSize();
239 for ( int i = 1; i <= kcount; i++ ) {
240 answer.at(i) = ( -1.0 ) * this->kinematicModuli * reducedKinematicGrad.at(i);
241 }
242 }
243
244 if ( this->isotropicHardeningFlag ) {
245 answer.at(size) = ( -1.0 ) * this->isotropicModuli;
246 }
247}
248
249void
250J2Mat :: computeReducedHardeningVarsSigmaGradient(FloatMatrix &answer, GaussPoint *gp, const IntArray &activeConditionMap,
251 const FloatArray &fullStressVector,
252 const FloatArray &strainSpaceHardeningVars,
253 const FloatArray &gamma) const
254{
255 int rsize = StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() );
257 answer.zero();
258
259 if ( this->kinematicHardeningFlag ) {
260 double coeff = sqrt(2.) * ( 2. / 3. ) * gamma.at(1);
261 FloatMatrix h;
262
263 this->computeReducedSSGradientMatrix(h, 1, gp, fullStressVector, strainSpaceHardeningVars);
264 for ( int i = 1; i <= rsize; i++ ) {
265 for ( int j = 1; j <= rsize; j++ ) {
266 answer.at(i, j) = coeff * h.at(i, j);
267 }
268 }
269 }
270}
271
272void
273J2Mat :: computeReducedHardeningVarsLamGradient(FloatMatrix &answer, GaussPoint *gp, int actSurf,
274 const IntArray &activeConditionMap,
275 const FloatArray &fullStressVector,
276 const FloatArray &strainSpaceHardeningVars,
277 const FloatArray &gamma) const
278{
279 int size = this->giveSizeOfReducedHardeningVarsVector(gp);
280 answer.resize(size, 1);
281
282 if ( this->kinematicHardeningFlag ) {
283 int rsize;
284 FloatArray loadGradSigVec;
285 this->computeReducedStressGradientVector(loadGradSigVec, loadFunction, 1, gp, fullStressVector,
286 strainSpaceHardeningVars);
287 rsize = loadGradSigVec.giveSize();
288 for ( int i = 1; i <= rsize; i++ ) {
289 answer.at(i, 1) = loadGradSigVec.at(i);
290 }
291
292 answer.times( sqrt(2.) * ( 2. / 3. ) );
293 }
294
296 answer.at(size, 1) = sqrt(1. / 3.);
297 }
298}
299
300
301void
302J2Mat :: computeReducedSSGradientMatrix(FloatMatrix &gradientMatrix, int isurf, GaussPoint *gp, const FloatArray &fullStressVector,
303 const FloatArray &strainSpaceHardeningVars) const
304{
305 int size;
306 int imask, jmask;
307 FloatArray helpVector, backStress, df(6);
308 IntArray mask;
309 double f, f32, f12, ax, ay, az;
310
311 StructuralMaterial :: giveInvertedVoigtVectorMask( mask, gp->giveMaterialMode() );
312 size = StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() );
313
314 gradientMatrix.resize(size, size);
315 gradientMatrix.zero();
316
317
318 if ( fullStressVector.giveSize() != 0 ) {
319 /* kinematic hardening variables first */
320 if ( this->kinematicHardeningFlag ) {
321 this->giveStressBackVector(backStress, gp, strainSpaceHardeningVars);
322 helpVector = fullStressVector;
323 helpVector.add(backStress);
324 } else {
325 helpVector = fullStressVector;
326 }
327
328 f = this->computeJ2InvariantAt(helpVector);
329 f12 = sqrt(f);
330 f32 = pow(f, 3. / 2.);
331
332 ax = helpVector.at(1);
333 ay = helpVector.at(2);
334 az = helpVector.at(3);
335
336 df.at(1) = ( 2. / 3. ) * ax - ( 1. / 3. ) * ay - ( 1. / 3. ) * az;
337 df.at(2) = ( 2. / 3. ) * ay - ( 1. / 3. ) * ax - ( 1. / 3. ) * az;
338 df.at(3) = ( 2. / 3. ) * az - ( 1. / 3. ) * ay - ( 1. / 3. ) * ax;
339 df.at(4) = 2. * helpVector.at(4);
340 df.at(5) = 2. * helpVector.at(5);
341 df.at(6) = 2. * helpVector.at(6);
342
343 for ( int i = 1; i <= 3; i++ ) {
344 if ( ( imask = mask.at(i) ) == 0 ) {
345 continue;
346 }
347
348 for ( int j = i; j <= 3; j++ ) {
349 if ( ( jmask = mask.at(j) ) == 0 ) {
350 continue;
351 }
352
353 if ( i == j ) {
354 gradientMatrix.at(imask, jmask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j) + 0.5 * ( 1. / f12 ) * ( 4. / 6 );
355 } else {
356 gradientMatrix.at(imask, jmask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j) + 0.5 * ( 1. / f12 ) * ( -2. / 6 );
357 gradientMatrix.at(jmask, imask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j) + 0.5 * ( 1. / f12 ) * ( -2. / 6 );
358 }
359 }
360 }
361
362 for ( int i = 1; i <= 3; i++ ) {
363 if ( ( imask = mask.at(i) ) == 0 ) {
364 continue;
365 }
366
367 for ( int j = 4; j <= 6; j++ ) {
368 if ( ( jmask = mask.at(j) ) == 0 ) {
369 continue;
370 }
371
372 gradientMatrix.at(imask, jmask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j);
373 gradientMatrix.at(jmask, imask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j);
374 }
375 }
376
377 for ( int i = 4; i <= 6; i++ ) {
378 if ( ( imask = mask.at(i) ) == 0 ) {
379 continue;
380 }
381
382 for ( int j = i; j <= 6; j++ ) {
383 if ( ( jmask = mask.at(j) ) == 0 ) {
384 continue;
385 }
386
387 if ( i == j ) {
388 gradientMatrix.at(imask, jmask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j) + 0.5 * ( 1. / f12 ) * 2.;
389 } else {
390 gradientMatrix.at(imask, jmask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j);
391 gradientMatrix.at(jmask, imask) = -( 1. / 4. ) * ( 1. / f32 ) * df.at(i) * df.at(j);
392 }
393 }
394 }
395 }
396}
397
398
399void
400J2Mat :: computeReducedSKGradientMatrix(FloatMatrix &gradientMatrix, int i, GaussPoint *gp, const FloatArray &fullStressVector,
401 const FloatArray &strainSpaceHardeningVariables) const
402{
403 // something will be here for k1 vector
405 FloatMatrix helpMat;
406 gradientMatrix.resize(StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() ), size);
407 gradientMatrix.zero();
408
409 if ( this->kinematicHardeningFlag ) {
410 int kcount;
411 this->computeReducedSSGradientMatrix(helpMat, i, gp, fullStressVector, strainSpaceHardeningVariables);
412 helpMat.times( ( -1.0 ) * this->kinematicModuli );
413 kcount = helpMat.giveNumberOfRows();
414 for ( int ii = 1; ii <= kcount; ii++ ) {
415 for ( int j = 1; j <= kcount; j++ ) {
416 gradientMatrix.at(ii, j) = helpMat.at(ii, j);
417 }
418 }
419 }
420}
421
422
423int
424J2Mat :: hasHardening() const
425{
426 return ( this->kinematicHardeningFlag || this->isotropicHardeningFlag );
427}
428
429
430double
431J2Mat :: computeJ2InvariantAt(const FloatArray &stressVector)
432{
433 double answer;
434 double v1, v2, v3;
435
436 if ( stressVector.isEmpty() ) {
437 return 0.0;
438 }
439
440 v1 = ( ( stressVector.at(1) - stressVector.at(2) ) * ( stressVector.at(1) - stressVector.at(2) ) );
441 v2 = ( ( stressVector.at(2) - stressVector.at(3) ) * ( stressVector.at(2) - stressVector.at(3) ) );
442 v3 = ( ( stressVector.at(3) - stressVector.at(1) ) * ( stressVector.at(3) - stressVector.at(1) ) );
443
444 answer = ( 1. / 6. ) * ( v1 + v2 + v3 ) + stressVector.at(4) * stressVector.at(4) +
445 stressVector.at(5) * stressVector.at(5) + stressVector.at(6) * stressVector.at(6);
446
447 return answer;
448}
449
450
451void
452J2Mat :: giveStressBackVector(FloatArray &answer, GaussPoint *gp,
453 const FloatArray &strainSpaceHardeningVars) const
454{
455 /* returns part of hardening vector corresponding to kinematic hardening */
456 if ( this->kinematicHardeningFlag ) {
457 IntArray mask;
458 int isize;
459
460 answer.resize(6);
461 StructuralMaterial :: giveVoigtSymVectorMask( mask, gp->giveMaterialMode() );
462 isize = mask.giveSize();
463 //int rSize = this->giveSizeOfReducedHardeningVarsVector(gp);
464
465 /* kinematic hardening variables are first */
466 for ( int i = 1; i <= isize; i++ ) {
467 answer.at( mask.at(i) ) = ( -1.0 ) * this->kinematicModuli * strainSpaceHardeningVars.at(i);
468 }
469 } else {
470 answer.clear();
471 return;
472 }
473}
474
475
476double
477J2Mat :: giveIsotropicHardeningVar(GaussPoint *gp, const FloatArray &strainSpaceHardeningVars) const
478{
479 /* returns value in hardening vector corresponding to isotropic hardening */
480 if ( !isotropicHardeningFlag ) {
481 return 0.;
482 } else {
483 int rSize = this->giveSizeOfReducedHardeningVarsVector(gp);
484
485 return ( -1.0 ) * this->isotropicModuli * strainSpaceHardeningVars.at(rSize);
486 }
487}
488} // end namespace oofem
#define REGISTER_Material(class)
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
bool isEmpty() const
Returns true if receiver is empty.
Definition floatarray.h:265
void add(const FloatArray &src)
Definition floatarray.C:218
bool isNotEmpty() const
Returns true if receiver is not empty.
Definition floatarray.h:263
void times(double f)
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
static double computeJ2InvariantAt(const FloatArray &stressVector)
Definition j2mat.C:431
double k
Definition j2mat.h:62
void computeReducedSSGradientMatrix(FloatMatrix &gradientMatrix, int i, GaussPoint *gp, const FloatArray &fullStressVector, const FloatArray &strainSpaceHardeningVariables) const override
Computes second derivative of loading function with respect to stress.
Definition j2mat.C:302
int kinematicHardeningFlag
Definition j2mat.h:60
double kinematicModuli
Definition j2mat.h:61
int giveSizeOfReducedHardeningVarsVector(GaussPoint *gp) const override
Definition j2mat.C:112
double giveIsotropicHardeningVar(GaussPoint *gp, const FloatArray &strainSpaceHardeningVars) const
Definition j2mat.C:477
void giveStressBackVector(FloatArray &answer, GaussPoint *gp, const FloatArray &strainSpaceHardeningVars) const
Definition j2mat.C:452
double isotropicModuli
Definition j2mat.h:61
int isotropicHardeningFlag
Definition j2mat.h:60
int hasHardening() const override
Definition j2mat.C:424
void computeReducedStressGradientVector(FloatArray &answer, functType ftype, int isurf, GaussPoint *gp, const FloatArray &stressVector, const FloatArray &strainSpaceHardeningVariables) const
enum oofem::MPlasticMaterial2::ReturnMappingAlgoType rmType
LinearElasticMaterial * linearElasticMaterial
Reference to bulk (undamaged) material.
functType
Type that allows to distinguish between yield function and loading function.
MPlasticMaterial2(int n, Domain *d)
int nsurf
Number of yield surfaces.
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_J2Mat_khm
Definition j2mat.h:44
#define _IFT_J2Mat_rma
Definition j2mat.h:46
#define _IFT_J2Mat_ry
Definition j2mat.h:43
#define _IFT_J2Mat_ihm
Definition j2mat.h:45

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