Number formatting of time loop / Newton report
If enabled, the Newton solver and timeloop report the times needed for different task within a time step. This could look, for example, like this:
Newton iteration 1 done, maximum relative shift = 3.422e-05
Newton iteration 2 done, maximum relative shift = 4.256e-08
Newton iteration 3 done, maximum relative shift = 1.872e-11
Assemble/solve/update time: 7.21320998(87.88445714%)/0.99315735(12.10045107%)/0.00123867(0.01509179%)
[ 0%] Time step 16 done in 8.350391 seconds. Wall clock time: 72.928, time: 3372.22524, time step size: 1192.57376716
I think the large amount of decimal places makes the output less attractive. Also, for large simulation times one gets output like:
Newton iteration 1 done, maximum relative shift = 8.006e-15
Newton iteration 2 done, maximum relative shift = 8.309e-15
Assemble/solve/update time: 2.62229738(82.52166682%)/0.55519350(17.47150939%)/0.00021684(0.00682379%)
[100%] Time step 58 done in 3.238292 seconds. Wall clock time: 274.076, time: 315360000000.00000, time step size: 86447646949.13092041
where I think it would be better to switch to scientific number formatting. Moreover, it seems that the automatic formatting can lead to different formats in different time steps. For instance:
Newton iteration 1 done, maximum relative shift = 9.667e-04
Newton iteration 2 done, maximum relative shift = 3.701e-07
Newton iteration 3 done, maximum relative shift = 5.220e-11
Assemble/solve/update time: 3.425e+00(8.114e+01%)/7.960e-01(1.886e+01%)/3.049e-04(7.222e-03%)
[ 33%] Time step 1 done in 4.221978 seconds. Wall clock time: 4.222, time: 1.00000, time step size: 1.00000000
WARNING: Bulk pressure solve output for box not implemented
WARNING: Facet pressure solve output for box not implemented
Newton iteration 1 done, maximum relative shift = 7.910e-09
Newton iteration 2 done, maximum relative shift = 3.428e-14
Assemble/solve/update time: 2.33427275(82.13281486%)/0.50744530(17.85477328%)/0.00035275(0.01241187%)
In the first of the shown time steps I find it particularly cumbersome to read the percentages in scientific notation. I looked into timeloop.hh
and newtonsolver.hh
, and in the Newton solver we don't seem to do any formatting, while in the time loop we do specify the number of digits to be printed for all quantities. As can be seen from the above exemplary output
[ 33%] Time step 1 done in 4.221978 seconds. Wall clock time: 4.222, time: 1.00000, time step size: 1.00000000
we use 0, 6, 3, 5 and 8 decimal places (the second number - time step index - is an integer and is shown correctly anyway). I would propose the following on the basis of which we could further discuss:
- Restrict the output to two decimal places
- Use scientific notation only for values below 0.1
- Use scientic values only for values above
x
where x
could maybe be 1e3 or 1e4.