mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-26 03:00:17 -06:00
add parameter to set maximum water saturation. Default is 1.0
This commit is contained in:
parent
72e1bfb749
commit
60c65ec661
@ -55,6 +55,8 @@ template<class TypeTag, class MyTypeTag>
|
||||
struct TemperatureMax { using type = UndefinedProperty; };
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct TemperatureMin { using type = UndefinedProperty; };
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct MaximumWaterSaturation { using type = UndefinedProperty; };
|
||||
template<class TypeTag>
|
||||
struct DpMaxRel<TypeTag, TTag::NewtonMethod>
|
||||
{
|
||||
@ -93,6 +95,12 @@ struct TemperatureMin<TypeTag, TTag::NewtonMethod>
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 0.0; //Kelvin
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct MaximumWaterSaturation<TypeTag, TTag::NewtonMethod>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 1.0;
|
||||
};
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm {
|
||||
@ -130,7 +138,7 @@ public:
|
||||
maxTempChange_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxTemperatureChange);
|
||||
tempMax_ = EWOMS_GET_PARAM(TypeTag, Scalar, TemperatureMax);
|
||||
tempMin_ = EWOMS_GET_PARAM(TypeTag, Scalar, TemperatureMin);
|
||||
|
||||
waterSaturationMax_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaximumWaterSaturation);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -159,6 +167,7 @@ public:
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxTemperatureChange, "Maximum absolute change of temperature in a single iteration");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, TemperatureMax, "Maximum absolute temperature");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, TemperatureMin, "Minimum absolute temperature");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaximumWaterSaturation, "Maximum water saturation");
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -449,9 +458,9 @@ protected:
|
||||
// use a threshold value after a switch to make it harder to switch back
|
||||
// immediately.
|
||||
if (wasSwitched_[globalDofIdx])
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx, priVarOscilationThreshold_);
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx, waterSaturationMax_, priVarOscilationThreshold_);
|
||||
else
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx);
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx, waterSaturationMax_);
|
||||
|
||||
if (wasSwitched_[globalDofIdx])
|
||||
++ numPriVarsSwitched_;
|
||||
@ -466,6 +475,7 @@ private:
|
||||
int numPriVarsSwitched_;
|
||||
|
||||
Scalar priVarOscilationThreshold_;
|
||||
Scalar waterSaturationMax_;
|
||||
Scalar dpMaxRel_;
|
||||
Scalar dsMax_;
|
||||
bool projectSaturations_;
|
||||
|
@ -493,7 +493,7 @@ public:
|
||||
*
|
||||
* \return true Iff the interpretation of one of the switching variables was changed
|
||||
*/
|
||||
bool adaptPrimaryVariables(const Problem& problem, unsigned globalDofIdx, Scalar eps = 0.0)
|
||||
bool adaptPrimaryVariables(const Problem& problem, unsigned globalDofIdx, Scalar swMaximum, Scalar eps = 0.0)
|
||||
{
|
||||
static const Scalar thresholdWaterFilledCell = 1.0 - eps;
|
||||
|
||||
@ -553,9 +553,9 @@ public:
|
||||
// as sw >= 1.0 -> gas <= 0 (i.e. gas phase disappears)
|
||||
if (sw >= thresholdWaterFilledCell && !FluidSystem::enableDissolvedGasInWater()) {
|
||||
|
||||
// make sure water saturations does not exceed 1.0
|
||||
// make sure water saturations does not exceed sw_maximum. Default to 1.0
|
||||
if constexpr (waterEnabled) {
|
||||
(*this)[Indices::waterSwitchIdx] = 1.0;
|
||||
(*this)[Indices::waterSwitchIdx] = std::min(swMaximum, sw);
|
||||
assert(primaryVarsMeaningWater() == WaterMeaning::Sw);
|
||||
}
|
||||
// the hydrocarbon gas saturation is set to 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user