changed: put calculation of vaporized and dissolved water volume ratio in separate method

This commit is contained in:
Arne Morten Kvarving 2023-05-05 14:22:56 +02:00
parent 516320699e
commit fdfd181629
2 changed files with 48 additions and 20 deletions

View File

@ -479,6 +479,15 @@ namespace Opm
PerforationRates& perf_rates,
const Value& rvw,
const Value& rsw) const;
template<class Value>
void disOilVapWatVolumeRatio(Value& volumeRatio,
const Value& rvw,
const Value& rsw,
const Value& pressure,
const std::vector<Value>& cmix_s,
const std::vector<Value>& b_perfcells_dense,
DeferredLogger& deferred_logger) const;
};
}

View File

@ -255,26 +255,8 @@ namespace Opm
Value volumeRatio = bhp * 0.0; // initialize it with the correct type
;
if (FluidSystem::enableVaporizedWater() && FluidSystem::enableDissolvedGasInWater()) {
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
// Incorporate RSW/RVW factors if both water and gas active
const Value d = 1.0 - rvw * rsw;
if (d <= 0.0) {
std::ostringstream sstr;
sstr << "Problematic d value " << d << " obtained for well " << this->name()
<< " during computePerfRate calculations with rsw " << rsw
<< ", rvw " << rvw << " and pressure " << pressure
<< " obtaining d " << d
<< " Continue as if no dissolution (rsw = 0) and vaporization (rvw = 0) "
<< " for this connection.";
deferred_logger.debug(sstr.str());
}
const Value tmp_wat = d > 0.0? (cmix_s[waterCompIdx] - rvw * cmix_s[gasCompIdx]) / d : cmix_s[waterCompIdx];
volumeRatio += tmp_wat / b_perfcells_dense[waterCompIdx];
const Value tmp_gas = d > 0.0? (cmix_s[gasCompIdx] - rsw * cmix_s[waterCompIdx]) / d : cmix_s[gasCompIdx];
volumeRatio += tmp_gas / b_perfcells_dense[gasCompIdx];
disOilVapWatVolumeRatio(volumeRatio, rvw, rsw, pressure,
cmix_s, b_perfcells_dense, deferred_logger);
} else {
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
@ -2496,4 +2478,41 @@ namespace Opm
}
}
template <typename TypeTag>
template<class Value>
void
StandardWell<TypeTag>::
disOilVapWatVolumeRatio(Value& volumeRatio,
const Value& rvw,
const Value& rsw,
const Value& pressure,
const std::vector<Value>& cmix_s,
const std::vector<Value>& b_perfcells_dense,
DeferredLogger& deferred_logger) const
{
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
// Incorporate RSW/RVW factors if both water and gas active
const Value d = 1.0 - rvw * rsw;
if (d <= 0.0) {
std::ostringstream sstr;
sstr << "Problematic d value " << d << " obtained for well " << this->name()
<< " during computePerfRate calculations with rsw " << rsw
<< ", rvw " << rvw << " and pressure " << pressure
<< " obtaining d " << d
<< " Continue as if no dissolution (rsw = 0) and vaporization (rvw = 0) "
<< " for this connection.";
deferred_logger.debug(sstr.str());
}
const Value tmp_wat = d > 0.0 ? (cmix_s[waterCompIdx] - rvw * cmix_s[gasCompIdx]) / d
: cmix_s[waterCompIdx];
volumeRatio += tmp_wat / b_perfcells_dense[waterCompIdx];
const Value tmp_gas = d > 0.0 ? (cmix_s[gasCompIdx] - rsw * cmix_s[waterCompIdx]) / d
: cmix_s[waterCompIdx];
volumeRatio += tmp_gas / b_perfcells_dense[gasCompIdx];
}
} // namespace Opm