77 subroutine rrtmgp_lw_cloud_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_clouds, &
78 doGP_cldoptics_PADE, doGP_cldoptics_LUT, nrghice, mpicomm, mpirank, mpiroot, &
82 character(len=128),
intent(in) :: &
83 rrtmgp_root_dir, & !< RTE-RRTMGP root directory
86 logical,
intent(in) :: &
87 doGP_cldoptics_PADE,& !< Use RRTMGP cloud-optics: PADE approximation?
89 integer,
intent(inout) :: &
91 type(mpi_comm),
intent(in) :: &
93 integer,
intent(in) :: &
94 mpirank, & !< Current MPI rank
98 character(len=*),
intent(out) :: &
100 integer,
intent(out) :: &
104 integer :: dimID,varID,status,ncid,mpierr
105 character(len=264) :: lw_cloud_props_file
112 lw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_lw_file_clouds)
121 if (mpirank .eq. mpiroot)
then
123 write (*,*)
'Reading RRTMGP longwave cloud-optics metadata ... '
126 status = nf90_open(trim(lw_cloud_props_file), nf90_nowrite, ncid)
129 status = nf90_inq_dimid(ncid,
'nband', dimid)
130 status = nf90_inquire_dimension(ncid, dimid, len=nbandlw)
131 status = nf90_inq_dimid(ncid,
'nrghice', dimid)
132 status = nf90_inquire_dimension(ncid, dimid, len=nrghice_fromfilelw)
133 status = nf90_inq_dimid(ncid,
'nsize_liq', dimid)
134 status = nf90_inquire_dimension(ncid, dimid, len=nsize_liqlw)
135 status = nf90_inq_dimid(ncid,
'nsize_ice', dimid)
136 status = nf90_inquire_dimension(ncid, dimid, len=nsize_icelw)
137 status = nf90_inq_dimid(ncid,
'nsizereg', dimid)
138 status = nf90_inquire_dimension(ncid, dimid, len=nsizereglw)
139 status = nf90_inq_dimid(ncid,
'ncoeff_ext', dimid)
140 status = nf90_inquire_dimension(ncid, dimid, len=ncoeff_extlw)
141 status = nf90_inq_dimid(ncid,
'ncoeff_ssa_g', dimid)
142 status = nf90_inquire_dimension(ncid, dimid, len=ncoeff_ssa_glw)
143 status = nf90_inq_dimid(ncid,
'nbound', dimid)
144 status = nf90_inquire_dimension(ncid, dimid, len=nboundlw)
145 status = nf90_inq_dimid(ncid,
'pair', dimid)
146 status = nf90_inquire_dimension(ncid, dimid, len=npairslw)
152 call mpi_barrier(mpicomm, mpierr)
160 call mpi_bcast(nbandlw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
161 call mpi_bcast(nsize_liqlw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
162 call mpi_bcast(nsize_icelw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
163 call mpi_bcast(nsizereglw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
164 call mpi_bcast(ncoeff_extlw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
165 call mpi_bcast(ncoeff_ssa_glw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
166 call mpi_bcast(nboundlw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
167 call mpi_bcast(npairslw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
172 if (nrghice .ne. 0) nrghice_fromfilelw = nrghice
174 call mpi_bcast(nrghice_fromfilelw, 1, mpi_integer, mpiroot, mpicomm, mpierr)
183 if (dogp_cldoptics_lut)
then
184 allocate(lut_extliqlw(nsize_liqlw, nbandlw))
185 allocate(lut_ssaliqlw(nsize_liqlw, nbandlw))
186 allocate(lut_asyliqlw(nsize_liqlw, nbandlw))
187 allocate(lut_exticelw(nsize_icelw, nbandlw, nrghice_fromfilelw))
188 allocate(lut_ssaicelw(nsize_icelw, nbandlw, nrghice_fromfilelw))
189 allocate(lut_asyicelw(nsize_icelw, nbandlw, nrghice_fromfilelw))
191 if (dogp_cldoptics_pade)
then
192 allocate(pade_extliqlw(nbandlw, nsizereglw, ncoeff_extlw ))
193 allocate(pade_ssaliqlw(nbandlw, nsizereglw, ncoeff_ssa_glw))
194 allocate(pade_asyliqlw(nbandlw, nsizereglw, ncoeff_ssa_glw))
195 allocate(pade_exticelw(nbandlw, nsizereglw, ncoeff_extlw, nrghice_fromfilelw))
196 allocate(pade_ssaicelw(nbandlw, nsizereglw, ncoeff_ssa_glw, nrghice_fromfilelw))
197 allocate(pade_asyicelw(nbandlw, nsizereglw, ncoeff_ssa_glw, nrghice_fromfilelw))
198 allocate(pade_sizereg_extliqlw(nboundlw))
199 allocate(pade_sizereg_ssaliqlw(nboundlw))
200 allocate(pade_sizereg_asyliqlw(nboundlw))
201 allocate(pade_sizereg_exticelw(nboundlw))
202 allocate(pade_sizereg_ssaicelw(nboundlw))
203 allocate(pade_sizereg_asyicelw(nboundlw))
205 allocate(band_limscldlw(2,nbandlw))
214 if (mpirank .eq. mpiroot)
then
217 if (dogp_cldoptics_lut)
then
218 write (*,*)
'Reading RRTMGP longwave cloud data (LUT) ... '
219 status = nf90_inq_varid(ncid,
'radliq_lwr',varid)
220 status = nf90_get_var(ncid,varid,radliq_lwrlw)
221 status = nf90_inq_varid(ncid,
'radliq_upr',varid)
222 status = nf90_get_var(ncid,varid,radliq_uprlw)
223 status = nf90_inq_varid(ncid,
'radliq_fac',varid)
224 status = nf90_get_var(ncid,varid,radliq_faclw)
225 status = nf90_inq_varid(ncid,
'radice_lwr',varid)
226 status = nf90_get_var(ncid,varid,radice_lwrlw)
227 status = nf90_inq_varid(ncid,
'radice_upr',varid)
228 status = nf90_get_var(ncid,varid,radice_uprlw)
229 status = nf90_inq_varid(ncid,
'radice_fac',varid)
230 status = nf90_get_var(ncid,varid,radice_faclw)
231 status = nf90_inq_varid(ncid,
'lut_extliq',varid)
232 status = nf90_get_var(ncid,varid,lut_extliqlw)
233 status = nf90_inq_varid(ncid,
'lut_ssaliq',varid)
234 status = nf90_get_var(ncid,varid,lut_ssaliqlw)
235 status = nf90_inq_varid(ncid,
'lut_asyliq',varid)
236 status = nf90_get_var(ncid,varid,lut_asyliqlw)
237 status = nf90_inq_varid(ncid,
'lut_extice',varid)
238 status = nf90_get_var(ncid,varid,lut_exticelw)
239 status = nf90_inq_varid(ncid,
'lut_ssaice',varid)
240 status = nf90_get_var(ncid,varid,lut_ssaicelw)
241 status = nf90_inq_varid(ncid,
'lut_asyice',varid)
242 status = nf90_get_var(ncid,varid,lut_asyicelw)
243 status = nf90_inq_varid(ncid,
'bnd_limits_wavenumber',varid)
244 status = nf90_get_var(ncid,varid,band_limscldlw)
246 if (dogp_cldoptics_pade)
then
247 write (*,*)
'Reading RRTMGP longwave cloud data (PADE) ... '
248 status = nf90_inq_varid(ncid,
'radliq_lwr',varid)
249 status = nf90_get_var(ncid,varid,radliq_lwrlw)
250 status = nf90_inq_varid(ncid,
'radliq_upr',varid)
251 status = nf90_get_var(ncid,varid,radliq_uprlw)
252 status = nf90_inq_varid(ncid,
'radliq_fac',varid)
253 status = nf90_get_var(ncid,varid,radliq_faclw)
254 status = nf90_inq_varid(ncid,
'radice_lwr',varid)
255 status = nf90_get_var(ncid,varid,radice_lwrlw)
256 status = nf90_inq_varid(ncid,
'radice_upr',varid)
257 status = nf90_get_var(ncid,varid,radice_uprlw)
258 status = nf90_inq_varid(ncid,
'radice_fac',varid)
259 status = nf90_get_var(ncid,varid,radice_faclw)
260 status = nf90_inq_varid(ncid,
'pade_extliq',varid)
261 status = nf90_get_var(ncid,varid,pade_extliqlw)
262 status = nf90_inq_varid(ncid,
'pade_ssaliq',varid)
263 status = nf90_get_var(ncid,varid,pade_ssaliqlw)
264 status = nf90_inq_varid(ncid,
'pade_asyliq',varid)
265 status = nf90_get_var(ncid,varid,pade_asyliqlw)
266 status = nf90_inq_varid(ncid,
'pade_extice',varid)
267 status = nf90_get_var(ncid,varid,pade_exticelw)
268 status = nf90_inq_varid(ncid,
'pade_ssaice',varid)
269 status = nf90_get_var(ncid,varid,pade_ssaicelw)
270 status = nf90_inq_varid(ncid,
'pade_asyice',varid)
271 status = nf90_get_var(ncid,varid,pade_asyicelw)
272 status = nf90_inq_varid(ncid,
'pade_sizreg_extliq',varid)
273 status = nf90_get_var(ncid,varid,pade_sizereg_extliqlw)
274 status = nf90_inq_varid(ncid,
'pade_sizreg_ssaliq',varid)
275 status = nf90_get_var(ncid,varid,pade_sizereg_ssaliqlw)
276 status = nf90_inq_varid(ncid,
'pade_sizreg_asyliq',varid)
277 status = nf90_get_var(ncid,varid,pade_sizereg_asyliqlw)
278 status = nf90_inq_varid(ncid,
'pade_sizreg_extice',varid)
279 status = nf90_get_var(ncid,varid,pade_sizereg_exticelw)
280 status = nf90_inq_varid(ncid,
'pade_sizreg_ssaice',varid)
281 status = nf90_get_var(ncid,varid,pade_sizereg_ssaicelw)
282 status = nf90_inq_varid(ncid,
'pade_sizreg_asyice',varid)
283 status = nf90_get_var(ncid,varid,pade_sizereg_asyicelw)
284 status = nf90_inq_varid(ncid,
'bnd_limits_wavenumber',varid)
285 status = nf90_get_var(ncid,varid,band_limscldlw)
289 status = nf90_close(ncid)
294 call mpi_barrier(mpicomm, mpierr)
304 call mpi_bcast(radliq_faclw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
305 call mpi_bcast(radice_faclw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
306 call mpi_bcast(radliq_lwrlw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
307 call mpi_bcast(radliq_uprlw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
308 call mpi_bcast(radice_lwrlw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
309 call mpi_bcast(radice_uprlw, 1, mpi_double_precision, mpiroot, mpicomm, mpierr)
312 call mpi_bcast(band_limscldlw,
size(band_limscldlw), &
313 mpi_double_precision, mpiroot, mpicomm, mpierr)
314 if (dogp_cldoptics_lut)
then
315 call mpi_bcast(lut_extliqlw,
size(lut_extliqlw), &
316 mpi_double_precision, mpiroot, mpicomm, mpierr)
317 call mpi_bcast(lut_ssaliqlw,
size(lut_ssaliqlw), &
318 mpi_double_precision, mpiroot, mpicomm, mpierr)
319 call mpi_bcast(lut_asyliqlw,
size(lut_asyliqlw), &
320 mpi_double_precision, mpiroot, mpicomm, mpierr)
321 call mpi_bcast(lut_exticelw,
size(lut_exticelw), &
322 mpi_double_precision, mpiroot, mpicomm, mpierr)
323 call mpi_bcast(lut_ssaicelw,
size(lut_ssaicelw), &
324 mpi_double_precision, mpiroot, mpicomm, mpierr)
325 call mpi_bcast(lut_asyicelw,
size(lut_asyicelw), &
326 mpi_double_precision, mpiroot, mpicomm, mpierr)
328 if (dogp_cldoptics_pade)
then
329 call mpi_bcast(pade_extliqlw,
size(pade_extliqlw), &
330 mpi_double_precision, mpiroot, mpicomm, mpierr)
331 call mpi_bcast(pade_ssaliqlw,
size(pade_ssaliqlw), &
332 mpi_double_precision, mpiroot, mpicomm, mpierr)
333 call mpi_bcast(pade_asyliqlw,
size(pade_asyliqlw), &
334 mpi_double_precision, mpiroot, mpicomm, mpierr)
335 call mpi_bcast(pade_exticelw,
size(pade_exticelw), &
336 mpi_double_precision, mpiroot, mpicomm, mpierr)
337 call mpi_bcast(pade_ssaicelw,
size(pade_ssaicelw), &
338 mpi_double_precision, mpiroot, mpicomm, mpierr)
339 call mpi_bcast(pade_asyicelw,
size(pade_asyicelw), &
340 mpi_double_precision, mpiroot, mpicomm, mpierr)
341 call mpi_bcast(pade_sizereg_extliqlw,
size(pade_sizereg_extliqlw), &
342 mpi_double_precision, mpiroot, mpicomm, mpierr)
343 call mpi_bcast(pade_sizereg_ssaliqlw,
size(pade_sizereg_ssaliqlw), &
344 mpi_double_precision, mpiroot, mpicomm, mpierr)
345 call mpi_bcast(pade_sizereg_asyliqlw,
size(pade_sizereg_asyliqlw), &
346 mpi_double_precision, mpiroot, mpicomm, mpierr)
347 call mpi_bcast(pade_sizereg_exticelw,
size(pade_sizereg_exticelw), &
348 mpi_double_precision, mpiroot, mpicomm, mpierr)
349 call mpi_bcast(pade_sizereg_ssaicelw,
size(pade_sizereg_ssaicelw), &
350 mpi_double_precision, mpiroot, mpicomm, mpierr)
351 call mpi_bcast(pade_sizereg_asyicelw,
size(pade_sizereg_asyicelw), &
352 mpi_double_precision, mpiroot, mpicomm, mpierr)
361 if (dogp_cldoptics_lut)
then
362 call check_error_msg(
'lw_cloud_optics_init',lw_cloud_props%load(band_limscldlw, &
363 radliq_lwrlw, radliq_uprlw, radliq_faclw, radice_lwrlw, radice_uprlw, &
364 radice_faclw, lut_extliqlw, lut_ssaliqlw, lut_asyliqlw, lut_exticelw, &
365 lut_ssaicelw, lut_asyicelw))
368 if (dogp_cldoptics_pade)
then
369 call check_error_msg(
'lw_cloud_optics_init', lw_cloud_props%load(band_limscldlw, &
370 pade_extliqlw, pade_ssaliqlw, pade_asyliqlw, pade_exticelw, pade_ssaicelw, &
371 pade_asyicelw, pade_sizereg_extliqlw, pade_sizereg_ssaliqlw, &
372 pade_sizereg_asyliqlw, pade_sizereg_exticelw, pade_sizereg_ssaicelw, &
373 pade_sizereg_asyicelw))
376 call check_error_msg(
'lw_cloud_optics_init',lw_cloud_props%set_ice_roughness(nrghice))