Add "amg" option to --linear-solver-configuration.

This commit is contained in:
Atgeirr Flø Rasmussen 2020-10-11 09:31:48 +02:00
parent 842afd312e
commit 30a4fe55b0
3 changed files with 30 additions and 0 deletions

View File

@ -64,6 +64,31 @@ setupCPR(const std::string& conf, const FlowLinearSolverParameters& p)
return prm;
}
boost::property_tree::ptree
setupAMG([[maybe_unused]] const std::string& conf, const FlowLinearSolverParameters& p)
{
boost::property_tree::ptree prm;
prm.put("tol", p.linear_solver_reduction_);
prm.put("maxiter", p.linear_solver_maxiter_);
prm.put("verbosity", p.linear_solver_verbosity_);
prm.put("solver", "bicgstab");
prm.put("preconditioner.type", "amg");
prm.put("preconditioner.alpha", 0.333333333333);
prm.put("preconditioner.relaxation", 1.0);
prm.put("preconditioner.iterations", 20);
prm.put("preconditioner.coarsenTarget", 1200);
prm.put("preconditioner.pre_smooth", 1);
prm.put("preconditioner.post_smooth", 1);
prm.put("preconditioner.beta", 1e-5);
prm.put("preconditioner.smoother", "ILU0");
prm.put("preconditioner.verbosity", 0);
prm.put("preconditioner.maxlevel", 15);
prm.put("preconditioner.skip_isolated", 0);
return prm;
}
boost::property_tree::ptree
setupILU([[maybe_unused]] const std::string& conf, const FlowLinearSolverParameters& p)
{

View File

@ -31,6 +31,7 @@ template<class TypeTag>
boost::property_tree::ptree setupPropertyTree(FlowLinearSolverParameters p);
boost::property_tree::ptree setupCPR(const std::string& conf, const FlowLinearSolverParameters& p);
boost::property_tree::ptree setupAMG(const std::string& conf, const FlowLinearSolverParameters& p);
boost::property_tree::ptree setupILU(const std::string& conf, const FlowLinearSolverParameters& p);
} // namespace Opm

View File

@ -75,6 +75,10 @@ setupPropertyTree(FlowLinearSolverParameters p) // Note: copying the parameters
return setupCPR(conf, p);
}
if (conf == "amg") {
return setupAMG(conf, p);
}
// Use ILU0 configuration.
if (conf == "ilu0") {
return setupILU(conf, p);