00001
00002
00003
00004
00005
00006
00007 module ice_history_fields
00008
00009
00010
00011
00012
00013
00014 use ice_kinds_mod
00015 use ice_domain_size
00016
00017
00018
00019 implicit none
00020 save
00021
00022 logical (kind=log_kind) ::
00023 hist_avg
00024
00025 character (len=char_len_long) ::
00026 history_dir ,
00027 incond_dir
00028
00029 character (len=char_len) ::
00030 history_file ,
00031 incond_file
00032
00033 character (len=3) ::
00034 history_format
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 type, public :: ice_hist_field
00050 character (len=16) :: vname
00051 character (len=16) :: vunit
00052 character (len=16) :: vcoord
00053 character (len=16) :: vcellmeas
00054 character (len=55) :: vdesc
00055 character (len=55) :: vcomment
00056 real (kind=dbl_kind) :: cona
00057 real (kind=dbl_kind) :: conb
00058 character (len=1) :: vhistfreq
00059 integer (kind=int_kind) :: vhistfreq_n
00060 end type
00061
00062 integer (kind=int_kind), parameter ::
00063 max_avail_hist_fields = 600
00064
00065 integer (kind=int_kind) ::
00066 num_avail_hist_fields = 0
00067
00068 type (ice_hist_field), dimension(max_avail_hist_fields) ::
00069 avail_hist_fields
00070
00071
00072
00073
00074
00075 integer (kind=int_kind), parameter ::
00076 ncat_hist = ncat
00077
00078 integer (kind=int_kind), parameter ::
00079 nvar = 11
00080
00081
00082 real (kind=real_kind) :: time_beg(max_nstrm),
00083 time_end(max_nstrm)
00084 real (kind=real_kind) :: time_bounds(2)
00085
00086 real (kind=dbl_kind), allocatable ::
00087 aa(:,:,:,:)
00088
00089 logical (kind=log_kind) ::
00090 igrd(nvar)
00091
00092
00093
00094
00095
00096 logical (kind=log_kind) ::
00097 f_bounds = .true.
00098
00099
00100
00101
00102
00103 integer (kind=int_kind), parameter ::
00104 n_tmask = 1,
00105 n_tarea = 2,
00106 n_uarea = 3,
00107 n_dxt = 4,
00108 n_dyt = 5,
00109 n_dxu = 6,
00110 n_dyu = 7,
00111 n_HTN = 8,
00112 n_HTE = 9,
00113 n_ANGLE = 10,
00114 n_ANGLET = 11,
00115
00116 n_lont_bnds = 1, &
00117 n_latt_bnds = 2, &
00118 n_lonu_bnds = 3, &
00119 n_latu_bnds = 4
00120
00121 integer (kind=int_kind), dimension(max_nstrm) ::
00122
00123 n_hi , n_hs , &
00124 n_fs , &
00125 n_Tsfc , n_aice , &
00126 n_uvel , n_vvel , &
00127 n_transix , n_transiy , &
00128 n_fswdn , n_fswup , &
00129 n_flwdn , &
00130 n_snow , n_snow_ai , &
00131 n_rain , n_rain_ai , &
00132 n_sst , n_sss , &
00133 n_uocn , n_vocn , &
00134 n_frzmlt , n_fswfac , &
00135 n_fswabs , n_fswabs_ai , &
00136 n_alvdr , n_alidr , &
00137 n_albice , n_albsno , &
00138 n_albpnd , n_coszen , &
00139 n_flat , n_flat_ai , &
00140 n_fsens , n_fsens_ai , &
00141 n_flwup , n_flwup_ai , &
00142 n_evap , n_evap_ai , &
00143 n_qi , n_qs , &
00144 n_Tair , &
00145 n_Tref , n_Qref , &
00146 n_congel , n_frazil , &
00147 n_snoice , &
00148 n_meltt , n_melts , &
00149 n_meltb , n_meltl , &
00150 n_fresh , n_fresh_ai , &
00151 n_fsalt , n_fsalt_ai , &
00152 n_fhocn , n_fhocn_ai , &
00153 n_fswthru , n_fswthru_ai , &
00154 n_strairx , n_strairy , &
00155 n_strtltx , n_strtlty , &
00156 n_strcorx , n_strcory , &
00157 n_strocnx , n_strocny , &
00158 n_strintx , n_strinty , &
00159 n_strength , n_opening , &
00160 n_divu , n_shear , &
00161 n_sig1 , n_sig2 , &
00162 n_dvidtt , n_dvidtd , &
00163 n_daidtt , n_daidtd , &
00164 n_mlt_onset , n_frz_onset , &
00165 n_dardg1dt , n_dardg2dt , &
00166 n_dvirdgdt , &
00167 n_hisnap , n_aisnap , &
00168 n_trsig , n_icepresent , &
00169 n_iage , n_FY , &
00170 n_apond , &
00171 n_ardg , n_vrdg , &
00172 n_alvl , n_vlvl , &
00173 n_fsurf_ai , n_fcondtop_ai, &
00174 n_fmeltt_ai
00175
00176
00177 integer(kind=int_kind), dimension(ncat_hist,max_nstrm) ::
00178 n_aicen ,
00179 n_vicen ,
00180 n_apondn ,
00181 n_fsurfn_ai ,
00182 n_fcondtopn_ai,
00183 n_fmelttn_ai ,
00184 n_flatn_ai
00185
00186 integer(kind=int_kind), dimension(n_aeromx,max_nstrm) ::
00187 n_faero_atm ,
00188 n_faero_ocn ,
00189 n_aerosn1 ,
00190 n_aerosn2 ,
00191 n_aeroic1 ,
00192 n_aeroic2
00193
00194 integer(kind=int_kind), dimension(n_aeromx*ncat_hist,max_nstrm) ::
00195 n_aerosn1n,
00196 n_aerosn2n,
00197 n_aeroic1n,
00198 n_aeroic2n
00199
00200
00201
00202 contains
00203
00204
00205
00206 subroutine construct_filename(ncfile,suffix,ns)
00207
00208 use ice_calendar, only: time, sec, idate, nyr, month, daymo, &
00209 mday, write_ic, histfreq, histfreq_n, &
00210 year_init, new_year, new_month, new_day, &
00211 dayyr, dt
00212 use ice_restart, only: lenstr
00213
00214 integer (kind=int_kind), intent(in) :: ns
00215 character (char_len_long), intent(inout) :: ncfile
00216 character (len=2), intent(in) :: suffix
00217 character (len=1) :: cstream
00218
00219 integer (kind=int_kind) :: iyear, imonth, iday, isec
00220
00221 iyear = nyr + year_init - 1
00222 imonth = month
00223 iday = mday
00224 isec = sec - dt
00225
00226
00227 if (write_ic) then
00228 write(ncfile,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
00229 incond_file(1:lenstr(incond_file)),iyear,'-', &
00230 imonth,'-',iday,'-',isec,'.',suffix
00231 else
00232
00233 if (hist_avg) then
00234 if (histfreq(ns).eq.'h'.or.histfreq(ns).eq.'H') then
00235
00236 elseif (new_year) then
00237 iyear = iyear - 1
00238 imonth = 12
00239 iday = daymo(imonth)
00240 elseif (new_month) then
00241 imonth = month - 1
00242 iday = daymo(imonth)
00243 elseif (new_day) then
00244 iday = iday - 1
00245 endif
00246 endif
00247
00248 cstream = ''
00249 if (ns > 1) write(cstream,'(i1.1)') ns-1
00250
00251 if (histfreq(ns) == '1') then
00252
00253 write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
00254 history_file(1:lenstr(history_file))//trim(cstream),'_inst.', &
00255 iyear,'-',imonth,'-',iday,'-',sec,'.',suffix
00256
00257 elseif (hist_avg) then
00258
00259 if (histfreq(ns).eq.'d'.or.histfreq(ns).eq.'D') then
00260 write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,a)') &
00261 history_file(1:lenstr(history_file))//trim(cstream), &
00262 '.',iyear,'-',imonth,'-',iday,'.',suffix
00263 elseif (histfreq(ns).eq.'h'.or.histfreq(ns).eq.'H') then
00264 write(ncfile,'(a,a,i2.2,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
00265 history_file(1:lenstr(history_file))//trim(cstream),'_', &
00266 histfreq_n(ns),'h.',iyear,'-',imonth,'-',iday,'-',sec,'.',suffix
00267 elseif (histfreq(ns).eq.'m'.or.histfreq(ns).eq.'M') then
00268 write(ncfile,'(a,a,i4.4,a,i2.2,a,a)') &
00269 history_file(1:lenstr(history_file))//trim(cstream),'.', &
00270 iyear,'-',imonth,'.',suffix
00271 elseif (histfreq(ns).eq.'y'.or.histfreq(ns).eq.'Y') then
00272 write(ncfile,'(a,a,i4.4,a,a)') &
00273 history_file(1:lenstr(history_file))//trim(cstream),'.', &
00274 iyear,'.',suffix
00275 endif
00276
00277 else
00278 write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
00279 history_file(1:lenstr(history_file)),'_inst.', &
00280 iyear,'-',imonth,'-',iday,'-',sec,'.',suffix
00281 endif
00282 endif
00283
00284 end subroutine construct_filename
00285
00286 end module ice_history_fields