Abort on nan

This commit is contained in:
Ian Jauslin 2023-10-10 10:43:24 -04:00
parent 1ecb4bbe70
commit 3efdbf4451

View File

@ -226,6 +226,12 @@ int enstrophy(
alpha=compute_alpha(u, K1, K2, g, L);
enstrophy=compute_enstrophy(u, K1, K2, L);
// check that anything is nan
if(isnan(alpha) || isnan(enstrophy)){
fprintf(stderr,"nan encountered, aborting.\n");
break;
}
// add to running averages (estimate the total duration of interval as print_freq, will be adjusted later)
avg_a+=alpha*(step/print_freq);
avg_en+=enstrophy*(step/print_freq);