mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Bugfix: take absolute value of residuals for comparison.
Also tighten hardcoded tolerance for testing, and update a comment.
This commit is contained in:
parent
87477f7a44
commit
2c20bb6cde
@ -685,10 +685,11 @@ namespace Opm {
|
|||||||
const int other = from == cell ? to : from;
|
const int other = from == cell ? to : from;
|
||||||
const double vt = (from == cell) ? total_flux_[conn.index] : -total_flux_[conn.index];
|
const double vt = (from == cell) ? total_flux_[conn.index] : -total_flux_[conn.index];
|
||||||
|
|
||||||
// From this point, we treat everything about this connection as going
|
// From this point, we treat everything about this
|
||||||
// from 'cell' to 'other'. Since we don't want derivatives from the 'other'
|
// connection as going from 'cell' to 'other'. Since
|
||||||
// cell to participate in the solution, we must be careful to use .value
|
// we don't want derivatives from the 'other' cell to
|
||||||
// to avoid creating trouble.
|
// participate in the solution, we use the constant
|
||||||
|
// values from cstate_[other].
|
||||||
Eval dh[3];
|
Eval dh[3];
|
||||||
Eval dh_sat[3];
|
Eval dh_sat[3];
|
||||||
for (int phase : { Water, Oil, Gas }) {
|
for (int phase : { Water, Oil, Gas }) {
|
||||||
@ -707,6 +708,9 @@ namespace Opm {
|
|||||||
{{ m1[Water].value, m1[Oil].value, m1[Gas].value }},
|
{{ m1[Water].value, m1[Oil].value, m1[Gas].value }},
|
||||||
{{ m2[Water], m2[Oil], m2[Gas] }},
|
{{ m2[Water], m2[Oil], m2[Gas] }},
|
||||||
tran, vt);
|
tran, vt);
|
||||||
|
if (upw[0] != upw[1] || upw[1] != upw[2]) {
|
||||||
|
OpmLog::debug("Detected countercurrent flow between cells " + std::to_string(from) + " and " + std::to_string(to));
|
||||||
|
}
|
||||||
Eval b[3];
|
Eval b[3];
|
||||||
Eval mob[3];
|
Eval mob[3];
|
||||||
Eval tot_mob = Eval::createConstant(0.0);
|
Eval tot_mob = Eval::createConstant(0.0);
|
||||||
@ -749,8 +753,8 @@ namespace Opm {
|
|||||||
|
|
||||||
bool getConvergence(const Vec2& res)
|
bool getConvergence(const Vec2& res)
|
||||||
{
|
{
|
||||||
const double tol = 1e-6;
|
const double tol = 1e-9;
|
||||||
return res[0] < tol && res[1] < tol;
|
return std::fabs(res[0]) < tol && std::fabs(res[1] < tol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user