mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 17:20:59 -06:00
Fixed missing unit conversion for total fluid in place
This commit is contained in:
parent
67374531e3
commit
ccec17f81b
@ -158,6 +158,9 @@ namespace Opm
|
||||
const BlackoilState& x,
|
||||
WellState& xw);
|
||||
|
||||
void
|
||||
FIPUnitConvert(const UnitSystem& units, V& fip);
|
||||
|
||||
void
|
||||
FIPUnitConvert(const UnitSystem& units,
|
||||
std::vector<V>& fip);
|
||||
|
@ -277,10 +277,14 @@ namespace Opm
|
||||
// Compute current FIP.
|
||||
std::vector<V> COIP;
|
||||
COIP = solver->computeFluidInPlace(state, fipnum);
|
||||
FIPUnitConvert(eclipse_state_->getUnits(), COIP);
|
||||
V OOIP_totals = FIPTotals(OOIP, state);
|
||||
V COIP_totals = FIPTotals(COIP, state);
|
||||
|
||||
//Convert to correct units
|
||||
FIPUnitConvert(eclipse_state_->getUnits(), COIP);
|
||||
FIPUnitConvert(eclipse_state_->getUnits(), OOIP_totals);
|
||||
FIPUnitConvert(eclipse_state_->getUnits(), COIP_totals);
|
||||
|
||||
if ( terminal_output_ )
|
||||
{
|
||||
outputFluidInPlace(OOIP_totals, COIP_totals,eclipse_state_->getUnits(), 0);
|
||||
@ -667,21 +671,27 @@ namespace Opm
|
||||
SimulatorBase<Implementation>::FIPUnitConvert(const UnitSystem& units,
|
||||
std::vector<V>& fip)
|
||||
{
|
||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
||||
for (size_t i = 0; i < fip.size(); ++i) {
|
||||
fip[i][0] = unit::convert::to(fip[i][0], unit::stb);
|
||||
fip[i][1] = unit::convert::to(fip[i][1], unit::stb);
|
||||
fip[i][2] = unit::convert::to(fip[i][2], 1000*unit::cubic(unit::feet));
|
||||
fip[i][3] = unit::convert::to(fip[i][3], 1000*unit::cubic(unit::feet));
|
||||
fip[i][4] = unit::convert::to(fip[i][4], unit::stb);
|
||||
fip[i][5] = unit::convert::to(fip[i][5], unit::stb);
|
||||
fip[i][6] = unit::convert::to(fip[i][6], unit::psia);
|
||||
}
|
||||
for (size_t i = 0; i < fip.size(); ++i) {
|
||||
FIPUnitConvert(units, fip[i]);
|
||||
}
|
||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||
for (size_t i = 0; i < fip.size(); ++i) {
|
||||
fip[i][6] = unit::convert::to(fip[i][6], unit::barsa);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Implementation>
|
||||
void
|
||||
SimulatorBase<Implementation>::FIPUnitConvert(const UnitSystem& units, V& fip)
|
||||
{
|
||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
||||
fip[0] = unit::convert::to(fip[0], unit::stb);
|
||||
fip[1] = unit::convert::to(fip[1], unit::stb);
|
||||
fip[2] = unit::convert::to(fip[2], 1000*unit::cubic(unit::feet));
|
||||
fip[3] = unit::convert::to(fip[3], 1000*unit::cubic(unit::feet));
|
||||
fip[4] = unit::convert::to(fip[4], unit::stb);
|
||||
fip[5] = unit::convert::to(fip[5], unit::stb);
|
||||
fip[6] = unit::convert::to(fip[6], unit::psia);
|
||||
}
|
||||
else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||
fip[6] = unit::convert::to(fip[6], unit::barsa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -707,7 +717,7 @@ namespace Opm
|
||||
if ( ! is_parallel_run_ )
|
||||
{
|
||||
totals[5] = geo_.poreVolume().sum();
|
||||
totals[6] = unit::convert::to((p * geo_.poreVolume() * hydrocarbon).sum() / ((geo_.poreVolume() * hydrocarbon).sum()), unit::barsa);
|
||||
totals[6] = (p * geo_.poreVolume() * hydrocarbon).sum() / ((geo_.poreVolume() * hydrocarbon).sum());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -728,8 +738,8 @@ namespace Opm
|
||||
pinfo.computeReduction(inputs, operators, results);
|
||||
using std::get;
|
||||
totals[5] = get<0>(results);
|
||||
totals[6] = unit::convert::to(get<1>(results)/get<2>(results),
|
||||
unit::barsa);
|
||||
totals[6] = get<1>(results)/get<2>(results);
|
||||
|
||||
#else
|
||||
// This should never happen!
|
||||
OPM_THROW(std::logic_error, "HAVE_MPI should be defined if we are running in parallel");
|
||||
|
Loading…
Reference in New Issue
Block a user