MixingRateControls: remove unnecessary Scalar template parameter

use the Scalar type from the FluidSystem
This commit is contained in:
Arne Morten Kvarving 2024-02-22 15:17:09 +01:00
parent 2c35cb9659
commit 5972b3c88d
4 changed files with 47 additions and 40 deletions

View File

@ -371,7 +371,7 @@ protected:
std::vector<Scalar> solventRsw_; std::vector<Scalar> solventRsw_;
MICPSolutionContainer<Scalar> micp_; MICPSolutionContainer<Scalar> micp_;
MixingRateControls<FluidSystem, Scalar> mixControls_; MixingRateControls<FluidSystem> mixControls_;
// time stepping parameters // time stepping parameters
bool enableTuning_; bool enableTuning_;

View File

@ -107,7 +107,7 @@ serializationTestObject(const EclipseState& eclState,
result.solventRsw_ = {18.0}; result.solventRsw_ = {18.0};
result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject(); result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject();
result.micp_ = MICPSolutionContainer<Scalar>::serializationTestObject(); result.micp_ = MICPSolutionContainer<Scalar>::serializationTestObject();
result.mixControls_ = MixingRateControls<FluidSystem,Scalar>::serializationTestObject(schedule); result.mixControls_ = MixingRateControls<FluidSystem>::serializationTestObject(schedule);
return result; return result;
} }

View File

@ -36,26 +36,26 @@
namespace Opm { namespace Opm {
template<class FluidSystem, class Scalar> template<class FluidSystem>
MixingRateControls<FluidSystem,Scalar>:: MixingRateControls<FluidSystem>::
MixingRateControls(const Schedule& schedule) MixingRateControls(const Schedule& schedule)
: schedule_(schedule) : schedule_(schedule)
{} {}
template<class FluidSystem, class Scalar> template<class FluidSystem>
MixingRateControls<FluidSystem,Scalar>:: MixingRateControls<FluidSystem>::
MixingRateControls(const MixingRateControls& rhs) MixingRateControls(const MixingRateControls& rhs)
: schedule_(rhs.schedule_) : schedule_(rhs.schedule_)
{ {
*this = rhs; *this = rhs;
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
MixingRateControls<FluidSystem,Scalar> MixingRateControls<FluidSystem>
MixingRateControls<FluidSystem,Scalar>:: MixingRateControls<FluidSystem>::
serializationTestObject(const Schedule& schedule) serializationTestObject(const Schedule& schedule)
{ {
MixingRateControls<FluidSystem,Scalar> result(schedule); MixingRateControls<FluidSystem> result(schedule);
result.lastRv_ = {21.0}; result.lastRv_ = {21.0};
result.maxDRv_ = {22.0, 23.0}; result.maxDRv_ = {22.0, 23.0};
result.convectiveDrs_ = {24.0, 25.0, 26.0}; result.convectiveDrs_ = {24.0, 25.0, 26.0};
@ -66,8 +66,8 @@ serializationTestObject(const Schedule& schedule)
return result; return result;
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
bool MixingRateControls<FluidSystem,Scalar>:: bool MixingRateControls<FluidSystem>::
operator==(const MixingRateControls& rhs) const operator==(const MixingRateControls& rhs) const
{ {
return this->lastRv_ == rhs.lastRv_ && return this->lastRv_ == rhs.lastRv_ &&
@ -78,9 +78,9 @@ operator==(const MixingRateControls& rhs) const
this->dRsDtOnlyFreeGas_ == rhs.dRsDtOnlyFreeGas_; this->dRsDtOnlyFreeGas_ == rhs.dRsDtOnlyFreeGas_;
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
MixingRateControls<FluidSystem,Scalar>& MixingRateControls<FluidSystem>&
MixingRateControls<FluidSystem,Scalar>:: MixingRateControls<FluidSystem>::
operator=(const MixingRateControls& rhs) operator=(const MixingRateControls& rhs)
{ {
this->lastRv_ = rhs.lastRv_; this->lastRv_ = rhs.lastRv_;
@ -93,8 +93,8 @@ operator=(const MixingRateControls& rhs)
return *this; return *this;
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
void MixingRateControls<FluidSystem,Scalar>:: void MixingRateControls<FluidSystem>::
init(std::size_t numDof, int episodeIdx, const unsigned ntpvt) init(std::size_t numDof, int episodeIdx, const unsigned ntpvt)
{ {
// deal with DRSDT // deal with DRSDT
@ -116,8 +116,8 @@ init(std::size_t numDof, int episodeIdx, const unsigned ntpvt)
} }
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
bool MixingRateControls<FluidSystem,Scalar>:: bool MixingRateControls<FluidSystem>::
drsdtActive(int episodeIdx) const drsdtActive(int episodeIdx) const
{ {
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap(); const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -126,8 +126,8 @@ drsdtActive(int episodeIdx) const
return (oilVaporizationControl.drsdtActive() && bothOilGasActive); return (oilVaporizationControl.drsdtActive() && bothOilGasActive);
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
bool MixingRateControls<FluidSystem,Scalar>:: bool MixingRateControls<FluidSystem>::
drvdtActive(int episodeIdx) const drvdtActive(int episodeIdx) const
{ {
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap(); const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -136,8 +136,8 @@ drvdtActive(int episodeIdx) const
return (oilVaporizationControl.drvdtActive() && bothOilGasActive); return (oilVaporizationControl.drvdtActive() && bothOilGasActive);
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
bool MixingRateControls<FluidSystem,Scalar>:: bool MixingRateControls<FluidSystem>::
drsdtConvective(int episodeIdx) const drsdtConvective(int episodeIdx) const
{ {
const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap(); const auto& oilVaporizationControl = schedule_[episodeIdx].oilvap();
@ -146,8 +146,8 @@ drsdtConvective(int episodeIdx) const
return (oilVaporizationControl.drsdtConvective() && bothOilGasActive); return (oilVaporizationControl.drsdtConvective() && bothOilGasActive);
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
void MixingRateControls<FluidSystem,Scalar>:: void MixingRateControls<FluidSystem>::
updateExplicitQuantities(const int episodeIdx, updateExplicitQuantities(const int episodeIdx,
const Scalar timeStepSize) const Scalar timeStepSize)
{ {
@ -165,8 +165,8 @@ updateExplicitQuantities(const int episodeIdx,
} }
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
void MixingRateControls<FluidSystem,Scalar>:: void MixingRateControls<FluidSystem>::
updateLastValues(const unsigned elemIdx, updateLastValues(const unsigned elemIdx,
const Scalar Rs, const Scalar Rs,
const Scalar Rv) const Scalar Rv)
@ -180,8 +180,8 @@ updateLastValues(const unsigned elemIdx,
} }
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
void MixingRateControls<FluidSystem,Scalar>:: void MixingRateControls<FluidSystem>::
updateMaxValues(const int episodeIdx, updateMaxValues(const int episodeIdx,
const Scalar timeStepSize) const Scalar timeStepSize)
{ {
@ -201,8 +201,9 @@ updateMaxValues(const int episodeIdx,
} }
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
Scalar MixingRateControls<FluidSystem,Scalar>:: typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
drsdtcon(const unsigned elemIdx, drsdtcon(const unsigned elemIdx,
int episodeIdx, int episodeIdx,
const int pvtRegionIdx) const const int pvtRegionIdx) const
@ -218,8 +219,9 @@ drsdtcon(const unsigned elemIdx,
return oilVaporizationControl.getMaxDRSDT(pvtRegionIdx) * convectiveDrs_[elemIdx]; return oilVaporizationControl.getMaxDRSDT(pvtRegionIdx) * convectiveDrs_[elemIdx];
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
Scalar MixingRateControls<FluidSystem,Scalar>:: typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
maxGasDissolutionFactor(const unsigned timeIdx, maxGasDissolutionFactor(const unsigned timeIdx,
const unsigned globalDofIdx, const unsigned globalDofIdx,
const int episodeIdx, const int episodeIdx,
@ -243,8 +245,9 @@ maxGasDissolutionFactor(const unsigned timeIdx,
} }
} }
template<class FluidSystem, class Scalar> template<class FluidSystem>
Scalar MixingRateControls<FluidSystem,Scalar>:: typename MixingRateControls<FluidSystem>::Scalar
MixingRateControls<FluidSystem>::
maxOilVaporizationFactor(const unsigned timeIdx, maxOilVaporizationFactor(const unsigned timeIdx,
const unsigned globalDofIdx, const unsigned globalDofIdx,
const int episodeIdx, const int episodeIdx,
@ -262,8 +265,9 @@ maxOilVaporizationFactor(const unsigned timeIdx,
return lastRv_[globalDofIdx]; return lastRv_[globalDofIdx];
} }
} }
template<class FluidSystem, class Scalar>
void MixingRateControls<FluidSystem,Scalar>:: template<class FluidSystem>
void MixingRateControls<FluidSystem>::
updateConvectiveDRsDt_(const unsigned compressedDofIdx, updateConvectiveDRsDt_(const unsigned compressedDofIdx,
const Scalar t, const Scalar t,
const Scalar p, const Scalar p,
@ -294,6 +298,6 @@ updateConvectiveDRsDt_(const unsigned compressedDofIdx,
= permz * rssat * max(0.0, deltaDensity) * gravity / (so * visc * distZ * poro); = permz * rssat * max(0.0, deltaDensity) * gravity / (so * visc * distZ * poro);
} }
template class MixingRateControls<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, double>; template class MixingRateControls<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
} // namespace Opm } // namespace Opm

View File

@ -41,9 +41,12 @@ namespace Opm {
class EclipseState; class EclipseState;
//! \brief Class handling mixing rate controls for a FlowProblem. //! \brief Class handling mixing rate controls for a FlowProblem.
template<class FluidSystem, class Scalar> template<class FluidSystem>
class MixingRateControls { class MixingRateControls
{
public: public:
using Scalar = typename FluidSystem::Scalar;
MixingRateControls(const Schedule& schedule); MixingRateControls(const Schedule& schedule);
MixingRateControls(const MixingRateControls& rhs); MixingRateControls(const MixingRateControls& rhs);