diff --git a/opm/autodiff/ISTLSolver.hpp b/opm/autodiff/ISTLSolver.hpp index ca2a12e3d..d667b1e97 100644 --- a/opm/autodiff/ISTLSolver.hpp +++ b/opm/autodiff/ISTLSolver.hpp @@ -418,18 +418,7 @@ namespace Opm } const double relax = parameters_.ilu_relaxation_; - if ( ! parameters_.use_cpr_ ) - { - typedef typename CPRSelectorType::AMG AMG; - std::unique_ptr< AMG > amg; - - // Construct preconditioner. - constructAMGPrecond( linearOperator, parallelInformation_arg, amg, opA, relax ); - - // Solve. - solve(linearOperator, x, istlb, *sp, *amg, result); - } - else + if ( parameters_.use_cpr_ ) { using Matrix = typename MatrixOperator::matrix_type; using CouplingMetric = Dune::Amg::Diagonal; @@ -443,6 +432,17 @@ namespace Opm Criterion crit(15, 2000); constructAMGPrecond( linearOperator, parallelInformation_arg, amg, opA, relax ); + // Solve. + solve(linearOperator, x, istlb, *sp, *amg, result); + } + else + { + typedef typename CPRSelectorType::AMG AMG; + std::unique_ptr< AMG > amg; + + // Construct preconditioner. + constructAMGPrecond( linearOperator, parallelInformation_arg, amg, opA, relax ); + // Solve. solve(linearOperator, x, istlb, *sp, *amg, result); }