mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #808 from qilicun/fix-pav
Correct the formulation for PAV calculations.
This commit is contained in:
commit
f78155fe23
@ -2310,9 +2310,9 @@ namespace detail {
|
||||
const DataBlock s = Eigen::Map<const DataBlock>(& x.saturation()[0], nc, np);
|
||||
state.pressure = ADB::constant(Eigen::Map<const V>(& x.pressure()[0], nc, 1));
|
||||
state.temperature = ADB::constant(Eigen::Map<const V>(& x.temperature()[0], nc, 1));
|
||||
state.saturation[Water] = ADB::constant(s.col(Water));
|
||||
state.saturation[Oil] = ADB::constant(s.col(Oil));
|
||||
state.saturation[Gas] = ADB::constant(s.col(Gas));
|
||||
state.saturation[Water] = active_[Water] ? ADB::constant(s.col(Water)) : ADB::null();
|
||||
state.saturation[Oil] = active_[Oil] ? ADB::constant(s.col(Oil)) : ADB::constant(V::Zero(nc));
|
||||
state.saturation[Gas] = active_[Gas] ? ADB::constant(s.col(Gas)) : ADB::constant(V::Zero(nc));
|
||||
state.rs = ADB::constant(Eigen::Map<const V>(& x.gasoilratio()[0], nc, 1));
|
||||
state.rv = ADB::constant(Eigen::Map<const V>(& x.rv()[0], nc, 1));
|
||||
state.canonical_phase_pressures = computePressures(state.pressure,
|
||||
@ -2324,8 +2324,6 @@ namespace detail {
|
||||
|
||||
const std::vector<PhasePresence> cond = phaseCondition();
|
||||
|
||||
|
||||
|
||||
const ADB pv_mult = poroMult(state.pressure);
|
||||
const V& pv = geo_.poreVolume();
|
||||
const int maxnp = Opm::BlackoilPhases::MaxNumPhases;
|
||||
@ -2356,16 +2354,25 @@ namespace detail {
|
||||
}
|
||||
}
|
||||
|
||||
// compute PAV and PORV or every regions.
|
||||
// compute PAV and PORV for every regions.
|
||||
const V hydrocarbon = state.saturation[Oil].value() + state.saturation[Gas].value();
|
||||
V hcpv = V::Zero(nc);
|
||||
V pres = V::Zero(nc);
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
if (fipnum[c] != 0) {
|
||||
hcpv[fipnum[c]-1] += pv[c] * hydrocarbon[c];
|
||||
pres[fipnum[c]-1] += pv[c] * state.pressure.value()[c];
|
||||
values[fipnum[c]-1][5] += pv[c];
|
||||
values[fipnum[c]-1][6] += pv[c] * state.pressure.value()[c];
|
||||
values[fipnum[c]-1][6] += pv[c] * state.pressure.value()[c] * hydrocarbon[c];
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& val : values) {
|
||||
val[6] = val[6] / val[5];
|
||||
for (int reg = 0; reg < dims; ++reg) {
|
||||
if (hcpv[reg] != 0) {
|
||||
values[reg][6] /= hcpv[reg];
|
||||
} else {
|
||||
values[reg][6] = pres[reg] / values[reg][5];
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
|
@ -163,7 +163,7 @@ namespace Opm
|
||||
std::vector<V>& fip);
|
||||
|
||||
V
|
||||
FIPTotals(const std::vector<V>& fip, const std::vector<double>& press);
|
||||
FIPTotals(const std::vector<V>& fip, const ReservoirState& state);
|
||||
|
||||
void
|
||||
outputFluidInPlace(const V& oip, const V& cip, const UnitSystem& units, const int reg);
|
||||
|
@ -271,8 +271,8 @@ namespace Opm
|
||||
std::vector<V> COIP;
|
||||
COIP = solver->computeFluidInPlace(state, fipnum);
|
||||
FIPUnitConvert(eclipse_state_->getUnits(), COIP);
|
||||
V OOIP_totals = FIPTotals(OOIP, state.pressure());
|
||||
V COIP_totals = FIPTotals(COIP, state.pressure());
|
||||
V OOIP_totals = FIPTotals(OOIP, state);
|
||||
V COIP_totals = FIPTotals(COIP, state);
|
||||
outputFluidInPlace(OOIP_totals, COIP_totals,eclipse_state_->getUnits(), 0);
|
||||
for (size_t reg = 0; reg < OOIP.size(); ++reg) {
|
||||
outputFluidInPlace(OOIP[reg], COIP[reg], eclipse_state_->getUnits(), reg+1);
|
||||
@ -682,7 +682,7 @@ namespace Opm
|
||||
|
||||
template <class Implementation>
|
||||
V
|
||||
SimulatorBase<Implementation>::FIPTotals(const std::vector<V>& fip, const std::vector<double>& press)
|
||||
SimulatorBase<Implementation>::FIPTotals(const std::vector<V>& fip, const ReservoirState& state)
|
||||
{
|
||||
V totals(V::Zero(7));
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
@ -690,9 +690,16 @@ namespace Opm
|
||||
totals[i] += fip[reg][i];
|
||||
}
|
||||
}
|
||||
const V p = Eigen::Map<const V>(& press[0], press.size());
|
||||
const int nc = Opm::AutoDiffGrid::numCells(grid_);
|
||||
const int np = state.numPhases();
|
||||
const PhaseUsage& pu = props_.phaseUsage();
|
||||
const DataBlock s = Eigen::Map<const DataBlock>(& state.saturation()[0], nc, np);
|
||||
const V so = pu.phase_used[BlackoilPhases::Liquid] ? V(s.col(BlackoilPhases::Liquid)) : V::Zero(nc);
|
||||
const V sg = pu.phase_used[BlackoilPhases::Vapour] ? V(s.col(BlackoilPhases::Vapour)) : V::Zero(nc);
|
||||
const V hydrocarbon = so + sg;
|
||||
const V p = Eigen::Map<const V>(& state.pressure()[0], nc);
|
||||
totals[5] = geo_.poreVolume().sum();
|
||||
totals[6] = unit::convert::to((p * geo_.poreVolume()).sum() / totals[5], unit::barsa);
|
||||
totals[6] = unit::convert::to((p * geo_.poreVolume() * hydrocarbon).sum() / ((geo_.poreVolume() * hydrocarbon).sum()), unit::barsa);
|
||||
|
||||
return totals;
|
||||
}
|
||||
@ -705,28 +712,32 @@ namespace Opm
|
||||
{
|
||||
std::ostringstream ss;
|
||||
if (!reg) {
|
||||
ss << " ==================================================\n"
|
||||
ss << " ===================================================\n"
|
||||
<< " : Field Totals :\n";
|
||||
} else {
|
||||
ss << " ==================================================\n"
|
||||
ss << " ===================================================\n"
|
||||
<< " : FIPNUM report region "
|
||||
<< std::setw(2) << reg << " :\n";
|
||||
}
|
||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||
ss << " : PAV =" << std::setw(14) << cip[6] << " BARSA :\n"
|
||||
<< std::fixed << std::setprecision(0)
|
||||
<< " : PORV =" << std::setw(14) << cip[5] << " RM3 :\n"
|
||||
<< " : Pressure is weighted by hydrocarbon pore voulme:\n"
|
||||
<< " : Porv volume are taken at reference conditions :\n"
|
||||
<< " :--------------- Oil SM3 ---------------:-- Wat SM3 --:--------------- Gas SM3 ---------------:\n";
|
||||
<< " : PORV =" << std::setw(14) << cip[5] << " RM3 :\n";
|
||||
if (!reg) {
|
||||
ss << " : Pressure is weighted by hydrocarbon pore volume :\n"
|
||||
<< " : Porv volumes are taken at reference conditions :\n";
|
||||
}
|
||||
ss << " :--------------- Oil SM3 ---------------:-- Wat SM3 --:--------------- Gas SM3 ---------------:\n";
|
||||
}
|
||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
|
||||
ss << " : PAV =" << std::setw(14) << cip[6] << " PSIA :"
|
||||
ss << " : PAV =" << std::setw(14) << cip[6] << " PSIA :\n"
|
||||
<< std::fixed << std::setprecision(0)
|
||||
<< " : PORV =" << std::setprecision(14) << cip[5] << " STB :"
|
||||
<< " : Pressure is weighted by hydrocarbon pore voulme :"
|
||||
<< " : Pore volume are taken at reference conditions :"
|
||||
<< " :--------------- Oil STB ---------------:-- Wat STB --:--------------- Gas MSCF ---------------:\n";
|
||||
<< " : PORV =" << std::setw(14) << cip[5] << " RB :\n";
|
||||
if (!reg) {
|
||||
ss << " : Pressure is weighted by hydrocarbon pore voulme :\n"
|
||||
<< " : Pore volumes are taken at reference conditions :\n";
|
||||
}
|
||||
ss << " :--------------- Oil STB ---------------:-- Wat STB --:--------------- Gas MSCF ---------------:\n";
|
||||
}
|
||||
ss << " : Liquid Vapour Total : Total : Free Dissolved Total :" << "\n"
|
||||
<< ":------------------------:------------------------------------------:----------------:------------------------------------------:" << "\n"
|
||||
|
@ -564,16 +564,33 @@ namespace {
|
||||
|
||||
|
||||
const int dims = *std::max_element(fipnum.begin(), fipnum.end());
|
||||
std::vector<V> values(dims, V::Zero(5));
|
||||
|
||||
for (int d = 0; d < dims; ++d) {
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
std::vector<V> values(dims, V::Zero(7));
|
||||
V hcpv = V::Zero(nc);
|
||||
V pres = V::Zero(nc);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
if (fipnum[c] == d) {
|
||||
values[d][i] += fip[c][i];
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
if (fipnum[c] != 0) {
|
||||
values[fipnum[c]-1][i] += fip[i][c];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// compute PAV and PORV or every regions.
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
if (fipnum[c] != 0) {
|
||||
hcpv[fipnum[c]-1] += pv[c] * s.col(Oil)[c];
|
||||
pres[fipnum[c]-1] += pv[c] * state.pressure.value()[c];
|
||||
values[fipnum[c]-1][5] += pv[c];
|
||||
values[fipnum[c]-1][6] += pv[c] * state.pressure.value()[c] * s.col(Oil)[c];
|
||||
}
|
||||
}
|
||||
|
||||
for (int reg = 0; reg < dims; ++reg) {
|
||||
if (hcpv[reg] != 0) {
|
||||
values[reg][6] /= hcpv[reg];
|
||||
} else {
|
||||
values[reg][6] = pres[reg] / values[reg][5];
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
|
Loading…
Reference in New Issue
Block a user