mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-02 05:49:09 -06:00
Merge pull request #4400 from blattms/use-cpr-from-datafile
Use CPR if specified in RUNSPEC / Make cprw the default
This commit is contained in:
commit
7c1cf03773
@ -238,7 +238,7 @@ namespace Opm
|
||||
bool opencl_ilu_parallel_;
|
||||
|
||||
template <class TypeTag>
|
||||
void init()
|
||||
void init(bool cprRequestedInDataFile)
|
||||
{
|
||||
// TODO: these parameters have undocumented non-trivial dependencies
|
||||
linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag, double, LinearSolverReduction);
|
||||
@ -255,7 +255,13 @@ namespace Opm
|
||||
scale_linear_system_ = EWOMS_GET_PARAM(TypeTag, bool, ScaleLinearSystem);
|
||||
cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag, int, CprReuseSetup);
|
||||
cpr_reuse_interval_ = EWOMS_GET_PARAM(TypeTag, int, CprReuseInterval);
|
||||
linsolver_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolver);
|
||||
|
||||
if (!EWOMS_PARAM_IS_SET(TypeTag, int, LinearSolverMaxIter) && cprRequestedInDataFile) {
|
||||
linsolver_ = "cpr";
|
||||
} else {
|
||||
linsolver_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolver);
|
||||
}
|
||||
|
||||
accelerator_mode_ = EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
|
||||
bda_device_id_ = EWOMS_GET_PARAM(TypeTag, int, BdaDeviceId);
|
||||
opencl_platform_id_ = EWOMS_GET_PARAM(TypeTag, int, OpenclPlatformId);
|
||||
@ -279,7 +285,7 @@ namespace Opm
|
||||
EWOMS_REGISTER_PARAM(TypeTag, bool, ScaleLinearSystem, "Scale linear system according to equation scale and primary variable types");
|
||||
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.");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolver, "Configuration of solver. Valid options are: ilu0 (default), cpr (an alias for cpr_trueimpes), cpr_quasiimpes, cpr_trueimpes or amg. 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), cprw, cpr (an alias for cprw), cpr_quasiimpes, cpr_trueimpes or amg. 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, AcceleratorMode, "Choose a linear solver, usage: '--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution]'");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, BdaDeviceId, "Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, OpenclPlatformId, "Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
|
||||
|
@ -241,7 +241,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
|
||||
#if HAVE_MPI
|
||||
comm_.reset( new CommunicationType( simulator_.vanguard().grid().comm() ) );
|
||||
#endif
|
||||
parameters_.template init<TypeTag>();
|
||||
parameters_.template init<TypeTag>(simulator_.vanguard().eclState().getSimulationConfig().useCPR());
|
||||
prm_ = setupPropertyTree(parameters_,
|
||||
EWOMS_PARAM_IS_SET(TypeTag, int, LinearSolverMaxIter),
|
||||
EWOMS_PARAM_IS_SET(TypeTag, double, LinearSolverReduction));
|
||||
|
@ -63,11 +63,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
|
||||
}
|
||||
|
||||
// Use CPR configuration.
|
||||
if ((conf == "cpr") || (conf == "cpr_trueimpes") || (conf == "cpr_quasiimpes")) {
|
||||
if (conf == "cpr") {
|
||||
// Treat "cpr" as short cut for the true IMPES variant.
|
||||
conf = "cpr_trueimpes";
|
||||
}
|
||||
if ((conf == "cpr_trueimpes") || (conf == "cpr_quasiimpes")) {
|
||||
if (!linearSolverMaxIterSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.linear_solver_maxiter_ = 20;
|
||||
@ -79,7 +75,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
|
||||
return setupCPR(conf, p);
|
||||
}
|
||||
|
||||
if ((conf == "cprw")) {
|
||||
if ((conf == "cpr") || (conf == "cprw")) {
|
||||
if (!linearSolverMaxIterSet) {
|
||||
// Use our own default unless it was explicitly overridden by user.
|
||||
p.linear_solver_maxiter_ = 20;
|
||||
|
@ -33,7 +33,7 @@ add_test_compare_parallel_restarted_simulation(CASENAME numerical_aquifer_3d_2aq
|
||||
REL_TOL 5.0e-2
|
||||
RESTART_STEP 3
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --enable-tuning=true --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --enable-tuning=true --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
||||
add_test_compare_parallel_restarted_simulation(CASENAME numerical_aquifer_3d_1aqu
|
||||
FILENAME 3D_1AQU_3CELLS
|
||||
@ -42,4 +42,4 @@ add_test_compare_parallel_restarted_simulation(CASENAME numerical_aquifer_3d_1aq
|
||||
REL_TOL 5.0e-2
|
||||
RESTART_STEP 3
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --enable-tuning=true --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --enable-tuning=true --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
@ -131,7 +131,7 @@ add_test_compare_parallel_simulation(CASENAME numerical_aquifer_3d_2aqu
|
||||
ABS_TOL 0.17
|
||||
REL_TOL ${coarse_rel_tol_parallel}
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --tolerance-cnv=0.000003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --tolerance-cnv=0.000003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
||||
add_test_compare_parallel_simulation(CASENAME numerical_aquifer_3d_1aqu
|
||||
FILENAME 3D_1AQU_3CELLS
|
||||
@ -139,7 +139,7 @@ add_test_compare_parallel_simulation(CASENAME numerical_aquifer_3d_1aqu
|
||||
ABS_TOL ${abs_tol_parallel}
|
||||
REL_TOL ${coarse_rel_tol_parallel}
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
||||
add_test_compare_parallel_simulation(CASENAME actionx_m1
|
||||
FILENAME ACTIONX_M1
|
||||
|
@ -161,7 +161,7 @@ add_test_compareECLFiles(CASENAME numerical_aquifer_3d_2aqu
|
||||
ABS_TOL ${abs_tol}
|
||||
REL_TOL ${rel_tol}
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
||||
add_test_compareECLFiles(CASENAME numerical_aquifer_3d_1aqu
|
||||
FILENAME 3D_1AQU_3CELLS
|
||||
@ -169,7 +169,7 @@ add_test_compareECLFiles(CASENAME numerical_aquifer_3d_1aqu
|
||||
ABS_TOL ${abs_tol}
|
||||
REL_TOL ${rel_tol}
|
||||
DIR aquifer-num
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr)
|
||||
TEST_ARGS --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
|
||||
|
||||
add_test_compareECLFiles(CASENAME spe3
|
||||
FILENAME SPE3CASE1
|
||||
|
Loading…
Reference in New Issue
Block a user