diff --git a/src/coreComponents/constitutive/solid/CompressibleSolid.hpp b/src/coreComponents/constitutive/solid/CompressibleSolid.hpp index 0fc8464a260..d8d286d0d5c 100644 --- a/src/coreComponents/constitutive/solid/CompressibleSolid.hpp +++ b/src/coreComponents/constitutive/solid/CompressibleSolid.hpp @@ -55,11 +55,7 @@ class CompressibleSolidUpdates : public CoupledSolidUpdates< NullModel, PORO_TYP virtual void updateStateFromPressureAndTemperature( localIndex const k, localIndex const q, real64 const & pressure, - real64 const & GEOS_UNUSED_PARAM( pressure_k ), - real64 const & GEOS_UNUSED_PARAM( pressure_n ), - real64 const & temperature, - real64 const & GEOS_UNUSED_PARAM( temperature_k ), - real64 const & GEOS_UNUSED_PARAM( temperature_n ) ) const override final + real64 const & temperature ) const override final { m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, temperature ); real64 const porosity = m_porosityUpdate.getPorosity( k, q ); diff --git a/src/coreComponents/constitutive/solid/CoupledSolid.hpp b/src/coreComponents/constitutive/solid/CoupledSolid.hpp index e255738fd22..3b4de3beaec 100644 --- a/src/coreComponents/constitutive/solid/CoupledSolid.hpp +++ b/src/coreComponents/constitutive/solid/CoupledSolid.hpp @@ -85,11 +85,20 @@ class CoupledSolidUpdates virtual void updateStateFromPressureAndTemperature( localIndex const k, localIndex const q, real64 const & pressure, - real64 const & pressure_k, - real64 const & pressure_n, - real64 const & temperature, - real64 const & temperature_k, - real64 const & temperature_n ) const + real64 const & temperature ) const + { + GEOS_UNUSED_VAR( k, q, pressure, temperature ); + } + + GEOS_HOST_DEVICE + virtual void updateStateFixedStress( localIndex const k, + localIndex const q, + real64 const & pressure, + real64 const & pressure_k, + real64 const & pressure_n, + real64 const & temperature, + real64 const & temperature_k, + real64 const & temperature_n ) const { GEOS_UNUSED_VAR( k, q, pressure, pressure_k, pressure_n, diff --git a/src/coreComponents/constitutive/solid/PorousSolid.hpp b/src/coreComponents/constitutive/solid/PorousSolid.hpp index 92502fd947c..bf504091b4a 100644 --- a/src/coreComponents/constitutive/solid/PorousSolid.hpp +++ b/src/coreComponents/constitutive/solid/PorousSolid.hpp @@ -54,14 +54,14 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, {} GEOS_HOST_DEVICE - virtual void updateStateFromPressureAndTemperature( localIndex const k, - localIndex const q, - real64 const & pressure, - real64 const & pressure_k, - real64 const & pressure_n, - real64 const & temperature, - real64 const & temperature_k, - real64 const & temperature_n ) const override final + virtual void updateStateFixedStress( localIndex const k, + localIndex const q, + real64 const & pressure, + real64 const & pressure_k, + real64 const & pressure_n, + real64 const & temperature, + real64 const & temperature_k, + real64 const & temperature_n ) const override final { updateBiotCoefficientAndAssignModuli( k ); diff --git a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp index 1e7087744f7..13dbf39d837 100644 --- a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp +++ b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp @@ -105,7 +105,9 @@ class BiotPorosityUpdates : public PorosityBaseUpdates dPorosity_dPressure = biotSkeletonModulusInverse; dPorosity_dTemperature = -porosityThermalExpansion; - savePorosity( k, q, porosity, dPorosity_dPressure, dPorosity_dTemperature ); + m_newPorosity[k][q] = porosity; + m_dPorosity_dPressure[k][q] = dPorosity_dPressure; + m_dPorosity_dTemperature[k][q] = dPorosity_dTemperature; } GEOS_HOST_DEVICE diff --git a/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp b/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp index 2f5486e73a0..2e2fc577b91 100644 --- a/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp +++ b/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp @@ -59,30 +59,6 @@ class PorosityBaseUpdates m_referencePorosity ( referencePorosity ) {} - /** - * @brief Helper to save porosity back to m_newPorosity array - * - * This is mostly defined for improving code readability. - * - * @param[in] k Element index. - * @param[in] q Quadrature point index. - * @param[in] porosity porosity to be saved to m_newPorosity[k][q] - * @param[in] dPorosity_dPressure porosity derivative w.r.t pressure to be saved to m_dPorosity_dPressure[k][q] - * @param[in] dPorosity_dTemperature porosity derivative w.r.t temperature to be saved to m_dPorosity_dTemperature[k][q] - */ - GEOS_HOST_DEVICE - GEOS_FORCE_INLINE - void savePorosity( localIndex const k, - localIndex const q, - real64 const & porosity, - real64 const & dPorosity_dPressure, - real64 const & dPorosity_dTemperature ) const - { - m_newPorosity[k][q] = porosity; - m_dPorosity_dPressure[k][q] = dPorosity_dPressure; - m_dPorosity_dTemperature[k][q] = dPorosity_dTemperature; - } - GEOS_HOST_DEVICE inline real64 getPorosity( localIndex const k, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index 3a1096f8fb4..691eeb8b00f 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -45,11 +45,7 @@ template< typename POROUSWRAPPER_TYPE > void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE porousWrapper, CellElementSubRegion & subRegion, arrayView1d< real64 const > const & pressure, - arrayView1d< real64 const > const & pressure_k, - arrayView1d< real64 const > const & pressure_n, - arrayView1d< real64 const > const & temperature, - arrayView1d< real64 const > const & temperature_k, - arrayView1d< real64 const > const & temperature_n ) + arrayView1d< real64 const > const & temperature ) { forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k ) { @@ -57,15 +53,35 @@ void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE { porousWrapper.updateStateFromPressureAndTemperature( k, q, pressure[k], - pressure_k[k], - pressure_n[k], - temperature[k], - temperature_k[k], - temperature_n[k] ); + temperature[k] ); } } ); } +template< typename POROUSWRAPPER_TYPE > +void updatePorosityAndPermeabilityFixedStress( POROUSWRAPPER_TYPE porousWrapper, + CellElementSubRegion & subRegion, + arrayView1d< real64 const > const & pressure, + arrayView1d< real64 const > const & pressure_k, + arrayView1d< real64 const > const & pressure_n, + arrayView1d< real64 const > const & temperature, + arrayView1d< real64 const > const & temperature_k, + arrayView1d< real64 const > const & temperature_n ) +{ + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k ) + { + for( localIndex q = 0; q < porousWrapper.numGauss(); ++q ) + { + porousWrapper.updateStateFixedStress( k, q, + pressure[k], + pressure_k[k], + pressure_n[k], + temperature[k], + temperature_k[k], + temperature_n[k] ); + } + } ); +} template< typename POROUSWRAPPER_TYPE > void updatePorosityAndPermeabilityFromPressureAndAperture( POROUSWRAPPER_TYPE porousWrapper, @@ -585,10 +601,7 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe GEOS_MARK_FUNCTION; arrayView1d< real64 const > const & pressure = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const & pressure_n = subRegion.getField< fields::flow::pressure_n >(); - arrayView1d< real64 const > const & temperature = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 const > const & temperature_n = subRegion.getField< fields::flow::temperature_n >(); string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); CoupledSolidBase & porousSolid = subRegion.template getConstitutiveModel< CoupledSolidBase >( solidName ); @@ -598,13 +611,15 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe typename TYPEOFREF( castedPorousSolid ) ::KernelWrapper porousWrapper = castedPorousSolid.createKernelUpdates(); if( m_isFixedStressPoromechanicsUpdate ) { + arrayView1d< real64 const > const & pressure_n = subRegion.getField< fields::flow::pressure_n >(); arrayView1d< real64 const > const & pressure_k = subRegion.getField< fields::flow::pressure_k >(); + arrayView1d< real64 const > const & temperature_n = subRegion.getField< fields::flow::temperature_n >(); arrayView1d< real64 const > const & temperature_k = subRegion.getField< fields::flow::temperature_k >(); - updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n ); + updatePorosityAndPermeabilityFixedStress( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n ); } else { - updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_n, pressure_n, temperature, temperature_n, temperature_n ); + updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, temperature ); } } ); }