mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-16 16:31:55 -06:00
Added simple defaults for flexible solver: current options added ilu0, cpr_quasiimpes, cpr_trueimpes, file (genneal configuration)
This commit 0c62c8442
cherry-picked and slightly cleaned up and
adapted to recent changes.
This commit is contained in:
parent
90b22d8713
commit
2388a9b551
@ -55,6 +55,7 @@ SET_INT_PROP(EclFlowProblemSimple, CprMaxEllIter, 1);
|
||||
SET_INT_PROP(EclFlowProblemSimple, CprEllSolvetype, 3);
|
||||
SET_INT_PROP(EclFlowProblemSimple, CprReuseSetup, 3);
|
||||
SET_INT_PROP(EclFlowProblemSimple, CprSolverVerbose, 0);
|
||||
SET_STRING_PROP(EclFlowProblemSimple, LinearSolverConfiguration, "file");
|
||||
SET_STRING_PROP(EclFlowProblemSimple, SystemStrategy, "quasiimpes");
|
||||
END_PROPERTIES
|
||||
|
||||
|
@ -66,6 +66,7 @@ NEW_PROP_TAG(CprUseDrs);
|
||||
NEW_PROP_TAG(CprMaxEllIter);
|
||||
NEW_PROP_TAG(CprEllSolvetype);
|
||||
NEW_PROP_TAG(CprReuseSetup);
|
||||
NEW_PROP_TAG(LinearSolverConfiguration);
|
||||
NEW_PROP_TAG(LinearSolverConfigurationJsonFile);
|
||||
NEW_PROP_TAG(UseGpu);
|
||||
|
||||
@ -92,6 +93,7 @@ SET_BOOL_PROP(FlowIstlSolverParams, CprUseDrs, false);
|
||||
SET_INT_PROP(FlowIstlSolverParams, CprMaxEllIter, 20);
|
||||
SET_INT_PROP(FlowIstlSolverParams, CprEllSolvetype, 0);
|
||||
SET_INT_PROP(FlowIstlSolverParams, CprReuseSetup, 0);
|
||||
SET_STRING_PROP(FlowIstlSolverParams, LinearSolverConfiguration, "ilu0");
|
||||
SET_STRING_PROP(FlowIstlSolverParams, LinearSolverConfigurationJsonFile, "none");
|
||||
SET_BOOL_PROP(FlowIstlSolverParams, UseGpu, false);
|
||||
|
||||
@ -164,6 +166,7 @@ namespace Opm
|
||||
bool use_cpr_;
|
||||
std::string system_strategy_;
|
||||
bool scale_linear_system_;
|
||||
std::string linear_solver_configuration_;
|
||||
std::string linear_solver_configuration_json_file_;
|
||||
bool use_gpu_;
|
||||
|
||||
@ -192,6 +195,7 @@ namespace Opm
|
||||
cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag, int, CprMaxEllIter);
|
||||
cpr_ell_solvetype_ = EWOMS_GET_PARAM(TypeTag, int, CprEllSolvetype);
|
||||
cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag, int, CprReuseSetup);
|
||||
linear_solver_configuration_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolverConfiguration);
|
||||
linear_solver_configuration_json_file_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolverConfigurationJsonFile);
|
||||
use_gpu_ = EWOMS_GET_PARAM(TypeTag, bool, UseGpu);
|
||||
}
|
||||
@ -220,6 +224,7 @@ namespace Opm
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, CprMaxEllIter, "MaxIterations of the elliptic pressure part of the cpr solver");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, CprEllSolvetype, "Solver type of elliptic pressure solve (0: bicgstab, 1: cg, 2: only amg preconditioner)");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, CprReuseSetup, "Reuse Amg Setup");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolverConfiguration, "Configuration of solver valid is: ilu0 (default), cpr_quasiimpes, cpr_trueimpes or file (given by LinserSolverConfigurationJsonFile) ");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolverConfigurationJsonFile, "Filename of JSON configuration for flexible linear solver system.");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, bool, UseGpu, "Use GPU cusparseSolver as the linear solver");
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <opm/simulators/linalg/FlexibleSolver.hpp>
|
||||
#include <opm/simulators/linalg/setupPropertyTree.hpp>
|
||||
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
@ -226,6 +228,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// Zero out off-diagonal blocks on rows corresponding to overlap cells
|
||||
/// Diagonal blocks on ovelap rows are set to diag(1.0).
|
||||
void makeOverlapRowsInvalid(MatrixType& matrix) const
|
||||
@ -289,7 +292,6 @@ protected:
|
||||
return weights;
|
||||
}
|
||||
|
||||
|
||||
const Simulator& simulator_;
|
||||
|
||||
std::unique_ptr<SolverType> solver_;
|
||||
|
@ -36,12 +36,50 @@ boost::property_tree::ptree
|
||||
setupPropertyTree(const FlowLinearSolverParameters& p)
|
||||
{
|
||||
boost::property_tree::ptree prm;
|
||||
if (p.linear_solver_configuration_ == "file") {
|
||||
#if BOOST_VERSION / 100 % 1000 > 48
|
||||
if (p.linear_solver_configuration_json_file_ != "none") {
|
||||
boost::property_tree::read_json(p.linear_solver_configuration_json_file_, prm);
|
||||
} else
|
||||
if (p.linear_solver_configuration_json_file_ == "none"){
|
||||
throw std::runtime_error("No linear-solver-configuration-json-file given for linear-solver-configuration=file ");
|
||||
}else{
|
||||
boost::property_tree::read_json(p.linear_solver_configuration_json_file_, prm);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
} else if((p.linear_solver_configuration_ == "cpr_trueimpes") ||
|
||||
(p.linear_solver_configuration_ == "cpr_quasiimpes")){
|
||||
prm.put("tol", p.linear_solver_reduction_);
|
||||
prm.put("maxiter", p.linear_solver_maxiter_);//should we change this
|
||||
prm.put("verbosity", p.linear_solver_verbosity_);
|
||||
prm.put("solver", "bicgstab");
|
||||
prm.put("preconditioner.type", "cpr");
|
||||
prm.put("preconditioner.weight_filename", "cpr_weights.txt");
|
||||
prm.put("preconditioner.weight_type","quasiimpes");
|
||||
prm.put("preconditioner.finesmoother.type", "ParOverILU0");
|
||||
prm.put("preconditioner.finesmoother.relaxation", 1.0);
|
||||
prm.put("preconditioner.pressure_var_index",1);
|
||||
prm.put("preconditioner.verbosity",0);
|
||||
prm.put("preconditioner.coarsesolver.maxiter",1);
|
||||
prm.put("preconditioner.coarsesolver.tol",1e-1);
|
||||
prm.put("preconditioner.coarsesolver.solver","loopsolver");
|
||||
prm.put("preconditioner.coarsesolver.verbosity",0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.type","amg");
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.alpha",0.333333333333);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.relaxation",1.0);
|
||||
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.smoother","ILU0");
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.verbosity",0);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.maxlevel",15);
|
||||
prm.put("preconditioner.coarsesolver.preconditioner.skip_isolated",0);
|
||||
if(p.linear_solver_configuration_ == "cpr_trueimpes"){
|
||||
prm.put("preconditioner.weight_type","trueimpes");
|
||||
}
|
||||
} else {
|
||||
if(p.linear_solver_configuration_ != "ilu0"){
|
||||
throw std::runtime_error("Not a valid setting for linear_solver_configuration");
|
||||
}
|
||||
prm.put("tol", p.linear_solver_reduction_);
|
||||
prm.put("maxiter", p.linear_solver_maxiter_);
|
||||
prm.put("verbosity", p.linear_solver_verbosity_);
|
||||
|
Loading…
Reference in New Issue
Block a user