Field-over-dt diagnostic
Divides any input field by the model timestep dt = t_current − t_start_of_step.
This is useful for converting accumulated differences into per-second rates.
Configuration
Append _over_dt to any field name X:
field_names:
- X_over_dt
The output field has the same layout and grid as X, with units [X_units / s].
Behavior
- At the start of each timestep (
init_timestep), the start-of-step timestamp is saved internally. - At evaluation time (
compute_diagnostic),dtis computed as the difference between the field's current timestamp and the saved start timestamp (in seconds). - The output is
X / dtelement-wise. - Before
init_timestephas ever been called, the output is filled with the standard EAMxx fill value (constants::fill_value<Real>). Note this does NOT cover the case whereinit_timestepHAS been called but no time has elapsed since: theredtis zero, which is an error rather than a fill value (see the caveats below).
Example: atmospheric backward tendency
field_names:
- T_mid_minus_T_mid_prev_over_dt
This composes three diagnostics:
T_mid_prev—FieldPrevDiag: value ofT_midat the start of the stepT_mid_minus_T_mid_prev—BinaryOpsDiag: differenceT_mid_minus_T_mid_prev_over_dt—FieldOverDtDiag: rate
The shorthand T_mid_atm_backtend expands to the same expression via the
built-in alias system (see Built-in aliases).
Caveats
dtmust be strictly positive; a zero or negative timestep triggers a runtime error.- This diagnostic cannot be written to an
instantoutput stream. An instant stream takes a snapshot att0, before the first step has run, sodtis zero and the run aborts with "dt must be positive". Use an averaged stream (averaging_type: average,max,min) instead. The same applies to everything built on top of it, includingX_atm_backtend. - Only fields with
Realdata type are supported. - The suffix
_over_dtis matched before binary-op patterns, soA_minus_B_over_dtparses asFieldOverDtDiag(A_minus_B), notBinaryOpsDiag(A_minus_B, over, dt). See Parsing precedence for details.