Commit 76563518 authored by Timo Koch's avatar Timo Koch
Browse files

[params] Move global defaults for linear solver to local defaults in the solver class

parent d8d8390c
...@@ -16,6 +16,8 @@ Differences Between DuMuX 3.2 and DuMuX 3.1 ...@@ -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 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` - __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 - __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]` - __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. 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.
......
...@@ -80,7 +80,9 @@ public: ...@@ -80,7 +80,9 @@ public:
{ {
if (Dune::MPIHelper::getCollectiveCommunication().size() > 1) if (Dune::MPIHelper::getCollectiveCommunication().size() > 1)
DUNE_THROW(Dune::InvalidStateException, "Using sequential constructor for parallel run. Use signature with gridView and dofMapper!"); 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: ...@@ -96,7 +98,8 @@ public:
: phelper_(std::make_shared<ParallelISTLHelper<GridView, AMGTraits>>(gridView, dofMapper)) : phelper_(std::make_shared<ParallelISTLHelper<GridView, AMGTraits>>(gridView, dofMapper))
, firstCall_(true) , firstCall_(true)
{ {
convertParameterTree(paramGroup); resetDefaultParameters();
convertParameterTree_(paramGroup);
} }
/*! /*!
...@@ -146,9 +149,21 @@ public: ...@@ -146,9 +149,21 @@ public:
firstCall_ = false; firstCall_ = false;
return result_.converged; 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: private:
void convertParameterTree(const std::string& paramGroup="") void convertParameterTree_(const std::string& paramGroup="")
{ {
const auto& loggingTree = Parameters::getTree(); const auto& loggingTree = Parameters::getTree();
auto matchingGroups = loggingTree.getSubGroups("LinearSolver", paramGroup); auto matchingGroups = loggingTree.getSubGroups("LinearSolver", paramGroup);
......
...@@ -52,11 +52,11 @@ public: ...@@ -52,11 +52,11 @@ public:
LinearSolver(const std::string& paramGroup = "") LinearSolver(const std::string& paramGroup = "")
: paramGroup_(paramGroup) : paramGroup_(paramGroup)
{ {
verbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Verbosity"); verbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Verbosity", 0);
maxIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.MaxIterations"); maxIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.MaxIterations", 250);
residReduction_ = getParamFromGroup<double>(paramGroup, "LinearSolver.ResidualReduction"); residReduction_ = getParamFromGroup<double>(paramGroup, "LinearSolver.ResidualReduction", 1e-13);
relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation"); relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation", 1);
precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations"); precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations", 1);
} }
/*! /*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment