Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/timeIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, CheckNan() will be executed once for each integration stage each time we reach the number of cycles requested (so possibly 2 or 3 times). I think checkNan should come at the very end of each integration cycle, not at the end of each stage.

// 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 //
/////////////////////////////////////////////////
Expand Down
Loading