changed: put calculation of zFraction connection rate in separate method

This commit is contained in:
Arne Morten Kvarving
2023-05-05 09:55:26 +02:00
parent b1cafa25ca
commit c239cbd14f
2 changed files with 36 additions and 14 deletions

View File

@@ -446,6 +446,12 @@ namespace Opm
std::tuple<Eval,Eval,Eval>
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const;
std::tuple<Eval,EvalWell>
connectionRatezFraction(double& rate,
const double dis_gas_rate,
const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const;
};
}

View File

@@ -745,20 +745,10 @@ namespace Opm
}
if constexpr (has_zFraction) {
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
cq_s_zfrac_effective = cq_s[gasCompIdx];
if (this->isInjector()) {
cq_s_zfrac_effective *= this->wsolvent();
} else if (cq_s_zfrac_effective.value() != 0.0) {
const double dis_gas_frac = perf_rates.dis_gas / cq_s_zfrac_effective.value();
cq_s_zfrac_effective *= this->extendEval(dis_gas_frac*intQuants.xVolume() + (1.0-dis_gas_frac)*intQuants.yVolume());
}
auto& perf_rate_solvent = perf_data.solvent_rates;
perf_rate_solvent[perf] = cq_s_zfrac_effective.value();
cq_s_zfrac_effective *= this->well_efficiency_factor_;
connectionRates[perf][Indices::contiZfracEqIdx] = Base::restrictEval(cq_s_zfrac_effective);
std::tie(connectionRates[perf][Indices::contiZfracEqIdx],
cq_s_zfrac_effective) =
connectionRatezFraction(perf_data.solvent_rates[perf],
perf_rates.dis_gas, cq_s, intQuants);
}
if constexpr (has_brine) {
@@ -2410,4 +2400,30 @@ namespace Opm
Base::restrictEval(cq_s_urea)};
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::EvalWell>
StandardWell<TypeTag>::
connectionRatezFraction(double& rate,
const double dis_gas_rate,
const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const
{
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
EvalWell cq_s_zfrac_effective = cq_s[gasCompIdx];
if (this->isInjector()) {
cq_s_zfrac_effective *= this->wsolvent();
} else if (cq_s_zfrac_effective.value() != 0.0) {
const double dis_gas_frac = dis_gas_rate / cq_s_zfrac_effective.value();
cq_s_zfrac_effective *= this->extendEval(dis_gas_frac*intQuants.xVolume() + (1.0-dis_gas_frac)*intQuants.yVolume());
}
rate = cq_s_zfrac_effective.value();
cq_s_zfrac_effective *= this->well_efficiency_factor_;
return {Base::restrictEval(cq_s_zfrac_effective), cq_s_zfrac_effective};
}
} // namespace Opm