Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ice_history: fix history averaging over multiple time steps
The code at the beginning of subroutine 'accum_hist' is responsible for resetting the accumulation arrays a2D, a3Dc, etc. to zero when writing snapshots, but it also resets them if "histfreq(ns) == '1'". This has been the case since ab1c53e (Many thanks to Dave Bailey (NCAR) for getting this ball rolling., 2009-06-01) [1], which implemented the multiple-stream history functionality in CICE 5. This means that averaging over multiple time steps, i.e. histfreq = '1' histfreq_n = m ! m > 1 hist_avg = .true. does not work: the accumulation arrays will always be reset to zero at the beginning of 'accum_hist' and no accumulation will happen. This also means that the variable 'time_beg' is not initialized in that configuration, since this it is initialized in the 'else' branch of that 'if' statement. Commit ab1c53e also *removed* the following line in ice_init::input_data: if (histfreq == '1') hist_avg = .false. ! potential conflict so it's unclear if that configuration was forgotten at the time. Allow overaging over multiple time steps by only resetting the accumulation arrays if 'hist_avg' is false. As a side effect, this correctly initializes the 'time_beg' variable, which avoids writing that variable uninitialized to the output files, which can lead to analysis tools failing if compiling with '-init=snan,arrays' (or similar [2]. While at it, remove a commented line in the 'else' branch since it's implemented just below. This commit does not modify neither ice_history_shared::construct_filename nor the different ice_history_write::ice_write_hist subroutines, that also assume that 'histfreq = 1' implies 'histfreq_n = 1'. They will be modified in subsequent commits. [1] CICE-Consortium/CICE-svn-trunk@ab1c53e?branch=ab1c53eaf0c4a0b0dbc65e582a5e1b35c2208a88&diff=unified#diff-aebd77751eba77ed6b6c194d4cd2e4b353258f7e903cc7877343911c9b25c283L1296-L1306 [2] Closes CICE-Consortium#551
- Loading branch information