From e510dde102541f5a8b5f6986534b510679de9f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 10 Mar 2014 13:30:43 +0100 Subject: [PATCH] Initialize well rates better. Instead of making well rates zero for wells that are not controlled by surface volume, we initialize them to a small value with the correct sign (positive for injectors, negative for producers). --- opm/core/simulator/WellState.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index 39fbdbd3..adf3fb24 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -59,13 +59,20 @@ namespace Opm bhp_[w] = well_controls_get_current_target( ctrl ); } - // Initialize well rates to match controls if type is SURFACE_RATE + // Initialize well rates to match controls if type is SURFACE_RATE, + // otherwise set to a small rate with the correct sign. if (well_controls_well_is_open( ctrl ) || (well_controls_get_current_type(ctrl) == SURFACE_RATE)) { const double rate_target = well_controls_get_current_target(ctrl); const double * distr = well_controls_get_current_distr( ctrl ); for (int p = 0; p < np; ++p) { wellrates_[np*w + p] = rate_target * distr[p]; } + } else { + const double small_rate = 1e-14; + const double sign = (wells->type[w] == INJECTOR) ? 1.0 : -1.0; + for (int p = 0; p < np; ++p) { + wellrates_[np*w + p] = small_rate * sign; + } } } // The perforation rates and perforation pressures are