From 4970d9e657c9930c9f158af31719c900984ba040 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 19 Mar 2026 13:53:40 +0100 Subject: [PATCH] adding the member volume_ratio_ for BlackOilFluidState --- .../fluidstates/BlackOilFluidState.hpp | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/opm/material/fluidstates/BlackOilFluidState.hpp b/opm/material/fluidstates/BlackOilFluidState.hpp index 5f14f14bc30..085733add26 100644 --- a/opm/material/fluidstates/BlackOilFluidState.hpp +++ b/opm/material/fluidstates/BlackOilFluidState.hpp @@ -459,6 +459,16 @@ friend class BlackOilFluidState; OPM_HOST_DEVICE void setRsSolw(const ValueType& newRsSolw) { *rsSolw_ = newRsSolw; } + /*! + * \brief Set the reservoir volume per unit surface volume [-]. + * + * This quantity is used in wellbore accumulation term calculation. + * It is only meaningful in a wellbore context and is not set for + * regular reservoir fluid states for now + */ + OPM_HOST_DEVICE void setVolumeRatio(const ValueType& value) + { volume_ratio_ = value; } + /*! * \brief Return the pressure of a fluid phase [Pa] */ @@ -636,6 +646,27 @@ friend class BlackOilFluidState; } } + /*! + * \brief Return whether the volume ratio has been set. + * + * This is only true for wellbore fluid states; regular reservoir + * fluid states do not carry this quantity for now. + */ + OPM_HOST_DEVICE bool hasVolumeRatio() const + { return volume_ratio_.has_value(); } + + /*! + * \brief Return the reservoir volume per unit surface volume [-]. + * + * This quantity is used in wellbore accumulation term calculation. + * Only valid if hasVolumeRatio() returns true. + */ + OPM_HOST_DEVICE ValueType volumeRatio() const + { + assert(volume_ratio_.has_value()); + return *volume_ratio_; + } + /*! * \brief Return the PVT region where the current fluid state is assumed to be part of. * @@ -867,6 +898,9 @@ friend class BlackOilFluidState; ConditionalStorage temperature_{}; ConditionalStorage > enthalpy_{}; ValueType totalSaturation_{}; + // reservoir volume per unit surface volume + // currently, it is used in wellbore accumulation term calculation + std::optional volume_ratio_{}; std::array pressure_{}; std::array saturation_{}; std::array invB_{}; @@ -882,6 +916,8 @@ friend class BlackOilFluidState; ConditionalStorage solventInvB_{}; ConditionalStorage rsSolw_{}; + + unsigned short pvtRegionIdx_{}; // If we have a non-static fluid system, we need to store a pointer