Skip to content

Move CheckNan to end of loop on stages in timeIntegrator - #403

Open
nscepi wants to merge 2 commits into
idefix-code:developfrom
nscepi:master
Open

Move CheckNan to end of loop on stages in timeIntegrator#403
nscepi wants to merge 2 commits into
idefix-code:developfrom
nscepi:master

Conversation

@nscepi

@nscepi nscepi commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

CheckNan was previously located after EvolveStage. However, EvolveStage updates the conservative variables and CheckNan checks the primitive variables. This delays 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 cycle where it was created.

nscepi and others added 2 commits August 27, 2026 10:31
    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.
@glesur
glesur self-requested a review August 31, 2026 10:03
Comment thread src/timeIntegrator.cpp
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants