Skip to content

Commit a8a57c7

Browse files
authored
feat: plastic strain output (#3384)
1 parent adfefc3 commit a8a57c7

File tree

11 files changed

+376
-36
lines changed

11 files changed

+376
-36
lines changed

.integrated_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
baselines:
22
bucket: geosx
3-
baseline: integratedTests/baseline_integratedTests-pr3486-9492-f0c817c
3+
baseline: integratedTests/baseline_integratedTests-pr3384-9542-4e0f693
44
allow_fail:
55
all: ''
66
streak: ''

BASELINE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines.
66
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
77
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).
88

9+
PR #3384 (2024-01-07)
10+
=====================
11+
Added plastic strain output.
12+
913
PR #3486 (2025-01-06)
1014
=====================
1115
useNewGravity became gravityDensityScheme.

src/coreComponents/constitutive/solid/ElasticIsotropic.hpp

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ class ElasticIsotropicUpdates : public SolidBaseUpdates
135135
localIndex const q,
136136
real64 ( &elasticStrain )[6] ) const override final;
137137

138+
GEOS_HOST_DEVICE
139+
virtual void getElasticStrainInc( localIndex const k,
140+
localIndex const q,
141+
real64 ( &elasticStrainInc )[6] ) const override final;
142+
138143
GEOS_HOST_DEVICE
139144
virtual real64 getBulkModulus( localIndex const k ) const override final
140145
{
@@ -171,6 +176,13 @@ class ElasticIsotropicUpdates : public SolidBaseUpdates
171176

172177
protected:
173178

179+
GEOS_HOST_DEVICE
180+
virtual void computeElasticStrain( localIndex const k,
181+
localIndex const q,
182+
real64 const ( &stress )[6],
183+
real64 ( &elasticStrainInc )[6] ) const;
184+
185+
174186
/// A reference to the ArrayView holding the bulk modulus for each element.
175187
arrayView1d< real64 const > const m_bulkModulus;
176188

@@ -210,24 +222,53 @@ void ElasticIsotropicUpdates::getElasticStiffness( localIndex const k,
210222
}
211223

212224

225+
GEOS_HOST_DEVICE
226+
inline
227+
void ElasticIsotropicUpdates::computeElasticStrain( localIndex const k,
228+
localIndex const q,
229+
real64 const ( &stress )[6],
230+
real64 ( & elasticStrain)[6] ) const
231+
{
232+
GEOS_UNUSED_VAR( q );
233+
real64 const E = conversions::bulkModAndShearMod::toYoungMod( m_bulkModulus[k], m_shearModulus[k] );
234+
real64 const nu = conversions::bulkModAndShearMod::toPoissonRatio( m_bulkModulus[k], m_shearModulus[k] );
235+
236+
elasticStrain[0] = ( stress[0] - nu*stress[1] - nu*stress[2])/E;
237+
elasticStrain[1] = (-nu*stress[0] + stress[1] - nu*stress[2])/E;
238+
elasticStrain[2] = (-nu*stress[0] - nu*stress[1] + stress[2])/E;
239+
240+
elasticStrain[3] = stress[3] / m_shearModulus[k];
241+
elasticStrain[4] = stress[4] / m_shearModulus[k];
242+
elasticStrain[5] = stress[5] / m_shearModulus[k];
243+
}
244+
213245
GEOS_HOST_DEVICE
214246
inline
215247
void ElasticIsotropicUpdates::getElasticStrain( localIndex const k,
216248
localIndex const q,
217249
real64 ( & elasticStrain)[6] ) const
218250
{
219-
real64 const E = conversions::bulkModAndShearMod::toYoungMod( m_bulkModulus[k], m_shearModulus[k] );
220-
real64 const nu = conversions::bulkModAndShearMod::toPoissonRatio( m_bulkModulus[k], m_shearModulus[k] );
221251

222-
elasticStrain[0] = ( m_newStress[k][q][0] - nu*m_newStress[k][q][1] - nu*m_newStress[k][q][2])/E;
223-
elasticStrain[1] = (-nu*m_newStress[k][q][0] + m_newStress[k][q][1] - nu*m_newStress[k][q][2])/E;
224-
elasticStrain[2] = (-nu*m_newStress[k][q][0] - nu*m_newStress[k][q][1] + m_newStress[k][q][2])/E;
252+
real64 stress[6] = {m_newStress[k][q][0], m_newStress[k][q][1], m_newStress[k][q][2], m_newStress[k][q][3], m_newStress[k][q][4], m_newStress[k][q][5]};
253+
254+
computeElasticStrain( k, q, stress, elasticStrain );
225255

226-
elasticStrain[3] = m_newStress[k][q][3] / m_shearModulus[k];
227-
elasticStrain[4] = m_newStress[k][q][4] / m_shearModulus[k];
228-
elasticStrain[5] = m_newStress[k][q][5] / m_shearModulus[k];
229256
}
230257

258+
GEOS_HOST_DEVICE
259+
inline
260+
void ElasticIsotropicUpdates::getElasticStrainInc( localIndex const k,
261+
localIndex const q,
262+
real64 ( & elasticStrainInc)[6] ) const
263+
{
264+
265+
real64 stress[6] =
266+
{m_newStress[k][q][0] - m_oldStress[k][q][0], m_newStress[k][q][1] - m_oldStress[k][q][1], m_newStress[k][q][2] - m_oldStress[k][q][2], m_newStress[k][q][3] - m_oldStress[k][q][3],
267+
m_newStress[k][q][4] - m_oldStress[k][q][4], m_newStress[k][q][5] - m_oldStress[k][q][5]};
268+
269+
computeElasticStrain( k, q, stress, elasticStrainInc );
270+
271+
}
231272

232273
GEOS_HOST_DEVICE
233274
inline

src/coreComponents/constitutive/solid/ElasticIsotropicPressureDependent.hpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ class ElasticIsotropicPressureDependentUpdates : public SolidBaseUpdates
115115
localIndex const q,
116116
real64 ( &elasticStrain )[6] ) const override final;
117117

118+
GEOS_HOST_DEVICE
119+
virtual void getElasticStrainInc( localIndex const k,
120+
localIndex const q,
121+
real64 ( &elasticStrainInc )[6] ) const override final;
122+
118123
GEOS_HOST_DEVICE
119124
virtual void viscousStateUpdate( localIndex const k,
120125
localIndex const q,
@@ -223,6 +228,60 @@ void ElasticIsotropicPressureDependentUpdates::getElasticStrain( localIndex cons
223228
}
224229

225230

231+
GEOS_HOST_DEVICE
232+
inline
233+
void ElasticIsotropicPressureDependentUpdates::getElasticStrainInc( localIndex const k,
234+
localIndex const q,
235+
real64 ( & elasticStrainInc)[6] ) const
236+
{
237+
real64 const mu = m_shearModulus[k];
238+
real64 const p0 = m_refPressure;
239+
real64 const eps_v0 = m_refStrainVol;
240+
real64 const Cr = m_recompressionIndex[k];
241+
real64 deviator[6]{};
242+
real64 stress[6]{};
243+
real64 P;
244+
real64 Q;
245+
246+
LvArray::tensorOps::copy< 6 >( stress, m_newStress[k][q] );
247+
248+
twoInvariant::stressDecomposition( stress,
249+
P,
250+
Q,
251+
deviator );
252+
253+
real64 elasticStrainVol = LvArray::math::log( P/p0 ) * Cr * (-1.0) + eps_v0;
254+
real64 elasticStrainDev = Q/3./mu;
255+
256+
twoInvariant::strainRecomposition( elasticStrainVol,
257+
elasticStrainDev,
258+
deviator,
259+
elasticStrainInc );
260+
261+
real64 oldStrain[6]{};
262+
263+
LvArray::tensorOps::copy< 6 >( stress, m_oldStress[k][q] );
264+
265+
twoInvariant::stressDecomposition( stress,
266+
P,
267+
Q,
268+
deviator );
269+
270+
elasticStrainVol = LvArray::math::log( P/p0 ) * Cr * (-1.0) + eps_v0;
271+
elasticStrainDev = Q/3./mu;
272+
273+
twoInvariant::strainRecomposition( elasticStrainVol,
274+
elasticStrainDev,
275+
deviator,
276+
oldStrain );
277+
278+
for( localIndex i = 0; i<6; ++i )
279+
{
280+
elasticStrainInc[i] -= oldStrain[i];
281+
}
282+
}
283+
284+
226285
GEOS_HOST_DEVICE
227286
inline
228287
void ElasticIsotropicPressureDependentUpdates::smallStrainUpdate( localIndex const k,

src/coreComponents/constitutive/solid/ElasticOrthotropic.hpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ class ElasticOrthotropicUpdates : public SolidBaseUpdates
147147
real64 ( &stress )[6],
148148
DiscretizationOps & stiffness ) const final;
149149

150+
GEOS_HOST_DEVICE
151+
virtual void getElasticStrain( localIndex const k,
152+
localIndex const q,
153+
real64 ( &elasticStrain )[6] ) const override final;
154+
155+
GEOS_HOST_DEVICE
156+
virtual void getElasticStrainInc( localIndex const k,
157+
localIndex const q,
158+
real64 ( &elasticStrainInc )[6] ) const override final;
159+
150160
// miscellaneous getters
151161

152162
GEOS_HOST_DEVICE
@@ -162,6 +172,13 @@ class ElasticOrthotropicUpdates : public SolidBaseUpdates
162172
return LvArray::math::max( LvArray::math::max( m_c44[k], m_c55[k] ), m_c66[k] );
163173
}
164174

175+
protected:
176+
GEOS_HOST_DEVICE
177+
virtual void computeElasticStrain( localIndex const k,
178+
localIndex const q,
179+
real64 const (&stress)[6],
180+
real64 ( &elasticStrain )[6] ) const;
181+
165182
private:
166183
/// A reference to the ArrayView holding c11 for each element.
167184
arrayView1d< real64 const > const m_c11;
@@ -219,6 +236,64 @@ void ElasticOrthotropicUpdates::getElasticStiffness( localIndex const k,
219236
stiffness[5][5] = m_c66[k];
220237
}
221238

239+
240+
GEOS_HOST_DEVICE
241+
inline
242+
void ElasticOrthotropicUpdates::computeElasticStrain( localIndex const k,
243+
localIndex const q,
244+
real64 const (&stress)[6],
245+
real64 ( & elasticStrain)[6] ) const
246+
{
247+
248+
GEOS_UNUSED_VAR( q );
249+
250+
real64 const detC = m_c11[k]*(m_c22[k]*m_c33[k] - m_c23[k]*m_c23[k]) - m_c12[k]*(m_c12[k]*m_c33[k] - m_c23[k]*m_c13[k]) + m_c13[k]*(m_c12[k]*m_c23[k] - m_c22[k]*m_c13[k]);
251+
252+
elasticStrain[0] =
253+
( (m_c22[k]*m_c33[k] - m_c23[k]*m_c23[k])*stress[0] + (m_c13[k]*m_c23[k] - m_c12[k]*m_c33[k])*stress[1] + (m_c12[k]*m_c23[k] - m_c13[k]*m_c22[k])*stress[2] ) /
254+
detC;
255+
elasticStrain[1] =
256+
( (m_c23[k]*m_c13[k] - m_c12[k]*m_c33[k])*stress[0] + (m_c11[k]*m_c33[k] - m_c13[k]*m_c13[k])*stress[1] + (m_c13[k]*m_c12[k] - m_c11[k]*m_c23[k])*stress[2] ) /
257+
detC;
258+
elasticStrain[2] =
259+
( (m_c12[k]*m_c23[k] - m_c22[k]*m_c13[k])*stress[0] + (m_c12[k]*m_c13[k] - m_c11[k]*m_c23[k])*stress[1] + (m_c11[k]*m_c22[k] - m_c12[k]*m_c12[k])*stress[2] ) /
260+
detC;
261+
262+
elasticStrain[3] = stress[3] / m_c44[k];
263+
elasticStrain[4] = stress[4] / m_c55[k];
264+
elasticStrain[5] = stress[5] / m_c66[k];
265+
}
266+
267+
268+
GEOS_HOST_DEVICE
269+
inline
270+
void ElasticOrthotropicUpdates::getElasticStrain( localIndex const k,
271+
localIndex const q,
272+
real64 ( & elasticStrain)[6] ) const
273+
{
274+
275+
real64 stress[6] = {m_newStress[k][q][0], m_newStress[k][q][1], m_newStress[k][q][2], m_newStress[k][q][3], m_newStress[k][q][4], m_newStress[k][q][5]};
276+
277+
computeElasticStrain( k, q, stress, elasticStrain );
278+
279+
}
280+
281+
GEOS_HOST_DEVICE
282+
inline
283+
void ElasticOrthotropicUpdates::getElasticStrainInc( localIndex const k,
284+
localIndex const q,
285+
real64 ( & elasticStrainInc)[6] ) const
286+
{
287+
288+
real64 stress[6] =
289+
{m_newStress[k][q][0] - m_oldStress[k][q][0], m_newStress[k][q][1] - m_oldStress[k][q][1], m_newStress[k][q][2] - m_oldStress[k][q][2], m_newStress[k][q][3] - m_oldStress[k][q][3],
290+
m_newStress[k][q][4] - m_oldStress[k][q][4], m_newStress[k][q][5] - m_oldStress[k][q][5]};
291+
292+
computeElasticStrain( k, q, stress, elasticStrainInc );
293+
294+
}
295+
296+
222297
inline
223298
GEOS_HOST_DEVICE
224299
void ElasticOrthotropicUpdates::smallStrainNoStateUpdate_StressOnly( localIndex const k,

src/coreComponents/constitutive/solid/ElasticTransverseIsotropic.hpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ class ElasticTransverseIsotropicUpdates : public SolidBaseUpdates
144144
GEOS_HOST_DEVICE
145145
virtual void getElasticStiffness( localIndex const k, localIndex const q, real64 ( &stiffness )[6][6] ) const override final;
146146

147+
GEOS_HOST_DEVICE
148+
virtual void getElasticStrain( localIndex const k,
149+
localIndex const q,
150+
real64 ( &elasticStrain )[6] ) const override final;
151+
152+
GEOS_HOST_DEVICE
153+
virtual void getElasticStrainInc( localIndex const k,
154+
localIndex const q,
155+
real64 ( &elasticStrainInc )[6] ) const override final;
156+
147157
/**
148158
* @brief Getter for apparent shear modulus.
149159
* @return reference to shear modulus that will be used for computing stabilization scalling parameter.
@@ -155,6 +165,15 @@ class ElasticTransverseIsotropicUpdates : public SolidBaseUpdates
155165
}
156166

157167

168+
protected:
169+
170+
GEOS_HOST_DEVICE
171+
virtual void computeElasticStrain( localIndex const k,
172+
localIndex const q,
173+
real64 const (&stress)[6],
174+
real64 ( &elasticStrain )[6] ) const;
175+
176+
158177
private:
159178

160179
/// A reference to the ArrayView holding c11 for each element.
@@ -200,6 +219,57 @@ void ElasticTransverseIsotropicUpdates::getElasticStiffness( localIndex const k,
200219
stiffness[5][5] = m_c66[k];
201220
}
202221

222+
GEOS_HOST_DEVICE
223+
inline
224+
void ElasticTransverseIsotropicUpdates::computeElasticStrain( localIndex const k,
225+
localIndex const q,
226+
real64 const (&stress)[6],
227+
real64 ( & elasticStrain)[6] ) const
228+
{
229+
GEOS_UNUSED_VAR( q );
230+
real64 const c12 = ( m_c11[k] - 2.0 * m_c66[k] );
231+
real64 const detC = m_c11[k]*(m_c11[k]*m_c33[k] - m_c13[k]*m_c13[k]) - c12*(c12*m_c33[k] - m_c13[k]*m_c13[k]) + m_c13[k]*(c12*m_c13[k] - m_c11[k]*m_c13[k]);
232+
233+
elasticStrain[0] =
234+
( (m_c11[k]*m_c33[k] - m_c13[k]*m_c13[k])*stress[0] + (m_c13[k]*m_c13[k] - c12*m_c33[k])*stress[1] + (c12*m_c13[k] - m_c13[k]*m_c11[k])*stress[2] ) / detC;
235+
elasticStrain[1] =
236+
( (m_c13[k]*m_c13[k] - c12*m_c33[k])*stress[0] + (m_c11[k]*m_c33[k] - m_c13[k]*m_c13[k])*stress[1] + (m_c13[k]*c12 - m_c11[k]*m_c13[k])*stress[2] ) / detC;
237+
elasticStrain[2] = ( (c12*m_c13[k] - m_c11[k]*m_c13[k])*stress[0] + (c12*m_c13[k] - m_c11[k]*m_c13[k])*stress[1] + (m_c11[k]*m_c11[k] - c12*c12)*stress[2] ) / detC;
238+
239+
elasticStrain[3] = stress[3] / m_c44[k];
240+
elasticStrain[4] = stress[4] / m_c44[k];
241+
elasticStrain[5] = stress[5] / m_c66[k];
242+
}
243+
244+
245+
GEOS_HOST_DEVICE
246+
inline
247+
void ElasticTransverseIsotropicUpdates::getElasticStrain( localIndex const k,
248+
localIndex const q,
249+
real64 ( & elasticStrain)[6] ) const
250+
{
251+
252+
real64 stress[6] = {m_newStress[k][q][0], m_newStress[k][q][1], m_newStress[k][q][2], m_newStress[k][q][3], m_newStress[k][q][4], m_newStress[k][q][5]};
253+
254+
computeElasticStrain( k, q, stress, elasticStrain );
255+
256+
}
257+
258+
GEOS_HOST_DEVICE
259+
inline
260+
void ElasticTransverseIsotropicUpdates::getElasticStrainInc( localIndex const k,
261+
localIndex const q,
262+
real64 ( & elasticStrainInc)[6] ) const
263+
{
264+
265+
real64 stress[6] =
266+
{m_newStress[k][q][0] - m_oldStress[k][q][0], m_newStress[k][q][1] - m_oldStress[k][q][1], m_newStress[k][q][2] - m_oldStress[k][q][2], m_newStress[k][q][3] - m_oldStress[k][q][3],
267+
m_newStress[k][q][4] - m_oldStress[k][q][4], m_newStress[k][q][5] - m_oldStress[k][q][5]};
268+
269+
computeElasticStrain( k, q, stress, elasticStrainInc );
270+
271+
}
272+
203273
inline
204274
GEOS_HOST_DEVICE
205275
void ElasticTransverseIsotropicUpdates::smallStrainNoStateUpdate_StressOnly( localIndex const k,

src/coreComponents/constitutive/solid/SolidBase.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,24 @@ class SolidBaseUpdates
337337
GEOS_ERROR( "getElasticStrain() not implemented for this model" );
338338
}
339339

340+
/**
341+
* @brief Return the current elastic strain increment at a given material point (small-strain interface)
342+
*
343+
* @param k the element inex
344+
* @param q the quadrature index
345+
* @param elasticStrainInc Current elastic strain increment
346+
*/
347+
GEOS_HOST_DEVICE
348+
virtual void getElasticStrainInc( localIndex const k,
349+
localIndex const q,
350+
real64 ( & elasticStrainInc )[6] ) const
351+
{
352+
GEOS_UNUSED_VAR( k );
353+
GEOS_UNUSED_VAR( q );
354+
GEOS_UNUSED_VAR( elasticStrainInc );
355+
GEOS_ERROR( "getElasticStrainInc() of SolidBase was called." );
356+
}
357+
340358
/**
341359
* @brief Perform a viscous (rate-dependent) state update
342360
*

0 commit comments

Comments
 (0)