Skip to content

Commit

Permalink
separate fixed stress
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Tomin authored and Pavel Tomin committed Dec 11, 2024
1 parent 7d30086 commit 6e49781
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 58 deletions.
6 changes: 1 addition & 5 deletions src/coreComponents/constitutive/solid/CompressibleSolid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
19 changes: 14 additions & 5 deletions src/coreComponents/constitutive/solid/CoupledSolid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions src/coreComponents/constitutive/solid/PorousSolid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
45 changes: 30 additions & 15 deletions src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,43 @@ 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 )
{
for( localIndex q = 0; q < porousWrapper.numGauss(); ++q )
{
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,
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
}
} );
}
Expand Down

0 comments on commit 6e49781

Please sign in to comment.