Check the main loop's termination condition before doing grid adaptation to avoid writing inconsistent final output files.
Check the main loop's termination condition before doing grid
adaptation to avoid writing inconsistent final output files.

speth/ember,speth/ember,speth/ember