diff --git a/opm/autodiff/BlackoilModelParameters.cpp b/opm/autodiff/BlackoilModelParameters.cpp index d5b08fe8e..bebefcda2 100644 --- a/opm/autodiff/BlackoilModelParameters.cpp +++ b/opm/autodiff/BlackoilModelParameters.cpp @@ -50,6 +50,7 @@ namespace Opm tolerance_cnv_ = param.getDefault("tolerance_cnv", tolerance_cnv_); tolerance_wells_ = param.getDefault("tolerance_wells", tolerance_wells_ ); tolerance_well_control_ = param.getDefault("tolerance_well_control", tolerance_well_control_); + tolerance_pressure_ms_wells_ = param.getDefault("tolerance_pressure_ms_wells", tolerance_pressure_ms_wells_); maxSinglePrecisionTimeStep_ = unit::convert::from( param.getDefault("max_single_precision_days", unit::convert::to( maxSinglePrecisionTimeStep_, unit::day) ), unit::day ); max_strict_iter_ = param.getDefault("max_strict_iter",8); @@ -76,6 +77,7 @@ namespace Opm tolerance_cnv_ = 1.0e-2; tolerance_wells_ = 1.0e-4; tolerance_well_control_ = 1.0e-7; + tolerance_pressure_ms_wells_ = 100.0; maxSinglePrecisionTimeStep_ = unit::convert::from( 20.0, unit::day ); solve_welleq_initially_ = true; update_equations_scaling_ = false; diff --git a/opm/autodiff/BlackoilModelParameters.hpp b/opm/autodiff/BlackoilModelParameters.hpp index 0e9984816..01fe6411a 100644 --- a/opm/autodiff/BlackoilModelParameters.hpp +++ b/opm/autodiff/BlackoilModelParameters.hpp @@ -51,6 +51,8 @@ namespace Opm /// Tolerance for the well control equations // TODO: it might need to distinguish between rate control and pressure control later double tolerance_well_control_; + /// Tolerance for the pressure equations for multisegment wells + double tolerance_pressure_ms_wells_; /// Tolerance for time step in seconds where single precision can be used /// for solving for the Jacobian diff --git a/opm/autodiff/MultisegmentWell_impl.hpp b/opm/autodiff/MultisegmentWell_impl.hpp index 40614b88f..1b88b3124 100644 --- a/opm/autodiff/MultisegmentWell_impl.hpp +++ b/opm/autodiff/MultisegmentWell_impl.hpp @@ -548,6 +548,8 @@ namespace Opm } } } else { // pressure equation + // TODO: we should distinguish the rate control equations, bhp control equations + // and the oridnary pressure equations const double pressure_residal = residual[seg][eq_idx]; const std::string eq_name("Pressure"); if (std::isnan(pressure_residal)) { @@ -575,8 +577,7 @@ namespace Opm report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_); } - // TODO: it is not good to use a hard-coded value. - report.converged = report.converged && (maximum_residual[SPres] < 100.0); + report.converged = report.converged && (maximum_residual[SPres] < param.tolerance_pressure_ms_wells_); } else { // abnormal values found and no need to check the convergence report.converged = false; }