Try to silence a warning about an unused variable.

Added some more debug code, and initialized some boolean variables.

The jenkins build gives a warning about that '"alq_is_limited" may be
used uninitialized', though the warning is generated in another file
(GasLiftWellState.hpp, line #44) it could be (?) caused by the fact that
"alq_is_limited" might not be initialized before calling the constructor
in GasLiftSingleWell_impl.hpp line #963..
This commit is contained in:
Håkon Hægland 2021-03-26 09:20:55 +01:00
parent a80ad54d7d
commit ff3c7f2afb

View File

@ -823,9 +823,20 @@ reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
std::tie(oil_rate, oil_is_limited) = getOilRateWithLimit_(potentials);
std::tie(gas_rate, gas_is_limited) = getGasRateWithLimit_(potentials);
if (this->debug) {
const std::string msg = fmt::format("Reduced oil rate from {} to {} and ALQ ",
"from {} to {}", orig_oil_rate, oil_rate, orig_alq, alq);
displayDebugMessage_(msg);
assert( alq <= orig_alq );
if (alq < orig_alq) {
// NOTE: ALQ may drop below zero before we are able to meet the target
const std::string msg = fmt::format(
"Reduced (oil_rate, alq) from ({}, {}) to ({}, {}) to meet target "
"at {}. ", orig_oil_rate, orig_alq, oil_rate, alq, target);
displayDebugMessage_(msg);
}
else if (alq == orig_alq) {
// We might not be able to reduce ALQ, for example if ALQ starts out at zero.
const std::string msg = fmt::format("Not able to reduce ALQ {} further. "
"Oil rate is {} and oil target is {}", orig_alq, oil_rate, target);
displayDebugMessage_(msg);
}
}
return std::make_tuple(oil_rate, gas_rate, oil_is_limited, gas_is_limited, alq);
}
@ -847,7 +858,9 @@ runOptimizeLoop_(bool increase)
std::vector<double> potentials(this->num_phases_, 0.0);
std::unique_ptr<GLiftWellState> ret_value; // nullptr initially
if (!computeInitialWellRates_(potentials)) return ret_value;
bool alq_is_limited, oil_is_limited, gas_is_limited;
bool alq_is_limited = false;
bool oil_is_limited = false;
bool gas_is_limited = false;
double oil_rate, gas_rate;
std::tie(oil_rate, gas_rate, oil_is_limited, gas_is_limited) =
getInitialRatesWithLimit_(potentials);