Added simple defaults for flexible solver: current options added ilu0, cpr_quasiimpes, cpr_trueimpes, file (genneal configuration)

This commit is contained in:
hnil 2019-08-22 21:14:48 +02:00
parent 8201eabfef
commit 0c62c84421
4 changed files with 49 additions and 4 deletions

View File

@ -59,6 +59,7 @@ SET_INT_PROP(EclFlowProblemSimple, CprMaxEllIter, 1);
SET_INT_PROP(EclFlowProblemSimple, CprEllSolvetype, 3); SET_INT_PROP(EclFlowProblemSimple, CprEllSolvetype, 3);
SET_INT_PROP(EclFlowProblemSimple, CprReuseSetup, 3); SET_INT_PROP(EclFlowProblemSimple, CprReuseSetup, 3);
SET_INT_PROP(EclFlowProblemSimple, CprSolverVerbose, 0); SET_INT_PROP(EclFlowProblemSimple, CprSolverVerbose, 0);
SET_STRING_PROP(EclFlowProblemSimple, LinearSolverConfiguration, "file");
SET_STRING_PROP(EclFlowProblemSimple, SystemStrategy, "quasiimpes"); SET_STRING_PROP(EclFlowProblemSimple, SystemStrategy, "quasiimpes");
END_PROPERTIES END_PROPERTIES

View File

@ -66,6 +66,7 @@ NEW_PROP_TAG(CprUseDrs);
NEW_PROP_TAG(CprMaxEllIter); NEW_PROP_TAG(CprMaxEllIter);
NEW_PROP_TAG(CprEllSolvetype); NEW_PROP_TAG(CprEllSolvetype);
NEW_PROP_TAG(CprReuseSetup); NEW_PROP_TAG(CprReuseSetup);
NEW_PROP_TAG(LinearSolverConfiguration);
NEW_PROP_TAG(LinearSolverConfigurationJsonFile); NEW_PROP_TAG(LinearSolverConfigurationJsonFile);
SET_SCALAR_PROP(FlowIstlSolverParams, LinearSolverReduction, 1e-2); SET_SCALAR_PROP(FlowIstlSolverParams, LinearSolverReduction, 1e-2);
@ -91,6 +92,7 @@ SET_BOOL_PROP(FlowIstlSolverParams, CprUseDrs, false);
SET_INT_PROP(FlowIstlSolverParams, CprMaxEllIter, 20); SET_INT_PROP(FlowIstlSolverParams, CprMaxEllIter, 20);
SET_INT_PROP(FlowIstlSolverParams, CprEllSolvetype, 0); SET_INT_PROP(FlowIstlSolverParams, CprEllSolvetype, 0);
SET_INT_PROP(FlowIstlSolverParams, CprReuseSetup, 0); SET_INT_PROP(FlowIstlSolverParams, CprReuseSetup, 0);
SET_STRING_PROP(FlowIstlSolverParams, LinearSolverConfiguration, "ilu0");
SET_STRING_PROP(FlowIstlSolverParams, LinearSolverConfigurationJsonFile, "none"); SET_STRING_PROP(FlowIstlSolverParams, LinearSolverConfigurationJsonFile, "none");
@ -162,6 +164,7 @@ namespace Opm
bool use_cpr_; bool use_cpr_;
std::string system_strategy_; std::string system_strategy_;
bool scale_linear_system_; bool scale_linear_system_;
std::string linear_solver_configuration_;
std::string linear_solver_configuration_json_file_; std::string linear_solver_configuration_json_file_;
template <class TypeTag> template <class TypeTag>
@ -189,6 +192,7 @@ namespace Opm
cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag, int, CprMaxEllIter); cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag, int, CprMaxEllIter);
cpr_ell_solvetype_ = EWOMS_GET_PARAM(TypeTag, int, CprEllSolvetype); cpr_ell_solvetype_ = EWOMS_GET_PARAM(TypeTag, int, CprEllSolvetype);
cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag, int, CprReuseSetup); 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); linear_solver_configuration_json_file_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolverConfigurationJsonFile);
} }
@ -216,6 +220,7 @@ namespace Opm
EWOMS_REGISTER_PARAM(TypeTag, int, CprMaxEllIter, "MaxIterations of the elliptic pressure part of the cpr solver"); 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, 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, 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, std::string, LinearSolverConfigurationJsonFile, "Filename of JSON configuration for flexible linear solver system.");
} }

View File

@ -24,7 +24,7 @@
#include <opm/simulators/linalg/findOverlapRowsAndColumns.hpp> #include <opm/simulators/linalg/findOverlapRowsAndColumns.hpp>
#include <opm/simulators/linalg/FlexibleSolver.hpp> #include <opm/simulators/linalg/FlexibleSolver.hpp>
#include <opm/simulators/linalg/setupPropertyTree.hpp> #include <opm/simulators/linalg/setupPropertyTree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -230,6 +230,7 @@ public:
} }
protected: protected:
/// Zero out off-diagonal blocks on rows corresponding to overlap cells /// Zero out off-diagonal blocks on rows corresponding to overlap cells
/// Diagonal blocks on ovelap rows are set to diag(1e100). /// Diagonal blocks on ovelap rows are set to diag(1e100).
void makeOverlapRowsInvalid(MatrixType& matrix) const void makeOverlapRowsInvalid(MatrixType& matrix) const
@ -296,7 +297,6 @@ protected:
return weights; return weights;
} }
const Simulator& simulator_; const Simulator& simulator_;
std::unique_ptr<SolverType> solver_; std::unique_ptr<SolverType> solver_;

View File

@ -35,9 +35,48 @@ boost::property_tree::ptree
setupPropertyTree(const FlowLinearSolverParameters& p) setupPropertyTree(const FlowLinearSolverParameters& p)
{ {
boost::property_tree::ptree prm; boost::property_tree::ptree prm;
if (p.linear_solver_configuration_json_file_ != "none") { if (p.linear_solver_configuration_ == "file") {
boost::property_tree::read_json(p.linear_solver_configuration_json_file_, prm); 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);
}
} 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 { } 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("tol", p.linear_solver_reduction_);
prm.put("maxiter", p.linear_solver_maxiter_); prm.put("maxiter", p.linear_solver_maxiter_);
prm.put("verbosity", p.linear_solver_verbosity_); prm.put("verbosity", p.linear_solver_verbosity_);