Commit a656a4bf authored by Dennis Gläser's avatar Dennis Gläser
Browse files

Merge branch 'feature/deprecate-old-preconditioner-params' into 'master'

Feature/deprecate old preconditioner params

Closes #825

See merge request !1890
parents f9671e2f 83566ad6
......@@ -301,14 +301,6 @@ private:
// parameters in the assembly group
defaultParams["Assembly.NumericDifferenceMethod"] = "1";
// parameters in the linear solver group
defaultParams["LinearSolver.GMResRestart"] = "10";
defaultParams["LinearSolver.MaxIterations"] = "250";
defaultParams["LinearSolver.PreconditionerIterations"] = "1";
defaultParams["LinearSolver.PreconditionerRelaxation"] = "1.0";
defaultParams["LinearSolver.ResidualReduction"] = "1e-13";
defaultParams["LinearSolver.Verbosity"] = "0";
// parameters in the problem group
defaultParams["Problem.EnableGravity"] = "true";
defaultParams["Problem.EnableInertiaTerms"] = "true";
......
......@@ -284,16 +284,9 @@ IstlSolverFactoryBackend<LinearSolverTraits>::dumuxToIstlSolverParams =
{"MaxOrthogonalizationVectors", "mmax"},
// preconditioner params
// we expect parameters in the subgroup "Preconditioner"
// there are some legacy param names that are still supported
// subgroup parameters overwrite legacy parameters
{"PreconditionerVerbosity", "preconditioner.verbosity"},
{"Preconditioner.Verbosity", "preconditioner.verbosity"},
{"PreconditionerType", "preconditioner.type"},
{"Preconditioner.Type", "preconditioner.type"},
{"PreconditionerIterations", "preconditioner.iterations"},
{"Preconditioner.Iterations", "preconditioner.iterations"},
{"PreconditionerRelaxation", "preconditioner.relaxation"},
{"Preconditioner.Relaxation", "preconditioner.relaxation"},
{"Preconditioner.ILUOrder", "preconditioner.n"},
{"Preconditioner.ILUResort", "preconditioner.resort"},
......
......@@ -88,7 +88,7 @@ public:
const std::string& modelParamGroup = "")
{
// get the restart threshold
const int restartGMRes = getParamFromGroup<double>(modelParamGroup, "LinearSolver.GMResRestart");
const int restartGMRes = getParamFromGroup<int>(modelParamGroup, "LinearSolver.GMResRestart", 10);
Preconditioner precond(A, s.precondIter(), s.relaxation());
......@@ -131,7 +131,7 @@ public:
const std::string& modelParamGroup = "")
{
// get the restart threshold
const int restartGMRes = getParamFromGroup<int>(modelParamGroup, "LinearSolver.GMResRestart");
const int restartGMRes = getParamFromGroup<int>(modelParamGroup, "LinearSolver.GMResRestart", 10);
Preconditioner precond(A, s.relaxation());
......
......@@ -46,9 +46,9 @@ public:
* - LinearSolver.Verbosity the verbosity level of the linear solver
* - LinearSolver.MaxIterations the maximum iterations of the solver
* - LinearSolver.ResidualReduction the residual reduction threshold, i.e. stopping criterion
* - LinearSolver.PreconditionerRelaxation precondition relaxation
* - LinearSolver.PreconditionerIterations the number of preconditioner iterations
* - LinearSolver.PreconditionerVerbosity the preconditioner verbosity level
* - LinearSolver.Preconditioner.Relaxation precondition relaxation
* - LinearSolver.Preconditioner.Iterations the number of preconditioner iterations
* - LinearSolver.Preconditioner.Verbosity the preconditioner verbosity level
*/
LinearSolver(const std::string& paramGroup = "")
: paramGroup_(paramGroup)
......@@ -56,9 +56,41 @@ public:
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);
precondVerbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerVerbosity", 0);
// for deprecation period we ask also for the "old" parameters but print a warning
// the "new" style parameter takes precedence
// TODO: Remove all this code after 3.2 and use commented code below
if (hasParamInGroup(paramGroup, "LinearSolver.PreconditionerRelaxation"))
{
std::cerr << "Deprecation warning: parameter LinearSolver.PreconditionerRelaxation is deprecated and will be removed after 3.2. "
<< "Use LinearSolver.Preconditioner.Relaxation instead (Preconditioner subgroup)." << std::endl;
relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.PreconditionerRelaxation");
}
else
relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.Preconditioner.Relaxation", 1);
if (hasParamInGroup(paramGroup, "LinearSolver.PreconditionerIterations"))
{
std::cerr << "Deprecation warning: parameter LinearSolver.PreconditionerIterations is deprecated and will be removed after 3.2. "
<< "Use LinearSolver.Preconditioner.Iterations instead (Preconditioner subgroup)." << std::endl;
precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerIterations");
}
else
precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Preconditioner.Iterations", 1);
if (hasParamInGroup(paramGroup, "LinearSolver.PreconditionerVerbosity"))
{
std::cerr << "Deprecation warning: parameter LinearSolver.PreconditionerVerbosity is deprecated and will be removed after 3.2. "
<< "Use LinearSolver.Preconditioner.Verbosity instead (Preconditioner subgroup)." << std::endl;
precondVerbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.PreconditionerVerbosity");
}
else
precondVerbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Preconditioner.Verbosity", 0);
// TODO: use this code instead of the above code after release 3.2
// relaxation_ = getParamFromGroup<double>(paramGroup, "LinearSolver.Preconditioner.Relaxation", 1);
// precondIter_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Preconditioner.Iterations", 1);
// precondVerbosity_ = getParamFromGroup<int>(paramGroup, "LinearSolver.Preconditioner.Verbosity", 0);
}
/*!
......
......@@ -490,7 +490,7 @@ void MimeticPressure2P<TypeTag>::solve()
{
using Solver = GetPropType<TypeTag, Properties::LinearSolver>;
auto verboseLevelSolver = getParam<int>("LinearSolver.Verbosity");
auto verboseLevelSolver = getParam<int>("LinearSolver.Verbosity", 0);
if (verboseLevelSolver)
std::cout << "MimeticPressure2P: solve for pressure" << std::endl;
......
......@@ -504,7 +504,7 @@ void MimeticPressure2PAdaptive<TypeTag>::solve()
{
using Solver = GetPropType<TypeTag, Properties::LinearSolver>;
int verboseLevelSolver = getParam<int>("LinearSolver.Verbosity");
int verboseLevelSolver = getParam<int>("LinearSolver.Verbosity", 0);
if (verboseLevelSolver)
std::cout << "MimeticPressure2PAdaptive: solve for pressure" << std::endl;
......
......@@ -527,7 +527,7 @@ void FVPressure<TypeTag>::solve()
{
using Solver = GetPropType<TypeTag, Properties::LinearSolver>;
int verboseLevelSolver = getParam<int>("LinearSolver.Verbosity");
int verboseLevelSolver = getParam<int>("LinearSolver.Verbosity", 0);
if (verboseLevelSolver)
std::cout << __FILE__ << ": solve for pressure" << std::endl;
......
......@@ -11,5 +11,5 @@ EnableGravity = false
LiquidDensity = 1.0
LiquidKinematicViscosity = 1.0
[LinearSolver]
PreconditionerIterations = 2
[LinearSolver.Preconditioner]
Iterations = 2
Supports Markdown
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