74 subroutine rrtmgp_sw_cloud_optics_init( rrtmgp_root_dir, rrtmgp_sw_file_clouds, &
75 doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot, &
79 character(len=128),
intent(in) :: &
80 rrtmgp_root_dir, & !< RTE-RRTMGP root directory
82 logical,
intent(in) :: &
83 doGP_cldoptics_PADE,& !< Use RRTMGP cloud-optics: PADE approximation?
85 integer,
intent(inout) :: &
87 type(mpi_comm),
intent(in) :: &
89 integer,
intent(in) :: &
90 mpirank, & !< Current MPI rank
94 character(len=*),
intent(out) :: &
96 integer,
intent(out) :: &
100 integer :: status,ncid,dimid,varID,mpierr
101 character(len=264) :: sw_cloud_props_file
108 sw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_sw_file_clouds)
117 if (mpirank .eq. mpiroot)
then
119 write (*,*)
'Reading RRTMGP shortwave cloud-optics metadata ... '
122 status = nf90_open(trim(sw_cloud_props_file), nf90_nowrite, ncid)
125 status = nf90_inq_dimid(ncid,
'nband', dimid)
126 status = nf90_inquire_dimension(ncid, dimid, len=nbandsw)
127 status = nf90_inq_dimid(ncid,
'nrghice', dimid)
128 status = nf90_inquire_dimension(ncid, dimid, len=nrghice_fromfilesw)
129 status = nf90_inq_dimid(ncid,
'nsize_liq', dimid)
130 status = nf90_inquire_dimension(ncid, dimid, len=nsize_liqsw)
131 status = nf90_inq_dimid(ncid,
'nsize_ice', dimid)
132 status = nf90_inquire_dimension(ncid, dimid, len=nsize_icesw)
133 status = nf90_inq_dimid(ncid,
'nsizereg', dimid)
134 status = nf90_inquire_dimension(ncid, dimid, len=nsizeregsw)
135 status = nf90_inq_dimid(ncid,
'ncoeff_ext', dimid)
136 status = nf90_inquire_dimension(ncid, dimid, len=ncoeff_extsw)
137 status = nf90_inq_dimid(ncid,
'ncoeff_ssa_g', dimid)
138 status = nf90_inquire_dimension(ncid, dimid, len=ncoeff_ssa_gsw)
139 status = nf90_inq_dimid(ncid,
'nbound', dimid)
140 status = nf90_inquire_dimension(ncid, dimid, len=nboundsw)
141 status = nf90_inq_dimid(ncid,
'pair', dimid)
142 status = nf90_inquire_dimension(ncid, dimid, len=npairssw)
147 call mpi_barrier(mpicomm, mpierr)
155 call mpi_bcast(nbandsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
156 call mpi_bcast(nsize_liqsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
157 call mpi_bcast(nsize_icesw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
158 call mpi_bcast(nsizeregsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
159 call mpi_bcast(ncoeff_extsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
160 call mpi_bcast(ncoeff_ssa_gsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
161 call mpi_bcast(nboundsw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
162 call mpi_bcast(npairssw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
167 if (nrghice .ne. 0) nrghice_fromfilesw = nrghice
169 call mpi_bcast(nrghice_fromfilesw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
178 if (dogp_cldoptics_lut)
then
179 allocate(lut_extliqsw(nsize_liqsw, nbandsw))
180 allocate(lut_ssaliqsw(nsize_liqsw, nbandsw))
181 allocate(lut_asyliqsw(nsize_liqsw, nbandsw))
182 allocate(lut_exticesw(nsize_icesw, nbandsw, nrghice_fromfilesw))
183 allocate(lut_ssaicesw(nsize_icesw, nbandsw, nrghice_fromfilesw))
184 allocate(lut_asyicesw(nsize_icesw, nbandsw, nrghice_fromfilesw))
186 if (dogp_cldoptics_pade)
then
187 allocate(pade_extliqsw(nbandsw, nsizeregsw, ncoeff_extsw ))
188 allocate(pade_ssaliqsw(nbandsw, nsizeregsw, ncoeff_ssa_gsw))
189 allocate(pade_asyliqsw(nbandsw, nsizeregsw, ncoeff_ssa_gsw))
190 allocate(pade_exticesw(nbandsw, nsizeregsw, ncoeff_extsw, nrghice_fromfilesw))
191 allocate(pade_ssaicesw(nbandsw, nsizeregsw, ncoeff_ssa_gsw, nrghice_fromfilesw))
192 allocate(pade_asyicesw(nbandsw, nsizeregsw, ncoeff_ssa_gsw, nrghice_fromfilesw))
193 allocate(pade_sizereg_extliqsw(nboundsw))
194 allocate(pade_sizereg_ssaliqsw(nboundsw))
195 allocate(pade_sizereg_asyliqsw(nboundsw))
196 allocate(pade_sizereg_exticesw(nboundsw))
197 allocate(pade_sizereg_ssaicesw(nboundsw))
198 allocate(pade_sizereg_asyicesw(nboundsw))
200 allocate(band_limscldsw(2,nbandsw))
209 if (mpirank .eq. mpiroot)
then
211 if (dogp_cldoptics_lut)
then
212 write (*,*)
'Reading RRTMGP shortwave cloud data (LUT) ... '
213 status = nf90_inq_varid(ncid,
'radliq_lwr',varid)
214 status = nf90_get_var(ncid,varid,radliq_lwrsw)
215 status = nf90_inq_varid(ncid,
'radliq_upr',varid)
216 status = nf90_get_var(ncid,varid,radliq_uprsw)
217 status = nf90_inq_varid(ncid,
'radliq_fac',varid)
218 status = nf90_get_var(ncid,varid,radliq_facsw)
219 status = nf90_inq_varid(ncid,
'radice_lwr',varid)
220 status = nf90_get_var(ncid,varid,radice_lwrsw)
221 status = nf90_inq_varid(ncid,
'radice_upr',varid)
222 status = nf90_get_var(ncid,varid,radice_uprsw)
223 status = nf90_inq_varid(ncid,
'radice_fac',varid)
224 status = nf90_get_var(ncid,varid,radice_facsw)
225 status = nf90_inq_varid(ncid,
'lut_extliq',varid)
226 status = nf90_get_var(ncid,varid,lut_extliqsw)
227 status = nf90_inq_varid(ncid,
'lut_ssaliq',varid)
228 status = nf90_get_var(ncid,varid,lut_ssaliqsw)
229 status = nf90_inq_varid(ncid,
'lut_asyliq',varid)
230 status = nf90_get_var(ncid,varid,lut_asyliqsw)
231 status = nf90_inq_varid(ncid,
'lut_extice',varid)
232 status = nf90_get_var(ncid,varid,lut_exticesw)
233 status = nf90_inq_varid(ncid,
'lut_ssaice',varid)
234 status = nf90_get_var(ncid,varid,lut_ssaicesw)
235 status = nf90_inq_varid(ncid,
'lut_asyice',varid)
236 status = nf90_get_var(ncid,varid,lut_asyicesw)
237 status = nf90_inq_varid(ncid,
'bnd_limits_wavenumber',varid)
238 status = nf90_get_var(ncid,varid,band_limscldsw)
240 if (dogp_cldoptics_pade)
then
241 write (*,*)
'Reading RRTMGP shortwave cloud data (PADE) ... '
242 status = nf90_inq_varid(ncid,
'radliq_lwr',varid)
243 status = nf90_get_var(ncid,varid,radliq_lwrsw)
244 status = nf90_inq_varid(ncid,
'radliq_upr',varid)
245 status = nf90_get_var(ncid,varid,radliq_uprsw)
246 status = nf90_inq_varid(ncid,
'radliq_fac',varid)
247 status = nf90_get_var(ncid,varid,radliq_facsw)
248 status = nf90_inq_varid(ncid,
'radice_lwr',varid)
249 status = nf90_get_var(ncid,varid,radice_lwrsw)
250 status = nf90_inq_varid(ncid,
'radice_upr',varid)
251 status = nf90_get_var(ncid,varid,radice_uprsw)
252 status = nf90_inq_varid(ncid,
'radice_fac',varid)
253 status = nf90_get_var(ncid,varid,radice_facsw)
254 status = nf90_inq_varid(ncid,
'pade_extliq',varid)
255 status = nf90_get_var(ncid,varid,pade_extliqsw)
256 status = nf90_inq_varid(ncid,
'pade_ssaliq',varid)
257 status = nf90_get_var(ncid,varid,pade_ssaliqsw)
258 status = nf90_inq_varid(ncid,
'pade_asyliq',varid)
259 status = nf90_get_var(ncid,varid,pade_asyliqsw)
260 status = nf90_inq_varid(ncid,
'pade_extice',varid)
261 status = nf90_get_var(ncid,varid,pade_exticesw)
262 status = nf90_inq_varid(ncid,
'pade_ssaice',varid)
263 status = nf90_get_var(ncid,varid,pade_ssaicesw)
264 status = nf90_inq_varid(ncid,
'pade_asyice',varid)
265 status = nf90_get_var(ncid,varid,pade_asyicesw)
266 status = nf90_inq_varid(ncid,
'pade_sizreg_extliq',varid)
267 status = nf90_get_var(ncid,varid,pade_sizereg_extliqsw)
268 status = nf90_inq_varid(ncid,
'pade_sizreg_ssaliq',varid)
269 status = nf90_get_var(ncid,varid,pade_sizereg_ssaliqsw)
270 status = nf90_inq_varid(ncid,
'pade_sizreg_asyliq',varid)
271 status = nf90_get_var(ncid,varid,pade_sizereg_asyliqsw)
272 status = nf90_inq_varid(ncid,
'pade_sizreg_extice',varid)
273 status = nf90_get_var(ncid,varid,pade_sizereg_exticesw)
274 status = nf90_inq_varid(ncid,
'pade_sizreg_ssaice',varid)
275 status = nf90_get_var(ncid,varid,pade_sizereg_ssaicesw)
276 status = nf90_inq_varid(ncid,
'pade_sizreg_asyice',varid)
277 status = nf90_get_var(ncid,varid,pade_sizereg_asyicesw)
278 status = nf90_inq_varid(ncid,
'bnd_limits_wavenumber',varid)
279 status = nf90_get_var(ncid,varid,band_limscldsw)
283 status = nf90_close(ncid)
289 call mpi_barrier(mpicomm, mpierr)
299 call mpi_bcast(radliq_facsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
300 call mpi_bcast(radice_facsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
301 call mpi_bcast(radliq_lwrsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
302 call mpi_bcast(radliq_uprsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
303 call mpi_bcast(radice_lwrsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
304 call mpi_bcast(radice_uprsw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
307 call mpi_bcast(band_limscldsw,
size(band_limscldsw), &
308 mpi_double_precision, mpiroot, mpicomm, mpierr)
309 if (dogp_cldoptics_lut)
then
310 call mpi_bcast(lut_extliqsw,
size(lut_extliqsw), &
311 mpi_double_precision, mpiroot, mpicomm, mpierr)
312 call mpi_bcast(lut_ssaliqsw,
size(lut_ssaliqsw), &
313 mpi_double_precision, mpiroot, mpicomm, mpierr)
314 call mpi_bcast(lut_asyliqsw,
size(lut_asyliqsw), &
315 mpi_double_precision, mpiroot, mpicomm, mpierr)
316 call mpi_bcast(lut_exticesw,
size(lut_exticesw), &
317 mpi_double_precision, mpiroot, mpicomm, mpierr)
318 call mpi_bcast(lut_ssaicesw,
size(lut_ssaicesw), &
319 mpi_double_precision, mpiroot, mpicomm, mpierr)
320 call mpi_bcast(lut_asyicesw,
size(lut_asyicesw), &
321 mpi_double_precision, mpiroot, mpicomm, mpierr)
323 if (dogp_cldoptics_pade)
then
324 call mpi_bcast(pade_extliqsw,
size(pade_extliqsw), &
325 mpi_double_precision, mpiroot, mpicomm, mpierr)
326 call mpi_bcast(pade_ssaliqsw,
size(pade_ssaliqsw), &
327 mpi_double_precision, mpiroot, mpicomm, mpierr)
328 call mpi_bcast(pade_asyliqsw,
size(pade_asyliqsw), &
329 mpi_double_precision, mpiroot, mpicomm, mpierr)
330 call mpi_bcast(pade_exticesw,
size(pade_exticesw), &
331 mpi_double_precision, mpiroot, mpicomm, mpierr)
332 call mpi_bcast(pade_ssaicesw,
size(pade_ssaicesw), &
333 mpi_double_precision, mpiroot, mpicomm, mpierr)
334 call mpi_bcast(pade_asyicesw,
size(pade_asyicesw), &
335 mpi_double_precision, mpiroot, mpicomm, mpierr)
336 call mpi_bcast(pade_sizereg_extliqsw,
size(pade_sizereg_extliqsw), &
337 mpi_double_precision, mpiroot, mpicomm, mpierr)
338 call mpi_bcast(pade_sizereg_ssaliqsw,
size(pade_sizereg_ssaliqsw), &
339 mpi_double_precision, mpiroot, mpicomm, mpierr)
340 call mpi_bcast(pade_sizereg_asyliqsw,
size(pade_sizereg_asyliqsw), &
341 mpi_double_precision, mpiroot, mpicomm, mpierr)
342 call mpi_bcast(pade_sizereg_exticesw,
size(pade_sizereg_exticesw), &
343 mpi_double_precision, mpiroot, mpicomm, mpierr)
344 call mpi_bcast(pade_sizereg_ssaicesw,
size(pade_sizereg_ssaicesw), &
345 mpi_double_precision, mpiroot, mpicomm, mpierr)
346 call mpi_bcast(pade_sizereg_asyicesw,
size(pade_sizereg_asyicesw), &
347 mpi_double_precision, mpiroot, mpicomm, mpierr)
356 if (dogp_cldoptics_lut)
then
357 call check_error_msg(
'sw_cloud_optics_init',sw_cloud_props%load(band_limscldsw, &
358 radliq_lwrsw, radliq_uprsw, radliq_facsw, radice_lwrsw, radice_uprsw, &
359 radice_facsw, lut_extliqsw, lut_ssaliqsw, lut_asyliqsw, lut_exticesw, &
360 lut_ssaicesw, lut_asyicesw))
363 if (dogp_cldoptics_pade)
then
364 call check_error_msg(
'sw_cloud_optics_init', sw_cloud_props%load(band_limscldsw, &
365 pade_extliqsw, pade_ssaliqsw, pade_asyliqsw, pade_exticesw, pade_ssaicesw, &
366 pade_asyicesw, pade_sizereg_extliqsw, pade_sizereg_ssaliqsw, &
367 pade_sizereg_asyliqsw, pade_sizereg_exticesw, pade_sizereg_ssaicesw, &
368 pade_sizereg_asyicesw))
371 call check_error_msg(
'sw_cloud_optics_init',sw_cloud_props%set_ice_roughness(nrghice_fromfilesw))
374 allocate(b0r(sw_cloud_props%get_nband()),b0s(sw_cloud_props%get_nband()), &
375 b1s(sw_cloud_props%get_nband()),c0r(sw_cloud_props%get_nband()), &
376 c0s(sw_cloud_props%get_nband()))
377 b0r = (/0.496, 0.466, 0.437, 0.416, 0.391, 0.374, 0.352, &
378 0.183, 0.048, 0.012, 0.000, 0.000, 0.000, 0.000/)
379 b0s = (/0.460, 0.460, 0.460, 0.460, 0.460, 0.460, 0.460, &
380 0.460, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000/)
381 b1s = (/0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, &
382 0.000, 1.62e-5, 1.62e-5, 0.000, 0.000, 0.000, 0.000/)
383 c0r = (/0.980, 0.975, 0.965, 0.960, 0.955, 0.952, 0.950, &
384 0.944, 0.894, 0.884, 0.883, 0.883, 0.883, 0.883/)
385 c0s = (/0.970, 0.970, 0.970, 0.970, 0.970, 0.970, 0.970, &
386 0.970, 0.970, 0.970, 0.700, 0.700, 0.700, 0.700/)