mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move gasOilPerfRateInj to RatioCalculator
This commit is contained in:
parent
24777604ae
commit
0f49998aba
@ -90,6 +90,53 @@ disOilVapWatVolumeRatio(Value& volumeRatio,
|
||||
volumeRatio += tmp_gas / b_perfcells_dense[gasComp_];
|
||||
}
|
||||
|
||||
template<class Value>
|
||||
void
|
||||
RatioCalculator<Value>::
|
||||
gasOilPerfRateInj(const std::vector<Value>& cq_s,
|
||||
PerforationRates<Scalar>& perf_rates,
|
||||
const Value& rv,
|
||||
const Value& rs,
|
||||
const Value& pressure,
|
||||
const Value& rvw,
|
||||
const bool waterActive,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// TODO: the formulations here remain to be tested with cases with strong crossflow through production wells
|
||||
// s means standard condition, r means reservoir condition
|
||||
// q_os = q_or * b_o + rv * q_gr * b_g
|
||||
// q_gs = q_gr * b_g + rs * q_or * b_o
|
||||
// d = 1.0 - rs * rv
|
||||
// q_or = 1 / (b_o * d) * (q_os - rv * q_gs)
|
||||
// q_gr = 1 / (b_g * d) * (q_gs - rs * q_os)
|
||||
|
||||
const Scalar d = 1.0 - getValue(rv) * getValue(rs);
|
||||
|
||||
if (d <= 0.0) {
|
||||
deferred_logger.debug(dValueError(d, name_,
|
||||
"gasOilPerfRateInj",
|
||||
rs, rv, pressure));
|
||||
} else {
|
||||
// vaporized oil into gas
|
||||
// rv * q_gr * b_g = rv * (q_gs - rs * q_os) / d
|
||||
perf_rates.vap_oil = getValue(rv) * (getValue(cq_s[gasComp_]) -
|
||||
getValue(rs) * getValue(cq_s[oilComp_])) / d;
|
||||
// dissolved of gas in oil
|
||||
// rs * q_or * b_o = rs * (q_os - rv * q_gs) / d
|
||||
perf_rates.dis_gas = getValue(rs) * (getValue(cq_s[oilComp_]) -
|
||||
getValue(rv) * getValue(cq_s[gasComp_])) / d;
|
||||
}
|
||||
|
||||
if (waterActive) {
|
||||
// q_ws = q_wr * b_w + rvw * q_gr * b_g
|
||||
// q_wr = 1 / b_w * (q_ws - rvw * q_gr * b_g) = 1 / b_w * (q_ws - rvw * 1 / d (q_gs - rs * q_os))
|
||||
// vaporized water in gas
|
||||
// rvw * q_gr * b_g = q_ws -q_wr *b_w = rvw * (q_gs -rs *q_os) / d
|
||||
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasComp_]) -
|
||||
getValue(rs) * getValue(cq_s[oilComp_])) / d;
|
||||
}
|
||||
}
|
||||
|
||||
template<class Value>
|
||||
void
|
||||
RatioCalculator<Value>::
|
||||
|
@ -52,6 +52,15 @@ public:
|
||||
const std::vector<Value>& b_perfcells_dense,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void gasOilPerfRateInj(const std::vector<Value>& cq_s,
|
||||
PerforationRates<Scalar>& perf_rates,
|
||||
const Value& rv,
|
||||
const Value& rs,
|
||||
const Value& pressure,
|
||||
const Value& rvw,
|
||||
const bool waterActive,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void gasOilPerfRateProd(std::vector<Value>& cq_s,
|
||||
PerforationRates<Scalar>& perf_rates,
|
||||
const Value& rv,
|
||||
|
@ -467,15 +467,6 @@ namespace Opm
|
||||
const std::vector<EvalWell>& cq_s,
|
||||
const IntensiveQuantities& intQuants,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class Value>
|
||||
void gasOilPerfRateInj(const std::vector<Value>& cq_s,
|
||||
PerforationRates<Scalar>& perf_rates,
|
||||
const Value& rv,
|
||||
const Value& rs,
|
||||
const Value& pressure,
|
||||
const Value& rvw,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -30,39 +30,17 @@
|
||||
|
||||
#include <opm/input/eclipse/Units/Units.hpp>
|
||||
|
||||
#include <opm/material/densead/EvaluationFormat.hpp>
|
||||
|
||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||
#include <opm/simulators/wells/StandardWellAssemble.hpp>
|
||||
#include <opm/simulators/wells/VFPHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||
#include <opm/simulators/wells/WellConvergence.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
|
||||
namespace {
|
||||
|
||||
template<class dValue, class Value>
|
||||
auto dValueError(const dValue& d,
|
||||
const std::string& name,
|
||||
const std::string& methodName,
|
||||
const Value& Rs,
|
||||
const Value& Rv,
|
||||
const Value& pressure)
|
||||
{
|
||||
return fmt::format("Problematic d value {} obtained for well {}"
|
||||
" during {} calculations with rs {}"
|
||||
", rv {} and pressure {}."
|
||||
" Continue as if no dissolution (rs = 0) and vaporization (rv = 0) "
|
||||
" for this connection.", d, name, methodName, Rs, Rv, pressure);
|
||||
}
|
||||
|
||||
}
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -345,11 +323,17 @@ namespace Opm
|
||||
|
||||
// calculating the perforation solution gas rate and solution oil rates
|
||||
if (this->isProducer()) {
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
|
||||
gasOilPerfRateInj(cq_s, perf_rates,
|
||||
rv, rs, pressure, rvw, deferred_logger);
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) &&
|
||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
|
||||
{
|
||||
ratioCalc.gasOilPerfRateInj(cq_s, perf_rates,
|
||||
rv, rs, pressure, rvw,
|
||||
FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
|
||||
deferred_logger);
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) &&
|
||||
FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx))
|
||||
{
|
||||
//no oil
|
||||
ratioCalc.gasWaterPerfRateInj(cq_s, perf_rates, rvw, rsw,
|
||||
pressure, deferred_logger);
|
||||
@ -2661,51 +2645,4 @@ namespace Opm
|
||||
|
||||
return result * this->well_efficiency_factor_;
|
||||
}
|
||||
|
||||
|
||||
template <typename TypeTag>
|
||||
template<class Value>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
gasOilPerfRateInj(const std::vector<Value>& cq_s,
|
||||
PerforationRates<Scalar>& perf_rates,
|
||||
const Value& rv,
|
||||
const Value& rs,
|
||||
const Value& pressure,
|
||||
const Value& rvw,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
|
||||
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
|
||||
// TODO: the formulations here remain to be tested with cases with strong crossflow through production wells
|
||||
// s means standard condition, r means reservoir condition
|
||||
// q_os = q_or * b_o + rv * q_gr * b_g
|
||||
// q_gs = q_gr * b_g + rs * q_or * b_o
|
||||
// d = 1.0 - rs * rv
|
||||
// q_or = 1 / (b_o * d) * (q_os - rv * q_gs)
|
||||
// q_gr = 1 / (b_g * d) * (q_gs - rs * q_os)
|
||||
|
||||
const Scalar d = 1.0 - getValue(rv) * getValue(rs);
|
||||
|
||||
if (d <= 0.0) {
|
||||
deferred_logger.debug(dValueError(d, this->name(),
|
||||
"gasOilPerfRateInj",
|
||||
rs, rv, pressure));
|
||||
} else {
|
||||
// vaporized oil into gas
|
||||
// rv * q_gr * b_g = rv * (q_gs - rs * q_os) / d
|
||||
perf_rates.vap_oil = getValue(rv) * (getValue(cq_s[gasCompIdx]) - getValue(rs) * getValue(cq_s[oilCompIdx])) / d;
|
||||
// dissolved of gas in oil
|
||||
// rs * q_or * b_o = rs * (q_os - rv * q_gs) / d
|
||||
perf_rates.dis_gas = getValue(rs) * (getValue(cq_s[oilCompIdx]) - getValue(rv) * getValue(cq_s[gasCompIdx])) / d;
|
||||
}
|
||||
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
|
||||
// q_ws = q_wr * b_w + rvw * q_gr * b_g
|
||||
// q_wr = 1 / b_w * (q_ws - rvw * q_gr * b_g) = 1 / b_w * (q_ws - rvw * 1 / d (q_gs - rs * q_os))
|
||||
// vaporized water in gas
|
||||
// rvw * q_gr * b_g = q_ws -q_wr *b_w = rvw * (q_gs -rs *q_os) / d
|
||||
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasCompIdx]) - getValue(rs) * getValue(cq_s[oilCompIdx])) / d;
|
||||
}
|
||||
}
|
||||
} // namespace Opm
|
||||
|
Loading…
Reference in New Issue
Block a user