From 2a5449b24f56385b379b143321aae4a220f1dce0 Mon Sep 17 00:00:00 2001 From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de> Date: Fri, 11 Jan 2013 14:00:27 +0000 Subject: [PATCH] [BoxAssembler] Replace assert by throwing NumericalProblem. If non-finite values are found in the residual, the simulation does not stop but retry with smaller time step. (reviewed by pnuske) git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9967 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/implicit/box/boxassembler.hh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dumux/implicit/box/boxassembler.hh b/dumux/implicit/box/boxassembler.hh index 6bbcebb9f7..dfbc196b77 100644 --- a/dumux/implicit/box/boxassembler.hh +++ b/dumux/implicit/box/boxassembler.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_BOX_ASSEMBLER_HH #define DUMUX_BOX_ASSEMBLER_HH +#include <dumux/common/exceptions.hh> #include <dumux/implicit/common/implicitassembler.hh> #include <dumux/parallel/vertexhandles.hh> @@ -302,8 +303,12 @@ private: // update the right hand side this->residual_[globI] += this->model_().localJacobian().residual(i); - for (int j = 0; j < this->residual_[globI].dimension; ++j) - assert(std::isfinite(this->residual_[globI][j])); + for (int j = 0; j < this->residual_[globI].dimension; ++j) { + if (!std::isfinite(this->residual_[globI][j])) { + DUNE_THROW(NumericalProblem, + "residual_[" << globI "][" << j << "] is not finite"); + } + } if (this->enableJacobianRecycling_()) { this->storageTerm_[globI] += this->model_().localJacobian().storageTerm(i); -- GitLab