From 3255626b2e0e333264a83cfe03032c06d156ce41 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 25 Sep 2017 14:03:10 +0200 Subject: [PATCH] scaling the gas rates a little bit for MS well. It can possibly benefit the StandardWell, while it is something needs a little bit more investigation before using it. --- opm/autodiff/MultisegmentWell_impl.hpp | 4 +++- .../SimulatorFullyImplicitBlackoilEbos.hpp | 2 +- .../WellStateFullyImplicitBlackoilDense.hpp | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/opm/autodiff/MultisegmentWell_impl.hpp b/opm/autodiff/MultisegmentWell_impl.hpp index 6b3e013cf..bf582b69e 100644 --- a/opm/autodiff/MultisegmentWell_impl.hpp +++ b/opm/autodiff/MultisegmentWell_impl.hpp @@ -550,9 +550,11 @@ namespace Opm // check convergence for flux residuals for ( int comp_idx = 0; comp_idx < numComponents(); ++comp_idx) { - report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_ * 10.); + // report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_ * 10.); + report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_); } + // TODO: it is not good to use a hard-coded value. report.converged = report.converged && (maximum_residual[SPres] < 100.0); } else { // abnormal values found and no need to check the convergence report.converged = false; diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp index fadeb6fd2..5ff485386 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp @@ -301,7 +301,7 @@ public: // handling MS well related for (const auto& well : wells_ecl) { if (well->isMultiSegment(timer.currentStepNum())) { // there is one well is MS well - well_state.initWellStateMSWell(wells, wells_ecl, timer.currentStepNum(), prev_well_state); + well_state.initWellStateMSWell(wells, wells_ecl, timer.currentStepNum(), phaseUsage_, prev_well_state); break; } } diff --git a/opm/autodiff/WellStateFullyImplicitBlackoilDense.hpp b/opm/autodiff/WellStateFullyImplicitBlackoilDense.hpp index 0c20e1500..633daf65e 100644 --- a/opm/autodiff/WellStateFullyImplicitBlackoilDense.hpp +++ b/opm/autodiff/WellStateFullyImplicitBlackoilDense.hpp @@ -114,7 +114,7 @@ namespace Opm /// init the MS well related. template void initWellStateMSWell(const Wells* wells, const std::vector& wells_ecl, - const int time_step, const PrevWellState& prev_well_state) + const int time_step, const PhaseUsage& pu, const PrevWellState& prev_well_state) { // still using the order in wells const int nw = wells->number_of_wells; @@ -178,12 +178,25 @@ namespace Opm } } + // for the segrates_, now it becomes a recursive solution procedure. { const int np = numPhases(); const int start_perf = wells->well_connpos[w]; const int start_perf_next_well = wells->well_connpos[w + 1]; assert(nperf == (start_perf_next_well - start_perf)); // make sure the information from wells_ecl consistent with wells + if (pu.phase_used[Gas]) { + const int gaspos = pu.phase_pos[Gas]; + // scale the phase rates for Gas to avoid too bad initial guess for gas fraction + // it will probably benefit the standard well too, while it needs to be justified + // TODO: to see if this strategy can benefit StandardWell too + // TODO: it might cause big problem for gas rate control or if there is gas rate limit + for (int perf = 0; perf < nperf; perf++) { + const int perf_pos = start_perf + perf; + perfPhaseRates()[np * perf_pos + gaspos] *= 100.; + } + } + const std::vector perforation_rates(perfPhaseRates().begin() + np * start_perf, perfPhaseRates().begin() + np * start_perf_next_well); // the perforation rates for this well std::vector segment_rates;