From b5e2c5262fa152192e34af1fe9fcfb8ddc63c633 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 2 Mar 2017 12:33:27 +0100 Subject: [PATCH] using rs rv from grid cells when calculating the volume ratio during computeWellFlux for StandardWellsDense. --- opm/autodiff/StandardWellsDense_impl.hpp | 30 +++++++----------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/opm/autodiff/StandardWellsDense_impl.hpp b/opm/autodiff/StandardWellsDense_impl.hpp index 6a7fb2133..f5fff0c06 100644 --- a/opm/autodiff/StandardWellsDense_impl.hpp +++ b/opm/autodiff/StandardWellsDense_impl.hpp @@ -778,34 +778,20 @@ namespace Opm { const int oilpos = pu.phase_pos[Oil]; const int gaspos = pu.phase_pos[Gas]; - EvalWell rvPerf = 0.0; - if (cmix_s[gaspos] > 0) { - rvPerf = cmix_s[oilpos] / cmix_s[gaspos]; - } - - if (rvPerf.value() > rvSatEval.value()) { - rvPerf = rvSatEval; - //rvPerf.setValue(rvSatEval.value()); - } - - EvalWell rsPerf = 0.0; - if (cmix_s[oilpos] > 0) { - rsPerf = cmix_s[gaspos] / cmix_s[oilpos]; - } - - if (rsPerf.value() > rsSatEval.value()) { - //rsPerf = 0.0; - rsPerf= rsSatEval; - } // Incorporate RS/RV factors if both oil and gas active - const EvalWell d = 1.0 - rvPerf * rsPerf; + const EvalWell d = 1.0 - rv * rs; - const EvalWell tmp_oil = (cmix_s[oilpos] - rvPerf * cmix_s[gaspos]) / d; + if (d.value() == 0.0) { + OPM_THROW(Opm::NumericalProblem, "Zero d value obtained for well " << wells().name[w] << " during flux calcuation" + << " with rs " << rs << " and rv " << rv); + } + + const EvalWell tmp_oil = (cmix_s[oilpos] - rv * cmix_s[gaspos]) / d; //std::cout << "tmp_oil " <