Skip to content

Commit

Permalink
Add support for dissolved gas in water in the blackoil fluidsystem
Browse files Browse the repository at this point in the history
If DISGASW is in the input deck gas in allowed to dissolved into water
Currently only works in combination with CO2STORE
For general support assosiated input tables needs to be provided
  • Loading branch information
Tor Harald Sandve committed Dec 16, 2022
1 parent 86b3c79 commit 9d583b2
Show file tree
Hide file tree
Showing 12 changed files with 729 additions and 77 deletions.
36 changes: 35 additions & 1 deletion opm/material/fluidstates/BlackOilFluidState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ template <class ScalarT,
bool enableEvaporation = false,
bool enableBrine = false,
bool enableSaltPrecipitation = false,
bool enableDissolutionInWater = false,
unsigned numStoragePhases = FluidSystem::numPhases>
class BlackOilFluidState
{
Expand Down Expand Up @@ -162,6 +163,10 @@ class BlackOilFluidState
Valgrind::CheckDefined(*Rvw_);
}

if constexpr (enableDissolutionInWater) {
Valgrind::CheckDefined(*Rsw_);
}

if constexpr (enableBrine) {
Valgrind::CheckDefined(*saltConcentration_);
}
Expand Down Expand Up @@ -195,6 +200,9 @@ class BlackOilFluidState
if constexpr (enableEvaporation) {
setRvw(BlackOil::getRvw_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
}
if constexpr (enableDissolutionInWater) {
setRsw(BlackOil::getRsw_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
}
if constexpr (enableBrine){
setSaltConcentration(BlackOil::getSaltConcentration_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
}
Expand Down Expand Up @@ -311,6 +319,14 @@ class BlackOilFluidState
void setRvw(const Scalar& newRvw)
{ *Rvw_ = newRvw; }

/*!
* \brief Set the gas dissolution factor [m^3/m^3] of the water phase..
*
* This quantity is very specific to the black-oil model.
*/
void setRsw(const Scalar& newRsw)
{ *Rsw_ = newRsw; }

/*!
* \brief Set the salt concentration.
*/
Expand Down Expand Up @@ -372,7 +388,7 @@ class BlackOilFluidState
{ return invB_[canonicalToStoragePhaseIndex_(phaseIdx)]; }

/*!
* \brief Return the gas dissulition factor of oil [m^3/m^3].
* \brief Return the gas dissolution factor of oil [m^3/m^3].
*
* I.e., the amount of gas which is present in the oil phase in terms of cubic meters
* of gas at surface conditions per cubic meter of liquid oil at surface
Expand Down Expand Up @@ -422,6 +438,23 @@ class BlackOilFluidState
}
}

/*!
* \brief Return the gas dissolution factor of water [m^3/m^3].
*
* I.e., the amount of gas which is present in the water phase in terms of cubic meters
* of gas at surface conditions per cubic meter of water at surface
* conditions. This method is specific to the black-oil model.
*/
const Scalar& Rsw() const
{
if constexpr (enableDissolutionInWater) {
return *Rsw_;
} else {
static Scalar null = 0.0;
return null;
}
}

/*!
* \brief Return the concentration of salt in water
*/
Expand Down Expand Up @@ -657,6 +690,7 @@ class BlackOilFluidState
ConditionalStorage<enableDissolution,Scalar> Rs_;
ConditionalStorage<enableDissolution, Scalar> Rv_;
ConditionalStorage<enableEvaporation,Scalar> Rvw_;
ConditionalStorage<enableDissolutionInWater,Scalar> Rsw_;
ConditionalStorage<enableBrine, Scalar> saltConcentration_;
ConditionalStorage<enableSaltPrecipitation, Scalar> saltSaturation_;
unsigned short pvtRegionIdx_;
Expand Down
154 changes: 136 additions & 18 deletions opm/material/fluidsystems/BlackOilFluidSystem.hpp

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ class BrineCo2Pvt
unsigned numRegions() const
{ return brineReferenceDensity_.size(); }

/*!
* \brief Returns the specific enthalpy [J/kg] of gas given a set of parameters.
*/
template <class Evaluation>
Evaluation internalEnergy(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& Rs,
const Evaluation& /*saltConcentration*/) const
{
return internalEnergy(regionIdx, temperature, pressure, Rs);
}
/*!
* \brief Returns the specific enthalpy [J/kg] of gas given a set of parameters.
*/
Expand Down Expand Up @@ -184,6 +196,32 @@ class BrineCo2Pvt
return saturatedViscosity(regionIdx, temperature, pressure);
}

/*!
* \brief Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
*/
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*saltConcentration*/) const
{
return saturatedViscosity(regionIdx, temperature, pressure);
}

/*!
* \brief Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
*/
template <class Evaluation>
Evaluation viscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*Rsw*/,
const Evaluation& /*saltConcentration*/) const
{
//TODO: The viscosity does not yet depend on the composition
return saturatedViscosity(regionIdx, temperature, pressure);
}

/*!
* \brief Returns the dynamic viscosity [Pa s] of oil saturated gas at given pressure.
*/
Expand All @@ -195,6 +233,30 @@ class BrineCo2Pvt
return Brine::liquidViscosity(temperature, pressure);
}


/*!
* \brief Returns the formation volume factor [-] of the fluid phase.
*/
template <class Evaluation>
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*saltconcentration*/) const
{
return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure);
}
/*!
* \brief Returns the formation volume factor [-] of the fluid phase.
*/
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& Rs,
const Evaluation& /*saltConcentration*/) const
{
return inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rs);
}
/*!
* \brief Returns the formation volume factor [-] of the fluid phase.
*/
Expand Down Expand Up @@ -233,6 +295,21 @@ class BrineCo2Pvt
throw std::runtime_error("Requested the saturation pressure for the brine-co2 pvt module. Not yet implemented.");
}

/*!
* \brief Returns the saturation pressure of the brine phase [Pa]
* depending on its mass fraction of the gas component
*
* \param Rs
*/
template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*Rs*/,
const Evaluation& /*saltConcentration*/) const
{
throw std::runtime_error("Requested the saturation pressure for the brine-co2 pvt module. Not yet implemented.");
}

/*!
* \brief Returns the gas dissoluiton factor \f$R_s\f$ [m^3/m^3] of the liquid phase.
*/
Expand All @@ -247,6 +324,18 @@ class BrineCo2Pvt
return rsSat_(regionIdx, temperature, pressure);
}

/*!
* \brief Returns the gas dissoluiton factor \f$R_s\f$ [m^3/m^3] of the liquid phase.
*/
template <class Evaluation>
Evaluation saturatedGasDissolutionFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*saltConcentration*/) const
{
return rsSat_(regionIdx, temperature, pressure);
}

/*!
* \brief Returns thegas dissoluiton factor \f$R_s\f$ [m^3/m^3] of the liquid phase.
*/
Expand All @@ -261,6 +350,9 @@ class BrineCo2Pvt
const Scalar oilReferenceDensity(unsigned regionIdx) const
{ return brineReferenceDensity_[regionIdx]; }

const Scalar waterReferenceDensity(unsigned regionIdx) const
{ return brineReferenceDensity_[regionIdx]; }

const Scalar gasReferenceDensity(unsigned regionIdx) const
{ return co2ReferenceDensity_[regionIdx]; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class ConstantCompressibilityBrinePvt
*/
template <class Evaluation>
Evaluation internalEnergy(unsigned,
const Evaluation&,
const Evaluation&,
const Evaluation&,
const Evaluation&) const
Expand All @@ -169,6 +170,7 @@ class ConstantCompressibilityBrinePvt
Evaluation viscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& Rsw,
const Evaluation& saltconcentration) const
{
// cf. ECLiPSE 2013.2 technical description, p. 114
Expand All @@ -179,18 +181,53 @@ class ConstantCompressibilityBrinePvt
const Evaluation Y = (C-Cv)* (pressure - pRef);
Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);

const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);

return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
}


/*!
* \brief Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
*/
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& saltconcentration) const
{
Scalar pRef = referencePressure_[regionIdx];
const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
const Evaluation Y = (C-Cv)* (pressure - pRef);
Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);

const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);

return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
}

/*!
* \brief Returns the formation volume factor [-] of the fluid phase.
*/
template <class Evaluation>
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& saltconcentration) const
{
Evaluation Rsw = 0.0;
return inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
}
/*!
* \brief Returns the formation volume factor [-] of the fluid phase.
*/
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure,
const Evaluation& /*Rsw*/,
const Evaluation& saltconcentration) const
{
Scalar pRef = referencePressure_[regionIdx];
Expand All @@ -203,6 +240,37 @@ class ConstantCompressibilityBrinePvt

}

/*!
* \brief Returns the saturation pressure of the water phase [Pa]
* depending on its mass fraction of the gas component
*
* \param Rs The surface volume of gas component dissolved in what will yield one cubic meter of oil at the surface [-]
*/
template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*Rs*/,
const Evaluation& /*saltconcentration*/) const
{ return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }

/*!
* \brief Returns the gas dissolution factor \f$R_s\f$ [m^3/m^3] of the water phase.
*/
template <class Evaluation>
Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*saltconcentration*/) const
{ return 0.0; /* this is dead water! */ }

template <class Evaluation>
Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
unsigned /*compIdx*/) const
{
throw std::runtime_error("Not implemented: The PVT model does not provide a diffusionCoefficient()");
}

const Scalar waterReferenceDensity(unsigned regionIdx) const
{ return waterReferenceDensity_[regionIdx]; }

Expand Down
Loading

0 comments on commit 9d583b2

Please sign in to comment.