From d5577f634d0eab0b4e4a2797c546518ad86a2e44 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 7 May 2015 12:47:05 +0200 Subject: [PATCH] Changing the default parameters for SolverParameter To be more consistent with the OPM-autodiff. And also min_iter_ was added. --- .../FullyImplicitBlackoilPolymerSolver.hpp | 4 +++- .../FullyImplicitBlackoilPolymerSolver_impl.hpp | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver.hpp b/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver.hpp index 541ab69c2..b3f62257e 100644 --- a/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver.hpp +++ b/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver.hpp @@ -76,7 +76,8 @@ namespace Opm { double tolerance_mb_; double tolerance_cnv_; double tolerance_wells_; - int max_iter_; + int max_iter_; // max newton iterations + int min_iter_; // min newton iterations SolverParameter( const parameter::ParameterGroup& param ); SolverParameter(); @@ -440,6 +441,7 @@ namespace Opm { double relaxIncrement() const { return param_.relax_increment_; }; double relaxRelTol() const { return param_.relax_rel_tol_; }; double maxIter() const { return param_.max_iter_; } + double minIter() const { return param_.min_iter_; } double maxResidualAllowed() const { return param_.max_residual_allowed_; } }; diff --git a/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver_impl.hpp b/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver_impl.hpp index f285c4650..688faaba4 100644 --- a/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver_impl.hpp +++ b/opm/polymer/fullyimplicit/FullyImplicitBlackoilPolymerSolver_impl.hpp @@ -159,11 +159,13 @@ namespace detail { relax_max_ = 0.5; relax_increment_ = 0.1; relax_rel_tol_ = 0.2; - max_iter_ = 15; - max_residual_allowed_ = std::numeric_limits< double >::max(); - tolerance_mb_ = 1.0e-7; - tolerance_cnv_ = 1.0e-3; - tolerance_wells_ = 1./Opm::unit::day; + max_iter_ = 15; // not more then 15 its by default + min_iter_ = 1; // Default to always do at least one nonlinear iteration. + max_residual_allowed_ = 1e7; + tolerance_mb_ = 1.0e-5; + tolerance_cnv_ = 1.0e-2; + tolerance_wells_ = 5.0e-1; + } template @@ -187,6 +189,7 @@ namespace detail { dr_max_rel_ = param.getDefault("dr_max_rel", dr_max_rel_); relax_max_ = param.getDefault("relax_max", relax_max_); max_iter_ = param.getDefault("max_iter", max_iter_); + min_iter_ = param.getDefault("min_iter", min_iter_); max_residual_allowed_ = param.getDefault("max_residual_allowed", max_residual_allowed_); tolerance_mb_ = param.getDefault("tolerance_mb", tolerance_mb_); @@ -328,7 +331,7 @@ namespace detail { const enum RelaxType relaxtype = relaxType(); int linearIterations = 0; - while ((!converged) && (it < maxIter())) { + while ((!converged && (it < maxIter())) || (minIter() > it)) { V dx = solveJacobianSystem(); // store number of linear iterations used