mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Adjust default behaviours for CPR variants.
- Remove two unused parameters. CprEllSolvetype is never used, and CprEllMaxIter is not used correctly as is (if used, it should change the maximum iterations of the coarse solver, not the repeats of the preconditioner) and is better left for JSON file customization. - Make the default AMG setup for "cpr" (including "cpr_trueimpes" and "cpr_quasiimpes") match the setup for "cprw". In particular, beta = 0.0 (not 1e-4) and prolongationdamping = 1.0 (not 1.6). - Just as we override the default maximum number of linear iterations for cpr and cprw (unless the user actually specified on the command line) to 20 instead of 100, we change the default reduction to be 0.005 instead of 0.01.
This commit is contained in:
@@ -38,8 +38,8 @@ namespace Opm
|
||||
/// from file the data in the JSON file will override any other options.
|
||||
PropertyTree
|
||||
setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters to potentially override.
|
||||
bool LinearSolverMaxIterSet,
|
||||
bool CprMaxEllIterSet)
|
||||
bool linearSolverMaxIterSet,
|
||||
bool linearSolverReductionSet)
|
||||
{
|
||||
std::string conf = p.linsolver_;
|
||||
|
||||
@@ -68,22 +68,26 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
|
||||
// Treat "cpr" as short cut for the true IMPES variant.
|
||||
conf = "cpr_trueimpes";
|
||||
}
|
||||
if (!LinearSolverMaxIterSet) {
|
||||
if (!linearSolverMaxIterSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.linear_solver_maxiter_ = 20;
|
||||
}
|
||||
if (!CprMaxEllIterSet) {
|
||||
if (!linearSolverReductionSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.cpr_max_ell_iter_ = 1;
|
||||
p.linear_solver_reduction_ = 0.005;
|
||||
}
|
||||
return setupCPR(conf, p);
|
||||
}
|
||||
|
||||
if ((conf == "cprw")) {
|
||||
if (!LinearSolverMaxIterSet) {
|
||||
if (!linearSolverMaxIterSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.linear_solver_maxiter_ = 20;
|
||||
}
|
||||
if (!linearSolverReductionSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.linear_solver_reduction_ = 0.005;
|
||||
}
|
||||
return setupCPRW(conf, p);
|
||||
}
|
||||
|
||||
@@ -145,7 +149,7 @@ setupCPRW(const std::string& /*conf*/, const FlowLinearSolverParameters& p)
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.type", "amg"s);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.alpha", 0.333333333333);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.relaxation", 1.0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.iterations", p.cpr_max_ell_iter_);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.iterations", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.coarsenTarget", 1200);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.pre_smooth", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.post_smooth", 1);
|
||||
@@ -191,11 +195,11 @@ setupCPR(const std::string& conf, const FlowLinearSolverParameters& p)
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.type", "amg"s);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.alpha", 0.333333333333);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.relaxation", 1.0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.iterations", p.cpr_max_ell_iter_);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.iterations", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.coarsenTarget", 1200);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.pre_smooth", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.post_smooth", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.beta", 1e-5);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.beta", 0.0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.smoother", "ILU0"s);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.verbosity", 0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.maxlevel", 15);
|
||||
@@ -204,7 +208,7 @@ setupCPR(const std::string& conf, const FlowLinearSolverParameters& p)
|
||||
// graph might be unsymmetric and hence not supported by the PTScotch/ParMetis
|
||||
// calls in DUNE. Accumulating to 1 skips PTScotch/ParMetis
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.accumulate", 1);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.prolongationdamping", 1.6);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.prolongationdamping", 1.0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.maxdistance", 2);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.maxconnectivity", 15);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.maxaggsize", 6);
|
||||
|
||||
Reference in New Issue
Block a user