aronnax
aronnax copied to clipboard
Add optional detailed intermediate field dumps, for debugging
I am imagining a flag (possibly an integer flag with several verbosity levels, or a series of independent boolean flags) that causes the core to dump its fields with very high frequency, to enable debugging. The maximum version would be
- Every time-step (including the RK4 initialization and half-steps)
- Sub-time-step resolution (before and after applying sponging, before and after the n-layer correction that involves solving the linear system)
- Interpretable intermediate fields (e.g., the tendencies, or the computed wind that
DumpWind
calls for)
We now have two places where this came up: helping check momentum conservation https://github.com/edoddridge/aronnax/issues/66#issuecomment-295068094, and a generic comment about the usefulness of dumping the first field https://github.com/edoddridge/aronnax/issues/107#issuecomment-295721794.
I like this a lot.
I imagine the levels would look something like:
- 0: no additional outputs. Output frequency controlled by
DumpFreq
andAvFreq
- 1: output tendencies at frequency given by
DumpFreq
- 2: output tendencies and convergence diagnostics from the linear solve at frequency given by
DumpFreq
. - 3: output convergence diagnostics and tendencies before and after applying some or all of sponges, barotropic correction, winds, and boundary conditions at frequency controlled by
DumpFreq
- 4: dump all of the above fields every time step
- 5: dump everything every time step including the two initial RK4 steps
We may also want to include verbose messages from the input reader subroutines at 3 or 4. The jump from 2 to 3 may also be too large.