Represent Assigned PI as an optional<>

Suggested by: [at]joakim-hove
This commit is contained in:
Bård Skaflestad
2020-10-08 00:36:32 +02:00
parent a077847f69
commit f384269133
2 changed files with 4 additions and 4 deletions

View File

@@ -23,9 +23,9 @@
#include <cstddef>
#include <iosfwd>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -633,7 +633,7 @@ private:
double solvent_fraction;
bool has_produced = false;
bool prediction_mode = true;
double productivity_index{ std::numeric_limits<double>::lowest() };
std::optional<double> productivity_index{ std::nullopt };
std::shared_ptr<WellEconProductionLimits> econ_limits;
std::shared_ptr<WellFoamProperties> foam_properties;

View File

@@ -816,7 +816,7 @@ void Well::applyWellProdIndexScaling(const double currentEffectivePI) {
// No connections for this well. Unexpected.
return;
if (this->productivity_index < 0.0)
if (!this->productivity_index)
// WELPI not activated. Nothing to do.
return;
@@ -824,7 +824,7 @@ void Well::applyWellProdIndexScaling(const double currentEffectivePI) {
// No change in scaling.
return;
this->connections->applyWellPIScaling(this->productivity_index / currentEffectivePI);
this->connections->applyWellPIScaling(*this->productivity_index / currentEffectivePI);
}
const WellConnections& Well::getConnections() const {