mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #229 from totto82/output_conv
Output the total mass balance residual
This commit is contained in:
commit
47fa31a69c
@ -328,7 +328,7 @@ namespace Opm {
|
|||||||
|
|
||||||
/// Compute convergence based on total mass balance (tol_mb) and maximum
|
/// Compute convergence based on total mass balance (tol_mb) and maximum
|
||||||
/// residual mass balance (tol_cnv).
|
/// 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,
|
void detectNewtonOscillations(const std::vector<std::vector<double>>& residual_history,
|
||||||
const int it, const double relaxRelTol,
|
const int it, const double relaxRelTol,
|
||||||
|
@ -285,17 +285,11 @@ namespace {
|
|||||||
|
|
||||||
bool converged = false;
|
bool converged = false;
|
||||||
double omega = 1.;
|
double omega = 1.;
|
||||||
const double r0 = residualNorm();
|
|
||||||
|
|
||||||
residual_history.push_back(residuals());
|
residual_history.push_back(residuals());
|
||||||
|
|
||||||
converged = getConvergence(dt);
|
|
||||||
|
|
||||||
int it = 0;
|
int it = 0;
|
||||||
std::cout << "\nIteration Residual\n"
|
converged = getConvergence(dt,it);
|
||||||
<< std::setw(9) << it << std::setprecision(9)
|
|
||||||
<< std::setw(18) << r0 << std::endl;
|
|
||||||
|
|
||||||
const int sizeNonLinear = residual_.sizeNonLinear();
|
const int sizeNonLinear = residual_.sizeNonLinear();
|
||||||
|
|
||||||
V dxOld = V::Zero(sizeNonLinear);
|
V dxOld = V::Zero(sizeNonLinear);
|
||||||
@ -325,16 +319,12 @@ namespace {
|
|||||||
|
|
||||||
assemble(pvdt, x, xw);
|
assemble(pvdt, x, xw);
|
||||||
|
|
||||||
const double r = residualNorm();
|
|
||||||
|
|
||||||
residual_history.push_back(residuals());
|
residual_history.push_back(residuals());
|
||||||
|
|
||||||
converged = getConvergence(dt);
|
|
||||||
|
|
||||||
// increase iteration counter
|
// increase iteration counter
|
||||||
++it;
|
++it;
|
||||||
std::cout << std::setw(9) << it << std::setprecision(9)
|
|
||||||
<< std::setw(18) << r << std::endl;
|
converged = getConvergence(dt,it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!converged) {
|
if (!converged) {
|
||||||
@ -1816,7 +1806,7 @@ namespace {
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
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_mb = 1.0e-7;
|
||||||
const double tol_cnv = 1.0e-3;
|
const double tol_cnv = 1.0e-3;
|
||||||
@ -1879,11 +1869,13 @@ namespace {
|
|||||||
RG_sum = RG.sum();
|
RG_sum = RG.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
double tempValue = tol_mb * pvSum /dt;
|
const double mass_balance_residual_water = fabs(BW_avg*RW_sum) * pvSum / dt;
|
||||||
|
const double mass_balance_residual_oil = fabs(BO_avg*RO_sum) * pvSum / dt;
|
||||||
|
const double mass_balance_residual_gas = fabs(BG_avg*RG_sum) * pvSum / dt;
|
||||||
|
|
||||||
bool converged_MB = (fabs(BW_avg*RW_sum) < tempValue)
|
bool converged_MB = (mass_balance_residual_water < tol_mb)
|
||||||
&& (fabs(BO_avg*RO_sum) < tempValue)
|
&& (mass_balance_residual_oil< tol_mb)
|
||||||
&& (fabs(BG_avg*RG_sum) < tempValue);
|
&& (mass_balance_residual_gas < tol_mb);
|
||||||
|
|
||||||
bool converged_CNV = (CNVW < tol_cnv) && (CNVO < tol_cnv) && (CNVG < tol_cnv);
|
bool converged_CNV = (CNVW < tol_cnv) && (CNVO < tol_cnv) && (CNVG < tol_cnv);
|
||||||
|
|
||||||
@ -1894,6 +1886,15 @@ namespace {
|
|||||||
|
|
||||||
bool converged = converged_MB && converged_CNV && converged_Well;
|
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) << mass_balance_residual_water
|
||||||
|
<< std::setw(13) << mass_balance_residual_oil
|
||||||
|
<< std::setw(13) << mass_balance_residual_gas
|
||||||
|
<< std::setw(13) << residualWellFlux
|
||||||
|
<< std::setw(13) << residualWell
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
#ifdef OPM_VERBOSE
|
#ifdef OPM_VERBOSE
|
||||||
std::cout << " CNVW " << CNVW << " CNVO " << CNVO << " CNVG " << CNVG << std::endl;
|
std::cout << " CNVW " << CNVW << " CNVO " << CNVO << " CNVG " << CNVG << std::endl;
|
||||||
std::cout << " converged_MB " << converged_MB << " converged_CNV " << converged_CNV
|
std::cout << " converged_MB " << converged_MB << " converged_CNV " << converged_CNV
|
||||||
|
Loading…
Reference in New Issue
Block a user