move gasOilPerfRateProd to RatioCalculator

This commit is contained in:
Arne Morten Kvarving 2024-11-18 13:44:54 +01:00
parent c25853a871
commit 24777604ae
4 changed files with 51 additions and 49 deletions

View File

@ -90,6 +90,40 @@ disOilVapWatVolumeRatio(Value& volumeRatio,
volumeRatio += tmp_gas / b_perfcells_dense[gasComp_];
}
template<class Value>
void
RatioCalculator<Value>::
gasOilPerfRateProd(std::vector<Value>& cq_s,
PerforationRates<Scalar>& perf_rates,
const Value& rv,
const Value& rs,
const Value& rvw,
const bool waterActive,
const bool isProducer) const
{
const Value cq_sOil = cq_s[oilComp_];
const Value cq_sGas = cq_s[gasComp_];
const Value dis_gas = rs * cq_sOil;
const Value vap_oil = rv * cq_sGas;
cq_s[gasComp_] += dis_gas;
cq_s[oilComp_] += vap_oil;
// recording the perforation solution gas rate and solution oil rates
if (isProducer) {
perf_rates.dis_gas = getValue(dis_gas);
perf_rates.vap_oil = getValue(vap_oil);
}
if (waterActive) {
const Value vap_wat = rvw * cq_sGas;
cq_s[waterComp_] += vap_wat;
if (isProducer) {
perf_rates.vap_wat = getValue(vap_wat);
}
}
}
template<class Value>
void
RatioCalculator<Value>::
@ -127,7 +161,6 @@ gasWaterPerfRateInj(const std::vector<Value>& cq_s,
const Value& rsw,
const Value& pressure,
DeferredLogger& deferred_logger) const
{
const Scalar dw = 1.0 - getValue(rvw) * getValue(rsw);

View File

@ -52,6 +52,14 @@ public:
const std::vector<Value>& b_perfcells_dense,
DeferredLogger& deferred_logger) const;
void gasOilPerfRateProd(std::vector<Value>& cq_s,
PerforationRates<Scalar>& perf_rates,
const Value& rv,
const Value& rs,
const Value& rvw,
const bool waterActive,
const bool isProducer) const;
void gasOilVolumeRatio(Value& volumeRatio,
const Value& rv,
const Value& rs,

View File

@ -476,13 +476,6 @@ namespace Opm
const Value& pressure,
const Value& rvw,
DeferredLogger& deferred_logger) const;
template<class Value>
void gasOilPerfRateProd(std::vector<Value>& cq_s,
PerforationRates<Scalar>& perf_rates,
const Value& rv,
const Value& rs,
const Value& rvw) const;
};
}

View File

@ -272,9 +272,15 @@ namespace Opm
cq_s[componentIdx] = b_perfcells_dense[componentIdx] * cq_p;
}
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
gasOilPerfRateProd(cq_s, perf_rates, rv, rs, rvw);
} else if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) &&
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
{
ratioCalc.gasOilPerfRateProd(cq_s, perf_rates, rv, rs, rvw,
FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
this->isProducer());
} else if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) &&
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
{
ratioCalc.gasWaterPerfRateProd(cq_s, perf_rates, rvw, rsw, this->isProducer());
}
} else {
@ -2702,42 +2708,4 @@ namespace Opm
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasCompIdx]) - getValue(rs) * getValue(cq_s[oilCompIdx])) / d;
}
}
template <typename TypeTag>
template<class Value>
void
StandardWell<TypeTag>::
gasOilPerfRateProd(std::vector<Value>& cq_s,
PerforationRates<Scalar>& perf_rates,
const Value& rv,
const Value& rs,
const Value& rvw) const
{
const unsigned oilCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
const Value cq_sOil = cq_s[oilCompIdx];
const Value cq_sGas = cq_s[gasCompIdx];
const Value dis_gas = rs * cq_sOil;
const Value vap_oil = rv * cq_sGas;
cq_s[gasCompIdx] += dis_gas;
cq_s[oilCompIdx] += vap_oil;
// recording the perforation solution gas rate and solution oil rates
if (this->isProducer()) {
perf_rates.dis_gas = getValue(dis_gas);
perf_rates.vap_oil = getValue(vap_oil);
}
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
const Value vap_wat = rvw * cq_sGas;
cq_s[waterCompIdx] += vap_wat;
if (this->isProducer())
perf_rates.vap_wat = getValue(vap_wat);
}
}
} // namespace Opm