Add option for relaxed CNV tolerance

Use a relaxed tolerance for individual cells (CNV) when iter >
max_strict_iter.

tolerance_cnv_relaxed_ is defauled to 1.0e9
This assure the same behaviour as current master, where CNV criterion is
ignored when iter > max_strict_iter

TODO: Test this with a stricter default ( <= 1.0)
This commit is contained in:
Tor Harald Sandve 2018-03-08 08:19:44 +01:00
parent 13b7a4a426
commit 15aeac3f90
3 changed files with 11 additions and 6 deletions

View File

@ -818,6 +818,7 @@ namespace Opm {
const double dt = timer.currentStepLength();
const double tol_mb = param_.tolerance_mb_;
const double tol_cnv = param_.tolerance_cnv_;
const double tol_cnv_relaxed = param_.tolerance_cnv_relaxed_;
const int numComp = numEq;
@ -905,7 +906,10 @@ namespace Opm {
CNV[compIdx] = B_avg[compIdx] * dt * maxCoeff[compIdx];
mass_balance_residual[compIdx] = std::abs(B_avg[compIdx]*R_sum[compIdx]) * dt / pvSum;
converged_MB = converged_MB && (mass_balance_residual[compIdx] < tol_mb);
if (iteration < param_.max_strict_iter_)
converged_CNV = converged_CNV && (CNV[compIdx] < tol_cnv);
else
converged_CNV = converged_CNV && (CNV[compIdx] < tol_cnv_relaxed);
residual_norms.push_back(CNV[compIdx]);
}
@ -914,9 +918,6 @@ namespace Opm {
bool converged = converged_MB && converged_Well;
// do not care about the cell based residual in the last two Newton
// iterations
if (iteration < param_.max_strict_iter_)
converged = converged && converged_CNV;
if ( terminal_output_ )

View File

@ -48,6 +48,7 @@ namespace Opm
max_residual_allowed_ = param.getDefault("max_residual_allowed", max_residual_allowed_);
tolerance_mb_ = param.getDefault("tolerance_mb", tolerance_mb_);
tolerance_cnv_ = param.getDefault("tolerance_cnv", tolerance_cnv_);
tolerance_cnv_relaxed_ = param.getDefault("tolerance_cnv_relaxed", tolerance_cnv_relaxed_);
tolerance_wells_ = param.getDefault("tolerance_wells", tolerance_wells_ );
tolerance_well_control_ = param.getDefault("tolerance_well_control", tolerance_well_control_);
max_welleq_iter_ = param.getDefault("max_welleq_iter", max_welleq_iter_);
@ -82,6 +83,7 @@ namespace Opm
max_residual_allowed_ = 1e7;
tolerance_mb_ = 1.0e-5;
tolerance_cnv_ = 1.0e-2;
tolerance_cnv_relaxed_ = 1.0e9;
tolerance_wells_ = 1.0e-4;
tolerance_well_control_ = 1.0e-7;
tolerance_pressure_ms_wells_ = unit::convert::from(0.01, unit::barsa); // 0.01 bar

View File

@ -46,6 +46,8 @@ namespace Opm
double tolerance_mb_;
/// Local convergence tolerance (max of local saturation errors).
double tolerance_cnv_;
/// Relaxed local convergence tolerance (used when iter >= max_strict_iter_).
double tolerance_cnv_relaxed_;
/// Well convergence tolerance.
double tolerance_wells_;
/// Tolerance for the well control equations