Output the total mass balance residual

The residual output is changed from max residual to
total mass balance residual. In this way the output
resemble what is actually used as convergence criteria.
This commit is contained in:
Tor Harald Sandve 2014-11-10 09:29:13 +01:00
parent 70f390f705
commit 9380ce71a2
2 changed files with 14 additions and 15 deletions

View File

@ -328,7 +328,7 @@ namespace Opm {
/// Compute convergence based on total mass balance (tol_mb) and maximum
/// residual mass balance (tol_cnv).
bool getConvergence(const double dt);
bool getConvergence(const double dt, const int iteration);
void detectNewtonOscillations(const std::vector<std::vector<double>>& residual_history,
const int it, const double relaxRelTol,

View File

@ -285,17 +285,11 @@ namespace {
bool converged = false;
double omega = 1.;
const double r0 = residualNorm();
residual_history.push_back(residuals());
converged = getConvergence(dt);
int it = 0;
std::cout << "\nIteration Residual\n"
<< std::setw(9) << it << std::setprecision(9)
<< std::setw(18) << r0 << std::endl;
converged = getConvergence(dt,it);
const int sizeNonLinear = residual_.sizeNonLinear();
V dxOld = V::Zero(sizeNonLinear);
@ -325,16 +319,12 @@ namespace {
assemble(pvdt, x, xw);
const double r = residualNorm();
residual_history.push_back(residuals());
converged = getConvergence(dt);
// increase iteration counter
++it;
std::cout << std::setw(9) << it << std::setprecision(9)
<< std::setw(18) << r << std::endl;
converged = getConvergence(dt,it);
}
if (!converged) {
@ -1816,7 +1806,7 @@ namespace {
template<class T>
bool
FullyImplicitBlackoilSolver<T>::getConvergence(const double dt)
FullyImplicitBlackoilSolver<T>::getConvergence(const double dt, const int iteration)
{
const double tol_mb = 1.0e-7;
const double tol_cnv = 1.0e-3;
@ -1894,6 +1884,15 @@ namespace {
bool converged = converged_MB && converged_CNV && converged_Well;
std::cout << "\nIteration OIL WATER GAS WELL-FLOW WELL-CONTROL\n"
<< std::setw(9) << iteration << std::setprecision(4)
<< std::setw(13) << fabs(BW_avg*RW_sum)
<< std::setw(13) << fabs(BO_avg*RO_sum)
<< std::setw(13) << fabs(BG_avg*RG_sum)
<< std::setw(13) << residualWellFlux
<< std::setw(13) << residualWell
<< std::endl;
#ifdef OPM_VERBOSE
std::cout << " CNVW " << CNVW << " CNVO " << CNVO << " CNVG " << CNVG << std::endl;
std::cout << " converged_MB " << converged_MB << " converged_CNV " << converged_CNV