Line data Source code
1 : !=======================================================================
2 : !
3 : ! Output files: netCDF or binary data, Fortran unformatted dumps
4 : !
5 : ! The following variables are currently hard-wired as snapshots
6 : ! (instantaneous rather than time-averages):
7 : ! divu, shear, sig1, sig2, sigP, trsig, mlt_onset, frz_onset, hisnap, aisnap
8 : !
9 : ! Options for histfreq: '1','h','d','m','y','x', where x means that
10 : ! output stream will not be used (recommended for efficiency).
11 : ! histfreq_n can be any nonnegative integer, where 0 means that the
12 : ! corresponding histfreq frequency will not be used.
13 : ! The flags (f_<field>) can be set to '1','h','d','m','y' or 'x', where
14 : ! n means the field will not be written. To output the same field at
15 : ! more than one frequency, for instance monthy and daily, set
16 : ! f_<field> = 'md'.
17 : !
18 : ! authors Tony Craig and Bruce Briegleb, NCAR
19 : ! Elizabeth C. Hunke and William H. Lipscomb, LANL
20 : ! C. M. Bitz, UW
21 : !
22 : ! 2012 Elizabeth Hunke split code from ice_history.F90
23 :
24 : module ice_history_shared
25 :
26 : use ice_kinds_mod
27 : use ice_communicate, only: my_task, master_task
28 : use ice_domain_size, only: max_nstrm
29 : use ice_exit, only: abort_ice
30 : use ice_fileunits, only: nu_diag
31 : use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
32 :
33 : implicit none
34 :
35 : private
36 : public :: define_hist_field, accum_hist_field, icefields_nml, construct_filename
37 :
38 : integer (kind=int_kind), public :: history_precision
39 :
40 : logical (kind=log_kind), public :: &
41 : hist_avg(max_nstrm) ! if true, write averaged data instead of snapshots
42 :
43 : character (len=char_len_long), public :: &
44 : history_file , & ! output file for history ! LCOV_EXCL_LINE
45 : incond_file ! output file for snapshot initial conditions
46 :
47 : character (len=char_len_long), public :: &
48 : history_dir , & ! directory name for history file ! LCOV_EXCL_LINE
49 : incond_dir ! directory for snapshot initial conditions
50 :
51 : character (len=char_len_long), public :: &
52 : pointer_file ! input pointer file for restarts
53 :
54 : character (len=char_len), public :: &
55 : version_name
56 :
57 : character (len=char_len), public :: &
58 : history_format
59 :
60 : !---------------------------------------------------------------
61 : ! Instructions for adding a field: (search for 'example')
62 : ! Here or in ice_history_[process].F90:
63 : ! (1) Add to frequency flags (f_<field>)
64 : ! (2) Add to namelist (here and also in ice_in)
65 : ! (3) Add to index list
66 : ! In init_hist (in ice_history.F90):
67 : ! (4) Add define_hist_field call with vname, vdesc, vunit,
68 : ! and vcomment, vcellmeas, and conversion factor if necessary.
69 : ! (5) Add flag to broadcast list
70 : ! (6) Add accum_hist_field call with appropriate variable
71 : !---------------------------------------------------------------
72 :
73 : type, public :: ice_hist_field
74 : character (len=16) :: vname ! variable name
75 : character (len=16) :: vunit ! variable units
76 : character (len=25) :: vcoord ! variable coordinates
77 : character (len=16) :: vcellmeas ! variable cell measures
78 : character (len=55) :: vdesc ! variable description
79 : character (len=55) :: vcomment ! variable description
80 : real (kind=dbl_kind) :: cona ! multiplicative conversion factor
81 : real (kind=dbl_kind) :: conb ! additive conversion factor
82 : character (len=1) :: vhistfreq ! frequency of history output
83 : integer (kind=int_kind) :: vhistfreq_n ! number of vhistfreq intervals
84 : end type
85 :
86 : integer (kind=int_kind), parameter, public :: &
87 : max_avail_hist_fields = 800 ! Max number of history fields
88 :
89 : integer (kind=int_kind), public :: &
90 : num_avail_hist_fields_tot = 0, & ! Current, total number of defined fields ! LCOV_EXCL_LINE
91 : num_avail_hist_fields_2D = 0, & ! Number of 2D fields ! LCOV_EXCL_LINE
92 : num_avail_hist_fields_3Dz = 0, & ! Number of 3D fields (vertical) ! LCOV_EXCL_LINE
93 : num_avail_hist_fields_3Dc = 0, & ! Number of 3D fields (thickness categories) ! LCOV_EXCL_LINE
94 : num_avail_hist_fields_3Db = 0, & ! Number of 3D fields (vertical biology) ! LCOV_EXCL_LINE
95 : num_avail_hist_fields_3Da = 0, & ! Number of 3D fields (vertical), snow-biology ! LCOV_EXCL_LINE
96 : num_avail_hist_fields_3Df = 0, & ! Number of 3D fields (floe size categories) ! LCOV_EXCL_LINE
97 : num_avail_hist_fields_4Di = 0, & ! Number of 4D fields (categories,vertical), ice ! LCOV_EXCL_LINE
98 : num_avail_hist_fields_4Ds = 0, & ! Number of 4D fields (categories,vertical), snow ! LCOV_EXCL_LINE
99 : num_avail_hist_fields_4Df = 0 ! Number of 4D fields (floe size, thickness categories)
100 :
101 : integer (kind=int_kind), public :: & ! cumulative counts
102 : n2D , & ! num_avail_hist_fields_2D ! LCOV_EXCL_LINE
103 : n3Dccum , & ! n2D + num_avail_hist_fields_3Dc ! LCOV_EXCL_LINE
104 : n3Dzcum , & ! n3Dccum + num_avail_hist_fields_3Dz ! LCOV_EXCL_LINE
105 : n3Dbcum , & ! n3Dzcum + num_avail_hist_fields_3Db ! LCOV_EXCL_LINE
106 : n3Dacum , & ! n3Dbcum + num_avail_hist_fields_3Da ! LCOV_EXCL_LINE
107 : n3Dfcum , & ! n3Dacum + num_avail_hist_fields_3Df ! LCOV_EXCL_LINE
108 : n4Dicum , & ! n3Dfcum + num_avail_hist_fields_4Di ! LCOV_EXCL_LINE
109 : n4Dscum , & ! n4Dicum + num_avail_hist_fields_4Ds ! LCOV_EXCL_LINE
110 : n4Dfcum ! n4Dscum + num_avail_hist_fields_4Df
111 :
112 : ! could set nzilyr = nilyr + nslyr and write Tin+Tsn together into Tinz
113 : integer (kind=int_kind), public :: &
114 : nzilyr , & ! vertical dimension (allows alternative grids) ! LCOV_EXCL_LINE
115 : nzslyr , & ! snow ! LCOV_EXCL_LINE
116 : nzblyr , & ! bio grid ! LCOV_EXCL_LINE
117 : nzalyr ! aerosols (2 snow & nblyr+2 bio) ! LCOV_EXCL_LINE
118 :
119 : type (ice_hist_field), public :: &
120 : avail_hist_fields(max_avail_hist_fields)
121 :
122 : integer (kind=int_kind), parameter, public :: &
123 : nvar_grd = 21 , & ! number of grid fields that can be written ! LCOV_EXCL_LINE
124 : ! excluding grid vertices
125 : nvar_grdz = 6 ! number of category/vertical grid fields written
126 :
127 : integer (kind=int_kind), public :: &
128 : ncat_hist , & ! number of thickness categories written <= ncat ! LCOV_EXCL_LINE
129 : nfsd_hist ! number of floe size categories written <= nfsd
130 :
131 : real (kind=real_kind), public :: time_beg(max_nstrm), & ! bounds for averaging
132 : time_end(max_nstrm), & ! LCOV_EXCL_LINE
133 : time_bounds(2)
134 :
135 : character (len=char_len), public :: hist_time_axis
136 :
137 : real (kind=dbl_kind), allocatable, public :: &
138 : a2D (:,:,:,:) , & ! field accumulations/averages, 2D ! LCOV_EXCL_LINE
139 : a3Dz(:,:,:,:,:) , & ! field accumulations/averages, 3D vertical ! LCOV_EXCL_LINE
140 : a3Db(:,:,:,:,:) , & ! field accumulations/averages, 3D vertical biology ! LCOV_EXCL_LINE
141 : a3Dc(:,:,:,:,:) , & ! field accumulations/averages, 3D thickness categories ! LCOV_EXCL_LINE
142 : a3Da(:,:,:,:,:) , & ! field accumulations/averages, 3D snow+bio ! LCOV_EXCL_LINE
143 : a3Df(:,:,:,:,:) , & ! field accumulations/averages, 3D floe size categories ! LCOV_EXCL_LINE
144 : a4Di(:,:,:,:,:,:), & ! field accumulations/averages, 4D categories,vertical, ice ! LCOV_EXCL_LINE
145 : a4Ds(:,:,:,:,:,:), & ! field accumulations/averages, 4D categories,vertical, snow ! LCOV_EXCL_LINE
146 : a4Df(:,:,:,:,:,:) ! field accumulations/averages, 4D floe size, thickness categories
147 :
148 : real (kind=dbl_kind), allocatable, public :: &
149 : Tinz4d (:,:,:,:) , & ! array for Tin ! LCOV_EXCL_LINE
150 : Tsnz4d (:,:,:,:) , & ! array for Tsn ! LCOV_EXCL_LINE
151 : Sinz4d (:,:,:,:) ! array for Sin
152 :
153 : real (kind=dbl_kind), public :: &
154 : avgct(max_nstrm) ! average sample counter
155 :
156 : logical (kind=log_kind), public :: &
157 : igrd (nvar_grd), & ! true if grid field is written to output file ! LCOV_EXCL_LINE
158 : igrdz(nvar_grdz) ! true if category/vertical grid field is written
159 :
160 : character (len=25), public, parameter :: &
161 : ! T grids
162 : tcstr = 'area: tarea' , & ! vcellmeas for T cell quantities
163 : tstr2D = 'TLON TLAT time' , & ! vcoord for T cell, 2D ! LCOV_EXCL_LINE
164 : tstr3Dc = 'TLON TLAT NCAT time', & ! vcoord for T cell, 3D, ncat ! LCOV_EXCL_LINE
165 : tstr3Da = 'TLON TLAT VGRDa time', & ! vcoord for T cell, 3D, ice-snow-bio ! LCOV_EXCL_LINE
166 : tstr3Db = 'TLON TLAT VGRDb time', & ! vcoord for T cell, 3D, ice-bio ! LCOV_EXCL_LINE
167 : tstr3Df = 'TLON TLAT NFSD time', & ! vcoord for T cell, 3D, fsd ! LCOV_EXCL_LINE
168 : tstr4Di = 'TLON TLAT VGRDi NCAT', & ! vcoord for T cell, 4D, ice ! LCOV_EXCL_LINE
169 : tstr4Ds = 'TLON TLAT VGRDs NCAT', & ! vcoord for T cell, 4D, snow ! LCOV_EXCL_LINE
170 : tstr4Df = 'TLON TLAT NFSD NCAT', & ! vcoord for T cell, 4D, fsd ! LCOV_EXCL_LINE
171 : ! U grids
172 : ucstr = 'area: uarea' , & ! vcellmeas for U cell quantities
173 : ustr2D = 'ULON ULAT time' , & ! vcoord for U cell, 2D ! LCOV_EXCL_LINE
174 : ! N grids
175 : ncstr = 'area: narea' , & ! vcellmeas for N cell quantities
176 : nstr2D = 'NLON NLAT time' , & ! vcoord for N cell, 2D ! LCOV_EXCL_LINE
177 : ! E grids
178 : ecstr = 'area: earea' , & ! vcellmeas for E cell quantities
179 : estr2D = 'ELON ELAT time' ! vcoord for E cell, 2D
180 :
181 : !---------------------------------------------------------------
182 : ! flags: write to output file if true or histfreq value
183 : !---------------------------------------------------------------
184 :
185 : logical (kind=log_kind), public :: &
186 : f_tmask = .true., f_umask = .true., & ! LCOV_EXCL_LINE
187 : f_nmask = .true., f_emask = .true., & ! LCOV_EXCL_LINE
188 : f_blkmask = .true., & ! LCOV_EXCL_LINE
189 : f_tarea = .true., f_uarea = .true., & ! LCOV_EXCL_LINE
190 : f_narea = .true., f_earea = .true., & ! LCOV_EXCL_LINE
191 : f_dxt = .true., f_dyt = .true., & ! LCOV_EXCL_LINE
192 : f_dxu = .true., f_dyu = .true., & ! LCOV_EXCL_LINE
193 : f_dxn = .true., f_dyn = .true., & ! LCOV_EXCL_LINE
194 : f_dxe = .true., f_dye = .true., & ! LCOV_EXCL_LINE
195 : f_HTN = .true., f_HTE = .true., & ! LCOV_EXCL_LINE
196 : f_ANGLE = .true., f_ANGLET = .true., & ! LCOV_EXCL_LINE
197 : f_bounds = .true., f_NCAT = .true., & ! LCOV_EXCL_LINE
198 : f_VGRDi = .true., f_VGRDs = .true., & ! LCOV_EXCL_LINE
199 : f_VGRDb = .true., f_VGRDa = .true., & ! LCOV_EXCL_LINE
200 : f_NFSD = .false.
201 :
202 : character (len=max_nstrm), public :: &
203 : ! f_example = 'md', & ! LCOV_EXCL_LINE
204 : f_hi = 'm', f_hs = 'm', & ! LCOV_EXCL_LINE
205 : f_snowfrac = 'x', f_snowfracn = 'x', & ! LCOV_EXCL_LINE
206 : f_Tsfc = 'm', f_aice = 'm', & ! LCOV_EXCL_LINE
207 : f_uvel = 'm', f_vvel = 'm', & ! LCOV_EXCL_LINE
208 : f_icespd = 'm', f_icedir = 'm', & ! LCOV_EXCL_LINE
209 : f_uvelE = 'x', f_vvelE = 'x', & ! LCOV_EXCL_LINE
210 : f_icespdE = 'x', f_icedirE = 'x', & ! LCOV_EXCL_LINE
211 : f_uvelN = 'x', f_vvelN = 'x', & ! LCOV_EXCL_LINE
212 : f_icespdN = 'x', f_icedirN = 'x', & ! LCOV_EXCL_LINE
213 : f_uatm = 'm', f_vatm = 'm', & ! LCOV_EXCL_LINE
214 : f_atmspd = 'm', f_atmdir = 'm', & ! LCOV_EXCL_LINE
215 : f_fswup = 'm', & ! LCOV_EXCL_LINE
216 : f_fswdn = 'm', f_flwdn = 'm', & ! LCOV_EXCL_LINE
217 : f_snow = 'm', f_snow_ai = 'm', & ! LCOV_EXCL_LINE
218 : f_rain = 'm', f_rain_ai = 'm', & ! LCOV_EXCL_LINE
219 : f_sst = 'm', f_sss = 'm', & ! LCOV_EXCL_LINE
220 : f_uocn = 'm', f_vocn = 'm', & ! LCOV_EXCL_LINE
221 : f_ocnspd = 'm', f_ocndir = 'm', & ! LCOV_EXCL_LINE
222 : f_sice = 'm', f_frzmlt = 'm', & ! LCOV_EXCL_LINE
223 : f_fswfac = 'm', f_fswint_ai = 'x', & ! LCOV_EXCL_LINE
224 : f_fswabs = 'm', f_fswabs_ai = 'm', & ! LCOV_EXCL_LINE
225 : f_albsni = 'm', & ! LCOV_EXCL_LINE
226 : f_alvdr = 'x', f_alidr = 'x', & ! LCOV_EXCL_LINE
227 : f_alvdf = 'x', f_alidf = 'x', & ! LCOV_EXCL_LINE
228 : f_alvdr_ai = 'm', f_alidr_ai = 'm', & ! LCOV_EXCL_LINE
229 : f_alvdf_ai = 'm', f_alidf_ai = 'm', & ! LCOV_EXCL_LINE
230 : f_albice = 'm', f_albsno = 'm', & ! LCOV_EXCL_LINE
231 : f_albpnd = 'm', f_coszen = 'm', & ! LCOV_EXCL_LINE
232 : f_flat = 'm', f_flat_ai = 'm', & ! LCOV_EXCL_LINE
233 : f_fsens = 'm', f_fsens_ai = 'm', & ! LCOV_EXCL_LINE
234 : f_flwup = 'm', f_flwup_ai = 'm', & ! LCOV_EXCL_LINE
235 : f_evap = 'm', f_evap_ai = 'm', & ! LCOV_EXCL_LINE
236 : f_Tair = 'm', & ! LCOV_EXCL_LINE
237 : f_Tref = 'm', f_Qref = 'm', & ! LCOV_EXCL_LINE
238 : f_congel = 'm', f_frazil = 'm', & ! LCOV_EXCL_LINE
239 : f_snoice = 'm', f_dsnow = 'm', & ! LCOV_EXCL_LINE
240 : f_meltt = 'm', f_melts = 'm', & ! LCOV_EXCL_LINE
241 : f_meltb = 'm', f_meltl = 'm', & ! LCOV_EXCL_LINE
242 : f_fresh = 'm', f_fresh_ai = 'm', & ! LCOV_EXCL_LINE
243 : f_fsalt = 'm', f_fsalt_ai = 'm', & ! LCOV_EXCL_LINE
244 : f_fbot = 'm', & ! LCOV_EXCL_LINE
245 : f_fhocn = 'm', f_fhocn_ai = 'm', & ! LCOV_EXCL_LINE
246 : f_fswthru = 'm', f_fswthru_ai = 'm', & ! LCOV_EXCL_LINE
247 : f_strairx = 'm', f_strairy = 'm', & ! LCOV_EXCL_LINE
248 : f_strtltx = 'm', f_strtlty = 'm', & ! LCOV_EXCL_LINE
249 : f_strcorx = 'm', f_strcory = 'm', & ! LCOV_EXCL_LINE
250 : f_strocnx = 'm', f_strocny = 'm', & ! LCOV_EXCL_LINE
251 : f_strintx = 'm', f_strinty = 'm', & ! LCOV_EXCL_LINE
252 : f_taubx = 'm', f_tauby = 'm', & ! LCOV_EXCL_LINE
253 : f_strairxN = 'x', f_strairyN = 'x', & ! LCOV_EXCL_LINE
254 : f_strtltxN = 'x', f_strtltyN = 'x', & ! LCOV_EXCL_LINE
255 : f_strcorxN = 'x', f_strcoryN = 'x', & ! LCOV_EXCL_LINE
256 : f_strocnxN = 'x', f_strocnyN = 'x', & ! LCOV_EXCL_LINE
257 : f_strintxN = 'x', f_strintyN = 'x', & ! LCOV_EXCL_LINE
258 : f_taubxN = 'x', f_taubyN = 'x', & ! LCOV_EXCL_LINE
259 : f_strairxE = 'x', f_strairyE = 'x', & ! LCOV_EXCL_LINE
260 : f_strtltxE = 'x', f_strtltyE = 'x', & ! LCOV_EXCL_LINE
261 : f_strcorxE = 'x', f_strcoryE = 'x', & ! LCOV_EXCL_LINE
262 : f_strocnxE = 'x', f_strocnyE = 'x', & ! LCOV_EXCL_LINE
263 : f_strintxE = 'x', f_strintyE = 'x', & ! LCOV_EXCL_LINE
264 : f_taubxE = 'x', f_taubyE = 'x', & ! LCOV_EXCL_LINE
265 : f_strength = 'm', & ! LCOV_EXCL_LINE
266 : f_divu = 'm', f_shear = 'm', & ! LCOV_EXCL_LINE
267 : f_sig1 = 'm', f_sig2 = 'm', & ! LCOV_EXCL_LINE
268 : f_sigP = 'm', & ! LCOV_EXCL_LINE
269 : f_dvidtt = 'm', f_dvidtd = 'm', & ! LCOV_EXCL_LINE
270 : f_daidtt = 'm', f_daidtd = 'm', & ! LCOV_EXCL_LINE
271 : f_dagedtt = 'm', f_dagedtd = 'm', & ! LCOV_EXCL_LINE
272 : f_mlt_onset = 'm', f_frz_onset = 'm', & ! LCOV_EXCL_LINE
273 : f_iage = 'm', f_FY = 'm', & ! LCOV_EXCL_LINE
274 : f_hisnap = 'm', f_aisnap = 'm', & ! LCOV_EXCL_LINE
275 : f_CMIP = 'x' , & ! LCOV_EXCL_LINE
276 : f_sithick = 'x', f_sisnthick = 'x', & ! LCOV_EXCL_LINE
277 : f_siage = 'x', & ! LCOV_EXCL_LINE
278 : f_sitemptop = 'x', f_sitempsnic = 'x', & ! LCOV_EXCL_LINE
279 : f_sitempbot = 'x', & ! LCOV_EXCL_LINE
280 : f_sispeed = 'x', f_sidir = 'x', & ! LCOV_EXCL_LINE
281 : f_siu = 'x', f_siv = 'x', & ! LCOV_EXCL_LINE
282 : f_sidmasstranx = 'x', f_sidmasstrany = 'x', & ! LCOV_EXCL_LINE
283 : f_sistrxdtop = 'x', f_sistrydtop = 'x', & ! LCOV_EXCL_LINE
284 : f_sistrxubot = 'x', f_sistryubot = 'x', & ! LCOV_EXCL_LINE
285 : f_sicompstren = 'x', & ! LCOV_EXCL_LINE
286 : f_sialb = 'x', & ! LCOV_EXCL_LINE
287 : f_sihc = 'x', f_sisnhc = 'x', & ! LCOV_EXCL_LINE
288 : f_sidconcth = 'x', f_sidconcdyn = 'x', & ! LCOV_EXCL_LINE
289 : f_sidmassth = 'x', f_sidmassdyn = 'x', & ! LCOV_EXCL_LINE
290 : f_sidmassgrowthwat = 'x', & ! LCOV_EXCL_LINE
291 : f_sidmassgrowthbot = 'x', & ! LCOV_EXCL_LINE
292 : f_sidmasssi = 'x', & ! LCOV_EXCL_LINE
293 : f_sidmassevapsubl = 'x', & ! LCOV_EXCL_LINE
294 : f_sndmasssubl = 'x', & ! LCOV_EXCL_LINE
295 : f_sidmassmelttop = 'x', & ! LCOV_EXCL_LINE
296 : f_sidmassmeltbot = 'x', & ! LCOV_EXCL_LINE
297 : f_sidmasslat = 'x', & ! LCOV_EXCL_LINE
298 : f_sndmasssnf = 'x', & ! LCOV_EXCL_LINE
299 : f_sndmassmelt = 'x', & ! LCOV_EXCL_LINE
300 : f_siflswdtop = 'x', & ! LCOV_EXCL_LINE
301 : f_siflswutop = 'x', & ! LCOV_EXCL_LINE
302 : f_siflswdbot = 'x', & ! LCOV_EXCL_LINE
303 : f_sifllwdtop = 'x', & ! LCOV_EXCL_LINE
304 : f_sifllwutop = 'x', & ! LCOV_EXCL_LINE
305 : f_siflsenstop = 'x', & ! LCOV_EXCL_LINE
306 : f_siflsensupbot = 'x', & ! LCOV_EXCL_LINE
307 : f_sifllatstop = 'x', & ! LCOV_EXCL_LINE
308 : f_siflcondtop = 'x', & ! LCOV_EXCL_LINE
309 : f_siflcondbot = 'x', & ! LCOV_EXCL_LINE
310 : f_sipr = 'x', & ! LCOV_EXCL_LINE
311 : f_sifb = 'x', & ! LCOV_EXCL_LINE
312 : f_siflsaltbot = 'x', & ! LCOV_EXCL_LINE
313 : f_siflfwbot = 'x', & ! LCOV_EXCL_LINE
314 : f_siflfwdrain = 'x', & ! LCOV_EXCL_LINE
315 : f_siforcetiltx = 'x', & ! LCOV_EXCL_LINE
316 : f_siforcetilty = 'x', & ! LCOV_EXCL_LINE
317 : f_siforcecoriolx = 'x', & ! LCOV_EXCL_LINE
318 : f_siforcecorioly = 'x', & ! LCOV_EXCL_LINE
319 : f_siforceintstrx = 'x', & ! LCOV_EXCL_LINE
320 : f_siforceintstry = 'x', & ! LCOV_EXCL_LINE
321 : f_siitdconc = 'x', & ! LCOV_EXCL_LINE
322 : f_siitdthick = 'x', & ! LCOV_EXCL_LINE
323 : f_siitdsnthick = 'x', & ! LCOV_EXCL_LINE
324 : f_sidragtop = 'x', & ! LCOV_EXCL_LINE
325 : f_sirdgthick = 'x', & ! LCOV_EXCL_LINE
326 : f_sistreave = 'x', & ! LCOV_EXCL_LINE
327 : f_sistremax = 'x', & ! LCOV_EXCL_LINE
328 : f_aicen = 'x', f_vicen = 'x', & ! LCOV_EXCL_LINE
329 : f_vsnon = 'x', & ! LCOV_EXCL_LINE
330 : f_trsig = 'm', f_icepresent = 'm', & ! LCOV_EXCL_LINE
331 : f_fsurf_ai = 'm', f_fcondtop_ai= 'm', & ! LCOV_EXCL_LINE
332 : f_fmeltt_ai = 'm', & ! LCOV_EXCL_LINE
333 : f_fsurfn_ai = 'x' ,f_fcondtopn_ai='x', & ! LCOV_EXCL_LINE
334 : f_fmelttn_ai= 'x', f_flatn_ai = 'x', & ! LCOV_EXCL_LINE
335 : f_fsensn_ai = 'x', & ! LCOV_EXCL_LINE
336 : ! f_field3dz = 'x', & ! LCOV_EXCL_LINE
337 : f_keffn_top = 'x', & ! LCOV_EXCL_LINE
338 : f_Tinz = 'x', f_Sinz = 'x', & ! LCOV_EXCL_LINE
339 : f_Tsnz = 'x', & ! LCOV_EXCL_LINE
340 : f_a11 = 'x', f_a12 = 'x', & ! LCOV_EXCL_LINE
341 : f_e11 = 'x', f_e12 = 'x', & ! LCOV_EXCL_LINE
342 : f_e22 = 'x', & ! LCOV_EXCL_LINE
343 : f_s11 = 'x', f_s12 = 'x', & ! LCOV_EXCL_LINE
344 : f_s22 = 'x', & ! LCOV_EXCL_LINE
345 : f_yieldstress11 = 'x', & ! LCOV_EXCL_LINE
346 : f_yieldstress12 = 'x', & ! LCOV_EXCL_LINE
347 : f_yieldstress22 = 'x'
348 :
349 : !---------------------------------------------------------------
350 : ! namelist variables
351 : !---------------------------------------------------------------
352 :
353 : namelist / icefields_nml / &
354 : f_tmask , f_umask , & ! LCOV_EXCL_LINE
355 : f_nmask , f_emask , & ! LCOV_EXCL_LINE
356 : f_blkmask , & ! LCOV_EXCL_LINE
357 : f_tarea , f_uarea , & ! LCOV_EXCL_LINE
358 : f_narea , f_earea , & ! LCOV_EXCL_LINE
359 : f_dxt , f_dyt , & ! LCOV_EXCL_LINE
360 : f_dxu , f_dyu , & ! LCOV_EXCL_LINE
361 : f_dxn , f_dyn , & ! LCOV_EXCL_LINE
362 : f_dxe , f_dye , & ! LCOV_EXCL_LINE
363 : f_HTN , f_HTE , & ! LCOV_EXCL_LINE
364 : f_ANGLE , f_ANGLET , & ! LCOV_EXCL_LINE
365 : f_bounds , f_NCAT , & ! LCOV_EXCL_LINE
366 : f_VGRDi , f_VGRDs , & ! LCOV_EXCL_LINE
367 : f_VGRDb , f_VGRDa , & ! LCOV_EXCL_LINE
368 : f_NFSD , & ! LCOV_EXCL_LINE
369 : ! f_example , & ! LCOV_EXCL_LINE
370 : f_hi, f_hs , & ! LCOV_EXCL_LINE
371 : f_snowfrac, f_snowfracn, & ! LCOV_EXCL_LINE
372 : f_Tsfc, f_aice , & ! LCOV_EXCL_LINE
373 : f_uvel, f_vvel , & ! LCOV_EXCL_LINE
374 : f_icespd, f_icedir , & ! LCOV_EXCL_LINE
375 : ! For now, C and CD grid quantities are controlled by the generic (originally B-grid) namelist flag
376 : ! f_uvelE, f_vvelE , &
377 : ! f_icespdE, f_icedirE , & ! LCOV_EXCL_LINE
378 : ! f_uvelN, f_vvelN , & ! LCOV_EXCL_LINE
379 : ! f_icespdN, f_icedirN , & ! LCOV_EXCL_LINE
380 : f_uatm, f_vatm , & ! LCOV_EXCL_LINE
381 : f_atmspd, f_atmdir , & ! LCOV_EXCL_LINE
382 : f_fswup, & ! LCOV_EXCL_LINE
383 : f_fswdn, f_flwdn , & ! LCOV_EXCL_LINE
384 : f_snow, f_snow_ai , & ! LCOV_EXCL_LINE
385 : f_rain, f_rain_ai , & ! LCOV_EXCL_LINE
386 : f_sst, f_sss , & ! LCOV_EXCL_LINE
387 : f_uocn, f_vocn , & ! LCOV_EXCL_LINE
388 : f_ocnspd, f_ocndir , & ! LCOV_EXCL_LINE
389 : f_sice, f_frzmlt , & ! LCOV_EXCL_LINE
390 : f_fswfac, f_fswint_ai, & ! LCOV_EXCL_LINE
391 : f_fswabs, f_fswabs_ai, & ! LCOV_EXCL_LINE
392 : f_albsni, & ! LCOV_EXCL_LINE
393 : f_alvdr, f_alidr , & ! LCOV_EXCL_LINE
394 : f_alvdf, f_alidf , & ! LCOV_EXCL_LINE
395 : f_alvdr_ai, f_alidr_ai , & ! LCOV_EXCL_LINE
396 : f_alvdf_ai, f_alidf_ai , & ! LCOV_EXCL_LINE
397 : f_albice, f_albsno , & ! LCOV_EXCL_LINE
398 : f_albpnd, f_coszen , & ! LCOV_EXCL_LINE
399 : f_flat, f_flat_ai , & ! LCOV_EXCL_LINE
400 : f_fsens, f_fsens_ai , & ! LCOV_EXCL_LINE
401 : f_flwup, f_flwup_ai , & ! LCOV_EXCL_LINE
402 : f_evap, f_evap_ai , & ! LCOV_EXCL_LINE
403 : f_Tair, & ! LCOV_EXCL_LINE
404 : f_Tref, f_Qref , & ! LCOV_EXCL_LINE
405 : f_congel, f_frazil , & ! LCOV_EXCL_LINE
406 : f_snoice, f_dsnow , & ! LCOV_EXCL_LINE
407 : f_meltt, f_melts , & ! LCOV_EXCL_LINE
408 : f_meltb, f_meltl , & ! LCOV_EXCL_LINE
409 : f_fresh, f_fresh_ai , & ! LCOV_EXCL_LINE
410 : f_fsalt, f_fsalt_ai , & ! LCOV_EXCL_LINE
411 : f_fbot, & ! LCOV_EXCL_LINE
412 : f_fhocn, f_fhocn_ai , & ! LCOV_EXCL_LINE
413 : f_fswthru, f_fswthru_ai,& ! LCOV_EXCL_LINE
414 : f_strairx, f_strairy , & ! LCOV_EXCL_LINE
415 : f_strtltx, f_strtlty , & ! LCOV_EXCL_LINE
416 : f_strcorx, f_strcory , & ! LCOV_EXCL_LINE
417 : f_strocnx, f_strocny , & ! LCOV_EXCL_LINE
418 : f_strintx, f_strinty , & ! LCOV_EXCL_LINE
419 : f_taubx, f_tauby , & ! LCOV_EXCL_LINE
420 : ! f_strairxN, f_strairyN , & ! LCOV_EXCL_LINE
421 : ! f_strtltxN, f_strtltyN , & ! LCOV_EXCL_LINE
422 : ! f_strcorxN, f_strcoryN , & ! LCOV_EXCL_LINE
423 : ! f_strocnxN, f_strocnyN , & ! LCOV_EXCL_LINE
424 : ! f_strintxN, f_strintyN , & ! LCOV_EXCL_LINE
425 : ! f_taubxN, f_taubyN , & ! LCOV_EXCL_LINE
426 : ! f_strairxE, f_strairyE , & ! LCOV_EXCL_LINE
427 : ! f_strtltxE, f_strtltyE , & ! LCOV_EXCL_LINE
428 : ! f_strcorxE, f_strcoryE , & ! LCOV_EXCL_LINE
429 : ! f_strocnxE, f_strocnyE , & ! LCOV_EXCL_LINE
430 : ! f_strintxE, f_strintyE , & ! LCOV_EXCL_LINE
431 : ! f_taubxE, f_taubyE , & ! LCOV_EXCL_LINE
432 : f_strength, & ! LCOV_EXCL_LINE
433 : f_divu, f_shear , & ! LCOV_EXCL_LINE
434 : f_sig1, f_sig2 , & ! LCOV_EXCL_LINE
435 : f_sigP, & ! LCOV_EXCL_LINE
436 : f_dvidtt, f_dvidtd , & ! LCOV_EXCL_LINE
437 : f_daidtt, f_daidtd , & ! LCOV_EXCL_LINE
438 : f_dagedtt, f_dagedtd , & ! LCOV_EXCL_LINE
439 : f_mlt_onset, f_frz_onset, & ! LCOV_EXCL_LINE
440 : f_iage, f_FY , & ! LCOV_EXCL_LINE
441 : f_hisnap, f_aisnap , & ! LCOV_EXCL_LINE
442 : f_CMIP, & ! LCOV_EXCL_LINE
443 : f_sithick, f_sisnthick, & ! LCOV_EXCL_LINE
444 : f_siage, & ! LCOV_EXCL_LINE
445 : f_sitemptop, f_sitempsnic,& ! LCOV_EXCL_LINE
446 : f_sitempbot, & ! LCOV_EXCL_LINE
447 : f_sispeed, f_sidir, & ! LCOV_EXCL_LINE
448 : f_siu, f_siv, & ! LCOV_EXCL_LINE
449 : f_sidmasstranx, f_sidmasstrany, & ! LCOV_EXCL_LINE
450 : f_sistrxdtop, f_sistrydtop, & ! LCOV_EXCL_LINE
451 : f_sistrxubot, f_sistryubot, & ! LCOV_EXCL_LINE
452 : f_sicompstren, & ! LCOV_EXCL_LINE
453 : f_sialb, & ! LCOV_EXCL_LINE
454 : f_sihc, f_sisnhc, & ! LCOV_EXCL_LINE
455 : f_sidconcth, f_sidconcdyn,& ! LCOV_EXCL_LINE
456 : f_sidmassth, f_sidmassdyn,& ! LCOV_EXCL_LINE
457 : f_sidmassgrowthwat, & ! LCOV_EXCL_LINE
458 : f_sidmassgrowthbot, & ! LCOV_EXCL_LINE
459 : f_sidmasssi, & ! LCOV_EXCL_LINE
460 : f_sidmassevapsubl, & ! LCOV_EXCL_LINE
461 : f_sndmasssubl, & ! LCOV_EXCL_LINE
462 : f_sidmassmelttop, & ! LCOV_EXCL_LINE
463 : f_sidmassmeltbot, & ! LCOV_EXCL_LINE
464 : f_sidmasslat, & ! LCOV_EXCL_LINE
465 : f_sndmasssnf, & ! LCOV_EXCL_LINE
466 : f_sndmassmelt, & ! LCOV_EXCL_LINE
467 : f_siflswdtop, & ! LCOV_EXCL_LINE
468 : f_siflswutop, & ! LCOV_EXCL_LINE
469 : f_siflswdbot, & ! LCOV_EXCL_LINE
470 : f_sifllwdtop, & ! LCOV_EXCL_LINE
471 : f_sifllwutop, & ! LCOV_EXCL_LINE
472 : f_siflsenstop, & ! LCOV_EXCL_LINE
473 : f_siflsensupbot, & ! LCOV_EXCL_LINE
474 : f_sifllatstop, & ! LCOV_EXCL_LINE
475 : f_siflcondtop, & ! LCOV_EXCL_LINE
476 : f_siflcondbot, & ! LCOV_EXCL_LINE
477 : f_sipr, & ! LCOV_EXCL_LINE
478 : f_sifb, & ! LCOV_EXCL_LINE
479 : f_siflsaltbot, & ! LCOV_EXCL_LINE
480 : f_siflfwbot, & ! LCOV_EXCL_LINE
481 : f_siflfwdrain, & ! LCOV_EXCL_LINE
482 : f_siforcetiltx, & ! LCOV_EXCL_LINE
483 : f_siforcetilty, & ! LCOV_EXCL_LINE
484 : f_siforcecoriolx, & ! LCOV_EXCL_LINE
485 : f_siforcecorioly, & ! LCOV_EXCL_LINE
486 : f_siforceintstrx, & ! LCOV_EXCL_LINE
487 : f_siforceintstry, & ! LCOV_EXCL_LINE
488 : f_siitdconc, & ! LCOV_EXCL_LINE
489 : f_siitdthick, & ! LCOV_EXCL_LINE
490 : f_siitdsnthick, & ! LCOV_EXCL_LINE
491 : f_sidragtop, & ! LCOV_EXCL_LINE
492 : f_sirdgthick, & ! LCOV_EXCL_LINE
493 : f_sistreave, & ! LCOV_EXCL_LINE
494 : f_sistremax, & ! LCOV_EXCL_LINE
495 : f_aicen, f_vicen , & ! LCOV_EXCL_LINE
496 : f_vsnon, & ! LCOV_EXCL_LINE
497 : f_trsig, f_icepresent,& ! LCOV_EXCL_LINE
498 : f_fsurf_ai, f_fcondtop_ai,& ! LCOV_EXCL_LINE
499 : f_fmeltt_ai, & ! LCOV_EXCL_LINE
500 : f_fsurfn_ai,f_fcondtopn_ai,& ! LCOV_EXCL_LINE
501 : f_fmelttn_ai,f_flatn_ai, & ! LCOV_EXCL_LINE
502 : f_fsensn_ai, & ! LCOV_EXCL_LINE
503 : ! f_field3dz, & ! LCOV_EXCL_LINE
504 : f_keffn_top, & ! LCOV_EXCL_LINE
505 : f_Tinz, f_Sinz, & ! LCOV_EXCL_LINE
506 : f_Tsnz, & ! LCOV_EXCL_LINE
507 : f_a11, f_a12, & ! LCOV_EXCL_LINE
508 : f_e11, f_e12, & ! LCOV_EXCL_LINE
509 : f_e22, & ! LCOV_EXCL_LINE
510 : f_s11, f_s12, & ! LCOV_EXCL_LINE
511 : f_s22, & ! LCOV_EXCL_LINE
512 : f_yieldstress11, & ! LCOV_EXCL_LINE
513 : f_yieldstress12, & ! LCOV_EXCL_LINE
514 : f_yieldstress22
515 :
516 : !---------------------------------------------------------------
517 : ! field indices
518 : !---------------------------------------------------------------
519 :
520 : integer (kind=int_kind), parameter, public :: &
521 : n_tmask = 1, & ! LCOV_EXCL_LINE
522 : n_umask = 2, & ! LCOV_EXCL_LINE
523 : n_nmask = 3, & ! LCOV_EXCL_LINE
524 : n_emask = 4, & ! LCOV_EXCL_LINE
525 : n_blkmask = 5, & ! LCOV_EXCL_LINE
526 : n_tarea = 6, & ! LCOV_EXCL_LINE
527 : n_uarea = 7, & ! LCOV_EXCL_LINE
528 : n_narea = 8, & ! LCOV_EXCL_LINE
529 : n_earea = 9, & ! LCOV_EXCL_LINE
530 : n_dxt = 10, & ! LCOV_EXCL_LINE
531 : n_dyt = 11, & ! LCOV_EXCL_LINE
532 : n_dxu = 12, & ! LCOV_EXCL_LINE
533 : n_dyu = 13, & ! LCOV_EXCL_LINE
534 : n_dxn = 14, & ! LCOV_EXCL_LINE
535 : n_dyn = 15, & ! LCOV_EXCL_LINE
536 : n_dxe = 16, & ! LCOV_EXCL_LINE
537 : n_dye = 17, & ! LCOV_EXCL_LINE
538 : n_HTN = 18, & ! LCOV_EXCL_LINE
539 : n_HTE = 19, & ! LCOV_EXCL_LINE
540 : n_ANGLE = 20, & ! LCOV_EXCL_LINE
541 : n_ANGLET = 21, & ! LCOV_EXCL_LINE
542 :
543 : n_NCAT = 1, &
544 : n_VGRDi = 2, & ! LCOV_EXCL_LINE
545 : n_VGRDs = 3, & ! LCOV_EXCL_LINE
546 : n_VGRDb = 4, & ! LCOV_EXCL_LINE
547 : n_VGRDa = 5, & ! LCOV_EXCL_LINE
548 : n_NFSD = 6, & ! LCOV_EXCL_LINE
549 :
550 : n_lont_bnds = 1, &
551 : n_latt_bnds = 2, & ! LCOV_EXCL_LINE
552 : n_lonu_bnds = 3, & ! LCOV_EXCL_LINE
553 : n_latu_bnds = 4, & ! LCOV_EXCL_LINE
554 : n_lonn_bnds = 5, & ! LCOV_EXCL_LINE
555 : n_latn_bnds = 6, & ! LCOV_EXCL_LINE
556 : n_lone_bnds = 7, & ! LCOV_EXCL_LINE
557 : n_late_bnds = 8
558 :
559 : integer (kind=int_kind), dimension(max_nstrm), public :: &
560 : ! n_example , & ! LCOV_EXCL_LINE
561 : n_hi , n_hs , & ! LCOV_EXCL_LINE
562 : n_snowfrac , n_snowfracn , & ! LCOV_EXCL_LINE
563 : n_Tsfc , n_aice , & ! LCOV_EXCL_LINE
564 : n_uvel , n_vvel , & ! LCOV_EXCL_LINE
565 : n_icespd , n_icedir , & ! LCOV_EXCL_LINE
566 : n_uvelE , n_vvelE , & ! LCOV_EXCL_LINE
567 : n_icespdE , n_icedirE , & ! LCOV_EXCL_LINE
568 : n_uvelN , n_vvelN , & ! LCOV_EXCL_LINE
569 : n_icespdN , n_icedirN , & ! LCOV_EXCL_LINE
570 : n_uatm , n_vatm , & ! LCOV_EXCL_LINE
571 : n_atmspd , n_atmdir , & ! LCOV_EXCL_LINE
572 : n_sice , & ! LCOV_EXCL_LINE
573 : n_fswup , & ! LCOV_EXCL_LINE
574 : n_fswdn , n_flwdn , & ! LCOV_EXCL_LINE
575 : n_snow , n_snow_ai , & ! LCOV_EXCL_LINE
576 : n_rain , n_rain_ai , & ! LCOV_EXCL_LINE
577 : n_sst , n_sss , & ! LCOV_EXCL_LINE
578 : n_uocn , n_vocn , & ! LCOV_EXCL_LINE
579 : n_ocnspd , n_ocndir , & ! LCOV_EXCL_LINE
580 : n_frzmlt , n_fswfac , & ! LCOV_EXCL_LINE
581 : n_fswint_ai , & ! LCOV_EXCL_LINE
582 : n_fswabs , n_fswabs_ai , & ! LCOV_EXCL_LINE
583 : n_albsni , & ! LCOV_EXCL_LINE
584 : n_alvdr , n_alidr , & ! LCOV_EXCL_LINE
585 : n_alvdf , n_alidf , & ! LCOV_EXCL_LINE
586 : n_alvdr_ai , n_alidr_ai , & ! LCOV_EXCL_LINE
587 : n_alvdf_ai , n_alidf_ai , & ! LCOV_EXCL_LINE
588 : n_albice , n_albsno , & ! LCOV_EXCL_LINE
589 : n_albpnd , n_coszen , & ! LCOV_EXCL_LINE
590 : n_flat , n_flat_ai , & ! LCOV_EXCL_LINE
591 : n_fsens , n_fsens_ai , & ! LCOV_EXCL_LINE
592 : n_flwup , n_flwup_ai , & ! LCOV_EXCL_LINE
593 : n_evap , n_evap_ai , & ! LCOV_EXCL_LINE
594 : n_Tair , & ! LCOV_EXCL_LINE
595 : n_Tref , n_Qref , & ! LCOV_EXCL_LINE
596 : n_congel , n_frazil , & ! LCOV_EXCL_LINE
597 : n_snoice , n_dsnow , & ! LCOV_EXCL_LINE
598 : n_meltt , n_melts , & ! LCOV_EXCL_LINE
599 : n_meltb , n_meltl , & ! LCOV_EXCL_LINE
600 : n_fresh , n_fresh_ai , & ! LCOV_EXCL_LINE
601 : n_fsalt , n_fsalt_ai , & ! LCOV_EXCL_LINE
602 : n_vsnon , & ! LCOV_EXCL_LINE
603 : n_fbot , & ! LCOV_EXCL_LINE
604 : n_fhocn , n_fhocn_ai , & ! LCOV_EXCL_LINE
605 : n_fswthru , n_fswthru_ai , & ! LCOV_EXCL_LINE
606 : n_strairx , n_strairy , & ! LCOV_EXCL_LINE
607 : n_strtltx , n_strtlty , & ! LCOV_EXCL_LINE
608 : n_strcorx , n_strcory , & ! LCOV_EXCL_LINE
609 : n_strocnx , n_strocny , & ! LCOV_EXCL_LINE
610 : n_strintx , n_strinty , & ! LCOV_EXCL_LINE
611 : n_taubx , n_tauby , & ! LCOV_EXCL_LINE
612 : n_strairxN , n_strairyN , & ! LCOV_EXCL_LINE
613 : n_strtltxN , n_strtltyN , & ! LCOV_EXCL_LINE
614 : n_strcorxN , n_strcoryN , & ! LCOV_EXCL_LINE
615 : n_strocnxN , n_strocnyN , & ! LCOV_EXCL_LINE
616 : n_strintxN , n_strintyN , & ! LCOV_EXCL_LINE
617 : n_taubxN , n_taubyN , & ! LCOV_EXCL_LINE
618 : n_strairxE , n_strairyE , & ! LCOV_EXCL_LINE
619 : n_strtltxE , n_strtltyE , & ! LCOV_EXCL_LINE
620 : n_strcorxE , n_strcoryE , & ! LCOV_EXCL_LINE
621 : n_strocnxE , n_strocnyE , & ! LCOV_EXCL_LINE
622 : n_strintxE , n_strintyE , & ! LCOV_EXCL_LINE
623 : n_taubxE , n_taubyE , & ! LCOV_EXCL_LINE
624 : n_strength , & ! LCOV_EXCL_LINE
625 : n_divu , n_shear , & ! LCOV_EXCL_LINE
626 : n_sig1 , n_sig2 , & ! LCOV_EXCL_LINE
627 : n_sigP , & ! LCOV_EXCL_LINE
628 : n_dvidtt , n_dvidtd , & ! LCOV_EXCL_LINE
629 : n_daidtt , n_daidtd , & ! LCOV_EXCL_LINE
630 : n_dagedtt , n_dagedtd , & ! LCOV_EXCL_LINE
631 : n_mlt_onset , n_frz_onset , & ! LCOV_EXCL_LINE
632 : n_hisnap , n_aisnap , & ! LCOV_EXCL_LINE
633 : n_sithick , n_sisnthick , & ! LCOV_EXCL_LINE
634 : n_siage, & ! LCOV_EXCL_LINE
635 : n_sitemptop , n_sitempsnic , & ! LCOV_EXCL_LINE
636 : n_sitempbot , & ! LCOV_EXCL_LINE
637 : n_sispeed , n_sidir , & ! LCOV_EXCL_LINE
638 : n_siu, n_siv, & ! LCOV_EXCL_LINE
639 : n_sidmasstranx, n_sidmasstrany, & ! LCOV_EXCL_LINE
640 : n_sistrxdtop, n_sistrydtop, & ! LCOV_EXCL_LINE
641 : n_sistrxubot, n_sistryubot, & ! LCOV_EXCL_LINE
642 : n_sicompstren, & ! LCOV_EXCL_LINE
643 : n_sialb, & ! LCOV_EXCL_LINE
644 : n_sihc , n_sisnhc, & ! LCOV_EXCL_LINE
645 : n_sidconcth , n_sidconcdyn, & ! LCOV_EXCL_LINE
646 : n_sidmassth , n_sidmassdyn, & ! LCOV_EXCL_LINE
647 : n_sidmassgrowthwat, & ! LCOV_EXCL_LINE
648 : n_sidmassgrowthbot, & ! LCOV_EXCL_LINE
649 : n_sidmasssi, & ! LCOV_EXCL_LINE
650 : n_sidmassevapsubl, & ! LCOV_EXCL_LINE
651 : n_sndmasssubl, & ! LCOV_EXCL_LINE
652 : n_sidmassmelttop, & ! LCOV_EXCL_LINE
653 : n_sidmassmeltbot, & ! LCOV_EXCL_LINE
654 : n_sidmasslat, & ! LCOV_EXCL_LINE
655 : n_sndmasssnf, & ! LCOV_EXCL_LINE
656 : n_sndmassmelt, & ! LCOV_EXCL_LINE
657 : n_siflswdtop, & ! LCOV_EXCL_LINE
658 : n_siflswutop, & ! LCOV_EXCL_LINE
659 : n_siflswdbot, & ! LCOV_EXCL_LINE
660 : n_sifllwdtop, & ! LCOV_EXCL_LINE
661 : n_sifllwutop, & ! LCOV_EXCL_LINE
662 : n_siflsenstop, & ! LCOV_EXCL_LINE
663 : n_siflsensupbot, & ! LCOV_EXCL_LINE
664 : n_sifllatstop, & ! LCOV_EXCL_LINE
665 : n_siflcondtop, & ! LCOV_EXCL_LINE
666 : n_siflcondbot, & ! LCOV_EXCL_LINE
667 : n_sipr, & ! LCOV_EXCL_LINE
668 : n_sifb, & ! LCOV_EXCL_LINE
669 : n_siflsaltbot, & ! LCOV_EXCL_LINE
670 : n_siflfwbot, & ! LCOV_EXCL_LINE
671 : n_siflfwdrain, & ! LCOV_EXCL_LINE
672 : n_siforcetiltx, & ! LCOV_EXCL_LINE
673 : n_siforcetilty, & ! LCOV_EXCL_LINE
674 : n_siforcecoriolx, & ! LCOV_EXCL_LINE
675 : n_siforcecorioly, & ! LCOV_EXCL_LINE
676 : n_siforceintstrx, & ! LCOV_EXCL_LINE
677 : n_siforceintstry, & ! LCOV_EXCL_LINE
678 : n_siitdconc, & ! LCOV_EXCL_LINE
679 : n_siitdthick, & ! LCOV_EXCL_LINE
680 : n_siitdsnthick, & ! LCOV_EXCL_LINE
681 : n_sidragtop, & ! LCOV_EXCL_LINE
682 : n_sirdgthick, & ! LCOV_EXCL_LINE
683 : n_sistreave, & ! LCOV_EXCL_LINE
684 : n_sistremax, & ! LCOV_EXCL_LINE
685 : n_trsig , n_icepresent , & ! LCOV_EXCL_LINE
686 : n_iage , n_FY , & ! LCOV_EXCL_LINE
687 : n_fsurf_ai , & ! LCOV_EXCL_LINE
688 : n_fcondtop_ai, n_fmeltt_ai , & ! LCOV_EXCL_LINE
689 : n_aicen , n_vicen , & ! LCOV_EXCL_LINE
690 : n_fsurfn_ai , & ! LCOV_EXCL_LINE
691 : n_fcondtopn_ai, & ! LCOV_EXCL_LINE
692 : n_fmelttn_ai , & ! LCOV_EXCL_LINE
693 : n_flatn_ai , & ! LCOV_EXCL_LINE
694 : n_fsensn_ai , & ! LCOV_EXCL_LINE
695 : ! n_field3dz , & ! LCOV_EXCL_LINE
696 : n_keffn_top , & ! LCOV_EXCL_LINE
697 : n_Tinz , n_Sinz , & ! LCOV_EXCL_LINE
698 : n_Tsnz , & ! LCOV_EXCL_LINE
699 : n_a11 , n_a12 , & ! LCOV_EXCL_LINE
700 : n_e11 , n_e12 , & ! LCOV_EXCL_LINE
701 : n_e22 , & ! LCOV_EXCL_LINE
702 : n_s11 , n_s12 , & ! LCOV_EXCL_LINE
703 : n_s22 , & ! LCOV_EXCL_LINE
704 : n_yieldstress11, n_yieldstress12, & ! LCOV_EXCL_LINE
705 : n_yieldstress22
706 :
707 : interface accum_hist_field ! generic interface
708 : module procedure accum_hist_field_2D, &
709 : accum_hist_field_3D, & ! LCOV_EXCL_LINE
710 : accum_hist_field_4D
711 : end interface
712 :
713 : !=======================================================================
714 :
715 : contains
716 :
717 : !=======================================================================
718 :
719 18 : subroutine construct_filename(ncfile,suffix,ns)
720 :
721 : use ice_calendar, only: msec, myear, mmonth, daymo, &
722 : mday, write_ic, histfreq, histfreq_n, & ! LCOV_EXCL_LINE
723 : new_year, new_month, new_day, & ! LCOV_EXCL_LINE
724 : dt
725 : use ice_restart_shared, only: lenstr
726 :
727 : character (char_len_long), intent(inout) :: ncfile
728 : character (len=2), intent(in) :: suffix
729 : integer (kind=int_kind), intent(in) :: ns
730 :
731 : integer (kind=int_kind) :: iyear, imonth, iday, isec
732 : character (len=1) :: cstream
733 : character(len=*), parameter :: subname = '(construct_filename)'
734 :
735 18 : iyear = myear
736 18 : imonth = mmonth
737 18 : iday = mday
738 18 : isec = int(msec - dt,int_kind)
739 :
740 : ! construct filename
741 18 : if (write_ic) then
742 7 : isec = msec
743 2 : write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
744 : incond_file(1:lenstr(incond_file)),'.',iyear,'-', & ! LCOV_EXCL_LINE
745 14 : imonth,'-',iday,'-',isec,'.',trim(suffix)
746 : else
747 :
748 11 : if (hist_avg(ns)) then
749 11 : if (histfreq(ns) == '1' .or. histfreq(ns) == 'h'.or.histfreq(ns) == 'H') then
750 : ! do nothing
751 11 : elseif (new_year) then
752 0 : iyear = iyear - 1
753 0 : imonth = 12
754 0 : iday = daymo(imonth)
755 11 : elseif (new_month) then
756 0 : imonth = mmonth - 1
757 0 : iday = daymo(imonth)
758 11 : elseif (new_day) then
759 11 : iday = iday - 1
760 : endif
761 : endif
762 :
763 11 : cstream = ''
764 : !echmod ! this was implemented for CESM but it breaks post-processing software
765 : !echmod ! of other groups (including RASM which uses CESMCOUPLED)
766 : !echmod if (ns > 1) write(cstream,'(i1.1)') ns-1
767 :
768 11 : if (hist_avg(ns)) then ! write averaged data
769 11 : if (histfreq(ns) == '1' .and. histfreq_n(ns) == 1) then ! timestep
770 0 : write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
771 : history_file(1:lenstr(history_file))//trim(cstream),'_inst.', & ! LCOV_EXCL_LINE
772 0 : iyear,'-',imonth,'-',iday,'-',msec,'.',trim(suffix)
773 11 : elseif (histfreq(ns) == '1' .and. histfreq_n(ns) > 1) then ! timestep
774 0 : write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
775 : history_file(1:lenstr(history_file))//trim(cstream),'.', & ! LCOV_EXCL_LINE
776 0 : iyear,'-',imonth,'-',iday,'-',msec,'.',trim(suffix)
777 11 : elseif (histfreq(ns) == 'h'.or.histfreq(ns) == 'H') then ! hourly
778 0 : write(ncfile,'(a,a,i2.2,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
779 : history_file(1:lenstr(history_file))//trim(cstream),'_', & ! LCOV_EXCL_LINE
780 0 : histfreq_n(ns),'h.',iyear,'-',imonth,'-',iday,'-',msec,'.',trim(suffix)
781 11 : elseif (histfreq(ns) == 'd'.or.histfreq(ns) == 'D') then ! daily
782 0 : write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,a)') &
783 : history_file(1:lenstr(history_file))//trim(cstream),'.', & ! LCOV_EXCL_LINE
784 22 : iyear,'-',imonth,'-',iday,'.',trim(suffix)
785 0 : elseif (histfreq(ns) == 'm'.or.histfreq(ns) == 'M') then ! monthly
786 0 : write(ncfile,'(a,a,i4.4,a,i2.2,a,a)') &
787 : history_file(1:lenstr(history_file))//trim(cstream),'.', & ! LCOV_EXCL_LINE
788 0 : iyear,'-',imonth,'.',trim(suffix)
789 0 : elseif (histfreq(ns) == 'y'.or.histfreq(ns) == 'Y') then ! yearly
790 0 : write(ncfile,'(a,a,i4.4,a,a)') &
791 : history_file(1:lenstr(history_file))//trim(cstream),'.', & ! LCOV_EXCL_LINE
792 0 : iyear,'.',trim(suffix)
793 : endif
794 :
795 : else ! instantaneous
796 0 : write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
797 : history_file(1:lenstr(history_file))//trim(cstream),'_inst.', & ! LCOV_EXCL_LINE
798 0 : iyear,'-',imonth,'-',iday,'-',msec,'.',trim(suffix)
799 : endif
800 :
801 : endif
802 :
803 18 : end subroutine construct_filename
804 :
805 : !=======================================================================
806 :
807 : ! Initializes description of an available field and returns location
808 : ! in the available fields array for use in later calls.
809 : !
810 : ! 2009 Created by D. Bailey following POP
811 :
812 8806 : subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, &
813 : vdesc, vcomment, cona, conb, & ! LCOV_EXCL_LINE
814 : ns, vhistfreq)
815 :
816 : use ice_calendar, only: histfreq, histfreq_n
817 :
818 : integer (int_kind), dimension(:), intent(out) :: & ! max_nstrm
819 : id ! location in avail_fields array for use in
820 : ! later routines
821 :
822 : character (len=*), intent(in) :: &
823 : vname , & ! variable names ! LCOV_EXCL_LINE
824 : vunit , & ! variable units ! LCOV_EXCL_LINE
825 : vcoord , & ! variable coordinates ! LCOV_EXCL_LINE
826 : vcellmeas , & ! variables cell measures ! LCOV_EXCL_LINE
827 : vdesc , & ! variable descriptions ! LCOV_EXCL_LINE
828 : vcomment ! variable comments
829 :
830 : real (kind=dbl_kind), intent(in) :: &
831 : cona , & ! multiplicative conversion factor ! LCOV_EXCL_LINE
832 : conb ! additive conversion factor
833 :
834 : character (len=*), intent(in) :: &
835 : vhistfreq ! history frequency
836 :
837 : integer (kind=int_kind), intent(in) :: &
838 : ns ! history file stream index
839 :
840 : integer (kind=int_kind) :: &
841 : ns1 , & ! variable stream loop index ! LCOV_EXCL_LINE
842 : lenf ! length of namelist string
843 :
844 : character (len=40) :: stmp
845 :
846 : character(len=*), parameter :: subname = '(define_hist_field)'
847 :
848 8806 : if (histfreq(ns) == 'x') then
849 0 : call abort_ice(subname//'ERROR: define_hist_fields has histfreq x')
850 : endif
851 :
852 52836 : if (ns == 1) id(:) = 0
853 8806 : lenf = len(trim(vhistfreq))
854 :
855 17612 : do ns1 = 1, lenf
856 17612 : if (vhistfreq(ns1:ns1) == histfreq(ns)) then
857 :
858 1837 : num_avail_hist_fields_tot = num_avail_hist_fields_tot + 1
859 :
860 1837 : if (vcoord(11:14) == 'time') then
861 1837 : num_avail_hist_fields_2D = num_avail_hist_fields_2D + 1
862 0 : elseif (vcoord(11:14) == 'NCAT' .and. vcoord(17:20) == 'time') then
863 0 : num_avail_hist_fields_3Dc = num_avail_hist_fields_3Dc + 1
864 0 : elseif (vcoord(11:14) == 'NFSD' .and. vcoord(17:20) == 'time') then
865 0 : num_avail_hist_fields_3Df = num_avail_hist_fields_3Df + 1
866 0 : elseif (vcoord(11:15) == 'VGRDi' .and. vcoord(17:20) == 'time') then
867 0 : num_avail_hist_fields_3Dz = num_avail_hist_fields_3Dz + 1
868 0 : elseif (vcoord(11:15) == 'VGRDb' .and. vcoord(17:20) == 'time') then
869 0 : num_avail_hist_fields_3Db = num_avail_hist_fields_3Db + 1
870 0 : elseif (vcoord(11:15) == 'VGRDa' .and. vcoord(17:20) == 'time') then
871 0 : num_avail_hist_fields_3Da = num_avail_hist_fields_3Da + 1
872 0 : elseif (vcoord(11:15) == 'VGRDi' .and. vcoord(17:20) == 'NCAT') then
873 0 : num_avail_hist_fields_4Di = num_avail_hist_fields_4Di + 1
874 0 : elseif (vcoord(11:15) == 'VGRDs' .and. vcoord(17:20) == 'NCAT') then
875 0 : num_avail_hist_fields_4Ds = num_avail_hist_fields_4Ds + 1
876 0 : elseif (vcoord(11:14) == 'NFSD' .and. vcoord(17:20) == 'NCAT') then
877 0 : num_avail_hist_fields_4Df = num_avail_hist_fields_4Df + 1
878 : endif
879 :
880 1837 : if (num_avail_hist_fields_tot > max_avail_hist_fields) then
881 0 : if (my_task == master_task) then
882 0 : write(nu_diag,*) subname,' num_avail_hist_fields_tot = ',num_avail_hist_fields_tot
883 0 : write(nu_diag,*) subname,' max_avail_hist_fields = ',max_avail_hist_fields
884 : endif
885 0 : call abort_ice(subname//'ERROR: Need in computation of max_avail_hist_fields')
886 : endif
887 :
888 1837 : if (num_avail_hist_fields_tot /= &
889 : num_avail_hist_fields_2D + & ! LCOV_EXCL_LINE
890 : num_avail_hist_fields_3Dc + & ! LCOV_EXCL_LINE
891 : num_avail_hist_fields_3Dz + & ! LCOV_EXCL_LINE
892 : num_avail_hist_fields_3Db + & ! LCOV_EXCL_LINE
893 : num_avail_hist_fields_3Da + & ! LCOV_EXCL_LINE
894 : num_avail_hist_fields_3Df + & ! LCOV_EXCL_LINE
895 : num_avail_hist_fields_4Di + & ! LCOV_EXCL_LINE
896 : num_avail_hist_fields_4Ds + & ! LCOV_EXCL_LINE
897 : num_avail_hist_fields_4Df) then
898 0 : if (my_task == master_task) then
899 0 : write(nu_diag,*) subname,' num_avail_hist_fields_tot = ',num_avail_hist_fields_tot
900 : endif
901 0 : call abort_ice(subname//'ERROR: in num_avail_hist_fields')
902 : endif
903 :
904 1837 : id(ns) = num_avail_hist_fields_tot
905 :
906 1837 : stmp = vname
907 1837 : if (ns > 1) &
908 0 : write(stmp,'(a,a1,a1)') trim(stmp),'_',vhistfreq(ns1:ns1)
909 :
910 1837 : avail_hist_fields(id(ns))%vname = trim(stmp)
911 1837 : avail_hist_fields(id(ns))%vunit = trim(vunit)
912 1837 : avail_hist_fields(id(ns))%vcoord = trim(vcoord)
913 1837 : avail_hist_fields(id(ns))%vcellmeas = trim(vcellmeas)
914 1837 : avail_hist_fields(id(ns))%vdesc = trim(vdesc)
915 1837 : avail_hist_fields(id(ns))%vcomment = trim(vcomment)
916 1837 : avail_hist_fields(id(ns))%cona = cona
917 1837 : avail_hist_fields(id(ns))%conb = conb
918 1837 : avail_hist_fields(id(ns))%vhistfreq = vhistfreq(ns1:ns1)
919 1837 : avail_hist_fields(id(ns))%vhistfreq_n = histfreq_n(ns)
920 :
921 : endif
922 : enddo
923 :
924 8806 : end subroutine define_hist_field
925 :
926 : !=======================================================================
927 :
928 : ! Accumulates a history field
929 : !
930 : ! 2009 Created by D. Bailey following POP
931 : ! 2010 Generalized dimension of variables by N. Jeffery, E. Hunke
932 :
933 1547968 : subroutine accum_hist_field_2D(id, iblk, field_accum, field)
934 :
935 : use ice_blocks, only: block, get_block
936 : use ice_calendar, only: nstreams
937 : use ice_domain, only: blocks_ice
938 : use ice_grid, only: tmask
939 :
940 : integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
941 : id ! location in avail_fields array for use in
942 : ! later routines
943 :
944 : integer (kind=int_kind), intent(in) :: iblk
945 :
946 : real (kind=dbl_kind), intent(in) :: &
947 : field_accum(:,:)
948 :
949 : real (kind=dbl_kind), intent(inout) :: &
950 : field(:,:,:,:)
951 :
952 : type (block) :: &
953 : this_block ! block information for current block
954 :
955 : integer (kind=int_kind) :: i,j, ilo, ihi, jlo, jhi, ns, idns
956 :
957 : character(len=*), parameter :: subname = '(accum_hist_field_2D)'
958 :
959 : !---------------------------------------------------------------
960 : ! increment field
961 : !---------------------------------------------------------------
962 :
963 3095936 : do ns = 1, nstreams
964 1547968 : idns = id(ns)
965 3095936 : if (idns > 0) then
966 :
967 787648 : this_block = get_block(blocks_ice(iblk),iblk)
968 787648 : ilo = this_block%ilo
969 787648 : ihi = this_block%ihi
970 787648 : jlo = this_block%jlo
971 787648 : jhi = this_block%jhi
972 :
973 24795807 : do j = jlo, jhi
974 706599398 : do i = ilo, ihi
975 705811750 : if (tmask(i,j,iblk)) then
976 581953726 : field(i,j,idns, iblk) = field(i,j,idns, iblk) + field_accum(i,j)
977 : endif
978 : enddo
979 : enddo
980 :
981 : endif
982 : enddo
983 :
984 1547968 : end subroutine accum_hist_field_2D
985 :
986 : !=======================================================================
987 :
988 : ! Accumulates a history field
989 : !
990 : ! 2009 Created by D. Bailey following POP
991 : ! 2010 Generalized dimension of variables by N. Jeffery, E. Hunke
992 :
993 0 : subroutine accum_hist_field_3D(id, iblk, ndim, field_accum, field)
994 :
995 : use ice_blocks, only: block, get_block
996 : use ice_calendar, only: nstreams
997 : use ice_domain, only: blocks_ice
998 : use ice_grid, only: tmask
999 :
1000 : integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
1001 : id ! location in avail_fields array for use in
1002 : ! later routines
1003 :
1004 : integer (kind=int_kind), intent(in) :: iblk
1005 :
1006 : integer (kind=int_kind), intent(in) :: &
1007 : ndim ! third dimension size
1008 :
1009 : real (kind=dbl_kind), intent(in) :: &
1010 : field_accum(:,:,:)
1011 :
1012 : real (kind=dbl_kind), intent(inout) :: &
1013 : field(:,:,:,:,:)
1014 :
1015 : type (block) :: &
1016 : this_block ! block information for current block
1017 :
1018 : integer (kind=int_kind) :: i,j,k, ilo, ihi, jlo, jhi, ns, idns
1019 :
1020 : character(len=*), parameter :: subname = '(accum_hist_field_3D)'
1021 :
1022 : !---------------------------------------------------------------
1023 : ! increment field
1024 : !---------------------------------------------------------------
1025 :
1026 0 : do ns = 1, nstreams
1027 0 : idns = id(ns)
1028 0 : if (idns > 0) then
1029 :
1030 0 : this_block = get_block(blocks_ice(iblk),iblk)
1031 0 : ilo = this_block%ilo
1032 0 : ihi = this_block%ihi
1033 0 : jlo = this_block%jlo
1034 0 : jhi = this_block%jhi
1035 :
1036 0 : do k = 1, ndim
1037 0 : do j = jlo, jhi
1038 0 : do i = ilo, ihi
1039 0 : if (tmask(i,j,iblk)) then
1040 0 : field(i,j,k,idns,iblk) = field(i,j,k,idns,iblk) + field_accum(i,j,k)
1041 : endif
1042 : enddo
1043 : enddo
1044 : enddo
1045 :
1046 : endif
1047 : enddo
1048 :
1049 0 : end subroutine accum_hist_field_3D
1050 :
1051 : !=======================================================================
1052 :
1053 : ! Accumulates a history field
1054 : !
1055 : ! 2009 Created by D. Bailey following POP
1056 : ! 2010 Generalized dimension of variables by N. Jeffery, E. Hunke
1057 :
1058 0 : subroutine accum_hist_field_4D(id, iblk, ndim3, ndim4, field_accum, field)
1059 :
1060 : use ice_blocks, only: block, get_block
1061 : use ice_calendar, only: nstreams
1062 : use ice_domain, only: blocks_ice
1063 : use ice_grid, only: tmask
1064 :
1065 : integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
1066 : id ! location in avail_fields array for use in
1067 : ! later routines
1068 :
1069 : integer (kind=int_kind), intent(in) :: iblk
1070 :
1071 : integer (kind=int_kind), intent(in) :: &
1072 : ndim3 , & ! third dimension size ! LCOV_EXCL_LINE
1073 : ndim4 ! fourth dimension size
1074 :
1075 : real (kind=dbl_kind), intent(in) :: &
1076 : field_accum(:,:,:,:)
1077 :
1078 : real (kind=dbl_kind), intent(inout) :: &
1079 : field(:,:,:,:,:,:)
1080 :
1081 : type (block) :: &
1082 : this_block ! block information for current block
1083 :
1084 : integer (kind=int_kind) :: i,j,k,n,ilo, ihi, jlo, jhi, ns, idns
1085 :
1086 : character(len=*), parameter :: subname = '(accum_hist_field_4D)'
1087 :
1088 : !---------------------------------------------------------------
1089 : ! increment field
1090 : !---------------------------------------------------------------
1091 :
1092 0 : do ns = 1, nstreams
1093 0 : idns = id(ns)
1094 0 : if (idns > 0) then
1095 :
1096 0 : this_block = get_block(blocks_ice(iblk),iblk)
1097 0 : ilo = this_block%ilo
1098 0 : ihi = this_block%ihi
1099 0 : jlo = this_block%jlo
1100 0 : jhi = this_block%jhi
1101 :
1102 0 : do k = 1, ndim4
1103 0 : do n = 1, ndim3
1104 0 : do j = jlo, jhi
1105 0 : do i = ilo, ihi
1106 0 : if (tmask(i,j,iblk)) then
1107 0 : field(i,j,n,k,idns,iblk) = field(i,j,n,k,idns,iblk) + field_accum(i,j,n,k)
1108 : endif
1109 : enddo
1110 : enddo
1111 : enddo
1112 : enddo
1113 :
1114 : endif
1115 : enddo
1116 :
1117 0 : end subroutine accum_hist_field_4D
1118 :
1119 : !=======================================================================
1120 :
1121 0 : end module ice_history_shared
1122 :
1123 : !=======================================================================
|