Skip to content

Commit

Permalink
fix modulo by zero bug..
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Jul 9, 2024
1 parent 051e55e commit 6523896
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/unsteady_ns_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,24 @@ bool UnsteadyNSSolver::Solve(SampleGenerator *sample_generator)

cfl = ComputeCFL(dt);
SanityCheck(step);
if (((step+1) % report_interval) == 0)
if (report_interval &&
((step+1) % report_interval) == 0)
printf("Time step: %05d, CFL: %.3e\n", step+1, cfl);

if (((step+1) % visual.time_interval) == 0)
if (visual.time_interval &&
((step+1) % visual.time_interval) == 0)
SaveVisualization(step+1, time);

if ((save_sol) && (((step+1) % restart_interval) == 0))
if (save_sol && restart_interval &&
(((step+1) % restart_interval) == 0))
{
restart_file = string_format(file_fmt, sol_dir.c_str(), sol_prefix.c_str(), step+1);
SaveSolutionWithTime(restart_file, step+1, time);
}

/* save solution if sample generator is provided */
if (sample_generator && ((step+1) > bootstrap) && (((step+1) % sample_interval) == 0))
if (sample_generator && sample_interval &&
((step+1) > bootstrap) && (((step+1) % sample_interval) == 0))
SaveSnapshots(sample_generator);
}

Expand Down

0 comments on commit 6523896

Please sign in to comment.