diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a36b953e73d84ee57a310777d4b77c480b3e99a..fc0be3f2c0cdba9bf410a8940e8f7ee3e527eb22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ Differences Between DuMuX 3.2 and DuMuX 3.1 - __Van Genuchten__: Corrected VanGenuchten-Mualem exponent in the non-wetting saturation formula (`1/3` instead of `1/2` (or `l`, see above)) - __Van Genuchten__: Corrected VanGenuchten-Mualem implementation of `dkrn/dSw` - __AMGBackend__: The internal structure of the AMGBackend and the ParallelISTLHelper has been overhauled, as only used by the AMG, we did not make the changes backwards-compatible +- The global default parameters for linear solvers have been removed and moved to the class `LinearSolver`. +This only affects users that directly obtain this parameter via `getParam` somewhere in the code. - __Change matrix block arrangement for staggered models__: The matrix block structure has been adapted such that it complies with the literature standard, i.e., having the velocity block (C) on `M[0][0]` rather than on `M[1][1]`. This also requires re-arranging the submodels and properties in dumux-multidomain such that the face-related classes and vector entries now appear before the cell-centered ones. diff --git a/dumux/linear/istlsolverfactorybackend.hh b/dumux/linear/istlsolverfactorybackend.hh index ec261f841a579337ca44420f468075c9bf278bdb..3c5d9706d3f3c64d3be1b968e095de8cbd7c611c 100644 --- a/dumux/linear/istlsolverfactorybackend.hh +++ b/dumux/linear/istlsolverfactorybackend.hh @@ -80,7 +80,9 @@ public: { if (Dune::MPIHelper::getCollectiveCommunication().size() > 1) DUNE_THROW(Dune::InvalidStateException, "Using sequential constructor for parallel run. Use signature with gridView and dofMapper!"); - convertParameterTree(paramGroup); + + resetDefaultParameters(); + convertParameterTree_(paramGroup); } /*! @@ -96,7 +98,8 @@ public: : phelper_(std::make_shared<ParallelISTLHelper<GridView, AMGTraits>>(gridView, dofMapper)) , firstCall_(true) { - convertParameterTree(paramGroup); + resetDefaultParameters(); + convertParameterTree_(paramGroup); } /*! @@ -146,9 +149,21 @@ public: firstCall_ = false; return result_.converged; } + + //! reset some defaults for the solver parameters + void resetDefaultParameters() + { + params_["restart"] = "10"; + params_["maxit"] = "250"; + params_["reduction"] = "1e-13"; + params_["verbose"] = "0"; + params_["preconditioner.iterations"] = "1"; + params_["preconditioner.relaxation"] = "1.0"; + } + private: - void convertParameterTree(const std::string& paramGroup="") + void convertParameterTree_(const std::string& paramGroup="") { const auto& loggingTree = Parameters::getTree(); auto matchingGroups = loggingTree.getSubGroups("LinearSolver", paramGroup); diff --git a/dumux/linear/solver.hh b/dumux/linear/solver.hh index 328e9604e220fa8023e1bc5823ee420d21385555..822dee897cb22683239b7043fcf262f9d2cf92a4 100644 --- a/dumux/linear/solver.hh +++ b/dumux/linear/solver.hh @@ -52,11 +52,11 @@ public: LinearSolver(const std::string& paramGroup = "") : paramGroup_(paramGroup) { - verbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Verbosity"); - maxIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.MaxIterations"); - residReduction_ = getParamFromGroup<double>(paramGroup, "LinearSolver.ResidualReduction"); - relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation"); - precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations"); + verbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Verbosity", 0); + maxIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.MaxIterations", 250); + residReduction_ = getParamFromGroup<double>(paramGroup, "LinearSolver.ResidualReduction", 1e-13); + relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation", 1); + precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations", 1); } /*!