allow for brine and thermal

This commit is contained in:
Tor Harald Sandve
2021-10-07 14:53:20 +02:00
parent f8647c2ced
commit 334482196d
2 changed files with 12 additions and 12 deletions

View File

@@ -193,7 +193,7 @@ public:
break;
case WaterPvtApproach::ThermalWaterPvt:
realWaterPvt_ = new WaterPvtThermal<Scalar>;
realWaterPvt_ = new WaterPvtThermal<Scalar, enableBrine>;
break;
case WaterPvtApproach::NoWaterPvt:
@@ -241,17 +241,17 @@ public:
}
template <WaterPvtApproach approachV>
typename std::enable_if<approachV == WaterPvtApproach::ThermalWaterPvt, WaterPvtThermal<Scalar> >::type& getRealPvt()
typename std::enable_if<approachV == WaterPvtApproach::ThermalWaterPvt, WaterPvtThermal<Scalar, enableBrine> >::type& getRealPvt()
{
assert(approach() == approachV);
return *static_cast<WaterPvtThermal<Scalar>* >(realWaterPvt_);
return *static_cast<WaterPvtThermal<Scalar, enableBrine>* >(realWaterPvt_);
}
template <WaterPvtApproach approachV>
typename std::enable_if<approachV == WaterPvtApproach::ThermalWaterPvt, const WaterPvtThermal<Scalar> >::type& getRealPvt() const
typename std::enable_if<approachV == WaterPvtApproach::ThermalWaterPvt, const WaterPvtThermal<Scalar, enableBrine> >::type& getRealPvt() const
{
assert(approach() == approachV);
return *static_cast<WaterPvtThermal<Scalar>* >(realWaterPvt_);
return *static_cast<WaterPvtThermal<Scalar, enableBrine>* >(realWaterPvt_);
}
const void* realWaterPvt() const { return realWaterPvt_; }
@@ -269,8 +269,8 @@ public:
return *static_cast<const ConstantCompressibilityBrinePvt<Scalar>*>(realWaterPvt_) ==
*static_cast<const ConstantCompressibilityBrinePvt<Scalar>*>(data.realWaterPvt_);
case WaterPvtApproach::ThermalWaterPvt:
return *static_cast<const WaterPvtThermal<Scalar>*>(realWaterPvt_) ==
*static_cast<const WaterPvtThermal<Scalar>*>(data.realWaterPvt_);
return *static_cast<const WaterPvtThermal<Scalar, enableBrine>*>(realWaterPvt_) ==
*static_cast<const WaterPvtThermal<Scalar, enableBrine>*>(data.realWaterPvt_);
default:
return true;
}
@@ -287,7 +287,7 @@ public:
realWaterPvt_ = new ConstantCompressibilityBrinePvt<Scalar>(*static_cast<const ConstantCompressibilityBrinePvt<Scalar>*>(data.realWaterPvt_));
break;
case WaterPvtApproach::ThermalWaterPvt:
realWaterPvt_ = new WaterPvtThermal<Scalar>(*static_cast<const WaterPvtThermal<Scalar>*>(data.realWaterPvt_));
realWaterPvt_ = new WaterPvtThermal<Scalar, enableBrine>(*static_cast<const WaterPvtThermal<Scalar, enableBrine>*>(data.realWaterPvt_));
break;
default:
break;

View File

@@ -50,12 +50,12 @@ class WaterPvtMultiplexer;
* Note that this _only_ implements the temperature part, i.e., it requires the
* isothermal properties as input.
*/
template <class Scalar>
template <class Scalar, bool enableBrine>
class WaterPvtThermal
{
public:
typedef Tabulated1DFunction<Scalar> TabulatedOneDFunction;
typedef WaterPvtMultiplexer<Scalar, /*enableThermal=*/false, false> IsothermalPvt;
typedef WaterPvtMultiplexer<Scalar, /*enableThermal=*/false, enableBrine> IsothermalPvt;
WaterPvtThermal()
{
@@ -344,7 +344,7 @@ public:
bool enableInternalEnergy() const
{ return enableInternalEnergy_; }
bool operator==(const WaterPvtThermal<Scalar>& data) const
bool operator==(const WaterPvtThermal<Scalar, enableBrine>& data) const
{
if (isothermalPvt_ && !data.isothermalPvt_)
return false;
@@ -369,7 +369,7 @@ public:
this->enableInternalEnergy() == data.enableInternalEnergy();
}
WaterPvtThermal<Scalar>& operator=(const WaterPvtThermal<Scalar>& data)
WaterPvtThermal<Scalar, enableBrine>& operator=(const WaterPvtThermal<Scalar, enableBrine>& data)
{
if (data.isothermalPvt_)
isothermalPvt_ = new IsothermalPvt(*data.isothermalPvt_);