diff --git a/opm/simulators/linalg/setupPropertyTree.cpp b/opm/simulators/linalg/setupPropertyTree.cpp index 5667ba191..9b8608e4e 100644 --- a/opm/simulators/linalg/setupPropertyTree.cpp +++ b/opm/simulators/linalg/setupPropertyTree.cpp @@ -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) { diff --git a/opm/simulators/linalg/setupPropertyTree.hpp b/opm/simulators/linalg/setupPropertyTree.hpp index 3c89ee8b0..688ac1e90 100644 --- a/opm/simulators/linalg/setupPropertyTree.hpp +++ b/opm/simulators/linalg/setupPropertyTree.hpp @@ -31,6 +31,7 @@ template 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 diff --git a/opm/simulators/linalg/setupPropertyTree_impl.hpp b/opm/simulators/linalg/setupPropertyTree_impl.hpp index 6f28cde33..58838e88b 100644 --- a/opm/simulators/linalg/setupPropertyTree_impl.hpp +++ b/opm/simulators/linalg/setupPropertyTree_impl.hpp @@ -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);