Fixes related to rsw/rvw handling in standard well

This commit is contained in:
Tor Harald Sandve 2023-04-14 14:22:43 +02:00
parent 56c6507664
commit 23e9bf599d
2 changed files with 23 additions and 4 deletions

View File

@ -599,7 +599,7 @@ processFractions()
} }
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (F[Water] < 0.0) { if (F[pu.phase_pos[Water]] < 0.0) {
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
F[pu.phase_pos[Gas]] /= (1.0 - F[pu.phase_pos[Water]]); F[pu.phase_pos[Gas]] /= (1.0 - F[pu.phase_pos[Water]]);
} }

View File

@ -352,7 +352,7 @@ namespace Opm
const Value tmp_wat = d > 0.0? (cmix_s[waterCompIdx] - rvw * cmix_s[gasCompIdx]) / d : cmix_s[waterCompIdx]; 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]; 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]; 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]; volumeRatio += tmp_gas / b_perfcells_dense[gasCompIdx];
} else { } else {
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
@ -448,8 +448,27 @@ namespace Opm
//no oil //no oil
const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx); const unsigned gasCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx); const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
perf_rates.vap_wat = getValue(rvw) * getValue(cq_s[gasCompIdx]);
perf_rates.dis_gas_in_water = getValue(rsw) * getValue(cq_s[waterCompIdx]); const double dw = 1.0 - getValue(rvw) * getValue(rsw);
if (dw <= 0.0) {
std::ostringstream sstr;
sstr << "Problematic d value " << dw << " obtained for well " << this->name()
<< " during computePerfRate calculations with rsw " << rsw
<< ", rvw " << rvw << " and pressure " << pressure
<< " obtaining d " << dw
<< " Continue as if no dissolution (rsw = 0) and vaporization (rvw = 0) "
<< " for this connection.";
deferred_logger.debug(sstr.str());
} else {
// vaporized water into gas
// rvw * q_gr * b_g = rvw * (q_gs - rsw * q_ws) / dw
perf_rates.vap_wat = getValue(rvw) * (getValue(cq_s[gasCompIdx]) - getValue(rsw) * getValue(cq_s[waterCompIdx])) / dw;
// dissolved gas in water
// rsw * q_wr * b_w = rsw * (q_ws - rvw * q_gs) / dw
perf_rates.dis_gas_in_water = getValue(rsw) * (getValue(cq_s[waterCompIdx]) - getValue(rvw) * getValue(cq_s[gasCompIdx])) / dw;
}
} }
} }
} }