Skip to content

Commit

Permalink
Many thanks to Dave Bailey (NCAR) for getting this ball rolling.
Browse files Browse the repository at this point in the history
The history module has been generalized to allow output at different 
frequencies.  Five output frequencies ('1', 'h', 'd', 'm', 'y') are 
available simultaneously during a run.   The same variable can be 
output at different frequencies (say daily and monthly) via its 
f_<variable> string in namelist.   

Added max_nstrm=5 to ice_domain_size.F90, one for each output frequency 
available, and made the namelist parameters histfreq and histfreq_n 
into corresponding arrays.   The namelist flags for history variables 
have been changed from logicals (true/false) to character strings 
corresponding to histfreq or 'x' for none (but note that grid variable 
flags are still logicals).

For example, in namelist

histfreq='1', 'h', 'd', 'm', 'y'
histfreq_n=1,6,0,1,1
f_hi = '1'
f_hs = 'h'
f_Tsfc = 'd'
f_aice = 'm'
f_meltb = 'mh'
f_iage = 'x'

Here, hi will be written to a file on every timestep, hs will be 
written once every 6 hours, aice once a month, meltb once a month AND 
once every 6 hours, and Tsfc and iage will not be written.   If there 
are no namelist flags with a given histfreq value, or if an element of 
histfreq_n is 0, then no file will be written at that frequency.

The output period can be discerned from the filenames as in the 
released code (this has not changed).

From an efficiency standpoint, it is best to set unused frequencies in 
histfreq to 'x'.  Having output at all 5 frequencies takes nearly 5 
times as long as for a single frequency.  If you only want monthly 
output, the most efficient setting is histfreq='m','x','x','x','x'.  The 
code counts the number of desired streams (nstreams) based on histfreq.

The history variable names must be unique for netcdf, so in cases where a 
variable is written at more than one frequency, the variable name is 
appended with the frequency in files after the first one.  In the example 
above, meltb is called meltb in the monthly file (for backward 
compatibility with the default configuration) and meltb_h in the 6-hourly 
file.

There are still 9 history variables hard-coded for instantaneous output, 
as before.  They are output at the frequency given by their namelist flag.

The names of two category history variables had to be changed from aice, 
vice to aicen, vicen to make the roots unique.  They are now consistent 
with the other category history variables.

Notes:  

Using the same frequency twice in histfreq will have unexpected 
consequences and currently will cause the code to abort.  It is not 
possible at the moment to output averages once a month and also once 
every 3 months, for example.  

CCSM's special units are not included in this version.

The units for Tair were listed as degrees C, but the field in the (old) 
file was in K.  Now they are both C.

Grid variables are currently written to all files.   I'd prefer to leave 
the minimum information in the history files, and maybe write the rest in 
the initial condition file, to cut down on redundancy.  Suggestions or 
opinions welcome!

I did not test every possible parameter combination; do let me know if 
you find one that doesn't work correctly or as expected.
  • Loading branch information
eclare108213 committed Jun 1, 2009
1 parent d607f8c commit ab1c53e
Show file tree
Hide file tree
Showing 12 changed files with 1,734 additions and 1,428 deletions.
4 changes: 3 additions & 1 deletion drivers/cice4/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,9 @@ subroutine coupling_prep
! for history averaging
cszn = c0
if (coszen(i,j,iblk) > puny) cszn = c1
albcnt(i,j,iblk) = albcnt(i,j,iblk) + cszn
do n = 1, nstreams
albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn
enddo
enddo
enddo
do n = 1, ncat
Expand Down
4 changes: 3 additions & 1 deletion drivers/cice4/CICE_RunMod.F90_debug
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@
! for history averaging
cszn = c0
if (coszen(i,j,iblk) > puny) cszn = c1
albcnt(i,j,iblk) = albcnt(i,j,iblk) + cszn
do n = 1, nstreams
albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn
enddo
enddo
enddo
do n = 1, ncat
Expand Down
4 changes: 3 additions & 1 deletion drivers/esmf/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,9 @@ subroutine coupling_prep
! for history averaging
cszn = c0
if (coszen(i,j,iblk) > puny) cszn = c1
albcnt(i,j,iblk) = albcnt(i,j,iblk) + cszn
do n = 1, nstreams
albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn
enddo
enddo
enddo
do n = 1, ncat
Expand Down
4 changes: 3 additions & 1 deletion drivers/hadgem3/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ subroutine coupling_prep
! for history averaging
cszn = c0
if (coszen(i,j,iblk) > puny) cszn = c1
albcnt(i,j,iblk) = albcnt(i,j,iblk) + cszn
do n = 1, nstreams
albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn
enddo
enddo
enddo
do n = 1, ncat
Expand Down
188 changes: 94 additions & 94 deletions input_templates/gx1/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
, latpnt(2) = -65.
, lonpnt(2) = -45.
, dbug = .false.
, histfreq = 'm'
, histfreq_n = 1
, histfreq = 'm','x','x','x','x'
, histfreq_n = 1 , 1 , 1 , 1 , 1
, hist_avg = .true.
, history_dir = './history/'
, history_file = 'iceh'
Expand Down Expand Up @@ -111,96 +111,96 @@
, f_ANGLE = .true.
, f_ANGLET = .true.
, f_bounds = .false.
, f_hi = .true.
, f_hs = .true.
, f_Tsfc = .true.
, f_aice = .true.
, f_uvel = .true.
, f_vvel = .true.
, f_fswdn = .true.
, f_flwdn = .true.
, f_snow = .false.
, f_snow_ai = .true.
, f_rain = .false.
, f_rain_ai = .true.
, f_sst = .true.
, f_sss = .true.
, f_uocn = .true.
, f_vocn = .true.
, f_frzmlt = .true.
, f_fswfac = .true.
, f_fswabs = .false.
, f_fswabs_ai = .true.
, f_albsni = .true.
, f_alvdr = .false.
, f_alidr = .false.
, f_albice = .false.
, f_albsno = .false.
, f_albpnd = .false.
, f_coszen = .false.
, f_flat = .false.
, f_flat_ai = .true.
, f_fsens = .false.
, f_fsens_ai = .true.
, f_flwup = .false.
, f_flwup_ai = .true.
, f_evap = .false.
, f_evap_ai = .true.
, f_Tair = .true.
, f_Tref = .false.
, f_Qref = .false.
, f_congel = .true.
, f_frazil = .true.
, f_snoice = .true.
, f_meltt = .true.
, f_meltb = .true.
, f_meltl = .true.
, f_fresh = .false.
, f_fresh_ai = .true.
, f_fsalt = .false.
, f_fsalt_ai = .true.
, f_fhocn = .false.
, f_fhocn_ai = .true.
, f_fswthru = .false.
, f_fswthru_ai = .true.
, f_fsurf_ai = .false.
, f_fcondtop_ai = .false.
, f_fmeltt_ai = .false.
, f_strairx = .true.
, f_strairy = .true.
, f_strtltx = .false.
, f_strtlty = .false.
, f_strcorx = .false.
, f_strcory = .false.
, f_strocnx = .false.
, f_strocny = .false.
, f_strintx = .false.
, f_strinty = .false.
, f_strength = .true.
, f_divu = .true.
, f_shear = .true.
, f_sig1 = .true.
, f_sig2 = .true.
, f_dvidtt = .true.
, f_dvidtd = .true.
, f_daidtt = .true.
, f_daidtd = .true.
, f_mlt_onset = .true.
, f_frz_onset = .true.
, f_dardg1dt = .true.
, f_dardg2dt = .true.
, f_dvirdgdt = .true.
, f_opening = .true.
, f_hisnap = .false.
, f_aisnap = .false.
, f_trsig = .true.
, f_icepresent = .true.
, f_iage = .false.
, f_aicen = .false.
, f_vicen = .false.
, f_fsurfn_ai = .false.
, f_fcondtopn_ai = .false.
, f_fmelttn_ai = .false.
, f_flatn_ai = .false.
, f_apondn = .false.
, f_hi = 'm'
, f_hs = 'm'
, f_Tsfc = 'm'
, f_aice = 'm'
, f_uvel = 'm'
, f_vvel = 'm'
, f_fswdn = 'm'
, f_flwdn = 'm'
, f_snow = 'x'
, f_snow_ai = 'm'
, f_rain = 'x'
, f_rain_ai = 'm'
, f_sst = 'm'
, f_sss = 'm'
, f_uocn = 'm'
, f_vocn = 'm'
, f_frzmlt = 'm'
, f_fswfac = 'm'
, f_fswabs = 'x'
, f_fswabs_ai = 'm'
, f_albsni = 'm'
, f_alvdr = 'x'
, f_alidr = 'x'
, f_albice = 'x'
, f_albsno = 'x'
, f_albpnd = 'x'
, f_coszen = 'x'
, f_flat = 'x'
, f_flat_ai = 'm'
, f_fsens = 'x'
, f_fsens_ai = 'm'
, f_flwup = 'x'
, f_flwup_ai = 'm'
, f_evap = 'x'
, f_evap_ai = 'm'
, f_Tair = 'm'
, f_Tref = 'x'
, f_Qref = 'x'
, f_congel = 'm'
, f_frazil = 'm'
, f_snoice = 'm'
, f_meltt = 'm'
, f_meltb = 'm'
, f_meltl = 'm'
, f_fresh = 'x'
, f_fresh_ai = 'm'
, f_fsalt = 'x'
, f_fsalt_ai = 'm'
, f_fhocn = 'x'
, f_fhocn_ai = 'm'
, f_fswthru = 'x'
, f_fswthru_ai = 'm'
, f_fsurf_ai = 'x'
, f_fcondtop_ai = 'x'
, f_fmeltt_ai = 'x'
, f_strairx = 'm'
, f_strairy = 'm'
, f_strtltx = 'x'
, f_strtlty = 'x'
, f_strcorx = 'x'
, f_strcory = 'x'
, f_strocnx = 'x'
, f_strocny = 'x'
, f_strintx = 'x'
, f_strinty = 'x'
, f_strength = 'm'
, f_divu = 'm'
, f_shear = 'm'
, f_sig1 = 'm'
, f_sig2 = 'm'
, f_dvidtt = 'm'
, f_dvidtd = 'm'
, f_daidtt = 'm'
, f_daidtd = 'm'
, f_mlt_onset = 'm'
, f_frz_onset = 'm'
, f_dardg1dt = 'm'
, f_dardg2dt = 'm'
, f_dvirdgdt = 'm'
, f_opening = 'm'
, f_hisnap = 'x'
, f_aisnap = 'x'
, f_trsig = 'm'
, f_icepresent = 'm'
, f_iage = 'x'
, f_aicen = 'x'
, f_vicen = 'x'
, f_fsurfn_ai = 'x'
, f_fcondtopn_ai = 'x'
, f_fmelttn_ai = 'x'
, f_flatn_ai = 'x'
, f_apondn = 'x'
/
Loading

0 comments on commit ab1c53e

Please sign in to comment.