From 512d18a66974b02bd267fdf81a5cf4ad6d0fa5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 1 Jun 2015 13:07:45 +0200 Subject: [PATCH] Create solver and model parameters only once. --- opm/autodiff/SimulatorBase.hpp | 5 +++++ opm/autodiff/SimulatorBase_impl.hpp | 13 ++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/opm/autodiff/SimulatorBase.hpp b/opm/autodiff/SimulatorBase.hpp index ed99bf23e..05e3e3da9 100644 --- a/opm/autodiff/SimulatorBase.hpp +++ b/opm/autodiff/SimulatorBase.hpp @@ -163,8 +163,13 @@ namespace Opm typedef RateConverter:: SurfaceToReservoirVoidage< BlackoilPropsAdInterface, std::vector > RateConverterType; + typedef typename Traits::Model Model; + typedef typename Model::ModelParameters ModelParameters; + typedef typename Solver::SolverParameters SolverParameters; const parameter::ParameterGroup param_; + ModelParameters model_param_; + SolverParameters solver_param_; // Observed objects. const Grid& grid_; diff --git a/opm/autodiff/SimulatorBase_impl.hpp b/opm/autodiff/SimulatorBase_impl.hpp index cbc1b9c26..d5b6ea344 100644 --- a/opm/autodiff/SimulatorBase_impl.hpp +++ b/opm/autodiff/SimulatorBase_impl.hpp @@ -38,6 +38,8 @@ namespace Opm OutputWriter& output_writer, const std::vector& threshold_pressures_by_face) : param_(param), + model_param_(param), + solver_param_(param), grid_(grid), props_(props), rock_comp_props_(rock_comp_props), @@ -332,12 +334,7 @@ namespace Opm auto SimulatorBase::createSolver(const Wells* wells) -> std::unique_ptr { - typedef typename Traits::Model Model; - typedef typename Model::ModelParameters ModelParams; - ModelParams modelParams( param_ ); - typedef NewtonSolver Solver; - - auto model = std::unique_ptr(new Model(modelParams, + auto model = std::unique_ptr(new Model(model_param_, grid_, props_, geo_, @@ -352,9 +349,7 @@ namespace Opm model->setThresholdPressures(threshold_pressures_by_face_); } - typedef typename Solver::SolverParameters SolverParams; - SolverParams solverParams( param_ ); - return std::unique_ptr(new Solver(solverParams, std::move(model))); + return std::unique_ptr(new Solver(solver_param_, std::move(model))); } template