mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3272 from totto82/fixRESVgroup
FIX wrong type RESV group control
This commit is contained in:
commit
84dcde5377
@ -31,20 +31,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename ElemType>
|
|
||||||
ElemType zero()
|
|
||||||
{
|
|
||||||
// This is for Evaluation types.
|
|
||||||
ElemType x;
|
|
||||||
x = 0.0;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -66,9 +52,6 @@ TargetCalculator::TargetCalculator(const Group::ProductionCMode cmode,
|
|||||||
template <typename RateType>
|
template <typename RateType>
|
||||||
RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
|
RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
|
||||||
{
|
{
|
||||||
// ElemType is just the plain element type of the rates container,
|
|
||||||
// without any reference, const or volatile modifiers.
|
|
||||||
using ElemType = std::remove_cv_t<std::remove_reference_t<decltype(rates[0])>>;
|
|
||||||
switch (cmode_) {
|
switch (cmode_) {
|
||||||
case Group::ProductionCMode::ORAT: {
|
case Group::ProductionCMode::ORAT: {
|
||||||
assert(pu_.phase_used[BlackoilPhases::Liquid]);
|
assert(pu_.phase_used[BlackoilPhases::Liquid]);
|
||||||
@ -93,11 +76,8 @@ RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
|
|||||||
return rates[opos] + rates[wpos];
|
return rates[opos] + rates[wpos];
|
||||||
}
|
}
|
||||||
case Group::ProductionCMode::RESV: {
|
case Group::ProductionCMode::RESV: {
|
||||||
assert(pu_.phase_used[BlackoilPhases::Liquid]);
|
auto mode_rate = rates[0] * resv_coeff_[0];
|
||||||
assert(pu_.phase_used[BlackoilPhases::Aqua]);
|
for (int phase = 1; phase < pu_.num_phases; ++phase) {
|
||||||
assert(pu_.phase_used[BlackoilPhases::Vapour]);
|
|
||||||
ElemType mode_rate = zero<ElemType>();
|
|
||||||
for (int phase = 0; phase < pu_.num_phases; ++phase) {
|
|
||||||
mode_rate += rates[phase] * resv_coeff_[phase];
|
mode_rate += rates[phase] * resv_coeff_[phase];
|
||||||
}
|
}
|
||||||
return mode_rate;
|
return mode_rate;
|
||||||
@ -105,7 +85,7 @@ RateType TargetCalculator::calcModeRateFromRates(const RateType* rates) const
|
|||||||
default:
|
default:
|
||||||
// Should never be here.
|
// Should never be here.
|
||||||
assert(false);
|
assert(false);
|
||||||
return zero<ElemType>();
|
return rates[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user