From 07f61c2a2b370dcfa0a94c6686f07a7b2ded7854 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 15 May 2017 20:33:36 +0200 Subject: [PATCH] Add auxiliary module in BlackoilModelEbos constructor. Previously, we did this during assemble. Unfortunately, this resulted in the sparsity pattern being recomputed every time instead of just once for a non-linear solve. --- opm/autodiff/BlackoilModelEbos.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index 724be5820..ab4892b14 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -156,6 +156,15 @@ namespace Opm { { OPM_THROW(std::logic_error,"solver down cast to ISTLSolver failed"); } + + if ( param_.matrix_add_well_contributions_ ) + { + // This might be dangerous?! + ebosSimulator_.model().clearAuxiliaryModules(); + auto auxMod = std::make_shared >( wellModel().wells() ); + ebosSimulator_.model().addAuxiliaryModule(auxMod); + } + } bool isParallel() const @@ -354,15 +363,6 @@ namespace Opm { SimulatorReport assemble(const SimulatorTimerInterface& timer, const int iterationIdx) { - if ( param_.matrix_add_well_contributions_ ) - { - // This might be dangerous?! - ebosSimulator_.model().clearAuxiliaryModules(); - auto auxMod = std::make_shared >( wellModel().wells() ); - ebosSimulator_.model().addAuxiliaryModule(auxMod); - } - - // -------- Mass balance equations -------- ebosSimulator_.model().newtonMethod().setIterationIndex(iterationIdx); ebosSimulator_.problem().beginIteration();