From 2b6163b5ff3642b777e47b995f9b52d67de98b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 17 Jun 2015 12:51:39 +0200 Subject: [PATCH 1/3] Use the base class model_param_ and avoid recreating it. --- .../SimulatorFullyImplicitBlackoilPolymer_impl.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp b/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp index 4957ee6cf..94a75bc8e 100644 --- a/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp +++ b/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp @@ -64,12 +64,9 @@ namespace Opm -> std::unique_ptr { typedef typename Traits::Model Model; - typedef typename Model::ModelParameters ModelParams; - ModelParams modelParams( BaseType::param_ ); - typedef NewtonSolver Solver; - auto model = std::unique_ptr(new Model(modelParams, + auto model = std::unique_ptr(new Model(BaseType::model_param_, BaseType::grid_, BaseType::props_, BaseType::geo_, From 32590ec07294acc012481013f365c35a7018d46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 18 Jun 2015 11:09:57 +0200 Subject: [PATCH 2/3] Use solver_param_ from base class. --- .../SimulatorFullyImplicitBlackoilPolymer_impl.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp b/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp index 94a75bc8e..8387819b6 100644 --- a/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp +++ b/opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp @@ -86,9 +86,7 @@ namespace Opm model->setThresholdPressures(BaseType::threshold_pressures_by_face_); } - typedef typename Solver::SolverParameters SolverParams; - SolverParams solverParams( BaseType::param_ ); - return std::unique_ptr(new Solver(solverParams, std::move(model))); + return std::unique_ptr(new Solver(BaseType::solver_param_, std::move(model))); } 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 3/3] 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); } }