Add cpr_trueimpesanalytic option for LinearSolver parameter.

This commit is contained in:
Atgeirr Flø Rasmussen 2024-01-24 11:53:11 +01:00
parent 9b57cbce96
commit 7c2f01996a
3 changed files with 7 additions and 5 deletions

View File

@ -307,7 +307,7 @@ namespace Opm
EWOMS_REGISTER_PARAM(TypeTag, bool, UseGmres, "Use GMRES as the linear solver");
EWOMS_REGISTER_PARAM(TypeTag, bool, LinearSolverIgnoreConvergenceFailure, "Continue with the simulation like nothing happened after the linear solver did not converge");
EWOMS_REGISTER_PARAM(TypeTag, bool, ScaleLinearSystem, "Scale linear system according to equation scale and primary variable types");
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolver, "Configuration of solver. Valid options are: ilu0 (default), dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, cpr_trueimpes, amg or hybrid (experimental). Alternatively, you can request a configuration to be read from a JSON file by giving the filename here, ending with '.json.'");
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolver, "Configuration of solver. Valid options are: ilu0 (default), dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). Alternatively, you can request a configuration to be read from a JSON file by giving the filename here, ending with '.json.'");
EWOMS_REGISTER_PARAM(TypeTag, bool, LinearSolverPrintJsonDefinition, "Write the JSON definition of the linear solver setup to the DBG file.");
EWOMS_REGISTER_PARAM(TypeTag, int, CprReuseSetup, "Reuse preconditioner setup. Valid options are 0: recreate the preconditioner for every linear solve, 1: recreate once every timestep, 2: recreate if last linear solve took more than 10 iterations, 3: never recreate, 4: recreated every CprReuseInterval");
EWOMS_REGISTER_PARAM(TypeTag, int, CprReuseInterval, "Reuse preconditioner interval. Used when CprReuseSetup is set to 4, then the preconditioner will be fully recreated instead of reused every N linear solve, where N is this parameter.");

View File

@ -585,7 +585,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
OPM_THROW(std::invalid_argument,
"Weights type " + weightsType +
"not implemented for cpr."
" Please use quasiimpes or trueimpes.");
" Please use quasiimpes, trueimpes or trueimpesanalytic.");
}
}
return weightsCalculator;

View File

@ -63,7 +63,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
}
// Use CPR configuration.
if ((conf == "cpr_trueimpes") || (conf == "cpr_quasiimpes")) {
if ((conf == "cpr_trueimpes") || (conf == "cpr_quasiimpes") || (conf == "cpr_trueimpesanalytic")) {
if (!linearSolverMaxIterSet) {
// Use our own default unless it was explicitly overridden by user.
p.linear_solver_maxiter_ = 20;
@ -115,7 +115,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
// No valid configuration option found.
OPM_THROW(std::invalid_argument,
conf + " is not a valid setting for --linear-solver-configuration."
" Please use ilu0, dilu, cpr, cpr_trueimpes, cpr_quasiimpes or isai");
" Please use ilu0, dilu, cpr, cprw, cpr_trueimpes, cpr_quasiimpes, cpr_trueimpesanalytic or isai");
}
std::string getSolverString(const FlowLinearSolverParameters& p)
@ -186,8 +186,10 @@ setupCPR(const std::string& conf, const FlowLinearSolverParameters& p)
prm.put("preconditioner.type", "cpr"s);
if (conf == "cpr_quasiimpes") {
prm.put("preconditioner.weight_type", "quasiimpes"s);
} else {
} else if (conf == "cpr_trueimpes") {
prm.put("preconditioner.weight_type", "trueimpes"s);
} else {
prm.put("preconditioner.weight_type", "trueimpesanalytic"s);
}
prm.put("preconditioner.finesmoother.type", "ParOverILU0"s);
prm.put("preconditioner.finesmoother.relaxation", 1.0);