CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
GFS_rrtmg_setup.F90
1
3
8
9 use machine, only: kind_phys
10 use module_ozphys, only: ty_ozphys
11 implicit none
12
14
15 private
16
17 logical :: is_initialized = .false.
18
19 ! --- version tag and last revision date
20 character(40), parameter :: &
21 & VTAGRAD='NCEP-Radiation_driver v5.2 Jan 2013 '
22 ! & VTAGRAD='NCEP-Radiation_driver v5.1 Nov 2012 '
23 ! & VTAGRAD='NCEP-Radiation_driver v5.0 Aug 2012 '
24
26 integer :: month0 = 0
27 integer :: iyear0 = 0
28 integer :: monthd = 0
29
33 logical :: loz1st = .true.
34
35 contains
36
40 subroutine gfs_rrtmg_setup_init ( si, levr, ictm, isol, solar_file, ico2, &
41 iaer, ntcw, num_p3d, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, &
42 iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, lcrick, &
43 lcnorm, imp_physics, lnoprec, idate, iflip, do_RRTMGP, me, lalw1bd, &
44 iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz, &
45 con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd, co2usr_file, &
46 co2cyc_file, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw,&
47 iswmode, ipsd0, ltp, lextop, errmsg, errflg)
48! ================= subprogram documentation block ================ !
49! !
50! subprogram: GFS_rrtmg_setup_init - a subprogram to initialize radiation !
51! !
52! usage: call GFS_rrtmg_setup_init !
53! !
54! attributes: !
55! language: fortran 90 !
56! !
57! program history: !
58! mar 2012 - yu-tai hou create the program to initialize fixed !
59! control variables for radiaion processes. this !
60! subroutine is called at the start of model run. !
61! nov 2012 - yu-tai hou modified control parameter through !
62! module 'physparam'. !
63! mar 2014 - sarah lu iaermdl is determined from iaer !
64! jul 2014 - s moorthi add npdf3d for pdf clouds !
65! !
66! ==================== defination of variables ==================== !
67! !
68! input parameters: !
69! si : model vertical sigma interface or equivalence !
70! levr : number of model vertical layers !
71! ictm :=yyyy#, external data time/date control flag !
72! = -2: same as 0, but superimpose seasonal cycle !
73! from climatology data set. !
74! = -1: use user provided external data for the !
75! forecast time, no extrapolation. !
76! = 0: use data at initial cond time, if not !
77! available, use latest, no extrapolation. !
78! = 1: use data at the forecast time, if not !
79! available, use latest and extrapolation. !
80! =yyyy0: use yyyy data for the forecast time, !
81! no further data extrapolation. !
82! =yyyy1: use yyyy data for the fcst. if needed, do !
83! extrapolation to match the fcst time. !
84! isol := 0: use the old fixed solar constant in "physcon"!
85! =10: use the new fixed solar constant in "physcon"!
86! = 1: use noaa ann-mean tsi tbl abs-scale data tabl!
87! = 2: use noaa ann-mean tsi tbl tim-scale data tabl!
88! = 3: use cmip5 ann-mean tsi tbl tim-scale data tbl!
89! = 4: use cmip5 mon-mean tsi tbl tim-scale data tbl!
90! ico2 :=0: use prescribed global mean co2 (old oper) !
91! =1: use observed co2 annual mean value only !
92! =2: use obs co2 monthly data with 2-d variation !
93! iaer : 4-digit aerosol flag (dabc for aermdl,volc,lw,sw)!
94! d: =0 or none, opac-climatology aerosol scheme !
95! =1 use gocart climatology aerosol scheme !
96! =2 use gocart progostic aerosol scheme !
97! a: =0 use background stratospheric aerosol !
98! =1 incl stratospheric vocanic aeros !
99! b: =0 no topospheric aerosol in lw radiation !
100! =1 include tropspheric aerosols for lw !
101! c: =0 no topospheric aerosol in sw radiation !
102! =1 include tropspheric aerosols for sw !
103! ntcw :=0 no cloud condensate calculated !
104! >0 array index location for cloud condensate !
105! num_p3d :=3: ferrier's microphysics cloud scheme !
106! =4: zhao/carr/sundqvist microphysics cloud !
107! npdf3d =0 no pdf clouds !
108! =3 (when num_p3d=4) pdf clouds with zhao/carr/ !
109! sundqvist scheme !
110! ntoz : ozone data control flag !
111! =0: use climatological ozone profile !
112! >0: use interactive ozone profile !
113! icliq_sw : sw optical property for liquid clouds !
114! =0:input cld opt depth, ignoring iswcice setting !
115! =1:cloud optical property scheme based on Hu and !
116! Stamnes(1993) \cite hu_and_stamnes_1993 method !
117! =2:cloud optical property scheme based on Hu and !
118! Stamnes(1993) -updated !
119! iovr : control flag for cloud overlap (sw/lw rad) !
120! =0: random overlapping clouds !
121! =1: max/ran overlapping clouds !
122! =2: maximum overlap clouds (mcica only) !
123! =3: decorrelation-length overlap (mcica only) !
124! =4: exponential overlap clouds !
125! isubcsw/isubclw: sub-column cloud approx control flag (sw/lw rad) !
126! =0: with out sub-column cloud approximation !
127! =1: mcica sub-col approx. prescribed random seed !
128! =2: mcica sub-col approx. provided random seed !
129! lcrick : control flag for eliminating CRICK !
130! lcnorm : control flag for in-cloud condensate mixing ratio!
131! lnoprec : control flag for not using precip in radiation !
132! idate(4) : ncep absolute date and time of initial condition !
133! (hour, month, day, year) !
134! iflip : control flag for direction of vertical index !
135! =0: index from toa to surface !
136! =1: index from surface to toa !
137! me : print control flag !
138! ltp : number of radiation extra top layers !
139! lextop : control flag to denote extra top layers are used !
140! !
141! subroutines called: radinit !
142! !
143! =================================================================== !
144!
146 use module_radiation_aerosols, only : aer_init
149 use rrtmg_lw, only : rlwinit
150 use rrtmg_sw, only : rswinit
151 implicit none
152
153 ! interface variables
154 real (kind=kind_phys), intent(in) :: si(:)
155 integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, num_p3d, &
156 ltp, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max, &
157 iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, imp_physics, &
158 iflip, me, rad_hr_units, icliq_lw, isubcsw, isubclw, iswmode
159 integer, intent(in) :: idate(:)
160 logical, intent(in) :: lcrick, lcnorm, lnoprec, do_rrtmgp, lalw1bd, &
161 inc_minor_gas, lextop
162 character(len=26),intent(in) :: aeros_file, solar_file, co2usr_file,&
163 co2cyc_file
164 real(kind_phys), intent(in) :: con_pi, con_t0c, con_c, con_boltz, &
165 con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd
166 integer, intent(inout) :: ipsd0
167 character(len=*), intent(out) :: errmsg
168 integer, intent(out) :: errflg
169 integer, intent(out) :: iaermdl, iaerflg
170
171 ! Initialize the CCPP error handling variables
172 errmsg = ''
173 errflg = 0
174
175 if (do_rrtmgp) then
176 write(errmsg,'(*(a))') "Logic error: do_RRTMGP must be set to .false."
177 errflg = 1
178 return
179 end if
180
181 if ( ictm==0 .or. ictm==-2 ) then
182 iaerflg = mod(iaer, 100) ! no volcanic aerosols for clim hindcast
183 else
184 iaerflg = mod(iaer, 1000)
185 endif
186 iaermdl = iaer/1000 ! control flag for aerosol scheme selection
187 if ( iaermdl < 0 .or. (iaermdl>2 .and. iaermdl/=5) ) then
188 print *, ' Error -- IAER flag is incorrect, Abort'
189 errflg = 1
190 errmsg = 'ERROR(GFS_rrtmg_setup): IAER flag is incorrect'
191 return
192 endif
193
194! --- assign initial permutation seed for mcica cloud-radiation
195 if ( isubcsw>0 .or. isubclw>0 ) then
196! ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4) + ipsd0
197 ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4)
198 endif
199
200 if ( me == 0 ) then
201 print *,' In rad_initialize (GFS_rrtmg_setup_init), before calling RRTMG initialization'
202 print *,' si =',si
203 print *,' levr=',levr,' ictm=',ictm,' isol=',isol,' ico2=',ico2,&
204 ' iaermdl=',iaermdl,' iaerflg=',iaerflg
205 print *,' np3d=',num_p3d,' ntoz=',ntoz, &
206 ' iovr=',iovr,' isubcsw=',isubcsw, &
207 ' isubclw=',isubclw,' icliq_sw=',icliq_sw, &
208 ' iflip=',iflip,' me=',me
209 print *,' lcrick=',lcrick, &
210 ' lcnorm=',lcnorm,' lnoprec=',lnoprec
211 print *, 'lextop=',lextop, ' ltp=',ltp
212 endif
213
214 if (is_initialized) return
215
216 ! Call initialization routines
217 call sol_init ( me, isol, solar_file, con_solr_2008,con_solr_2002,&
218 con_pi )
219 call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, &
220 con_pi, con_t0c, con_c, con_boltz, con_plnk, errflg, errmsg)
221 call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, con_pi, errflg, errmsg )
222 call cld_init ( si, levr, imp_physics, me, con_g, con_rd, errflg, errmsg)
223 call rlwinit ( me, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, &
224 iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, &
225 iovr_exp, iovr_exprand, errflg, errmsg )
226 call rswinit ( me, rad_hr_units, inc_minor_gas, icliq_sw, isubclw, &
227 iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, &
228 iovr_exp, iovr_exprand,iswmode, errflg, errmsg )
229
230 if ( me == 0 ) then
231 print *,' Radiation sub-cloud initial seed =',ipsd0, &
232 & ' IC-idate =',idate
233 print *,' return from rad_initialize (GFS_rrtmg_setup_init) - after calling RRTMG initialization'
234 endif
235!
236 is_initialized = .true.
237!
238 return
239
240 end subroutine gfs_rrtmg_setup_init
241
245 subroutine gfs_rrtmg_setup_timestep_init (idate, jdate, deltsw, deltim, &
246 lsswr, me, iaermdl, iaerflg, isol, aeros_file, slag, sdec, cdec, &
247 solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, ozphys,&
248 errmsg, errflg)
249
250 implicit none
251
252 ! interface variables
253 integer, intent(in) :: idate(:)
254 integer, intent(in) :: jdate(:)
255 real(kind=kind_phys), intent(in) :: deltsw
256 real(kind=kind_phys), intent(in) :: deltim
257 real(kind=kind_phys), intent(in) :: con_pi
258 logical, intent(in) :: lsswr
259 integer, intent(in) :: me
260 integer, intent(in) :: iaermdl, iaerflg, isol, ictm, ico2, ntoz
261 type(ty_ozphys), intent(inout) :: ozphys
262 character(len=26), intent(in) :: aeros_file, co2dat_file, co2gbl_file
263 real(kind=kind_phys), intent(out) :: slag
264 real(kind=kind_phys), intent(out) :: sdec
265 real(kind=kind_phys), intent(out) :: cdec
266 real(kind=kind_phys), intent(out) :: solcon
267 character(len=*), intent(out) :: errmsg
268 integer, intent(out) :: errflg
269
270 ! Check initialization state
271 if (.not.is_initialized) then
272 write(errmsg, fmt='((a))') 'GFS_rrtmg_setup_timestep_init called before GFS_rrtmg_setup_init'
273 errflg = 1
274 return
275 end if
276
277 ! Initialize the CCPP error handling variables
278 errmsg = ''
279 errflg = 0
280
281 call radupdate(idate,jdate,deltsw,deltim,lsswr,me,iaermdl, iaerflg,isol,aeros_file,&
282 slag,sdec,cdec,solcon,con_pi,co2dat_file,co2gbl_file,ictm,ico2,ntoz,ozphys,errflg,errmsg)
283
284 end subroutine gfs_rrtmg_setup_timestep_init
285
289 subroutine gfs_rrtmg_setup_finalize (errmsg, errflg)
290
291 implicit none
292
293 character(len=*), intent( out) :: errmsg
294 integer, intent( out) :: errflg
295
296 ! Initialize the CCPP error handling variables
297 errmsg = ''
298 errflg = 0
299
300 if (.not.is_initialized) return
301
302 ! do finalization stuff if needed
303
304 is_initialized = .false.
305
306 end subroutine gfs_rrtmg_setup_finalize
307
327!-----------------------------------
328 subroutine radupdate( idate,jdate,deltsw,deltim,lsswr,me, iaermdl,&
329 iaerflg, isol, aeros_file, slag,sdec,cdec,solcon, con_pi, &
330 co2dat_file,co2gbl_file, ictm, ico2, ntoz, ozphys, errflg, errmsg)
331!...................................
332
333! ================= subprogram documentation block ================ !
334! !
335! subprogram: radupdate calls many update subroutines to check and !
336! update radiation required but time varying data sets and module !
337! variables. !
338! !
339! usage: call radupdate !
340! !
341! attributes: !
342! language: fortran 90 !
343! machine: ibm sp !
344! !
345! ==================== definition of variables ==================== !
346! !
347! input parameters: !
348! idate(8) : ncep absolute date and time of initial condition !
349! (yr, mon, day, t-zone, hr, min, sec, mil-sec) !
350! jdate(8) : ncep absolute date and time at fcst time !
351! (yr, mon, day, t-zone, hr, min, sec, mil-sec) !
352! deltsw : sw radiation calling frequency in seconds !
353! deltim : model timestep in seconds !
354! lsswr : logical flags for sw radiation calculations !
355! me : print control flag !
356! !
357! outputs: !
358! slag : equation of time in radians !
359! sdec, cdec : sin and cos of the solar declination angle !
360! solcon : sun-earth distance adjusted solar constant (w/m2) !
361! !
362! subroutines called: sol_update, aer_update, gas_update !
363! !
364! =================================================================== !
365!
367 use module_radiation_aerosols, only : aer_update
369
370 implicit none
371
372! --- inputs:
373 integer, intent(in) :: idate(:), jdate(:), me, iaermdl, iaerflg, isol, ictm, ntoz, ico2
374 type(ty_ozphys),intent(inout) :: ozphys
375 logical, intent(in) :: lsswr
376 character(len=26),intent(in) :: aeros_file,co2dat_file,co2gbl_file
377
378 real (kind=kind_phys), intent(in) :: deltsw, deltim, con_pi
379
380! --- outputs:
381 real (kind=kind_phys), intent(out) :: slag, sdec, cdec, solcon
382 character(len=*), intent(out) :: errmsg
383 integer, intent(out) :: errflg
384
385! --- locals:
386 integer :: iyear, imon, iday, ihour
387 integer :: kyear, kmon, kday, khour
388
389 logical :: lmon_chg ! month change flag
390 logical :: lco2_chg ! cntrl flag for updating co2 data
391 logical :: lsol_chg ! cntrl flag for updating solar constant
392!
393!===> ... begin here
394!
395
396 ! Initialize the CCPP error handling variables
397 errmsg = ''
398 errflg = 0
399
402! --- ... time stamp at fcst time
403
404 iyear = jdate(1)
405 imon = jdate(2)
406 iday = jdate(3)
407 ihour = jdate(5)
408
409! --- ... set up time stamp used for green house gases (** currently co2 only)
410
411 if ( ictm==0 .or. ictm==-2 ) then ! get external data at initial condition time
412 kyear = idate(1)
413 kmon = idate(2)
414 kday = idate(3)
415 khour = idate(5)
416 else ! get external data at fcst or specified time
417 kyear = iyear
418 kmon = imon
419 kday = iday
420 khour = ihour
421 endif ! end if_ictm_block
422
423 if ( month0 /= imon ) then
424 lmon_chg = .true.
425 month0 = imon
426 else
427 lmon_chg = .false.
428 endif
429
432 if (lsswr) then
433
434 if ( isol == 0 .or. isol == 10 ) then
435 lsol_chg = .false.
436 elseif ( iyear0 /= iyear ) then
437 lsol_chg = .true.
438 else
439 lsol_chg = ( isol==4 .and. lmon_chg )
440 endif
441 iyear0 = iyear
442
443 call sol_update &
444! --- inputs:
445 & ( jdate,kyear,deltsw,deltim,lsol_chg, me, &
446! --- outputs:
447 & slag,sdec,cdec,solcon,con_pi,errmsg,errflg &
448 & )
449
450 endif ! end_if_lsswr_block
451
454 if ( lmon_chg ) then
455 call aer_update ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg )
456 endif
457
460 if ( monthd /= kmon ) then
461 monthd = kmon
462 lco2_chg = .true.
463 else
464 lco2_chg = .false.
465 endif
466
467 call gas_update ( kyear,kmon,kday,khour,lco2_chg, me, co2dat_file, &
468 co2gbl_file, ictm, ico2, errflg, errmsg )
469 if (ntoz == 0) then
470 call ozphys%update_o3clim(kmon, kday, khour, loz1st)
471 endif
472
473 if ( loz1st ) loz1st = .false.
474
476! call sfc_update ( iyear, imon, me )
477
479! call cld_update ( iyear, imon, me )
480!
481 return
482!...................................
483 end subroutine radupdate
484!-----------------------------------
486
487end module gfs_rrtmg_setup
subroutine radupdate(idate, jdate, deltsw, deltim, lsswr, me, iaermdl, iaerflg, isol, aeros_file, slag, sdec, cdec, solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, ozphys, errflg, errmsg)
This subroutine checks and updates time sensitive data used by radiation computations....
integer month0
new data input control variables (set/reset in subroutine radupdate):
subroutine, public gfs_rrtmg_setup_init(si, levr, ictm, isol, solar_file, ico2, iaer, ntcw, num_p3d, npdf3d, ntoz, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, icliq_sw, lcrick, lcnorm, imp_physics, lnoprec, idate, iflip, do_rrtmgp, me, lalw1bd, iaermdl, iaerflg, aeros_file, con_pi, con_t0c, con_c, con_boltz, con_plnk, con_solr_2008, con_solr_2002, con_g, con_rd, co2usr_file, co2cyc_file, rad_hr_units, inc_minor_gas, icliq_lw, isubcsw, isubclw, iswmode, ipsd0, ltp, lextop, errmsg, errflg)
subroutine, public gfs_rrtmg_setup_finalize(errmsg, errflg)
logical loz1st
control flag for the first time of reading climatological ozone data (set/reset in subroutines radini...
subroutine, public gfs_rrtmg_setup_timestep_init(idate, jdate, deltsw, deltim, lsswr, me, iaermdl, iaerflg, isol, aeros_file, slag, sdec, cdec, solcon, con_pi, co2dat_file, co2gbl_file, ictm, ico2, ntoz, ozphys, errmsg, errflg)
subroutine, public sol_init(me, isolar, solar_file, con_solr, con_solr_old, con_pi)
This subroutine initializes astronomy process, and set up module constants.
subroutine, public sol_update(jdate, kyear, deltsw, deltim, lsol_chg, me, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
This subroutine computes solar parameters at forecast time.
subroutine, public cld_init(si, nlay, imp_physics, me, con_g, con_rd, errflg, errmsg)
This subroutine is an initialization program for cloud-radiation calculations and sets up boundary la...
subroutine, public gas_init(me, co2usr_file, co2cyc_file, ico2flg, ictmflg, con_pi, errflg, errmsg)
This subroutine sets up co2, etc. parameters.
subroutine, public gas_update(iyear, imon, iday, ihour, ldoco2, me, co2dat_file, co2gbl_file, ictmflg, ico2flg, errflg, errmsg)
This subroutine reads in 2-d monthly co2 data set for a specified year. Data are in a 15 degree lat/l...
subroutine, public rlwinit(me, rad_hr_units, inc_minor_gas, ilwcliq, isubclw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, errflg, errmsg)
This subroutine performs calculations necessary for the initialization of the longwave model,...
subroutine, public rswinit(me, rad_hr_units, inc_minor_gas, iswcliq, isubcsw, iovr, iovr_rand, iovr_maxrand, iovr_max, iovr_dcorr, iovr_exp, iovr_exprand, iswmode, errflg, errmsg)
This subroutine initializes non-varying module variables, conversion factors, and look-up tables.
The operational GFS currently parameterizes ozone production and destruction based on monthly mean co...
This module sets up astronomy quantities for solar radiation calculations.
This module computes cloud related quantities for radiation computations.
This module sets up constant gas rofiles, such as co2, ch4, n2o, o2, and those of cfc gases.
This module contains the CCPP-compliant NCEP's modifications of the rrtmg-lw radiation code from aer ...
This module contains the CCPP-compliant NCEP's modifications of the rrtmg-sw radiation code from aer ...
Derived type containing data and procedures needed by ozone photochemistry parameterization Note All ...