summary output: use the EclipseState to determine the deck unit system

seems like the guy who added EclipseState::getDeckUnitSystem() suffers
from dementia...
This commit is contained in:
Andreas Lauser
2015-03-31 12:11:57 +02:00
parent 979637967d
commit db35b75975

View File

@@ -734,7 +734,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,
@@ -742,7 +742,7 @@ public:
phase, phase,
type, type,
'R', 'R',
handleUnit_(phase, useFieldUnits)) handleUnit_(phase, unitType))
{ {
} }
@@ -770,27 +770,31 @@ public:
} }
private: private:
const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, bool useField) { 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 (useField) { if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "STB/DAY"; unitName_ = "STB/DAY";
targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day
} }
else { else if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
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
} }
else
OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else if (phase == BlackoilPhases::Vapour) { else if (phase == BlackoilPhases::Vapour) {
if (useField) { if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
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 { else if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
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
} }
else
OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else else
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,
@@ -812,7 +816,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,
@@ -820,7 +824,7 @@ public:
phase, phase,
type, type,
'T', 'T',
handleUnit_(phase, useFieldUnits)) handleUnit_(phase, unitType))
// nothing produced when the reporting starts // nothing produced when the reporting starts
, total_(0.) , total_(0.)
{ } { }
@@ -860,27 +864,31 @@ public:
} }
private: private:
const std::string handleUnit_(BlackoilPhases::PhaseIndex phase, bool useField) { 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 (useField) { if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
unitName_ = "STB/DAY"; unitName_ = "STB/DAY";
targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day targetRateToSiConversionFactor_ = stb/day; // m^3/s -> STB/day
} }
else { else if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
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
} }
else
OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else if (phase == BlackoilPhases::Vapour) { else if (phase == BlackoilPhases::Vapour) {
if (useField) { if (unitType == UnitSystem::UNIT_TYPE_METRIC) {
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 { else if (unitType == UnitSystem::UNIT_TYPE_FIELD) {
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
} }
else
OPM_THROW(std::logic_error, "Deck uses unexpected unit system");
} }
else else
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,
@@ -991,7 +999,8 @@ void Summary::addAllWells(Opm::DeckConstPtr deck,
const PhaseUsage& uses) const PhaseUsage& uses)
{ {
eclipseState_ = eclipseState; eclipseState_ = eclipseState;
bool useFieldUnits = !deck->hasKeyword("METRIC"); std::shared_ptr<const UnitSystem> unitsystem = eclipseState_->getDeckUnitSystem();
auto deckUnitType = unitsystem->getType();
// TODO: Only create report variables that are requested with keywords // TODO: Only create report variables that are requested with keywords
// (e.g. "WOPR") in the input files, and only for those wells that are // (e.g. "WOPR") in the input files, and only for those wells that are
@@ -1018,7 +1027,7 @@ void Summary::addAllWells(Opm::DeckConstPtr deck,
uses, uses,
ertPhaseIdx, ertPhaseIdx,
wellType, wellType,
useFieldUnits))); deckUnitType)));
// W{O,G,W}{I,P}T // W{O,G,W}{I,P}T
addWell(std::unique_ptr <WellReport>( addWell(std::unique_ptr <WellReport>(
new WellTotal(*this, new WellTotal(*this,
@@ -1027,7 +1036,7 @@ void Summary::addAllWells(Opm::DeckConstPtr deck,
uses, uses,
ertPhaseIdx, ertPhaseIdx,
wellType, wellType,
useFieldUnits))); deckUnitType)));
} }
} }
} }
@@ -1050,7 +1059,7 @@ void Summary::addAllWells(Opm::DeckConstPtr deck,
uses, uses,
ertPhaseIdx, ertPhaseIdx,
WELL_TYPES[0], WELL_TYPES[0],
useFieldUnits))); deckUnitType)));
} }
} }
} // end namespace EclipseWriterDetails } // end namespace EclipseWriterDetails