Implemented more error policies for regula falsi solver. Use in reorder code.

We have switched to WarnAndContinueOnError instead of ThrowOnError,
to reduce the annoyance factor when suffering from a minor error in
a long simulation run.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-05-24 10:21:38 +02:00
parent 733129a1a9
commit 5c15895e74

View File

@ -36,6 +36,9 @@
namespace Opm
{
// Choose error policy for scalar solves here.
typedef RegulaFalsi<WarnAndContinueOnError> RootFinder;
TransportModelTwophase::TransportModelTwophase(const UnstructuredGrid& grid,
const Opm::IncompPropertiesInterface& props,
@ -168,7 +171,7 @@ namespace Opm
// }
int iters_used;
// saturation_[cell] = modifiedRegulaFalsi(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
saturation_[cell] = RegulaFalsi<>::solve(res, saturation_[cell], 0.0, 1.0, maxit_, tol_, iters_used);
saturation_[cell] = RootFinder::solve(res, saturation_[cell], 0.0, 1.0, maxit_, tol_, iters_used);
fractionalflow_[cell] = fracFlow(saturation_[cell], cell);
}
@ -541,7 +544,7 @@ namespace Opm
GravityResidual res(*this, cells, pos, gravflux);
if (std::fabs(res(saturation_[cell])) > tol_) {
int iters_used;
saturation_[cell] = RegulaFalsi<>::solve(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
saturation_[cell] = RootFinder::solve(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
}
saturation_[cell] = std::min(std::max(saturation_[cell], smin_[2*cell]), smax_[2*cell]);
mobility(saturation_[cell], cell, &mob_[2*cell]);