From a2476312c64a565736beaf791df1a464e7e2ef68 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 11 Oct 2018 21:02:42 +0200 Subject: Check for instabilities during cell equilibration --- src/lbm.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lbm.cc b/src/lbm.cc index ca84cee..33c6824 100644 --- a/src/lbm.cc +++ b/src/lbm.cc @@ -1,9 +1,16 @@ #include "lbm.h" +#include + void Cell::equilibrize(Density d, Velocity v) { for ( int i = -1; i <= 1; ++i ) { for ( int j = -1; j <= 1; ++j ) { get(i,j) = weight.get(i,j) * d * (1 + 3*v.comp(i,j) + 4.5*sq(v.comp(i,j)) - 1.5*sq(v.norm())); + + if ( std::isnan(get(i,j)) ) { + std::cerr << "Instability detected!" << std::endl; + std::exit(-1); + } } } } -- cgit v1.2.3