mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-08-13 09:04:48 -05:00
FullyImplicitBlackoilSolver: add max_residual_allowed parameter to restart solver when
residual is to large.
This commit is contained in:
@@ -67,6 +67,7 @@ namespace Opm {
|
|||||||
double relax_max_;
|
double relax_max_;
|
||||||
double relax_increment_;
|
double relax_increment_;
|
||||||
double relax_rel_tol_;
|
double relax_rel_tol_;
|
||||||
|
double max_residual_allowed_;
|
||||||
int max_iter_;
|
int max_iter_;
|
||||||
|
|
||||||
SolverParameter( const parameter::ParameterGroup& param );
|
SolverParameter( const parameter::ParameterGroup& param );
|
||||||
@@ -363,7 +364,8 @@ namespace Opm {
|
|||||||
double relaxMax() const { return param_.relax_max_; };
|
double relaxMax() const { return param_.relax_max_; };
|
||||||
double relaxIncrement() const { return param_.relax_increment_; };
|
double relaxIncrement() const { return param_.relax_increment_; };
|
||||||
double relaxRelTol() const { return param_.relax_rel_tol_; };
|
double relaxRelTol() const { return param_.relax_rel_tol_; };
|
||||||
double maxIter() const { return param_.max_iter_; }
|
double maxIter() const { return param_.max_iter_; }
|
||||||
|
double maxResidualAllowed() const { return param_.max_residual_allowed_; }
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <limits>
|
||||||
//#include <fstream>
|
//#include <fstream>
|
||||||
|
|
||||||
// A debugging utility.
|
// A debugging utility.
|
||||||
@@ -169,6 +170,7 @@ namespace {
|
|||||||
relax_increment_ = 0.1;
|
relax_increment_ = 0.1;
|
||||||
relax_rel_tol_ = 0.2;
|
relax_rel_tol_ = 0.2;
|
||||||
max_iter_ = 15;
|
max_iter_ = 15;
|
||||||
|
max_residual_allowed_ = std::numeric_limits< double >::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -192,6 +194,7 @@ namespace {
|
|||||||
dr_max_rel_ = param.getDefault("dr_max_rel", dr_max_rel_);
|
dr_max_rel_ = param.getDefault("dr_max_rel", dr_max_rel_);
|
||||||
relax_max_ = param.getDefault("relax_max", relax_max_);
|
relax_max_ = param.getDefault("relax_max", relax_max_);
|
||||||
max_iter_ = param.getDefault("max_iter", max_iter_);
|
max_iter_ = param.getDefault("max_iter", max_iter_);
|
||||||
|
max_residual_allowed_ = param.getDefault("max_residual_allowed",max_residual_allowed_);
|
||||||
|
|
||||||
std::string relaxation_type = param.getDefault("relax_type", std::string("dampen"));
|
std::string relaxation_type = param.getDefault("relax_type", std::string("dampen"));
|
||||||
if (relaxation_type == "dampen") {
|
if (relaxation_type == "dampen") {
|
||||||
@@ -1964,16 +1967,16 @@ namespace {
|
|||||||
bool converged = converged_MB && converged_CNV && converged_Well;
|
bool converged = converged_MB && converged_CNV && converged_Well;
|
||||||
|
|
||||||
// if one of the residuals is NaN, throw exception, so that the solver can be restarted
|
// if one of the residuals is NaN, throw exception, so that the solver can be restarted
|
||||||
if( std::isnan(mass_balance_residual_water) ||
|
if( std::isnan(mass_balance_residual_water) || mass_balance_residual_water > maxResidualAllowed() ||
|
||||||
std::isnan(mass_balance_residual_oil) ||
|
std::isnan(mass_balance_residual_oil) || mass_balance_residual_oil > maxResidualAllowed() ||
|
||||||
std::isnan(mass_balance_residual_gas) ||
|
std::isnan(mass_balance_residual_gas) || mass_balance_residual_gas > maxResidualAllowed() ||
|
||||||
std::isnan(CNVW) ||
|
std::isnan(CNVW) || CNVW > maxResidualAllowed() ||
|
||||||
std::isnan(CNVO) ||
|
std::isnan(CNVO) || CNVO > maxResidualAllowed() ||
|
||||||
std::isnan(CNVG) ||
|
std::isnan(CNVG) || CNVG > maxResidualAllowed() ||
|
||||||
std::isnan(residualWellFlux) ||
|
std::isnan(residualWellFlux) || residualWellFlux > maxResidualAllowed() ||
|
||||||
std::isnan(residualWell) )
|
std::isnan(residualWell) || residualWell > maxResidualAllowed() )
|
||||||
{
|
{
|
||||||
OPM_THROW(Opm::NumericalProblem,"One of the residuals is NaN");
|
OPM_THROW(Opm::NumericalProblem,"One of the residuals is NaN or to large!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iteration == 0) {
|
if (iteration == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user