Skip to content

Commit d165f1a

Browse files
committed
Move CheckNan to end of loop on stages in timeIntegrator
CheckNan was previously located after EvolveStage. However, EvolveStage updates the conservative variables and CheckNan checks the primitive variables. This reports the detection of a NaN to the next cycle. By moving CheckNan to the end of the loop on stages in timeIntegrator, so after the ConsToPrim, this PR ensures that we detect the NaN at the right cycle.
1 parent dc80444 commit d165f1a

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/timeIntegrator.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,6 @@ void TimeIntegrator::Cycle(DataBlock &data) {
301301
// evolve dt accordingly
302302
data.t += data.dt;
303303

304-
// Look for Nans every now and then (this actually cost a lot of time on GPUs
305-
// because streams are divergent)
306-
if(ncycles%checkNanPeriodicity==0) {
307-
if(data.CheckNan()>0) {
308-
throw std::runtime_error(std::string("Nan found after integration cycle"));
309-
}
310-
}
311-
312304
// Compute next time_step during first stage
313305
if(stage==0) {
314306
if(!haveFixedDt) {
@@ -347,7 +339,15 @@ void TimeIntegrator::Cycle(DataBlock &data) {
347339

348340
// Add back fargo velocity so that boundary conditions are applied on the total V
349341
if(data.haveFargo) data.fargo->AddVelocity(data.t);
350-
}
342+
343+
// Look for Nans every now and then (this actually cost a lot of time on GPUs
344+
// because streams are divergent)
345+
if(ncycles%checkNanPeriodicity==0) {
346+
if(data.CheckNan()>0) {
347+
throw std::runtime_error(std::string("Nan found after integration cycle"));
348+
}
349+
}
350+
}
351351
/////////////////////////////////////////////////
352352
// END STAGES LOOP //
353353
/////////////////////////////////////////////////

0 commit comments

Comments
 (0)