From 4449f0c172d06a1e0c7a1fa9611319ffad5e2c18 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 6 Jun 2019 11:47:59 +0200 Subject: [PATCH] adding updateConnectionRatePolyMW to StandardWell --- opm/simulators/wells/StandardWell.hpp | 7 +++ opm/simulators/wells/StandardWell_impl.hpp | 64 ++++++++++++++-------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index cf76c0426..9985129f8 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -488,6 +488,13 @@ namespace Opm ConvergenceReport& report, DeferredLogger& deferred_logger) const; + // updating the connectionRates_ related polymer molecular weight + void updateConnectionRatePolyMW(const EvalWell& cq_s_poly, + const IntensiveQuantities& int_quants, + const WellState& well_state, + const int perf, + DeferredLogger& deferred_logger); + }; } diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index ce699af16..d4deda3b9 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -643,30 +643,7 @@ namespace Opm connectionRates_[perf][contiPolymerEqIdx] = Base::restrictEval(cq_s_poly); if (this->has_polymermw) { - // the source term related to transport of molecular weight - EvalWell cq_s_polymw = cq_s_poly; - if (well_type_ == INJECTOR) { - const int wat_vel_index = Bhp + 1 + perf; - const EvalWell water_velocity = primary_variables_evaluation_[wat_vel_index]; - if (water_velocity > 0.) { // injecting - const double throughput = well_state.perfThroughput()[first_perf_ + perf]; - const EvalWell molecular_weight = wpolymermw(throughput, water_velocity, deferred_logger); - cq_s_polymw *= molecular_weight; - } else { - // we do not consider the molecular weight from the polymer - // going-back to the wellbore through injector - cq_s_polymw *= 0.; - } - } else if (well_type_ == PRODUCER) { - if (cq_s_polymw < 0.) { - cq_s_polymw *= extendEval(intQuants.polymerMoleWeight() ); - } else { - // we do not consider the molecular weight from the polymer - // re-injecting back through producer - cq_s_polymw *= 0.; - } - } - connectionRates_[perf][this->contiPolymerMWEqIdx] = Base::restrictEval(cq_s_polymw); + updateConnectionRatePolyMW(cq_s_poly, intQuants, well_state, perf, deferred_logger); } } @@ -3217,4 +3194,43 @@ namespace Opm } } } + + + + + + template + void + StandardWell:: + updateConnectionRatePolyMW(const EvalWell& cq_s_poly, + const IntensiveQuantities& int_quants, + const WellState& well_state, + const int perf, + DeferredLogger& deferred_logger) + { + // the source term related to transport of molecular weight + EvalWell cq_s_polymw = cq_s_poly; + if (well_type_ == INJECTOR) { + const int wat_vel_index = Bhp + 1 + perf; + const EvalWell water_velocity = primary_variables_evaluation_[wat_vel_index]; + if (water_velocity > 0.) { // injecting + const double throughput = well_state.perfThroughput()[first_perf_ + perf]; + const EvalWell molecular_weight = wpolymermw(throughput, water_velocity, deferred_logger); + cq_s_polymw *= molecular_weight; + } else { + // we do not consider the molecular weight from the polymer + // going-back to the wellbore through injector + cq_s_polymw *= 0.; + } + } else if (well_type_ == PRODUCER) { + if (cq_s_polymw < 0.) { + cq_s_polymw *= extendEval(int_quants.polymerMoleWeight() ); + } else { + // we do not consider the molecular weight from the polymer + // re-injecting back through producer + cq_s_polymw *= 0.; + } + } + connectionRates_[perf][this->contiPolymerMWEqIdx] = Base::restrictEval(cq_s_polymw); + } }