Skip to content

Commit 6a90f8c

Browse files
ryar9534Ryan Michael AronsonRyan Michael Aronsonjhuang2601
authored
feat: averaging of stress components using quadrature (#3279)
* initial attempt * fixed compilation error, stresses match on simple problem * renaming data layout for stress/strain and unifying a bit * rename StrainHelper.hpp * start collapsing stress and strain averaging into one kernel * make the old stress data NOPLOT * update SolidMechanicsFields * add missing arguments * change plasticStrain to averagePlasticStrain * uncrustify * make newStress NOPLOT * update Kirsch problem to output and verify avg stress * update python script accordingly * update rst file for the definition of averageStress * update .integrated_tests.yaml * update BASELINE_NOTES.md --------- Co-authored-by: Ryan Michael Aronson <[email protected]> Co-authored-by: Ryan Michael Aronson <[email protected]> Co-authored-by: Jian HUANG <[email protected]> Co-authored-by: Jian Huang <[email protected]>
1 parent efe09c2 commit 6a90f8c

File tree

16 files changed

+105
-84
lines changed

16 files changed

+105
-84
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-pr3851-14171-9d950d6
3+
baseline: integratedTests/baseline_integratedTests-pr3279-14414-db55426
44

55
allow_fail:
66
all: ''

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 #3279 (2025-10-24) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr3279-14414-db55426.tar.gz>
10+
=====================
11+
Output cell-wise average of each stress and strain component.
12+
913
PR #3851 (2025-10-13) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr3851-14171-9d950d6.tar.gz>
1014
=====================
1115
Enable `FullyImplicit` for `SinglePhaseReservoirPoromechanicsConformingFractures`.

inputFiles/solidMechanics/KirschProblem_base.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<PackCollection
9797
name="stressCollection"
9898
objectPath="ElementRegions/Omega/cb1"
99-
fieldName="rock_stress"/>
99+
fieldName="averageStress"/>
100100

101101
<PackCollection
102102
name="displacementCollection"
@@ -112,11 +112,6 @@
112112
plotFileRoot="plot"
113113
/>
114114

115-
<Silo
116-
name="siloOutput"
117-
plotLevel="3"
118-
/>
119-
120115
<TimeHistory
121116
name="stressOutput"
122117
sources="{/Tasks/stressCollection}"

inputFiles/solidMechanics/KirschProblem_benchmark.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
target="/Outputs/vtkOutput"
4141
/>
4242

43-
<PeriodicEvent
44-
name="outputs1"
45-
target="/Outputs/siloOutput"
46-
/>
47-
4843
<PeriodicEvent
4944
name="stressCollection"
5045
timeFrequency="1"

inputFiles/solidMechanics/KirschProblem_smoke.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
targetExactTimestep="1"
4040
target="/Outputs/vtkOutput"
4141
/>
42-
43-
<PeriodicEvent
44-
name="outputs1"
45-
target="/Outputs/siloOutput"
46-
/>
4742

4843
<PeriodicEvent
4944
name="restarts"

src/coreComponents/common/DataLayouts.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,24 @@ namespace cells
155155
/// Cell node map permutation when using cuda.
156156
using NODE_MAP_PERMUTATION = RAJA::PERM_JI;
157157

158-
/// Cell strain permutation when using cuda
159-
using STRAIN_PERM = RAJA::PERM_JI;
158+
/// Cell tensor (i.e. average stress and strain) permutation when using cuda
159+
using RANK2_TENSOR_PERM = RAJA::PERM_JI;
160160

161161
#else
162162

163163
/// Cell node map permutation when not using cuda.
164164
using NODE_MAP_PERMUTATION = RAJA::PERM_IJ;
165165

166-
/// Cell strain permutation when not using cuda
167-
using STRAIN_PERM = RAJA::PERM_IJ;
166+
/// Cell tensor (i.e. average stress and strain) permutation when not using cuda
167+
using RANK2_TENSOR_PERM = RAJA::PERM_IJ;
168168

169169
#endif
170170

171171
/// Cell node map unit stride dimension.
172172
static constexpr int NODE_MAP_USD = LvArray::typeManipulation::getStrideOneDimension( NODE_MAP_PERMUTATION {} );
173173

174174
/// Cell strain unit stride dimension
175-
static constexpr int STRAIN_USD = LvArray::typeManipulation::getStrideOneDimension( STRAIN_PERM {} );
175+
static constexpr int RANK2_TENSOR_USD = LvArray::typeManipulation::getStrideOneDimension( RANK2_TENSOR_PERM {} );
176176

177177
} // namespace cells
178178

src/coreComponents/constitutive/solid/SolidFields.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ DECLARE_FIELD( stress,
3838
"stress",
3939
array3dLayoutStress,
4040
0,
41-
LEVEL_0,
41+
NOPLOT,
4242
WRITE_AND_READ,
4343
"Current material stress" );
4444

src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsFields.hpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ using array2dLayoutIncrDisplacement = array2d< real64, nodes::INCR_DISPLACEMENT_
4242
using arrayView2dLayoutIncrDisplacement = arrayView2d< real64, nodes::INCR_DISPLACEMENT_USD >;
4343
using arrayViewConst2dLayoutIncrDisplacement = arrayView2d< real64 const, nodes::INCR_DISPLACEMENT_USD >;
4444

45-
using array2dLayoutStrain = array2d< real64, cells::STRAIN_PERM >;
46-
using arrayView2dLayoutStrain = arrayView2d< real64, cells::STRAIN_USD >;
47-
using arrayViewConst2dLayoutStrain = arrayView2d< real64 const, cells::STRAIN_USD >;
45+
using array2dLayoutStrain = array2d< real64, cells::RANK2_TENSOR_PERM >;
46+
using arrayView2dLayoutStrain = arrayView2d< real64, cells::RANK2_TENSOR_USD >;
47+
using arrayViewConst2dLayoutStrain = arrayView2d< real64 const, cells::RANK2_TENSOR_USD >;
48+
49+
using array2dLayoutAvgStress = array2d< real64, cells::RANK2_TENSOR_PERM >;
50+
using arrayView2dLayoutAvgStress = arrayView2d< real64, cells::RANK2_TENSOR_USD >;
51+
using arrayViewConst2dLayoutAvgStress = arrayView2d< real64 const, cells::RANK2_TENSOR_USD >;
4852

4953
using array2dLayoutVelocity = array2d< real64, nodes::VELOCITY_PERM >;
5054
using arrayView2dLayoutVelocity = arrayView2d< real64, nodes::VELOCITY_USD >;
@@ -71,16 +75,24 @@ DECLARE_FIELD( incrementalDisplacement,
7175
WRITE_AND_READ,
7276
"Incremental displacements for the current time step on the nodes" );
7377

74-
DECLARE_FIELD( strain,
75-
"strain",
78+
DECLARE_FIELD( averageStrain,
79+
"averageStrain",
7680
array2dLayoutStrain,
7781
0,
7882
LEVEL_0,
7983
WRITE_AND_READ,
80-
"Average strain in cell" );
84+
"Quadrature averaged strain components in cell" );
85+
86+
DECLARE_FIELD( averageStress,
87+
"averageStress",
88+
array2dLayoutAvgStress,
89+
0,
90+
LEVEL_0,
91+
WRITE_AND_READ,
92+
"Quadrature averaged stress components in cell" );
8193

82-
DECLARE_FIELD( plasticStrain,
83-
"plasticStrain",
94+
DECLARE_FIELD( averagePlasticStrain,
95+
"averagePlasticStrain",
8496
array2dLayoutStrain,
8597
0,
8698
LEVEL_0,

src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ void SolidMechanicsLagrangianFEM::registerDataOnMesh( Group & meshBodies )
168168
[&]( localIndex const,
169169
ElementSubRegionBase & subRegion )
170170
{
171-
subRegion.registerField< solidMechanics::strain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 );
172-
subRegion.registerField< solidMechanics::plasticStrain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 );
171+
subRegion.registerField< solidMechanics::averageStrain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 );
172+
subRegion.registerField< solidMechanics::averagePlasticStrain >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 );
173+
subRegion.registerField< solidMechanics::averageStress >( getName() ).setDimLabels( 1, voightLabels ).reference().resizeDimension< 1 >( 6 );
173174
} );
174175

175176
NodeManager & nodes = meshLevel.getNodeManager();
@@ -924,29 +925,32 @@ void SolidMechanicsLagrangianFEM::implicitStepComplete( real64 const & GEOS_UNUS
924925
string const & solidMaterialName = subRegion.template getReference< string >( viewKeyStruct::solidMaterialNamesString() );
925926
SolidBase & constitutiveRelation = getConstitutiveModel< SolidBase >( subRegion, solidMaterialName );
926927

928+
arrayView3d< real64 const, solid::STRESS_USD > const stress = constitutiveRelation.getStress();
927929

928-
solidMechanics::arrayView2dLayoutStrain strain = subRegion.getField< solidMechanics::strain >();
929-
solidMechanics::arrayView2dLayoutStrain plasticStrain = subRegion.getField< solidMechanics::plasticStrain >();
930+
solidMechanics::arrayView2dLayoutStrain avgStrain = subRegion.getField< solidMechanics::averageStrain >();
931+
solidMechanics::arrayView2dLayoutStrain avgPlasticStrain = subRegion.getField< solidMechanics::averagePlasticStrain >();
932+
solidMechanics::arrayView2dLayoutAvgStress avgStress = subRegion.getField< solidMechanics::averageStress >();
930933

931934
constitutive::ConstitutivePassThru< SolidBase >::execute( constitutiveRelation, [&] ( auto & solidModel )
932935
{
933-
934936
using SOLID_TYPE = TYPEOFREF( solidModel );
935937

936938
finiteElement::FiniteElementBase & subRegionFE = subRegion.template getReference< finiteElement::FiniteElementBase >( this->getDiscretizationName());
937939
finiteElement::FiniteElementDispatchHandler< BASE_FE_TYPES >::dispatch3D( subRegionFE, [&] ( auto const finiteElement )
938940
{
939941
using FE_TYPE = decltype( finiteElement );
940-
AverageStrainOverQuadraturePointsKernelFactory::createAndLaunch< FE_TYPE, SOLID_TYPE, parallelDevicePolicy<> >( nodeManager,
941-
mesh.getEdgeManager(),
942-
mesh.getFaceManager(),
943-
subRegion,
944-
finiteElement,
945-
solidModel,
946-
disp,
947-
uhat,
948-
strain,
949-
plasticStrain );
942+
AverageStressStrainOverQuadraturePointsKernelFactory::createAndLaunch< FE_TYPE, SOLID_TYPE, parallelDevicePolicy<> >( nodeManager,
943+
mesh.getEdgeManager(),
944+
mesh.getFaceManager(),
945+
subRegion,
946+
finiteElement,
947+
solidModel,
948+
disp,
949+
uhat,
950+
avgStrain,
951+
avgPlasticStrain,
952+
stress,
953+
avgStress );
950954
} );
951955

952956

src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "common/format/EnumStrings.hpp"
2424
#include "common/TimingMacros.hpp"
2525
#include "kernels/SolidMechanicsLagrangianFEMKernels.hpp"
26-
#include "kernels/StrainHelper.hpp"
26+
#include "kernels/StressStrainAverageKernels.hpp"
2727
#include "mesh/mpiCommunications/CommunicationTools.hpp"
2828
#include "mesh/mpiCommunications/MPI_iCommData.hpp"
2929
#include "physicsSolvers/PhysicsSolverBase.hpp"

0 commit comments

Comments
 (0)