Skip to content

Commit 3372c8f

Browse files
authored
fix: use mass and energy consistently for single phase solvers (#3485)
1 parent a4b442e commit 3372c8f

19 files changed

+259
-348
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-pr3460-10601-911479c
3+
baseline: integratedTests/baseline_integratedTests-pr3485-10612-832f30e
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 #3485 (2024-03-09)
10+
=====================
11+
Use mass and energy consistently for single phase solvers.
12+
913
PR #3460 (2024-03-08)
1014
=====================
1115
Refactor single phase constitutive containers.

src/coreComponents/constitutive/docs/constitutiveDeveloperGuide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ dependency of porosity and permeability on the primary unknowns.
8888
The base class ``CoupledSolidBase`` implements some basic behaviors
8989
and is used to access a generic ``CoupledSolid`` in a physics solver:
9090

91-
.. literalinclude:: /coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp
91+
.. literalinclude:: /coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp
9292
:language: c++
9393
:start-after: //START_SPHINX_INCLUDE_COUPLEDSOLID
9494
:end-before: //END_SPHINX_INCLUDE_COUPLEDSOLID

src/coreComponents/constitutive/solid/CompressibleSolid.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ class CompressibleSolidUpdates : public CoupledSolidUpdates< NullModel, PORO_TYP
5555
virtual void updateStateFromPressureAndTemperature( localIndex const k,
5656
localIndex const q,
5757
real64 const & pressure,
58-
real64 const & GEOS_UNUSED_PARAM( pressure_k ),
59-
real64 const & GEOS_UNUSED_PARAM( pressure_n ),
60-
real64 const & temperature,
61-
real64 const & GEOS_UNUSED_PARAM( temperature_k ),
62-
real64 const & GEOS_UNUSED_PARAM( temperature_n ) ) const override final
58+
real64 const & temperature ) const override final
6359
{
6460
m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, temperature );
6561
real64 const porosity = m_porosityUpdate.getPorosity( k, q );

src/coreComponents/constitutive/solid/CoupledSolid.hpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ class CoupledSolidUpdates
8585
virtual void updateStateFromPressureAndTemperature( localIndex const k,
8686
localIndex const q,
8787
real64 const & pressure,
88-
real64 const & pressure_k,
89-
real64 const & pressure_n,
90-
real64 const & temperature,
91-
real64 const & temperature_k,
92-
real64 const & temperature_n ) const
88+
real64 const & temperature ) const
89+
{
90+
GEOS_UNUSED_VAR( k, q, pressure, temperature );
91+
}
92+
93+
GEOS_HOST_DEVICE
94+
virtual void updateStateFixedStress( localIndex const k,
95+
localIndex const q,
96+
real64 const & pressure,
97+
real64 const & pressure_k,
98+
real64 const & pressure_n,
99+
real64 const & temperature,
100+
real64 const & temperature_k,
101+
real64 const & temperature_n ) const
93102
{
94103
GEOS_UNUSED_VAR( k, q,
95104
pressure, pressure_k, pressure_n,

src/coreComponents/constitutive/solid/PorousSolid.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity,
5454
{}
5555

5656
GEOS_HOST_DEVICE
57-
virtual void updateStateFromPressureAndTemperature( localIndex const k,
58-
localIndex const q,
59-
real64 const & pressure,
60-
real64 const & pressure_k,
61-
real64 const & pressure_n,
62-
real64 const & temperature,
63-
real64 const & temperature_k,
64-
real64 const & temperature_n ) const override final
57+
virtual void updateStateFixedStress( localIndex const k,
58+
localIndex const q,
59+
real64 const & pressure,
60+
real64 const & pressure_k,
61+
real64 const & pressure_n,
62+
real64 const & temperature,
63+
real64 const & temperature_k,
64+
real64 const & temperature_n ) const override final
6565
{
6666
updateBiotCoefficientAndAssignModuli( k );
6767

src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ class BiotPorosityUpdates : public PorosityBaseUpdates
105105
dPorosity_dPressure = biotSkeletonModulusInverse;
106106
dPorosity_dTemperature = -porosityThermalExpansion;
107107

108-
savePorosity( k, q, porosity, dPorosity_dPressure, dPorosity_dTemperature );
108+
m_newPorosity[k][q] = porosity;
109+
m_dPorosity_dPressure[k][q] = dPorosity_dPressure;
110+
m_dPorosity_dTemperature[k][q] = dPorosity_dTemperature;
109111
}
110112

111113
GEOS_HOST_DEVICE

src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,6 @@ class PorosityBaseUpdates
5959
m_referencePorosity ( referencePorosity )
6060
{}
6161

62-
/**
63-
* @brief Helper to save porosity back to m_newPorosity array
64-
*
65-
* This is mostly defined for improving code readability.
66-
*
67-
* @param[in] k Element index.
68-
* @param[in] q Quadrature point index.
69-
* @param[in] porosity porosity to be saved to m_newPorosity[k][q]
70-
* @param[in] dPorosity_dPressure porosity derivative w.r.t pressure to be saved to m_dPorosity_dPressure[k][q]
71-
* @param[in] dPorosity_dTemperature porosity derivative w.r.t temperature to be saved to m_dPorosity_dTemperature[k][q]
72-
*/
73-
GEOS_HOST_DEVICE
74-
GEOS_FORCE_INLINE
75-
void savePorosity( localIndex const k,
76-
localIndex const q,
77-
real64 const & porosity,
78-
real64 const & dPorosity_dPressure,
79-
real64 const & dPorosity_dTemperature ) const
80-
{
81-
m_newPorosity[k][q] = porosity;
82-
m_dPorosity_dPressure[k][q] = dPorosity_dPressure;
83-
m_dPorosity_dTemperature[k][q] = dPorosity_dTemperature;
84-
}
85-
8662
GEOS_HOST_DEVICE
8763
inline
8864
real64 getPorosity( localIndex const k,

src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,43 @@ template< typename POROUSWRAPPER_TYPE >
4545
void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE porousWrapper,
4646
CellElementSubRegion & subRegion,
4747
arrayView1d< real64 const > const & pressure,
48-
arrayView1d< real64 const > const & pressure_k,
49-
arrayView1d< real64 const > const & pressure_n,
50-
arrayView1d< real64 const > const & temperature,
51-
arrayView1d< real64 const > const & temperature_k,
52-
arrayView1d< real64 const > const & temperature_n )
48+
arrayView1d< real64 const > const & temperature )
5349
{
5450
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k )
5551
{
5652
for( localIndex q = 0; q < porousWrapper.numGauss(); ++q )
5753
{
5854
porousWrapper.updateStateFromPressureAndTemperature( k, q,
5955
pressure[k],
60-
pressure_k[k],
61-
pressure_n[k],
62-
temperature[k],
63-
temperature_k[k],
64-
temperature_n[k] );
56+
temperature[k] );
6557
}
6658
} );
6759
}
6860

61+
template< typename POROUSWRAPPER_TYPE >
62+
void updatePorosityAndPermeabilityFixedStress( POROUSWRAPPER_TYPE porousWrapper,
63+
CellElementSubRegion & subRegion,
64+
arrayView1d< real64 const > const & pressure,
65+
arrayView1d< real64 const > const & pressure_k,
66+
arrayView1d< real64 const > const & pressure_n,
67+
arrayView1d< real64 const > const & temperature,
68+
arrayView1d< real64 const > const & temperature_k,
69+
arrayView1d< real64 const > const & temperature_n )
70+
{
71+
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k )
72+
{
73+
for( localIndex q = 0; q < porousWrapper.numGauss(); ++q )
74+
{
75+
porousWrapper.updateStateFixedStress( k, q,
76+
pressure[k],
77+
pressure_k[k],
78+
pressure_n[k],
79+
temperature[k],
80+
temperature_k[k],
81+
temperature_n[k] );
82+
}
83+
} );
84+
}
6985

7086
template< typename POROUSWRAPPER_TYPE >
7187
void updatePorosityAndPermeabilityFromPressureAndAperture( POROUSWRAPPER_TYPE porousWrapper,
@@ -596,10 +612,7 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe
596612
GEOS_MARK_FUNCTION;
597613

598614
arrayView1d< real64 const > const & pressure = subRegion.getField< fields::flow::pressure >();
599-
arrayView1d< real64 const > const & pressure_n = subRegion.getField< fields::flow::pressure_n >();
600-
601615
arrayView1d< real64 const > const & temperature = subRegion.getField< fields::flow::temperature >();
602-
arrayView1d< real64 const > const & temperature_n = subRegion.getField< fields::flow::temperature_n >();
603616

604617
string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() );
605618
CoupledSolidBase & porousSolid = subRegion.template getConstitutiveModel< CoupledSolidBase >( solidName );
@@ -609,13 +622,15 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe
609622
typename TYPEOFREF( castedPorousSolid ) ::KernelWrapper porousWrapper = castedPorousSolid.createKernelUpdates();
610623
if( m_isFixedStressPoromechanicsUpdate )
611624
{
625+
arrayView1d< real64 const > const & pressure_n = subRegion.getField< fields::flow::pressure_n >();
612626
arrayView1d< real64 const > const & pressure_k = subRegion.getField< fields::flow::pressure_k >();
627+
arrayView1d< real64 const > const & temperature_n = subRegion.getField< fields::flow::temperature_n >();
613628
arrayView1d< real64 const > const & temperature_k = subRegion.getField< fields::flow::temperature_k >();
614-
updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n );
629+
updatePorosityAndPermeabilityFixedStress( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n );
615630
}
616631
else
617632
{
618-
updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_n, pressure_n, temperature, temperature_n, temperature_n );
633+
updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, temperature );
619634
}
620635
} );
621636
}

src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,6 @@ DECLARE_FIELD( temperatureScalingFactor,
241241
NO_WRITE,
242242
"Scaling factors for temperature" );
243243

244-
DECLARE_FIELD( mass,
245-
"mass",
246-
array1d< real64 >,
247-
0,
248-
LEVEL_0,
249-
WRITE_AND_READ,
250-
"Mass" );
251-
252-
DECLARE_FIELD( mass_n,
253-
"mass_n",
254-
array1d< real64 >,
255-
0,
256-
NOPLOT,
257-
WRITE_AND_READ,
258-
"Mass at the previous converged time step" );
259-
260244
DECLARE_FIELD( energy,
261245
"energy",
262246
array1d< real64 >,
@@ -270,17 +254,9 @@ DECLARE_FIELD( energy_n,
270254
array1d< real64 >,
271255
0,
272256
NOPLOT,
273-
WRITE_AND_READ,
257+
NO_WRITE,
274258
"Energy at the previous converged time step" );
275259

276-
DECLARE_FIELD( massCreated,
277-
"massCreated",
278-
array1d< real64 >,
279-
0,
280-
LEVEL_1,
281-
WRITE_AND_READ,
282-
"The amount of remaining mass that was introduced when the SurfaceElement was created." );
283-
284260
DECLARE_FIELD( fractureCreationTime,
285261
"fractureCreationTime",
286262
array1d< real64 >,

0 commit comments

Comments
 (0)