diff --git a/opm/autodiff/BlackoilModelParameters.cpp b/opm/autodiff/BlackoilModelParameters.cpp index bebefcda2..fd0947a28 100644 --- a/opm/autodiff/BlackoilModelParameters.cpp +++ b/opm/autodiff/BlackoilModelParameters.cpp @@ -51,6 +51,8 @@ namespace Opm 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_); + max_welleq_iter_ = param.getDefault("max_welleq_iter", max_welleq_iter_); + max_pressure_change_ms_wells_ = param.getDefault("max_pressure_change_ms_wells", max_pressure_change_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); @@ -78,6 +80,8 @@ namespace Opm tolerance_wells_ = 1.0e-4; tolerance_well_control_ = 1.0e-7; tolerance_pressure_ms_wells_ = 100.0; + max_welleq_iter_ = 15; + max_pressure_change_ms_wells_ = 100000.; // 1.0 bar 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 01fe6411a..af366c87d 100644 --- a/opm/autodiff/BlackoilModelParameters.hpp +++ b/opm/autodiff/BlackoilModelParameters.hpp @@ -53,6 +53,11 @@ namespace Opm double tolerance_well_control_; /// Tolerance for the pressure equations for multisegment wells double tolerance_pressure_ms_wells_; + /// Maximum pressure change over an iteratio for ms wells + double max_pressure_change_ms_wells_; + + /// Maximum iteration number of the well equation solution + int max_welleq_iter_; /// Tolerance for time step in seconds where single precision can be used /// for solving for the Jacobian diff --git a/opm/autodiff/BlackoilWellModel_impl.hpp b/opm/autodiff/BlackoilWellModel_impl.hpp index 60345701c..0d658656c 100644 --- a/opm/autodiff/BlackoilWellModel_impl.hpp +++ b/opm/autodiff/BlackoilWellModel_impl.hpp @@ -411,6 +411,8 @@ namespace Opm { std::vector< Scalar > B_avg( numComp, Scalar() ); computeAverageFormationFactor(ebosSimulator, B_avg); + const int max_iter = param_.max_welleq_iter_; + int it = 0; bool converged; do { @@ -442,7 +444,7 @@ namespace Opm { updateWellControls(well_state); initPrimaryVariablesEvaluation(); } - } while (it < 15); + } while (it < max_iter); if (converged) { if ( terminal_output_ ) { diff --git a/opm/autodiff/MultisegmentWell_impl.hpp b/opm/autodiff/MultisegmentWell_impl.hpp index fe51a7b32..604a62779 100644 --- a/opm/autodiff/MultisegmentWell_impl.hpp +++ b/opm/autodiff/MultisegmentWell_impl.hpp @@ -556,7 +556,6 @@ namespace Opm // check convergence for flux residuals for ( int comp_idx = 0; comp_idx < numComponents(); ++comp_idx) { - // report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_ * 10.); report.converged = report.converged && (maximum_residual[comp_idx] < param.tolerance_wells_); } @@ -828,6 +827,7 @@ namespace Opm // maybe better to give it a different name const double dBHPLimit = param.dbhp_max_rel_; const double dFLimit = param.dwell_fraction_max_; + const double max_pressure_change = param.max_pressure_change_ms_wells_; const std::vector > old_primary_variables = primary_variables_; for (int seg = 0; seg < numberOfSegments(); ++seg) { @@ -850,7 +850,7 @@ namespace Opm { const int sign = dwells[seg][SPres] > 0.? 1 : -1; const double current_pressure = old_primary_variables[seg][SPres]; - const double dx_limited = sign * std::min(std::abs(dwells[seg][SPres]), dBHPLimit * current_pressure); + const double dx_limited = sign * std::min(std::abs(dwells[seg][SPres]), max_pressure_change); primary_variables_[seg][SPres] = old_primary_variables[seg][SPres] - dx_limited; }