From 2319420f06460b7cb4767ee3b61a026c6d910946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 18 Jun 2015 14:34:52 +0200 Subject: [PATCH] Move polymer code extraAddWellEq -> addWellContributionToMassBalanceEq. --- .../fullyimplicit/BlackoilPolymerModel.hpp | 9 +++----- .../BlackoilPolymerModel_impl.hpp | 22 ++++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp b/opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp index ccdc3a04f..09fbb214c 100644 --- a/opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp +++ b/opm/polymer/fullyimplicit/BlackoilPolymerModel.hpp @@ -207,12 +207,9 @@ namespace Opm { assembleMassBalanceEq(const SolutionState& state); void - extraAddWellEq(const SolutionState& state, - const WellState& xw, - const std::vector& cq_ps, - const std::vector& cmix_s, - const ADB& cqt_is, - const std::vector& well_cells); + addWellContributionToMassBalanceEq(const SolutionState& state, + const WellState& xw, + const std::vector& cq_s); void computeMassFlux(const int actph , diff --git a/opm/polymer/fullyimplicit/BlackoilPolymerModel_impl.hpp b/opm/polymer/fullyimplicit/BlackoilPolymerModel_impl.hpp index 71d97a68c..f3d8e2c0c 100644 --- a/opm/polymer/fullyimplicit/BlackoilPolymerModel_impl.hpp +++ b/opm/polymer/fullyimplicit/BlackoilPolymerModel_impl.hpp @@ -279,23 +279,25 @@ namespace Opm { template - void BlackoilPolymerModel::extraAddWellEq(const SolutionState& state, - const WellState& xw, - const std::vector& cq_ps, - const std::vector& cmix_s, - const ADB& cqt_is, - const std::vector& well_cells) + void BlackoilPolymerModel::addWellContributionToMassBalanceEq(const SolutionState& state, + const WellState& xw, + const std::vector& cq_s) { + Base::addWellContributionToMassBalanceEq(state, xw, cq_s); + // Add well contributions to polymer mass balance equation if (has_polymer_) { const ADB mc = computeMc(state); const int nc = xw.polymerInflow().size(); const V polyin = Eigen::Map(xw.polymerInflow().data(), nc); + const int nperf = wells().well_connpos[wells().number_of_wells]; + const std::vector well_cells(wells().well_cells, wells().well_cells + nperf); const V poly_in_perf = subset(polyin, well_cells); - const V poly_mc_perf = subset(mc, well_cells).value(); - const PhaseUsage& pu = fluid_.phaseUsage(); - const ADB cq_s_poly = cq_ps[pu.phase_pos[Water]] * poly_mc_perf - + cmix_s[pu.phase_pos[Water]] * cqt_is * poly_in_perf; + const V poly_mc_perf = subset(mc.value(), well_cells); + const ADB& cq_s_water = cq_s[fluid_.phaseUsage().phase_pos[Water]]; + Selector injector_selector(cq_s_water.value()); + const V poly_perf = injector_selector.select(poly_in_perf, poly_mc_perf); + const ADB cq_s_poly = cq_s_water * poly_perf; residual_.material_balance_eq[poly_pos_] -= superset(cq_s_poly, well_cells, nc); } }