Address PR Review Comments

This commit is contained in:
Bård Skaflestad 2021-03-24 18:21:30 +01:00
parent 578fa4b6c3
commit 7503cfd76a

View File

@ -28,6 +28,7 @@
#include <exception> #include <exception>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <utility>
namespace Opm namespace Opm
{ {
@ -107,9 +108,8 @@ protected:
"for Carter-Tracey analytic aquifers"}; "for Carter-Tracey analytic aquifers"};
} }
inline void getInfluenceTableValues(const Scalar td_plus_dt, std::pair<Scalar, Scalar>
Scalar& PItd, getInfluenceTableValues(const Scalar td_plus_dt)
Scalar& PItdprime)
{ {
// We use the opm-common numeric linear interpolator // We use the opm-common numeric linear interpolator
this->dimensionless_pressure_ = this->dimensionless_pressure_ =
@ -117,11 +117,18 @@ protected:
this->aquct_data_.pi, this->aquct_data_.pi,
this->dimensionless_time_); this->dimensionless_time_);
PItd = Opm::linearInterpolation(aquct_data_.td, aquct_data_.pi, td_plus_dt); const auto PItd =
PItdprime = Opm::linearInterpolationDerivative(aquct_data_.td, aquct_data_.pi, td_plus_dt); Opm::linearInterpolation(this->aquct_data_.td,
this->aquct_data_.pi, td_plus_dt);
const auto PItdprime =
Opm::linearInterpolationDerivative(this->aquct_data_.td,
this->aquct_data_.pi, td_plus_dt);
return std::make_pair(PItd, PItdprime);
} }
inline Scalar dpai(int idx) Scalar dpai(const int idx) const
{ {
Scalar dp = this->pa0_ Scalar dp = this->pa0_
+ this->rhow_.at(idx).value() * this->gravity_() * (this->cell_depth_.at(idx) - this->aquiferDepth()) + this->rhow_.at(idx).value() * this->gravity_() * (this->cell_depth_.at(idx) - this->aquiferDepth())
@ -130,28 +137,28 @@ protected:
} }
// This function implements Eqs 5.8 and 5.9 of the EclipseTechnicalDescription // This function implements Eqs 5.8 and 5.9 of the EclipseTechnicalDescription
inline void calculateEqnConstants(Scalar& a, Scalar& b, const int idx, const Simulator& simulator) std::pair<Scalar, Scalar>
calculateEqnConstants(const int idx, const Simulator& simulator)
{ {
const Scalar td_plus_dt = (simulator.timeStepSize() + simulator.time()) / this->Tc_; const Scalar td_plus_dt = (simulator.timeStepSize() + simulator.time()) / this->Tc_;
this->dimensionless_time_ = simulator.time() / this->Tc_; this->dimensionless_time_ = simulator.time() / this->Tc_;
auto PItd = Scalar{0}; const auto [PItd, PItdprime] = this->getInfluenceTableValues(td_plus_dt);
auto PItdprime = Scalar{0};
this->getInfluenceTableValues(td_plus_dt, PItd, PItdprime);
const auto denom = this->Tc_ * (PItd - this->dimensionless_time_*PItdprime); const auto denom = this->Tc_ * (PItd - this->dimensionless_time_*PItdprime);
const auto a = (this->beta_*dpai(idx) - this->fluxValue_*PItdprime) / denom;
const auto b = this->beta_ / denom;
a = (this->beta_*dpai(idx) - this->fluxValue_*PItdprime) / denom; return std::make_pair(a, b);
b = this->beta_ / denom;
} }
// This function implements Eq 5.7 of the EclipseTechnicalDescription // This function implements Eq 5.7 of the EclipseTechnicalDescription
inline void calculateInflowRate(int idx, const Simulator& simulator) override inline void calculateInflowRate(int idx, const Simulator& simulator) override
{ {
Scalar a, b; const auto [a, b] = this->calculateEqnConstants(idx, simulator);
calculateEqnConstants(a, b, idx, simulator);
this->Qai_.at(idx) this->Qai_.at(idx) = this->alphai_.at(idx) *
= this->alphai_.at(idx) * (a - b * (this->pressure_current_.at(idx) - this->pressure_previous_.at(idx))); (a - b*(this->pressure_current_.at(idx) - this->pressure_previous_.at(idx)));
} }
inline void calculateAquiferConstants() override inline void calculateAquiferConstants() override