checking the residual for the well control equations.

This commit is contained in:
Kai Bao 2016-11-11 13:26:22 +01:00
parent 736585e85b
commit ce8498c4d7
3 changed files with 13 additions and 2 deletions

View File

@ -1840,6 +1840,7 @@ namespace detail {
const double tol_mb = param_.tolerance_mb_;
const double tol_cnv = param_.tolerance_cnv_;
const double tol_wells = param_.tolerance_wells_;
const double tol_well_control = param_.tolerance_well_control_;
const int nc = Opm::AutoDiffGrid::numCells(grid_);
const int np = asImpl().numPhases();
@ -1893,7 +1894,7 @@ namespace detail {
const double residualWell = detail::infinityNormWell(residual_.well_eq,
linsolver_.parallelInformation());
converged_Well = converged_Well && (residualWell < Opm::unit::barsa);
converged_Well = converged_Well && (residualWell < tol_well_control);
const bool converged = converged_MB && converged_CNV && converged_Well;
// Residual in Pascal can have high values and still be ok.
@ -1913,6 +1914,7 @@ namespace detail {
for (int idx = 0; idx < np; ++idx) {
msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")";
}
msg += " WELL-CONT";
// std::cout << " WELL-CONT ";
OpmLog::note(msg);
}
@ -1929,6 +1931,7 @@ namespace detail {
for (int idx = 0; idx < np; ++idx) {
ss << std::setw(11) << well_flux_residual[idx];
}
ss << std::setw(11) << residualWell;
// std::cout << std::setw(11) << residualWell;
ss.precision(oprec);
ss.flags(oflags);
@ -1976,6 +1979,7 @@ namespace detail {
getWellConvergence(const int iteration)
{
const double tol_wells = param_.tolerance_wells_;
const double tol_well_control = param_.tolerance_well_control_;
const int nc = Opm::AutoDiffGrid::numCells(grid_);
const int np = asImpl().numPhases();
@ -2010,7 +2014,7 @@ namespace detail {
const double residualWell = detail::infinityNormWell(residual_.well_eq,
linsolver_.parallelInformation());
converged_Well = converged_Well && (residualWell < Opm::unit::barsa);
converged_Well = converged_Well && (residualWell < tol_well_control);
const bool converged = converged_Well;
// if one of the residuals is NaN, throw exception, so that the solver can be restarted
@ -2040,6 +2044,7 @@ namespace detail {
for (int idx = 0; idx < np; ++idx) {
msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")";
}
msg += " WELL-CONT";
OpmLog::note(msg);
}
std::ostringstream ss;
@ -2049,6 +2054,7 @@ namespace detail {
for (int idx = 0; idx < np; ++idx) {
ss << std::setw(11) << well_flux_residual[idx];
}
ss << std::setw(11) << residualWell;
ss.precision(oprec);
ss.flags(oflags);
OpmLog::note(ss.str());

View File

@ -46,6 +46,7 @@ namespace Opm
tolerance_mb_ = param.getDefault("tolerance_mb", tolerance_mb_);
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_);
solve_welleq_initially_ = param.getDefault("solve_welleq_initially",solve_welleq_initially_);
update_equations_scaling_ = param.getDefault("update_equations_scaling", update_equations_scaling_);
compute_well_potentials_ = param.getDefault("compute_well_potentials", compute_well_potentials_);
@ -65,6 +66,7 @@ namespace Opm
tolerance_mb_ = 1.0e-5;
tolerance_cnv_ = 1.0e-2;
tolerance_wells_ = 1.0e-3;
tolerance_well_control_ = 1.0e-7;
solve_welleq_initially_ = true;
update_equations_scaling_ = false;
compute_well_potentials_ = false;

View File

@ -42,6 +42,9 @@ namespace Opm
double tolerance_cnv_;
/// Well convergence tolerance.
double tolerance_wells_;
/// Tolerance for the well control equations
// TODO: it might need to distinguish between rate control and pressure control later
double tolerance_well_control_;
/// Solve well equation initially
bool solve_welleq_initially_;