mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add convergence check, local whitespace cleanup.
This commit is contained in:
parent
ec03062b51
commit
307cd6ef33
@ -189,7 +189,6 @@ namespace Opm
|
|||||||
const double tolerance = 1e-3;
|
const double tolerance = 1e-3;
|
||||||
const int maxit = 5000;
|
const int maxit = 5000;
|
||||||
const int verbosity = 1;
|
const int verbosity = 1;
|
||||||
// Dune::BiCGSTABSolver<Vector> linsolve(opA, sp, precond, tolerance, maxit, verbosity);
|
|
||||||
const int restart = 40;
|
const int restart = 40;
|
||||||
Dune::RestartedGMResSolver<Vector> linsolve(opA, sp, precond, tolerance, restart, maxit, verbosity);
|
Dune::RestartedGMResSolver<Vector> linsolve(opA, sp, precond, tolerance, restart, maxit, verbosity);
|
||||||
|
|
||||||
@ -197,19 +196,14 @@ namespace Opm
|
|||||||
Dune::InverseOperatorResult result;
|
Dune::InverseOperatorResult result;
|
||||||
linsolve.apply(x, b, result);
|
linsolve.apply(x, b, result);
|
||||||
|
|
||||||
// Output results.
|
// Check for failure of linear solver.
|
||||||
LinearSolverInterface::LinearSolverReport res;
|
if (!result.converged) {
|
||||||
res.converged = result.converged;
|
OPM_THROW(std::runtime_error, "Convergence failure for linear solver.");
|
||||||
res.iterations = result.iterations;
|
}
|
||||||
res.residual_reduction = result.reduction;
|
|
||||||
|
|
||||||
|
// Copy solver output to dx.
|
||||||
std::copy(x.begin(), x.end(), dx.data());
|
std::copy(x.begin(), x.end(), dx.data());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Compute full solution using the eliminated equations.
|
// Compute full solution using the eliminated equations.
|
||||||
// Recovery in inverse order of elimination.
|
// Recovery in inverse order of elimination.
|
||||||
dx = recoverVariable(elim_eqs[1], dx, np);
|
dx = recoverVariable(elim_eqs[1], dx, np);
|
||||||
|
Loading…
Reference in New Issue
Block a user