diff --git a/src/timeIntegrator.cpp b/src/timeIntegrator.cpp index 6ffb6acf..9d940fee 100644 --- a/src/timeIntegrator.cpp +++ b/src/timeIntegrator.cpp @@ -301,14 +301,6 @@ void TimeIntegrator::Cycle(DataBlock &data) { // evolve dt accordingly data.t += data.dt; - // Look for Nans every now and then (this actually cost a lot of time on GPUs - // because streams are divergent) - if(ncycles%checkNanPeriodicity==0) { - if(data.CheckNan()>0) { - throw std::runtime_error(std::string("Nan found after integration cycle")); - } - } - // Compute next time_step during first stage if(stage==0) { if(!haveFixedDt) { @@ -347,7 +339,15 @@ void TimeIntegrator::Cycle(DataBlock &data) { // Add back fargo velocity so that boundary conditions are applied on the total V if(data.haveFargo) data.fargo->AddVelocity(data.t); - } + + // Look for Nans every now and then (this actually cost a lot of time on GPUs + // because streams are divergent) + if(ncycles%checkNanPeriodicity==0) { + if(data.CheckNan()>0) { + throw std::runtime_error(std::string("Nan found after integration cycle")); + } + } + } ///////////////////////////////////////////////// // END STAGES LOOP // /////////////////////////////////////////////////