CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
GFS_rrtmgp_setup.F90
1
3
5 use machine, only : kind_phys
7 use module_radiation_aerosols, only : aer_init, aer_update
9 use module_ozphys, only : ty_ozphys
10 implicit none
11
12 public gfs_rrtmgp_setup_init, gfs_rrtmgp_setup_timestep_init, gfs_rrtmgp_setup_finalize
13
14 private
15
16 ! Version tag and last revision date
17 character(40), parameter :: &
18 vtagrad='NCEP-RRTMGP_driver v1.0 Sep 2019 '
19
20 ! Module paramaters
21 integer :: &
22 month0 = 0, &
23 iyear0 = 0, &
24 monthd = 0
25 logical :: &
26 is_initialized = .false.
27 ! Control flag for the first time of reading climatological ozone data
28 ! (set/reset in subroutines GFS_rrtmgp_setup_init/GFS_rrtmgp_setup_timestep_init, it is used only if
29 ! the control parameter ntoz=0)
30 logical :: loz1st = .true.
31
32contains
33
36 subroutine gfs_rrtmgp_setup_init(do_RRTMGP, imp_physics, imp_physics_fer_hires, &
37 imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, &
38 imp_physics_zhao_carr_pdf, imp_physics_mg, si, levr, ictm, isol, ico2, iaer, &
39 ntcw, ntoz, iovr, isubc_sw, isubc_lw, lalw1bd, idate, &
40 me, aeros_file, iaermdl, iaerflg, con_pi, con_t0c, con_c, con_boltz, con_plnk, &
41 solar_file, con_solr_2008, con_solr_2002, co2usr_file, co2cyc_file, ipsd0, &
42 errmsg, errflg)
43
44 ! Inputs
45 logical, intent(in) :: do_rrtmgp
46 integer, intent(in) :: &
47 imp_physics, & !< Flag for MP scheme
48 imp_physics_fer_hires, & !< Flag for fer-hires scheme
49 imp_physics_gfdl, & !< Flag for gfdl scheme
50 imp_physics_thompson, & !< Flag for thompsonscheme
51 imp_physics_wsm6, & !< Flag for wsm6 scheme
52 imp_physics_zhao_carr, & !< Flag for zhao-carr scheme
53 imp_physics_zhao_carr_pdf, & !< Flag for zhao-carr+PDF scheme
54 imp_physics_mg
55 real(kind_phys), intent(in) :: &
56 con_pi, con_t0c, con_c, con_boltz, con_plnk, con_solr_2008, con_solr_2002
57 real(kind_phys), dimension(:), intent(in) :: &
58 si
59 integer, intent(in) :: levr, ictm, isol, ico2, iaer, ntcw, ntoz, iovr, isubc_sw, isubc_lw, me
60 logical, intent(in) :: &
61 lalw1bd
62 integer, intent(in), dimension(:) :: &
63 idate
64 character(len=26),intent(in) :: aeros_file, solar_file, co2usr_file, co2cyc_file
65
66 ! Outputs
67 character(len=*), intent(out) :: errmsg
68 integer, intent(out) :: errflg
69 integer, intent(inout) :: ipsd0
70 integer, intent(out) :: iaermdl, iaerflg
71
72 ! Initialize the CCPP error handling variables
73 errmsg = ''
74 errflg = 0
75
76 ! Consistency checks
77 if (.not. do_rrtmgp) then
78 write(errmsg,'(*(a))') "Logic error: do_RRTMGP must be set to .true."
79 errflg = 1
80 return
81 end if
82
83 ! Set radiation parameters
84 if ( ictm==0 .or. ictm==-2 ) then
85 iaerflg = mod(iaer, 100) ! no volcanic aerosols for clim hindcast
86 else
87 iaerflg = mod(iaer, 1000)
88 endif
89 iaermdl = iaer/1000 ! control flag for aerosol scheme selection
90 if ( iaermdl < 0 .or. (iaermdl>2 .and. iaermdl/=5) ) then
91 errmsg = trim(errmsg) // ' Error -- IAER flag is incorrect, Abort'
92 errflg = 1
93 return
94 endif
95
96 ! Assign initial permutation seed for mcica cloud-radiation
97 if ( isubc_sw>0 .or. isubc_lw>0 ) then
98 ipsd0 = 17*idate(1)+43*idate(2)+37*idate(3)+23*idate(4)
99 endif
100
101 if ( me == 0 ) then
102 print *,' In rad_initialize (GFS_rrtmgp_setup_init), before calling radinit'
103 print *,' si = ',si
104 print *,' levr = ',levr, &
105 ' ictm = ',ictm, &
106 ' isol = ',isol, &
107 ' ico2 = ',ico2, &
108 ' iaermdl = ',iaermdl, &
109 ' iaerflg = ',iaerflg, &
110 ' ntcw = ',ntcw, &
111 ' ntoz = ',ntoz, &
112 ' iovr = ',iovr, &
113 ' isubc_sw = ',isubc_sw, &
114 ' isubc_lw = ',isubc_lw, &
115 ' ipsd0 = ',ipsd0, &
116 ' me = ',me
117 endif
118
119 loz1st = (ntoz == 0) ! first-time clim ozone data read flag
120 month0 = 0
121 iyear0 = 0
122 monthd = 0
123
124 if (is_initialized) return
125
126 ! Call initialization routines..
127 call sol_init ( me, isol, solar_file, con_solr_2008, con_solr_2002, con_pi )
128 call aer_init ( levr, me, iaermdl, iaerflg, lalw1bd, aeros_file, con_pi, con_t0c, &
129 con_c, con_boltz, con_plnk, errflg, errmsg)
130 call gas_init ( me, co2usr_file, co2cyc_file, ico2, ictm, con_pi, errflg, errmsg )
131
132 if ( me == 0 ) then
133 print *,' return from rad_initialize (GFS_rrtmgp_setup_init) - after calling radinit'
134 endif
135
136 is_initialized = .true.
137
138 return
139 end subroutine gfs_rrtmgp_setup_init
140
143 subroutine gfs_rrtmgp_setup_timestep_init (idate, jdate, deltsw, deltim, doSWrad, me, &
144 iaermdl, aeros_file, isol, slag, sdec, cdec, solcon, con_pi, co2dat_file, &
145 co2gbl_file, ictm, ico2, ntoz, ozphys, errmsg, errflg)
146
147 ! Inputs
148 integer, intent(in) :: idate(:)
149 integer, intent(in) :: jdate(:)
150 real(kind_phys), intent(in) :: deltsw
151 real(kind_phys), intent(in) :: deltim
152 logical, intent(in) :: doswrad
153 real(kind_phys), intent(in) :: con_pi
154 integer, intent(in) :: me
155 integer, intent(in) :: iaermdl,isol,ictm,ico2,ntoz
156 character(len=26), intent(in) :: aeros_file,co2dat_file,co2gbl_file
157 type(ty_ozphys),intent(inout) :: ozphys
158 ! Outputs
159 real(kind_phys), intent(out) :: slag
160 real(kind_phys), intent(out) :: sdec
161 real(kind_phys), intent(out) :: cdec
162 real(kind_phys), intent(out) :: solcon
163 character(len=*),intent(out) :: errmsg
164 integer, intent(out) :: errflg
165
166 ! Locals
167 integer :: iyear, imon, iday, ihour
168 integer :: kyear, kmon, kday, khour
169 logical :: lmon_chg ! month change flag
170 logical :: lco2_chg ! cntrl flag for updating co2 data
171 logical :: lsol_chg ! cntrl flag for updating solar constant
172
173 ! Initialize the CCPP error handling variables
174 errmsg = ''
175 errflg = 0
176
177 ! Check initialization state
178 if (.not.is_initialized) then
179 write(errmsg, fmt='((a))') 'GFS_rrtmgp_setup_timestep_init called before GFS_rrtmgp_setup_init'
180 errflg = 1
181 return
182 end if
183
184 ! Set up time stamp at fcst time and that for green house gases
185 iyear = jdate(1)
186 imon = jdate(2)
187 iday = jdate(3)
188 ihour = jdate(5)
189
190 ! Set up time stamp used for green house gases (** currently co2 only)
191 ! get external data at initial condition time
192 if ( ictm==0 .or. ictm==-2 ) then
193 kyear = idate(1)
194 kmon = idate(2)
195 kday = idate(3)
196 khour = idate(5)
197 ! get external data at fcst or specified time
198 else
199 kyear = iyear
200 kmon = imon
201 kday = iday
202 khour = ihour
203 endif
204
205 if ( month0 /= imon ) then
206 lmon_chg = .true.
207 month0 = imon
208 else
209 lmon_chg = .false.
210 endif
211
212 ! Update solar forcing...
213 if (doswrad) then
214 if ( isol == 0 .or. isol == 10 ) then
215 lsol_chg = .false.
216 elseif ( iyear0 /= iyear ) then
217 lsol_chg = .true.
218 else
219 lsol_chg = ( isol==4 .and. lmon_chg )
220 endif
221 iyear0 = iyear
222 call sol_update(jdate, kyear, deltsw, deltim, lsol_chg, me, slag, sdec, cdec, solcon, con_pi, errmsg, errflg)
223 endif
224
225 ! Update aerosols...
226 if ( lmon_chg ) then
227 call aer_update ( iyear, imon, me, iaermdl, aeros_file, errflg, errmsg)
228 endif
229
230 ! Update trace gases (co2 only)...
231 if ( monthd /= kmon ) then
232 monthd = kmon
233 lco2_chg = .true.
234 else
235 lco2_chg = .false.
236 endif
237 call gas_update (kyear, kmon, kday, khour, lco2_chg, me, co2dat_file, co2gbl_file, ictm,&
238 ico2, errflg, errmsg )
239 if (ntoz == 0) then
240 call ozphys%update_o3clim(kmon, kday, khour, loz1st)
241 endif
242
243 if ( loz1st ) loz1st = .false.
244
245 return
246 end subroutine gfs_rrtmgp_setup_timestep_init
247
250 subroutine gfs_rrtmgp_setup_finalize (errmsg, errflg)
251 character(len=*), intent( out) :: errmsg
252 integer, intent( out) :: errflg
253
254 ! Initialize the CCPP error handling variables
255 errmsg = ''
256 errflg = 0
257
258 if (.not.is_initialized) return
259
260 ! do finalization stuff if needed
261 is_initialized = .false.
262
263 end subroutine gfs_rrtmgp_setup_finalize
264end module gfs_rrtmgp_setup
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 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...
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 sets up constant gas rofiles, such as co2, ch4, n2o, o2, and those of cfc gases.
Derived type containing data and procedures needed by ozone photochemistry parameterization Note All ...