OOFEM 3.0
Loading...
Searching...
No Matches
tutorialmaterial.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 "tutorialmaterial.h"
36#include "gausspoint.h"
37#include "floatmatrix.h"
38#include "floatarray.h"
39#include "dynamicinputrecord.h"
40#include "classfactory.h"
42#include "mathfem.h"
43
44namespace oofem {
46
47TutorialMaterial :: TutorialMaterial(int n, Domain *d) : StructuralMaterial(n, d), D(n, d)
48{}
49
50
51void
52TutorialMaterial :: initializeFrom(InputRecord &ir)
53{
54 StructuralMaterial :: initializeFrom(ir);
55
56 D.initializeFrom(ir);
59}
60
61
62void
63TutorialMaterial :: giveInputRecord(DynamicInputRecord &ir)
64{
65 StructuralMaterial :: giveInputRecord(ir);
66 D.giveInputRecord(ir);
69}
70
71
72std::unique_ptr<MaterialStatus>
73TutorialMaterial :: CreateStatus(GaussPoint *gp) const
74{
75 return std::make_unique<TutorialMaterialStatus>(gp);
76}
77
78
80TutorialMaterial :: giveRealStressVector_3d(const FloatArrayF<6> &totalStrain, GaussPoint *gp, TimeStep *tStep) const
81{
82 auto status = static_cast< TutorialMaterialStatus * >( this->giveStatus(gp) );
83
84 // subtract stress thermal expansion
85 auto thermalStrain = this->computeStressIndependentStrainVector_3d(gp, tStep, VM_Total);
86 auto strain = totalStrain - thermalStrain;
87
88 auto trialElastStrain = strain - status->givePlasticStrain();
89
90 // Compute trial stress = sig_tr = sig_old + E*delta_eps
91 const auto &elasticStiffness = D.giveTangent();
92 auto trialStress = dot(elasticStiffness, trialElastStrain);
93
94 //auto [devTrialStress, meanTrialStress] = computeDeviatoricVolumetricSplit(); // c++17
95 auto tmp = computeDeviatoricVolumetricSplit(trialStress);
96 auto devTrialStress = tmp.first;
97 auto meanTrialStress = tmp.second;
98
99 double J2 = this->computeSecondStressInvariant(devTrialStress);
100 double effectiveTrialStress = sqrt(3 * J2);
101
102 // evaluate the yield surface
103 double k = status->giveK();
104 double phiTrial = effectiveTrialStress - ( this->sig0 + H * k );
105
106 FloatArrayF<6> stress;
107 if ( phiTrial < 0.0 ) { // elastic
108 stress = trialStress;
109
110 status->letTempPlasticStrainBe(status->givePlasticStrain());
111 } else { // plastic loading
112 double G = D.giveShearModulus();
113 double mu = phiTrial / ( 3.0 * G + H ); // plastic multiplier
114 // radial return
115 auto devStress = ( 1.0 - 3.0*G*mu/effectiveTrialStress) * devTrialStress;
116 stress = computeDeviatoricVolumetricSum(devStress, meanTrialStress);
117 k += mu;
118
119 auto plasticStrain = status->givePlasticStrain();
120 auto dPlStrain = applyDeviatoricElasticCompliance(devTrialStress, 0.5);
121 plasticStrain += (mu * 3. / (2. * effectiveTrialStress)) * dPlStrain;
122 status->letTempPlasticStrainBe(plasticStrain);
123 }
124
125 // Store the temporary values for the given iteration
126 status->letTempStrainVectorBe(totalStrain);
127 status->letTempStressVectorBe(stress);
128 status->letTempKBe(k);
129 status->letTempDevTrialStressBe(devTrialStress);
130 return stress;
131}
132
133
135TutorialMaterial :: give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
136{
137 auto status = static_cast< TutorialMaterialStatus * >( this->giveStatus(gp) );
138 const auto &devTrialStress = status->giveTempDevTrialStress();
139
140 double J2 = this->computeSecondStressInvariant(devTrialStress);
141 double effectiveTrialStress = sqrt(3 * J2);
142
143 // evaluate the yield surface
144 double k = status->giveK();
145 double phiTrial = effectiveTrialStress - ( this->sig0 + H * k );
146
147 const auto &elasticStiffness = D.giveTangent();
148
149 if ( phiTrial < 0.0 ) { // elastic
150 return elasticStiffness;
151 } else { // plastic loading
152 double G = D.giveShearModulus();
153 // E_t = elasticStiffness - correction
154 // correction = 2.0 * G * ( 2.0 * G / h *( sig0 + kappa ) / sigtre *openProd(nu,nu) + mu*3*G/sigtre *Idev);
155 double h = 3.0 * G + H;
156 double mu = phiTrial / h; // plasic multiplier
157 auto nu = ( 3.0/2.0 / effectiveTrialStress ) * devTrialStress;
158
159 auto correction = dyad(nu, nu) * (2.0 * G / h * ( this->sig0 + H * k ));
160 correction += (mu * 3.0 * G) * I_dev6;
161 correction *= 2.0 * G / effectiveTrialStress;
162 return elasticStiffness - correction;
163 }
164}
165
166
168TutorialMaterial :: giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const
169{
170 return D.giveAlpha();
171}
172
173
174int
175TutorialMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
176{
177 TutorialMaterialStatus *status = static_cast< TutorialMaterialStatus * >( this->giveStatus(gp) );
178 if ( type == IST_PlasticStrainTensor ) {
179 answer = status->givePlasticStrain();
180 return 1;
181 } else {
182 return StructuralMaterial :: giveIPValue(answer, gp, type, tStep);
183 }
184}
185
186
187//=============================================================================
188
189
190TutorialMaterialStatus :: TutorialMaterialStatus(GaussPoint * g) :
192{
193 strainVector.resize(6);
194 stressVector.resize(6);
197}
198
199void
200TutorialMaterialStatus :: initTempStatus()
201{
202 //StructuralMaterialStatus :: initTempStatus();
203
204 // reset temp vars.
209
210
212 tempK = k;
214}
215
216
217void
218TutorialMaterialStatus :: updateYourself(TimeStep *tStep)
219{
220 // Copy the temporary values to the convered ones.
221 // This method is called after equilibrium has been reached and should
222 // set all...
223 StructuralMaterialStatus :: updateYourself(tStep);
224
226 k = tempK;
227 // deviatoric trial stress is not really a state variable and was used not to repeat some code...
228}
229
230} // end namespace oofem
#define REGISTER_Material(class)
void setField(int item, InputFieldType id)
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
FloatArray tempPVector
Temporary first Piola-Kirchhoff stress vector (to find balanced state).
FloatArray tempFVector
Temporary deformation gradient in reduced form (to find balanced state).
StructuralMaterialStatus(GaussPoint *g)
Constructor. Creates new StructuralMaterialStatus with IntegrationPoint g.
FloatArray tempStrainVector
Temporary strain vector in reduced form (to find balanced state).
FloatArray tempStressVector
Temporary stress vector in reduced form (increments are used mainly in nonlinear analysis).
FloatArray stressVector
Equilibrated stress vector in reduced form.
FloatArray PVector
Equilibrated first Piola-Kirchhoff stress vector.
FloatArray strainVector
Equilibrated strain vector in reduced form.
FloatArray FVector
Equilibrated deformation gradient in reduced form.
static FloatArrayF< 6 > computeDeviatoricVolumetricSum(const FloatArrayF< 6 > &dev, double mean)
static FloatArrayF< 6 > applyDeviatoricElasticCompliance(const FloatArrayF< 6 > &stress, double EModulus, double nu)
StructuralMaterial(int n, Domain *d)
static double computeSecondStressInvariant(const FloatArrayF< 6 > &s)
static std::pair< FloatArrayF< 6 >, double > computeDeviatoricVolumetricSplit(const FloatArrayF< 6 > &s)
FloatArrayF< 6 > computeStressIndependentStrainVector_3d(GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
FloatArrayF< 6 > plasticStrain
Last equilibriated plastic strain (end of last time step).
const FloatArrayF< 6 > & givePlasticStrain() const
const FloatArrayF< 6 > & giveTempDevTrialStress() const
FloatArrayF< 6 > tempPlasticStrain
Temporary plastic strain (the given iteration).
double H
Hardening modulus.
IsotropicLinearElasticMaterial D
double sig0
Initial (uniaxial) yield stress.
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
FloatMatrixF< N, M > dyad(const FloatArrayF< N > &a, const FloatArrayF< M > &b)
Computes the dyadic product .
const FloatMatrixF< 6, 6 > I_dev6
I_dev matrix in Voigt (stress) form.
double dot(const FloatArray &x, const FloatArray &y)
FloatArrayF< N > zeros()
For more readable code.
#define _IFT_TutorialMaterial_hardeningmoduli
#define _IFT_TutorialMaterial_yieldstress

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