diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh index 8e6e2637d7678dc9758630d635b2e720a57ba157..a3949028bc37a566498f0f45a89f545cf8e676a9 100644 --- a/dumux/common/parameters.hh +++ b/dumux/common/parameters.hh @@ -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"; diff --git a/dumux/linear/istlsolverfactorybackend.hh b/dumux/linear/istlsolverfactorybackend.hh index d6e7e11b89ea129d4aab9916be224b628c0ae9ab..5fac31dacff2be4dc90d3628e117477f872f3c80 100644 --- a/dumux/linear/istlsolverfactorybackend.hh +++ b/dumux/linear/istlsolverfactorybackend.hh @@ -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"}, diff --git a/dumux/linear/seqsolverbackend.hh b/dumux/linear/seqsolverbackend.hh index a5c75b93513d087136afe23de54641f22228ddac..c52132bec4514986dd3bc5ed4527c680c606bf11 100644 --- a/dumux/linear/seqsolverbackend.hh +++ b/dumux/linear/seqsolverbackend.hh @@ -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()); diff --git a/dumux/linear/solver.hh b/dumux/linear/solver.hh index 93d102b4953a71538fbd76a0f3d978a6f7a53f7c..943545c42abe841a73c228f88dc9bb4730019af3 100644 --- a/dumux/linear/solver.hh +++ b/dumux/linear/solver.hh @@ -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); } /*! diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh index 2bec024454d46e4aafcc770d0567650c5f66c33b..4160138ba7ceb1a62381727359771ea4f90d4716 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh @@ -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; diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh index 3641886bd40b2891c594c9121bd7312973f89a07..a774ed7b1019b4cfc1a516a35195eca3b6a0f887 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh @@ -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; diff --git a/dumux/porousmediumflow/sequential/cellcentered/pressure.hh b/dumux/porousmediumflow/sequential/cellcentered/pressure.hh index 12eacf2fea302f25272e4662c2a3e6af27645500..9d9df3d381132c344d87252d471237d536d6b57c 100644 --- a/dumux/porousmediumflow/sequential/cellcentered/pressure.hh +++ b/dumux/porousmediumflow/sequential/cellcentered/pressure.hh @@ -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; diff --git a/test/porousmediumflow/1p/sequential/test_diffusion.input b/test/porousmediumflow/1p/sequential/test_diffusion.input index c78c3672d9ad7dd515e1bdd067be356ad7f2e967..bb3e7d6221129e591e0c489675b03caa5dd7e166 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusion.input +++ b/test/porousmediumflow/1p/sequential/test_diffusion.input @@ -11,5 +11,5 @@ EnableGravity = false LiquidDensity = 1.0 LiquidKinematicViscosity = 1.0 -[LinearSolver] -PreconditionerIterations = 2 +[LinearSolver.Preconditioner] +Iterations = 2