Merge pull request #390 from akva2/thermal_fixes

Thermal fixes
This commit is contained in:
Bård Skaflestad 2020-01-29 13:26:36 +01:00 committed by GitHub
commit ff5c8eea84
4 changed files with 29 additions and 37 deletions

View File

@ -129,9 +129,9 @@ public:
bool sortInputs = true) bool sortInputs = true)
{ {
assert(x.size() == y.size()); assert(x.size() == y.size());
assert(x.size() > 1);
resizeArrays_(x.size()); resizeArrays_(x.size());
if (x.size() > 0) {
std::copy(x.begin(), x.end(), xValues_.begin()); std::copy(x.begin(), x.end(), xValues_.begin());
std::copy(y.begin(), y.end(), yValues_.begin()); std::copy(y.begin(), y.end(), yValues_.begin());
@ -140,6 +140,7 @@ public:
else if (xValues_[0] > xValues_[numSamples() - 1]) else if (xValues_[0] > xValues_[numSamples() - 1])
reverseSamplingPoints_(); reverseSamplingPoints_();
} }
}
/*! /*!
* \brief Set the sampling points for the piecewise linear function * \brief Set the sampling points for the piecewise linear function

View File

@ -1099,9 +1099,9 @@ private:
GasOilEffectiveParamVector gasOilEffectiveParamVector_; GasOilEffectiveParamVector gasOilEffectiveParamVector_;
OilWaterEffectiveParamVector oilWaterEffectiveParamVector_; OilWaterEffectiveParamVector oilWaterEffectiveParamVector_;
Opm::EclMultiplexerApproach threePhaseApproach_; Opm::EclMultiplexerApproach threePhaseApproach_ = EclMultiplexerApproach::EclDefaultApproach;
// this attribute only makes sense for twophase simulations! // this attribute only makes sense for twophase simulations!
enum EclTwoPhaseApproach twoPhaseApproach_; enum EclTwoPhaseApproach twoPhaseApproach_ = EclTwoPhaseApproach::EclTwoPhaseGasOil;
std::vector<std::shared_ptr<MaterialLawParams> > materialLawParams_; std::vector<std::shared_ptr<MaterialLawParams> > materialLawParams_;

View File

@ -81,7 +81,7 @@ public:
, realWaterPvt_(realWaterPvt) , realWaterPvt_(realWaterPvt)
{ } { }
WaterPvtMultiplexer(const WaterPvtMultiplexer<Scalar,enableThermal>& data) WaterPvtMultiplexer(const WaterPvtMultiplexer<Scalar,enableThermal,enableBrine>& data)
{ {
*this = data; *this = data;
} }
@ -274,7 +274,7 @@ public:
const void* realWaterPvt() const { return realWaterPvt_; } const void* realWaterPvt() const { return realWaterPvt_; }
bool operator==(const WaterPvtMultiplexer<Scalar,enableThermal, enableBrine>& data) const bool operator==(const WaterPvtMultiplexer<Scalar,enableThermal,enableBrine>& data) const
{ {
if (this->approach() != data.approach()) if (this->approach() != data.approach())
return false; return false;
@ -294,7 +294,7 @@ public:
} }
} }
WaterPvtMultiplexer<Scalar,enableThermal, enableBrine>& operator=(const WaterPvtMultiplexer<Scalar,enableThermal>& data) WaterPvtMultiplexer<Scalar,enableThermal,enableBrine>& operator=(const WaterPvtMultiplexer<Scalar,enableThermal,enableBrine>& data)
{ {
approach_ = data.approach_; approach_ = data.approach_;
switch (approach_) { switch (approach_) {

View File

@ -69,29 +69,28 @@ public:
thermalConductivityApproach_ = ThermalConductionLawParams::undefinedApproach; thermalConductivityApproach_ = ThermalConductionLawParams::undefinedApproach;
} }
void initFromDeck(const Opm::Deck& deck, void initParamsForElements(const Opm::EclipseState& eclState,
const Opm::EclipseState& eclState,
const std::vector<int>& compressedToCartesianElemIdx) const std::vector<int>& compressedToCartesianElemIdx)
{ {
const auto& fp = eclState.fieldProps(); const auto& fp = eclState.fieldProps();
const auto& tableManager = eclState.getTableManager();
bool has_heatcr = fp.has_double("HEATCR"); bool has_heatcr = fp.has_double("HEATCR");
bool has_thconr = fp.has_double("THCONR"); bool has_thconr = fp.has_double("THCONR");
bool has_thc = fp.has_double("THCROCK") || fp.has_double("THCOIL") || fp.has_double("THCGAS") || fp.has_double("THCWATER"); bool has_thc = fp.has_double("THCROCK") || fp.has_double("THCOIL") || fp.has_double("THCGAS") || fp.has_double("THCWATER");
if (has_heatcr) if (has_heatcr)
initHeatcr_(deck, eclState, compressedToCartesianElemIdx); initHeatcr_(eclState, compressedToCartesianElemIdx);
else if (deck.hasKeyword("SPECROCK")) else if (tableManager.hasTables("SPECROCK"))
initSpecrock_(deck, eclState, compressedToCartesianElemIdx); initSpecrock_(eclState, compressedToCartesianElemIdx);
else else
initNullRockEnergy_(deck, eclState, compressedToCartesianElemIdx); initNullRockEnergy_();
if (has_thconr) if (has_thconr)
initThconr_(deck, eclState, compressedToCartesianElemIdx); initThconr_(eclState, compressedToCartesianElemIdx);
else if (has_thc) else if (has_thc)
initThc_(deck, eclState, compressedToCartesianElemIdx); initThc_(eclState, compressedToCartesianElemIdx);
else else
initNullCond_(deck, eclState, compressedToCartesianElemIdx); initNullCond_();
} }
const SolidEnergyLawParams& solidEnergyLawParams(unsigned elemIdx) const const SolidEnergyLawParams& solidEnergyLawParams(unsigned elemIdx) const
@ -139,8 +138,7 @@ private:
/*! /*!
* \brief Initialize the parameters for the solid energy law using using HEATCR and friends. * \brief Initialize the parameters for the solid energy law using using HEATCR and friends.
*/ */
void initHeatcr_(const Opm::Deck& deck OPM_UNUSED, void initHeatcr_(const Opm::EclipseState& eclState,
const Opm::EclipseState& eclState,
const std::vector<int>& compressedToCartesianElemIdx) const std::vector<int>& compressedToCartesianElemIdx)
{ {
solidEnergyApproach_ = SolidEnergyLawParams::heatcrApproach; solidEnergyApproach_ = SolidEnergyLawParams::heatcrApproach;
@ -168,8 +166,7 @@ private:
/*! /*!
* \brief Initialize the parameters for the solid energy law using using SPECROCK and friends. * \brief Initialize the parameters for the solid energy law using using SPECROCK and friends.
*/ */
void initSpecrock_(const Opm::Deck& deck OPM_UNUSED, void initSpecrock_(const Opm::EclipseState& eclState,
const Opm::EclipseState& eclState,
const std::vector<int>& compressedToCartesianElemIdx) const std::vector<int>& compressedToCartesianElemIdx)
{ {
solidEnergyApproach_ = SolidEnergyLawParams::specrockApproach; solidEnergyApproach_ = SolidEnergyLawParams::specrockApproach;
@ -209,9 +206,7 @@ private:
/*! /*!
* \brief Specify the solid energy law by setting heat capacity of rock to 0 * \brief Specify the solid energy law by setting heat capacity of rock to 0
*/ */
void initNullRockEnergy_(const Opm::Deck& deck OPM_UNUSED, void initNullRockEnergy_()
const Opm::EclipseState& eclState OPM_UNUSED,
const std::vector<int>& compressedToCartesianElemIdx OPM_UNUSED)
{ {
solidEnergyApproach_ = SolidEnergyLawParams::nullApproach; solidEnergyApproach_ = SolidEnergyLawParams::nullApproach;
@ -222,8 +217,7 @@ private:
/*! /*!
* \brief Initialize the parameters for the thermal conduction law using THCONR and friends. * \brief Initialize the parameters for the thermal conduction law using THCONR and friends.
*/ */
void initThconr_(const Opm::Deck& deck OPM_UNUSED, void initThconr_(const Opm::EclipseState& eclState,
const Opm::EclipseState& eclState,
const std::vector<int>& compressedToCartesianElemIdx) const std::vector<int>& compressedToCartesianElemIdx)
{ {
thermalConductivityApproach_ = ThermalConductionLawParams::thconrApproach; thermalConductivityApproach_ = ThermalConductionLawParams::thconrApproach;
@ -257,8 +251,7 @@ private:
/*! /*!
* \brief Initialize the parameters for the thermal conduction law using THCROCK and friends. * \brief Initialize the parameters for the thermal conduction law using THCROCK and friends.
*/ */
void initThc_(const Opm::Deck& deck OPM_UNUSED, void initThc_(const Opm::EclipseState& eclState,
const Opm::EclipseState& eclState,
const std::vector<int>& compressedToCartesianElemIdx) const std::vector<int>& compressedToCartesianElemIdx)
{ {
thermalConductivityApproach_ = ThermalConductionLawParams::thcApproach; thermalConductivityApproach_ = ThermalConductionLawParams::thcApproach;
@ -306,9 +299,7 @@ private:
/*! /*!
* \brief Disable thermal conductivity * \brief Disable thermal conductivity
*/ */
void initNullCond_(const Opm::Deck& deck OPM_UNUSED, void initNullCond_()
const Opm::EclipseState& eclState OPM_UNUSED,
const std::vector<int>& compressedToCartesianElemIdx OPM_UNUSED)
{ {
thermalConductivityApproach_ = ThermalConductionLawParams::nullApproach; thermalConductivityApproach_ = ThermalConductionLawParams::nullApproach;