fix screw-up in the unit handling for the summary output

basically, the unit system was reversed for rates and a
UnitSystem::UnitType object was implicitly casted to bool for the
bottom hole pressure monitor. (if the BHP monitor worked, it was only
by accident...)
This commit is contained in:
Andreas Lauser 2015-04-08 13:36:43 +02:00
parent 1d2849691f
commit 8eed770265

View File

@ -772,11 +772,11 @@ private:
const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, UnitSystem::UnitType unitType) { const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, UnitSystem::UnitType unitType) {
using namespace Opm::unit; using namespace Opm::unit;
if (phase == BlackoilPhases::Liquid || phase == BlackoilPhases::Aqua) { if (phase == BlackoilPhases::Liquid || phase == BlackoilPhases::Aqua) {
if (unitType == UnitSystem::UNIT_TYPE_METRIC) { if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
unitName_ = "STB/DAY"; unitName_ = "STB/DAY";
targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day
} }
else if (unitType == UnitSystem::UNIT_TYPE_FIELD) { else if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "SM3/DAY"; unitName_ = "SM3/DAY";
targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day
} }
@ -784,11 +784,11 @@ private:
OPM_THROW(std::logic_error, "Deck uses unexpected unit system"); OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else if (phase == BlackoilPhases::Vapour) { else if (phase == BlackoilPhases::Vapour) {
if (unitType == UnitSystem::UNIT_TYPE_METRIC) { if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
unitName_ = "MSCF/DAY"; unitName_ = "MSCF/DAY";
targetRateToSiConversionFactor_ = 1000*cubic(feet)/day; // m^3/s -> MSCF^3/day targetRateToSiConversionFactor_ = 1000*cubic(feet)/day; // m^3/s -> MSCF^3/day
} }
else if (unitType == UnitSystem::UNIT_TYPE_FIELD) { else if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "SM3/DAY"; unitName_ = "SM3/DAY";
targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day
} }
@ -866,11 +866,11 @@ private:
const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, UnitSystem::UnitType unitType) { const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, UnitSystem::UnitType unitType) {
using namespace Opm::unit; using namespace Opm::unit;
if (phase == BlackoilPhases::Liquid || phase == BlackoilPhases::Aqua) { if (phase == BlackoilPhases::Liquid || phase == BlackoilPhases::Aqua) {
if (unitType == UnitSystem::UNIT_TYPE_METRIC) { if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
unitName_ = "STB/DAY"; unitName_ = "STB/DAY";
targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day
} }
else if (unitType == UnitSystem::UNIT_TYPE_FIELD) { else if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "SM3/DAY"; unitName_ = "SM3/DAY";
targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day
} }
@ -878,11 +878,11 @@ private:
OPM_THROW(std::logic_error, "Deck uses unexpected unit system"); OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else if (phase == BlackoilPhases::Vapour) { else if (phase == BlackoilPhases::Vapour) {
if (unitType == UnitSystem::UNIT_TYPE_METRIC) { if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
unitName_ = "MSCF/DAY"; unitName_ = "MSCF/DAY";
targetRateToSiConversionFactor_ = 1000*cubic(feet)/day; // m^3/s -> MSCF^3/day targetRateToSiConversionFactor_ = 1000*cubic(feet)/day; // m^3/s -> MSCF^3/day
} }
else if (unitType == UnitSystem::UNIT_TYPE_FIELD) { else if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "SM3/DAY"; unitName_ = "SM3/DAY";
targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day targetRateToSiConversionFactor_ = cubic(meter)/day; // m^3/s -> m^3/day
} }
@ -912,7 +912,7 @@ public:
PhaseUsage uses, PhaseUsage uses,
BlackoilPhases::PhaseIndex phase, BlackoilPhases::PhaseIndex phase,
WellType type, WellType type,
bool useFieldUnits) UnitSystem::UnitType unitType)
: WellReport(summary, : WellReport(summary,
eclipseState, eclipseState,
well, well,
@ -920,7 +920,7 @@ public:
phase, phase,
type, type,
'B', 'B',
handleUnit_(useFieldUnits)) handleUnit_(unitType))
{ } { }
virtual double retrieveValue(const int /* writeStepIdx */, virtual double retrieveValue(const int /* writeStepIdx */,
@ -943,17 +943,20 @@ public:
} }
private: private:
const std::string handleUnit_(bool useField) { const std::string handleUnit_(UnitSystem::UnitType unitType) {
using namespace Opm::unit; using namespace Opm::unit;
if (useField) { if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
unitName_ = "PSIA"; unitName_ = "PSIA";
targetRateToSiConversionFactor_ = psia; // Pa -> PSI targetRateToSiConversionFactor_ = psia; // Pa -> PSI
} }
else { else if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "BARSA"; unitName_ = "BARSA";
targetRateToSiConversionFactor_ = barsa; // Pa -> bar targetRateToSiConversionFactor_ = barsa; // Pa -> bar
} }
else
OPM_THROW(std::logic_error,
"Unexpected unit type " << unitType);
return unitName_; return unitName_;
} }