diff --git a/physics/rrtmgp_lw_aerosol_optics.F90 b/physics/rrtmgp_lw_aerosol_optics.F90 index bc6295e44..a77b00759 100644 --- a/physics/rrtmgp_lw_aerosol_optics.F90 +++ b/physics/rrtmgp_lw_aerosol_optics.F90 @@ -60,9 +60,9 @@ subroutine rrtmgp_lw_aerosol_optics_run(doLWrad, nCol, nLev, nTracer, p_lev, p_l type(ty_optical_props_1scl),intent(out) :: & lw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau) integer, intent(out) :: & - errflg ! + errflg ! CCPP error flag character(len=*), intent(out) :: & - errmsg ! + errmsg ! CCPP error message ! Local variables real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), NF_AELW) :: & diff --git a/physics/rrtmgp_lw_cloud_optics.F90 b/physics/rrtmgp_lw_cloud_optics.F90 index c8c7d8470..38a54ca4c 100644 --- a/physics/rrtmgp_lw_cloud_optics.F90 +++ b/physics/rrtmgp_lw_cloud_optics.F90 @@ -19,9 +19,9 @@ module rrtmgp_lw_cloud_optics !! subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_dir, & rrtmgp_lw_file_clouds, mpicomm, mpirank, mpiroot, lw_cloud_props, errmsg, errflg) -!#ifdef MPI -! use mpi -!#endif +#ifdef MPI + use mpi +#endif ! Inputs integer, intent(in) :: & @@ -43,56 +43,57 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d errflg ! Error code ! Variables that will be passed to cloud_optics%load() + ! cld_optics_scheme = 1 real(kind_phys) :: & - radliq_lwr, & ! - radliq_upr, & ! - radliq_fac, & ! - radice_lwr, & ! - radice_upr, & ! - radice_fac ! - real(kind_phys), dimension(:), allocatable :: & - pade_sizereg_extliq, & ! - pade_sizereg_ssaliq, & ! - pade_sizereg_asyliq, & ! - pade_sizereg_extice, & ! - pade_sizereg_ssaice, & ! - pade_sizereg_asyice ! + radliq_lwr, & ! Liquid particle size lower bound for LUT interpolation + radliq_upr, & ! Liquid particle size upper bound for LUT interpolation + radliq_fac, & ! Factor for calculating LUT interpolation indices for liquid + radice_lwr, & ! Ice particle size upper bound for LUT interpolation + radice_upr, & ! Ice particle size lower bound for LUT interpolation + radice_fac ! Factor for calculating LUT interpolation indices for ice real(kind_phys), dimension(:,:), allocatable :: & - lut_extliq, & ! - lut_ssaliq, & ! - lut_asyliq, & ! - band_lims_cldy ! - + lut_extliq, & ! LUT shortwave liquid extinction coefficient + lut_ssaliq, & ! LUT shortwave liquid single scattering albedo + lut_asyliq, & ! LUT shortwave liquid asymmetry parameter + band_lims_cldy ! Beginning and ending wavenumber [cm -1] for each band + real(kind_phys), dimension(:,:,:), allocatable :: & + lut_extice, & ! LUT shortwave ice extinction coefficient + lut_ssaice, & ! LUT shortwave ice single scattering albedo + lut_asyice ! LUT shortwave ice asymmetry parameter + ! cld_optics_scheme = 2 + real(kind_phys), dimension(:), allocatable :: & + pade_sizereg_extliq, & ! Particle size regime boundaries for shortwave liquid extinction + ! coefficient for Pade interpolation + pade_sizereg_ssaliq, & ! Particle size regime boundaries for shortwave liquid single + ! scattering albedo for Pade interpolation + pade_sizereg_asyliq, & ! Particle size regime boundaries for shortwave liquid asymmetry + ! parameter for Pade interpolation + pade_sizereg_extice, & ! Particle size regime boundaries for shortwave ice extinction + ! coefficient for Pade interpolation + pade_sizereg_ssaice, & ! Particle size regime boundaries for shortwave ice single + ! scattering albedo for Pade interpolation + pade_sizereg_asyice ! Particle size regime boundaries for shortwave ice asymmetry + ! parameter for Pade interpolation real(kind_phys), dimension(:,:,:), allocatable :: & - lut_extice, & ! - lut_ssaice, & ! - lut_asyice, & ! - pade_extliq, & ! - pade_ssaliq, & ! - pade_asyliq ! + pade_extliq, & ! PADE coefficients for shortwave liquid extinction + pade_ssaliq, & ! PADE coefficients for shortwave liquid single scattering albedo + pade_asyliq ! PADE coefficients for shortwave liquid asymmetry parameter real(kind_phys), dimension(:,:,:,:), allocatable :: & - pade_extice, & ! - pade_ssaice, & ! - pade_asyice ! + pade_extice, & ! PADE coefficients for shortwave ice extinction + pade_ssaice, & ! PADE coefficients for shortwave ice single scattering albedo + pade_asyice ! PADE coefficients for shortwave ice asymmetry parameter ! Dimensions integer :: & - nrghice_lw, & ! Number of ice-roughness categories in file - nbandLWcldy, & ! - nsize_liq, & ! - nsize_ice, & ! - nsizereg, & ! - ncoeff_ext, & ! - ncoeff_ssa_g, & ! - nbound, & ! - npairsLWcldy ! + nrghice_lw, nbandLWcldy, nsize_liq, nsize_ice, nsizereg,& + ncoeff_ext, ncoeff_ssa_g, nbound, npairsLWcldy ! Local variables integer :: dimID,varID,status,ncid_lw_clds character(len=264) :: lw_cloud_props_file integer,parameter :: max_strlen=256 -!#ifdef MPI -! integer :: ierr -!#endif +#ifdef MPI + integer :: ierr +#endif ! Initialize errmsg = '' @@ -104,7 +105,7 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d lw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_lw_file_clouds) ! Read dimensions for k-distribution fields (only on master processor(0)) -! if (mpirank .eq. mpiroot) then + if (mpirank .eq. mpiroot) then if(nf90_open(trim(lw_cloud_props_file), NF90_WRITE, ncid_lw_clds) == NF90_NOERR) then status = nf90_inq_dimid(ncid_lw_clds, 'nband', dimid) status = nf90_inquire_dimension(ncid_lw_clds, dimid, len=nbandLWcldy) @@ -131,22 +132,28 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d if (nrghice .gt. nrghice_lw) then errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' endif -! endif + endif -! ! Broadcast dimensions to all processors -!#ifdef MPI -! if (Cld_optics_scheme .eq. 1 .or. Cld_optics_scheme .eq. 2) then -! call MPI_BCAST(nbandLWcldy, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nrghice_lw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsize_liq, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsize_ice, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsizereg, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(ncoeff_ext, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(ncoeff_ssa_g, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nbound, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(npairsLWcldy, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! endif -!#endif + ! Broadcast dimensions to all processors +#ifdef MPI + call MPI_BCAST(nbandSWcldy_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + if (cld_optics_scheme .eq. 1) then + call MPI_BARRIER(mpicomm, ierr) + call MPI_BCAST(nrghice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsize_liq_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsize_ice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BARRIER(mpicomm, ierr) + endif + if (cld_optics_scheme .eq. 2) then + call MPI_BARRIER(mpicomm, ierr) + call MPI_BCAST(nrghice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsizereg_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(ncoeff_ext_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(ncoeff_ssa_g_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nbound_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BARRIER(mpicomm, ierr) + endif +#endif if (Cld_optics_scheme .eq. 1) then allocate(lut_extliq(nsize_liq, nBandLWcldy)) @@ -174,11 +181,9 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d endif ! On master processor, allocate space, read in fields, broadcast to all processors -! if (mpirank .eq. mpiroot) then - ! + if (mpirank .eq. mpiroot) then if (Cld_optics_scheme .eq. 1) then write (*,*) 'Reading RRTMGP longwave cloud data (LUT) ... ' - ! if(nf90_open(trim(lw_cloud_props_file), NF90_WRITE, ncid_lw_clds) == NF90_NOERR) then status = nf90_inq_varid(ncid_lw_clds,'radliq_lwr',varID) status = nf90_get_var(ncid_lw_clds,varID,radliq_lwr) @@ -212,7 +217,6 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d ! if (Cld_optics_scheme .eq. 2) then write (*,*) 'Reading RRTMGP longwave cloud data (PADE) ... ' - ! if(nf90_open(trim(lw_cloud_props_file), NF90_WRITE, ncid_lw_clds) == NF90_NOERR) then status = nf90_inq_varid(ncid_lw_clds,'radliq_lwr',varID) status = nf90_get_var(ncid_lw_clds,varID,radliq_lwr) @@ -255,75 +259,79 @@ subroutine rrtmgp_lw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d status = nf90_close(ncid_lw_clds) endif endif -! endif + endif -! ! Broadcast arrays to all processors -!#ifdef MPI -! if (Cld_optics_scheme .eq. 1) then -! write (*,*) 'Broadcasting RRTMGP longwave cloud data (LUT) ... ' -!#ifndef SINGLE_PREC -! call MPI_BCAST(radliq_lwr, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_upr, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_fac, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_lwr, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_upr, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_fac, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extliq, size(lut_extliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaliq, size(lut_ssaliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyliq, size(lut_asyliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extice, size(lut_extice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaice, size(lut_ssaice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyice, size(lut_asyice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy , size(band_lims_cldy), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -!#else -! call MPI_BCAST(radliq_lwr, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_upr, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_fac, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_lwr, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_upr, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_fac, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extliq, size(lut_extliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaliq, size(lut_ssaliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyliq, size(lut_asyliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extice, size(lut_extice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaice, size(lut_ssaice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyice, size(lut_asyice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy , size(band_lims_cldy), MPI_REAL, mpiroot, mpicomm, ierr) -!#endif -! endif -! if (Cld_optics_scheme .eq. 2) then -! write (*,*) 'Broadcasting RRTMGP longwave cloud data (PADE) ... ' -!#ifndef SINGLE_PREC -! call MPI_BCAST(pade_extliq, size(pade_extliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaliq, size(pade_ssaliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyliq, size(pade_asyliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_extice, size(pade_extice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaice, size(pade_ssaice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyice, size(pade_asyice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extliq, size(pade_sizereg_extliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaliq, size(pade_sizereg_ssaliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyliq, size(pade_sizereg_asyliq), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extice, size(pade_sizereg_extice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaice, size(pade_sizereg_ssaice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyice, size(pade_sizereg_asyice), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy, size(band_lims_cldy), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -!#else -! call MPI_BCAST(pade_extliq, size(pade_extliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaliq, size(pade_ssaliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyliq, size(pade_asyliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_extice, size(pade_extice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaice, size(pade_ssaice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyice, size(pade_asyice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extliq, size(pade_sizereg_extliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaliq, size(pade_sizereg_ssaliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyliq, size(pade_sizereg_asyliq), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extice, size(pade_sizereg_extice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaice, size(pade_sizereg_ssaice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyice, size(pade_sizereg_asyice), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy, size(band_lims_cldy), MPI_REAL, mpiroot, mpicomm, ierr) -!#endif -! endif -!#endif + ! Broadcast arrays to all processors +#ifdef MPI + if (cld_optics_scheme .eq. 1) then + if (mpirank==mpiroot) write (*,*) 'Broadcasting RRTMGP shortwave cloud data (LUT) ... ' + call MPI_BARRIER(mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(radliq_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(radliq_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) +#endif + call MPI_BARRIER(mpicomm, ierr) + endif + if (cld_optics_scheme .eq. 2) then + if (mpirank==mpiroot) write (*,*) 'Broadcasting RRTMGP shortwave cloud data (PADE) ... ' + call MPI_BARRIER(mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) +#endif + call MPI_BARRIER(mpicomm, ierr) + endif +#endif ! Load tables data for RRTMGP cloud-optics if (cld_optics_scheme .eq. 1) then @@ -366,10 +374,10 @@ subroutine rrtmgp_lw_cloud_optics_run(doLWrad, nCol, nLev, cld_optics_scheme, nr cld_reliq, & ! Cloud liquid effective radius cld_iwp, & ! Cloud ice water path cld_reice, & ! Cloud ice effective radius - cld_swp, & ! Cloud snow water path (used only fro RRTMG scheme) - cld_resnow, & ! Cloud snow effective radius (used only fro RRTMG scheme) - cld_rwp, & ! Cloud rain water path (used only fro RRTMG scheme) - cld_rerain ! Cloud rain effective radius (used only fro RRTMG scheme) + cld_swp, & ! Cloud snow water path (used only for RRTMG legacy scheme) + cld_resnow, & ! Cloud snow effective radius (used only for RRTMG legacy scheme) + cld_rwp, & ! Cloud rain water path (used only for RRTMG legacy scheme) + cld_rerain ! Cloud rain effective radius (used only for RRTMG legacy scheme) type(ty_cloud_optics),intent(in) :: & lw_cloud_props ! RRTMGP DDT: spectral information for RRTMGP LW radiation scheme type(ty_gas_optics_rrtmgp),intent(in) :: & @@ -381,9 +389,9 @@ subroutine rrtmgp_lw_cloud_optics_run(doLWrad, nCol, nLev, cld_optics_scheme, nr type(ty_optical_props_1scl),intent(out) :: & lw_optical_props_cloudsByBand ! RRTMGP DDT: longwave cloud optical properties in each band integer, intent(out) :: & - errflg ! Error flag + errflg ! CCPP error flag character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message ! Local variables logical,dimension(ncol,nLev) :: liqmask, icemask @@ -396,42 +404,36 @@ subroutine rrtmgp_lw_cloud_optics_run(doLWrad, nCol, nLev, cld_optics_scheme, nr if (.not. doLWrad) return - ! ####################################################################################### ! Compute ice/liquid cloud masks, needed by rrtmgp_cloud_optics - ! ####################################################################################### liqmask = (cld_frac .gt. 0 .and. cld_lwp .gt. 0) icemask = (cld_frac .gt. 0 .and. cld_iwp .gt. 0) - ! ####################################################################################### ! Allocate space for RRTMGP DDTs containing cloud radiative properties - ! ####################################################################################### ! Cloud optics [nCol,nLev,nBands] call check_error_msg('rrtmgp_lw_cloud_optics_run',lw_optical_props_cloudsByBand%alloc_1scl(& ncol, nLev, lw_gas_props%get_band_lims_wavenumber())) - ! ####################################################################################### ! Compute cloud-optics for RTE. - ! ####################################################################################### if (rrtmgp_cld_optics .gt. 0) then ! i) RRTMGP cloud-optics. call check_error_msg('rrtmgp_lw_cloud_optics_run',lw_cloud_props%cloud_optics(& - ncol, & ! IN - Number of horizontal gridpoints - nLev, & ! IN - Number of vertical layers - lw_cloud_props%get_nband(), & ! IN - Number of LW bands - nrghice, & ! IN - Number of ice-roughness categories - liqmask, & ! IN - Liquid-cloud mask - icemask, & ! IN - Ice-cloud mask - cld_lwp, & ! IN - Cloud liquid water path - cld_iwp, & ! IN - Cloud ice water path - cld_reliq, & ! IN - Cloud liquid effective radius - cld_reice, & ! IN - Cloud ice effective radius + ncol, & ! IN - Number of horizontal gridpoints + nLev, & ! IN - Number of vertical layers + lw_cloud_props%get_nband(), & ! IN - Number of LW bands + nrghice, & ! IN - Number of ice-roughness categories + liqmask, & ! IN - Liquid-cloud mask + icemask, & ! IN - Ice-cloud mask + cld_lwp, & ! IN - Cloud liquid water path + cld_iwp, & ! IN - Cloud ice water path + cld_reliq, & ! IN - Cloud liquid effective radius + cld_reice, & ! IN - Cloud ice effective radius lw_optical_props_cloudsByBand)) ! OUT - RRTMGP DDT containing cloud radiative properties - ! in each band + ! in each band else ! ii) RRTMG cloud-optics. if (any(cld_frac .gt. 0)) then call rrtmg_lw_cloud_optics(ncol, nLev, lw_gas_props%get_nband(), cld_lwp, & - cld_reliq, cld_iwp, cld_reice, cld_rwp, cld_rerain, cld_swp, cld_resnow, & + cld_reliq, cld_iwp, cld_reice, cld_rwp, cld_rerain, cld_swp, cld_resnow, & cld_frac, tau_cld) lw_optical_props_cloudsByBand%tau = tau_cld endif diff --git a/physics/rrtmgp_lw_cloud_sampling.F90 b/physics/rrtmgp_lw_cloud_sampling.F90 index 60d13e6f1..6bdf6b4ae 100644 --- a/physics/rrtmgp_lw_cloud_sampling.F90 +++ b/physics/rrtmgp_lw_cloud_sampling.F90 @@ -13,7 +13,20 @@ module rrtmgp_lw_cloud_sampling ! ######################################################################################### ! SUBROUTINE mcica_init ! ######################################################################################### - subroutine rrtmgp_lw_cloud_sampling_init() +!! \section arg_table_rrtmgp_lw_cloud_sampling_init +!! \htmlinclude rrtmgp_lw_cloud_sampling.html +!! + subroutine rrtmgp_lw_cloud_sampling_init(lw_gas_props, ipsdlw0) + ! Inputs + type(ty_gas_optics_rrtmgp),intent(in) :: & + lw_gas_props ! RRTMGP DDT: K-distribution data + ! Outputs + integer, intent(out) :: & + ipsdlw0 ! Initial permutation seed for McICA + + ! Set initial permutation seed for McICA, initially set to number of G-points + ipsdlw0 = lw_gas_props%get_ngpt() + end subroutine rrtmgp_lw_cloud_sampling_init ! ######################################################################################### @@ -46,9 +59,9 @@ subroutine rrtmgp_lw_cloud_sampling_run(doLWrad, nCol, nLev, ipsdlw0, icseed_lw, ! Outputs character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg ! Error code + errflg ! CCPP error code type(ty_optical_props_1scl),intent(out) :: & lw_optical_props_clouds ! RRTMGP DDT: Shortwave optical properties (cloudy atmosphere) diff --git a/physics/rrtmgp_lw_cloud_sampling.meta b/physics/rrtmgp_lw_cloud_sampling.meta index 79d28d929..299a0fd09 100644 --- a/physics/rrtmgp_lw_cloud_sampling.meta +++ b/physics/rrtmgp_lw_cloud_sampling.meta @@ -1,3 +1,24 @@ +[ccpp-arg-table] + name = rrtmgp_lw_cloud_sampling_init + type = scheme +[lw_gas_props] + standard_name = coefficients_for_lw_gas_optics + long_name = DDT containing spectral information for RRTMGP LW radiation scheme + units = DDT + dimensions = () + type = ty_gas_optics_rrtmgp + intent = in + optional = F +[ipsdlw0] + standard_name = initial_permutation_seed_lw + long_name = initial seed for McICA LW + units = none + dimensions = () + type = integer + intent = out + optional = F + +###################################################### [ccpp-arg-table] name = rrtmgp_lw_cloud_sampling_run type = scheme diff --git a/physics/rrtmgp_lw_gas_optics.F90 b/physics/rrtmgp_lw_gas_optics.F90 index 92874edb3..07c6d6231 100644 --- a/physics/rrtmgp_lw_gas_optics.F90 +++ b/physics/rrtmgp_lw_gas_optics.F90 @@ -18,7 +18,7 @@ module rrtmgp_lw_gas_optics !! \htmlinclude rrtmgp_lw_gas_optics.html !! subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp_nGases, & - active_gases_array, mpicomm, mpirank, mpiroot, lw_gas_props, ipsdlw0, errmsg, errflg) + active_gases_array, mpicomm, mpirank, mpiroot, lw_gas_props, errmsg, errflg) use netcdf #ifdef MPI @@ -40,12 +40,11 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp ! Outputs character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg, & ! Error code - ipsdlw0 ! + errflg ! CCPP error code type(ty_gas_optics_rrtmgp),intent(out) :: & - lw_gas_props ! RRTMGP DDT: + lw_gas_props ! RRTMGP DDT: longwave spectral information ! Variables that will be passed to gas_optics%load() type(ty_gas_concs) :: & @@ -67,7 +66,7 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp temp_ref_t ! Standard spectroscopic reference temperature [K] real(kind_phys), dimension(:), allocatable :: & press_ref, & ! Pressures for reference atmosphere; press_ref(# reference layers) [Pa] - temp_ref ! Remperatures for reference atmosphere; temp_ref(# reference layers) [K] + temp_ref ! Temperatures for reference atmosphere; temp_ref(# reference layers) [K] real(kind_phys), dimension(:,:), allocatable :: & band_lims, & ! Beginning and ending wavenumber [cm -1] for each band totplnk ! Integrated Planck function by band @@ -85,9 +84,9 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp character(len=32), dimension(:), allocatable :: & gas_names, & ! Names of absorbing gases gas_minor, & ! Name of absorbing minor gas - identifier_minor, & ! unique string identifying minor gas - minor_gases_lower, & ! names of minor absorbing gases in lower atmosphere - minor_gases_upper, & ! names of minor absorbing gases in upper atmosphere + identifier_minor, & ! Unique string identifying minor gas + minor_gases_lower, & ! Names of minor absorbing gases in lower atmosphere + minor_gases_upper, & ! Names of minor absorbing gases in upper atmosphere scaling_gas_lower, & ! Absorption also depends on the concentration of this gas scaling_gas_upper ! Absorption also depends on the concentration of this gas logical(wl), dimension(:), allocatable :: & @@ -98,27 +97,16 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp ! Dimensions integer :: & - ntemps, & ! - npress, & ! - ngpts_lw, & ! - nabsorbers, & ! - nextrabsorbers, & ! - nminorabsorbers, & ! - nmixingfracs, & ! - nlayers, & ! - nbnds, & ! - npairs, & ! - ninternalSourcetemps, & ! - nminor_absorber_intervals_lower, & ! - nminor_absorber_intervals_upper, & ! - ncontributors_lower, & ! - ncontributors_upper ! + ntemps, npress, ngpts_lw, nabsorbers, nextrabsorbers, nminorabsorbers,& + nmixingfracs, nlayers, nbnds, npairs, ninternalSourcetemps, & + nminor_absorber_intervals_lower, nminor_absorber_intervals_upper, & + ncontributors_lower, ncontributors_upper ! Local variables - integer :: ncid_lw,dimID,varID,status,iGas - integer,dimension(:),allocatable :: temp1,temp2,temp3,temp4, temp_log_array1, temp_log_array2, temp_log_array3, temp_log_array4 + integer :: ncid_lw, dimID, varID, status, iGas + integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4, & + temp_log_array1, temp_log_array2, temp_log_array3, temp_log_array4 character(len=264) :: lw_gas_props_file - integer,parameter :: max_strlen=256 #ifdef MPI integer :: ierr #endif @@ -402,9 +390,6 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp scaling_gas_upper, scale_by_complement_lower, scale_by_complement_upper, & kminor_start_lower, kminor_start_upper, totplnk, planck_frac, rayl_lower, rayl_upper)) - ! Set initial permutation seed for McICA, initially set to number of G-points - ipsdlw0 = lw_gas_props%get_ngpt() - end subroutine rrtmgp_lw_gas_optics_init ! ######################################################################################### @@ -433,17 +418,17 @@ subroutine rrtmgp_lw_gas_optics_run(doLWrad, nCol, nLev, lw_gas_props, p_lay, p_ real(kind_phys), dimension(ncol), intent(in) :: & skt ! Surface(skin) temperature (K) type(ty_gas_concs),intent(in) :: & - gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr) + gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr) ! Output character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg ! Error code + errflg ! CCPP error code type(ty_optical_props_1scl),intent(out) :: & - lw_optical_props_clrsky ! RRTMGP DDT: + lw_optical_props_clrsky ! RRTMGP DDT: longwave clear-sky radiative properties type(ty_source_func_lw),intent(out) :: & - sources ! RRTMGP DDT: + sources ! RRTMGP DDT: longwave source functions ! Initialize CCPP error handling variables errmsg = '' diff --git a/physics/rrtmgp_lw_gas_optics.meta b/physics/rrtmgp_lw_gas_optics.meta index b6d2c3934..cacda8c1c 100644 --- a/physics/rrtmgp_lw_gas_optics.meta +++ b/physics/rrtmgp_lw_gas_optics.meta @@ -77,14 +77,6 @@ type = integer intent = out optional = F -[ipsdlw0] - standard_name = initial_permutation_seed_lw - long_name = initial seed for McICA LW - units = none - dimensions = () - type = integer - intent = out - optional = F [lw_gas_props] standard_name = coefficients_for_lw_gas_optics long_name = DDT containing spectral information for RRTMGP LW radiation scheme diff --git a/physics/rrtmgp_lw_rte.F90 b/physics/rrtmgp_lw_rte.F90 index 1728a6baf..9a300df4f 100644 --- a/physics/rrtmgp_lw_rte.F90 +++ b/physics/rrtmgp_lw_rte.F90 @@ -45,11 +45,11 @@ subroutine rrtmgp_lw_rte_run(doLWrad, nCol, nLev, p_lay, t_lay, p_lev, skt, lw_g real(kind_phys), dimension(ncol), intent(in) :: & skt ! Surface(skin) temperature (K) type(ty_gas_optics_rrtmgp),intent(in) :: & - lw_gas_props ! DDT containing LW spectral information + lw_gas_props ! RRTMGP DDT: longwave spectral information real(kind_phys), dimension(lw_gas_props%get_nband(),ncol), intent(in) :: & sfc_emiss_byband ! Surface emissivity in each band type(ty_source_func_lw),intent(in) :: & - sources + sources ! RRTMGP DDT: longwave source functions type(ty_optical_props_1scl),intent(inout) :: & lw_optical_props_clrsky ! RRTMGP DDT: longwave clear-sky radiative properties type(ty_optical_props_1scl),intent(in) :: & diff --git a/physics/rrtmgp_sw_aerosol_optics.F90 b/physics/rrtmgp_sw_aerosol_optics.F90 index 566ecba68..d6413c368 100644 --- a/physics/rrtmgp_sw_aerosol_optics.F90 +++ b/physics/rrtmgp_sw_aerosol_optics.F90 @@ -63,9 +63,9 @@ subroutine rrtmgp_sw_aerosol_optics_run(doSWrad, nCol, nLev, nTracer, nDay, idxd type(ty_optical_props_2str),intent(out) :: & sw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau) integer, intent(out) :: & - errflg ! + errflg ! CCPP error flag character(len=*), intent(out) :: & - errmsg ! + errmsg ! CCPP error message ! Local variables real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), NF_AELW) :: & diff --git a/physics/rrtmgp_sw_cloud_optics.F90 b/physics/rrtmgp_sw_cloud_optics.F90 index e994dd558..377425a48 100644 --- a/physics/rrtmgp_sw_cloud_optics.F90 +++ b/physics/rrtmgp_sw_cloud_optics.F90 @@ -37,63 +37,63 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d ! Outputs type(ty_cloud_optics),intent(out) :: & - sw_cloud_props ! DDT containing spectral information for RRTMGP SW radiation scheme + sw_cloud_props ! RRTMGP DDT: shortwave spectral information character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg ! Error code + errflg ! CCPP error code ! Variables that will be passed to cloud_optics%load() + ! cld_optics_scheme = 1 real(kind_phys) :: & - radliq_lwr_sw, & ! - radliq_upr_sw, & ! - radliq_fac_sw, & ! - radice_lwr_sw, & ! - radice_upr_sw, & ! - radice_fac_sw ! - - real(kind_phys), dimension(:), allocatable :: & - pade_sizereg_extliq_sw, & ! - pade_sizereg_ssaliq_sw, & ! - pade_sizereg_asyliq_sw, & ! - pade_sizereg_extice_sw, & ! - pade_sizereg_ssaice_sw, & ! - pade_sizereg_asyice_sw ! + radliq_lwr_sw, & ! Liquid particle size lower bound for LUT interpolation + radliq_upr_sw, & ! Liquid particle size upper bound for LUT interpolation + radliq_fac_sw, & ! Factor for calculating LUT interpolation indices for liquid + radice_lwr_sw, & ! Ice particle size upper bound for LUT interpolation + radice_upr_sw, & ! Ice particle size lower bound for LUT interpolation + radice_fac_sw ! Factor for calculating LUT interpolation indices for ice real(kind_phys), dimension(:,:), allocatable :: & - lut_extliq_sw, & ! - lut_ssaliq_sw, & ! - lut_asyliq_sw, & ! - band_lims_cldy_sw ! - + lut_extliq_sw, & ! LUT shortwave liquid extinction coefficient + lut_ssaliq_sw, & ! LUT shortwave liquid single scattering albedo + lut_asyliq_sw, & ! LUT shortwave liquid asymmetry parameter + band_lims_cldy_sw ! Beginning and ending wavenumber [cm -1] for each band real(kind_phys), dimension(:,:,:), allocatable :: & - lut_extice_sw, & ! - lut_ssaice_sw, & ! - lut_asyice_sw, & ! - pade_extliq_sw, & ! - pade_ssaliq_sw, & ! - pade_asyliq_sw ! + lut_extice_sw, & ! LUT shortwave ice extinction coefficient + lut_ssaice_sw, & ! LUT shortwave ice single scattering albedo + lut_asyice_sw ! LUT shortwave ice asymmetry parameter + ! cld_optics_scheme = 2 + real(kind_phys), dimension(:), allocatable :: & + pade_sizereg_extliq_sw, & ! Particle size regime boundaries for shortwave liquid extinction + ! coefficient for Pade interpolation + pade_sizereg_ssaliq_sw, & ! Particle size regime boundaries for shortwave liquid single + ! scattering albedo for Pade interpolation + pade_sizereg_asyliq_sw, & ! Particle size regime boundaries for shortwave liquid asymmetry + ! parameter for Pade interpolation + pade_sizereg_extice_sw, & ! Particle size regime boundaries for shortwave ice extinction + ! coefficient for Pade interpolation + pade_sizereg_ssaice_sw, & ! Particle size regime boundaries for shortwave ice single + ! scattering albedo for Pade interpolation + pade_sizereg_asyice_sw ! Particle size regime boundaries for shortwave ice asymmetry + ! parameter for Pade interpolation + real(kind_phys), dimension(:,:,:), allocatable :: & + pade_extliq_sw, & ! PADE coefficients for shortwave liquid extinction + pade_ssaliq_sw, & ! PADE coefficients for shortwave liquid single scattering albedo + pade_asyliq_sw ! PADE coefficients for shortwave liquid asymmetry parameter real(kind_phys), dimension(:,:,:,:), allocatable :: & - pade_extice_sw, & ! - pade_ssaice_sw, & ! - pade_asyice_sw ! - ! Dimensions (to be broadcast across all processors) + pade_extice_sw, & ! PADE coefficients for shortwave ice extinction + pade_ssaice_sw, & ! PADE coefficients for shortwave ice single scattering albedo + pade_asyice_sw ! PADE coefficients for shortwave ice asymmetry parameter + ! Dimensions integer :: & - nrghice_sw, & ! Number of ice-roughness categories in file - nbandSWcldy_sw, & ! - nsize_liq_sw, & ! - nsize_ice_sw, & ! - nsizereg_sw, & ! - ncoeff_ext_sw, & ! - ncoeff_ssa_g_sw, & ! - nbound_sw, & ! - npairsSWcldy_sw ! + nrghice_sw, nbandSWcldy_sw, nsize_liq_sw, nsize_ice_sw, nsizereg_sw,& + ncoeff_ext_sw, ncoeff_ssa_g_sw, nbound_sw, npairsSWcldy_sw ! Local variables integer :: status,ncid_sw_clds,dimid,varID character(len=264) :: sw_cloud_props_file -!#ifdef MPI -! integer :: ierr -!#endif +#ifdef MPI + integer :: ierr +#endif ! Initialize errmsg = '' errflg = 0 @@ -104,7 +104,7 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d sw_cloud_props_file = trim(rrtmgp_root_dir)//trim(rrtmgp_sw_file_clouds) ! Read dimensions for k-distribution fields (only on master processor(0)) -! if (mpirank .eq. mpiroot) then + if (mpirank .eq. mpiroot) then if(nf90_open(trim(sw_cloud_props_file), NF90_WRITE, ncid_sw_clds) == NF90_NOERR) then status = nf90_inq_dimid(ncid_sw_clds, 'nband', dimid) status = nf90_inquire_dimension(ncid_sw_clds, dimid, len=nbandSWcldy_sw) @@ -123,30 +123,35 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d status = nf90_inq_dimid(ncid_sw_clds, 'nbound', dimid) status = nf90_inquire_dimension(ncid_sw_clds, dimid, len=nbound_sw) status = nf90_inq_dimid(ncid_sw_clds, 'pair', dimid) - status = nf90_inquire_dimension(ncid_sw_clds, dimid, len=npairsSWcldy_sw) - status = nf90_close(ncid_sw_clds) + endif ! Check to ensure that number of ice-roughness categories is feasible. if (nrghice .gt. nrghice_sw) then errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' endif -! endif + endif -! ! Broadcast dimensions to all processors -!#ifdef MPI -! if (cld_optics_scheme .eq. 1 .or. cld_optics_scheme .eq. 2) then -! call MPI_BCAST(nbandSWcldy_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nrghice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsize_liq_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsize_ice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nsizereg_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(ncoeff_ext_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(ncoeff_ssa_g_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(nbound_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! call MPI_BCAST(npairsSWcldy_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) -! endif -!#endif + ! Broadcast dimensions to all processors +#ifdef MPI + call MPI_BCAST(nbandSWcldy_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + if (cld_optics_scheme .eq. 1) then + call MPI_BARRIER(mpicomm, ierr) + call MPI_BCAST(nrghice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsize_liq_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsize_ice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BARRIER(mpicomm, ierr) + endif + if (cld_optics_scheme .eq. 2) then + call MPI_BARRIER(mpicomm, ierr) + call MPI_BCAST(nrghice_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nsizereg_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(ncoeff_ext_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(ncoeff_ssa_g_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(nbound_sw, 1, MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BARRIER(mpicomm, ierr) + endif +#endif if (cld_optics_scheme .eq. 1) then allocate(lut_extliq_sw(nsize_liq_sw, nBandSWcldy_sw)) @@ -155,7 +160,6 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d allocate(lut_extice_sw(nsize_ice_sw, nBandSWcldy_sw, nrghice_sw)) allocate(lut_ssaice_sw(nsize_ice_sw, nBandSWcldy_sw, nrghice_sw)) allocate(lut_asyice_sw(nsize_ice_sw, nBandSWcldy_sw, nrghice_sw)) - allocate(band_lims_cldy_sw(2, nBandSWcldy_sw)) endif if (cld_optics_scheme .eq. 2) then allocate(pade_extliq_sw(nbandSWcldy_sw, nsizereg_sw, ncoeff_ext_sw )) @@ -170,15 +174,13 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d allocate(pade_sizereg_extice_sw(nbound_sw)) allocate(pade_sizereg_ssaice_sw(nbound_sw)) allocate(pade_sizereg_asyice_sw(nbound_sw)) - allocate(band_lims_cldy_sw(2,nbandSWcldy_sw)) endif + allocate(band_lims_cldy_sw(2,nbandSWcldy_sw)) ! On master processor, allocate space, read in fields, broadcast to all processors -! if (mpirank .eq. mpiroot) then - ! + if (mpirank .eq. mpiroot) then if (cld_optics_scheme .eq. 1) then write (*,*) 'Reading RRTMGP shortwave cloud data (LUT) ... ' - ! if(nf90_open(trim(sw_cloud_props_file), NF90_WRITE, ncid_sw_clds) == NF90_NOERR) then status = nf90_inq_varid(ncid_sw_clds,'radliq_lwr',varID) status = nf90_get_var(ncid_sw_clds,varID,radliq_lwr_sw) @@ -212,7 +214,6 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d ! if (cld_optics_scheme .eq. 2) then write (*,*) 'Reading RRTMGP shortwave cloud data (PADE) ... ' - ! if(nf90_open(trim(sw_cloud_props_file), NF90_WRITE, ncid_sw_clds) == NF90_NOERR) then status = nf90_inq_varid(ncid_sw_clds,'radliq_lwr',varID) status = nf90_get_var(ncid_sw_clds,varID,radliq_lwr_sw) @@ -255,75 +256,79 @@ subroutine rrtmgp_sw_cloud_optics_init(cld_optics_scheme, nrghice, rrtmgp_root_d status = nf90_close(ncid_sw_clds) endif endif - !endif + endif ! Broadcast arrays to all processors -!#ifdef MPI -! if (cld_optics_scheme .eq. 1) then -! write (*,*) 'Broadcasting RRTMGP shortwave cloud data (LUT) ... ' -!#ifndef SINGLE_PREC -! call MPI_BCAST(radliq_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -!#else -! call MPI_BCAST(radliq_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radliq_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(radice_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) -!#endif -! endif -! if (cld_optics_scheme .eq. 2) then -! write (*,*) 'Broadcasting RRTMGP shortwave cloud data (PADE) ... ' -!#ifndef SINGLE_PREC -! call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) -!#else -! call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) -! call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) -!#endif -! endif -!#endif +#ifdef MPI + if (cld_optics_scheme .eq. 1) then + if (mpirank==mpiroot) write (*,*) 'Broadcasting RRTMGP shortwave cloud data (LUT) ... ' + call MPI_BARRIER(mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(radliq_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_lwr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_upr_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_fac_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(radliq_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radliq_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_lwr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_upr_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(radice_fac_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) +#endif + call MPI_BARRIER(mpicomm, ierr) + endif + if (cld_optics_scheme .eq. 2) then + if (mpirank==mpiroot) write (*,*) 'Broadcasting RRTMGP shortwave cloud data (PADE) ... ' + call MPI_BARRIER(mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), MPI_REAL, mpiroot, mpicomm, ierr) +#endif + call MPI_BARRIER(mpicomm, ierr) + endif +#endif ! Load tables data for RRTMGP cloud-optics if (cld_optics_scheme .eq. 1) then @@ -376,15 +381,15 @@ subroutine rrtmgp_sw_cloud_optics_run(doSWrad, nCol, nLev, nDay, idxday, nrghice cld_rwp, & ! Cloud rain water path cld_rerain ! Cloud rain effective radius type(ty_cloud_optics),intent(in) :: & - sw_cloud_props ! RRTMGP DDT: + sw_cloud_props ! RRTMGP DDT: shortwave cloud properties type(ty_gas_optics_rrtmgp),intent(in) :: & - sw_gas_props ! RRTMGP DDT: K-distribution data + sw_gas_props ! RRTMGP DDT: shortwave K-distribution data ! Outputs character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg ! Error code + errflg ! CCPP error code type(ty_optical_props_2str),intent(out) :: & sw_optical_props_cloudsByBand ! RRTMGP DDT: Shortwave optical properties (cloudy atmosphere) real(kind_phys), dimension(ncol,NLev), intent(out) :: & @@ -402,22 +407,16 @@ subroutine rrtmgp_sw_cloud_optics_run(doSWrad, nCol, nLev, nDay, idxday, nrghice if (.not. doSWrad) return if (nDay .gt. 0) then - ! ####################################################################################### ! Compute ice/liquid cloud masks, needed by rrtmgp_cloud_optics - ! ####################################################################################### liqmask = (cld_frac(idxday(1:nday),:) .gt. 0 .and. cld_lwp(idxday(1:nday),:) .gt. 0) icemask = (cld_frac(idxday(1:nday),:) .gt. 0 .and. cld_iwp(idxday(1:nday),:) .gt. 0) - ! ####################################################################################### ! Allocate space for RRTMGP DDTs containing cloud radiative properties - ! ####################################################################################### ! Cloud optics [nday,nLev,nBands] call check_error_msg('rrtmgp_sw_cloud_optics_run',sw_optical_props_cloudsByBand%alloc_2str(& nday, nLev, sw_gas_props%get_band_lims_wavenumber())) - ! ####################################################################################### ! Compute cloud-optics for RTE. - ! ####################################################################################### if (cld_optics_scheme .gt. 0) then ! RRTMGP cloud-optics. call check_error_msg('rrtmgp_sw_cloud_optics_run',sw_cloud_props%cloud_optics(& diff --git a/physics/rrtmgp_sw_cloud_sampling.F90 b/physics/rrtmgp_sw_cloud_sampling.F90 index 504e5f733..b290594ea 100644 --- a/physics/rrtmgp_sw_cloud_sampling.F90 +++ b/physics/rrtmgp_sw_cloud_sampling.F90 @@ -13,7 +13,20 @@ module rrtmgp_sw_cloud_sampling ! ######################################################################################### ! SUBROUTINE mcica_init ! ######################################################################################### - subroutine rrtmgp_sw_cloud_sampling_init() +!! \section arg_table_rrtmgp_sw_cloud_sampling_init +!! \htmlinclude rrtmgp_sw_cloud_sampling.html +!! + subroutine rrtmgp_sw_cloud_sampling_init(sw_gas_props, ipsdsw0) + ! Inputs + type(ty_gas_optics_rrtmgp),intent(in) :: & + sw_gas_props ! RRTMGP DDT: K-distribution data + ! Outputs + integer, intent(out) :: & + ipsdsw0 ! Initial permutation seed for McICA + + ! Set initial permutation seed for McICA, initially set to number of G-points + ipsdsw0 = sw_gas_props%get_ngpt() + end subroutine rrtmgp_sw_cloud_sampling_init ! ######################################################################################### diff --git a/physics/rrtmgp_sw_cloud_sampling.meta b/physics/rrtmgp_sw_cloud_sampling.meta index 1ffe9ba84..1243743a9 100644 --- a/physics/rrtmgp_sw_cloud_sampling.meta +++ b/physics/rrtmgp_sw_cloud_sampling.meta @@ -1,3 +1,24 @@ +[ccpp-arg-table] + name = rrtmgp_sw_cloud_sampling_init + type = scheme +[sw_gas_props] + standard_name = coefficients_for_sw_gas_optics + long_name = DDT containing spectral information for RRTMGP SW radiation scheme + units = DDT + dimensions = () + type = ty_gas_optics_rrtmgp + intent = in + optional = F +[ipsdsw0] + standard_name = initial_permutation_seed_sw + long_name = initial seed for McICA SW + units = none + dimensions = () + type = integer + intent = out + optional = F + +###################################################### [ccpp-arg-table] name = rrtmgp_sw_cloud_sampling_run type = scheme diff --git a/physics/rrtmgp_sw_gas_optics.F90 b/physics/rrtmgp_sw_gas_optics.F90 index 44aebde7d..c8f43d139 100644 --- a/physics/rrtmgp_sw_gas_optics.F90 +++ b/physics/rrtmgp_sw_gas_optics.F90 @@ -18,7 +18,7 @@ module rrtmgp_sw_gas_optics !! \htmlinclude rrtmgp_sw_gas_optics.html !! subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, rrtmgp_nGases, & - active_gases_array, mpicomm, mpirank, mpiroot, sw_gas_props, ipsdsw0, errmsg, errflg) + active_gases_array, mpicomm, mpirank, mpiroot, sw_gas_props, errmsg, errflg) use netcdf #ifdef MPI use mpi @@ -39,78 +39,70 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, rrtmgp ! Outputs character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg, & ! Error code - ipsdsw0 ! + errflg ! CCPP error code type(ty_gas_optics_rrtmgp),intent(out) :: & - sw_gas_props ! RRTMGP DDT: + sw_gas_props ! RRTMGP DDT: shortwave spectral information - ! Fields from the K-distribution files ! Variables that will be passed to gas_optics%load() type(ty_gas_concs) :: & gas_concentrations integer, dimension(:), allocatable :: & - kminor_start_lower_sw, & ! - kminor_start_upper_sw ! + kminor_start_lower_sw, & ! Starting index in the [1, nContributors] vector for a contributor + ! given by \"minor_gases_lower\" (lower atmosphere) + kminor_start_upper_sw ! Starting index in the [1, nContributors] vector for a contributor + ! given by \"minor_gases_upper\" (upper atmosphere) integer, dimension(:,:), allocatable :: & - band2gpt_sw, & ! - minor_limits_gpt_lower_sw, & ! - minor_limits_gpt_upper_sw ! + band2gpt_sw, & ! Beginning and ending gpoint for each band + minor_limits_gpt_lower_sw, & ! Beginning and ending gpoint for each minor interval in lower atmosphere + minor_limits_gpt_upper_sw ! Beginning and ending gpoint for each minor interval in upper atmosphere integer, dimension(:,:,:), allocatable :: & - key_species_sw ! + key_species_sw ! Key species pair for each band real(kind_phys) :: & - press_ref_trop_sw, & ! - temp_ref_p_sw, & ! - temp_ref_t_sw ! + press_ref_trop_sw, & ! Reference pressure separating the lower and upper atmosphere [Pa] + temp_ref_p_sw, & ! Standard spectroscopic reference pressure [Pa] + temp_ref_t_sw ! Standard spectroscopic reference temperature [K] real(kind_phys), dimension(:), allocatable :: & - press_ref_sw, & ! - temp_ref_sw, & ! - solar_source_sw ! + press_ref_sw, & ! Pressures for reference atmosphere; press_ref(# reference layers) [Pa] + temp_ref_sw, & ! Temperatures for reference atmosphere; temp_ref(# reference layers) [K] + solar_source_sw ! Stored solar source function from original RRTM real(kind_phys), dimension(:,:), allocatable :: & - band_lims_sw ! + band_lims_sw ! Beginning and ending wavenumber [cm -1] for each band real(kind_phys), dimension(:,:,:), allocatable :: & - vmr_ref_sw, & ! - kminor_lower_sw, & ! - kminor_upper_sw, & ! - rayl_lower_sw, & ! - rayl_upper_sw ! + vmr_ref_sw, & ! Volume mixing ratios for reference atmosphere + kminor_lower_sw, & ! (transformed from [nTemp x nEta x nGpt x nAbsorbers] array to + ! [nTemp x nEta x nContributors] array) + kminor_upper_sw, & ! (transformed from [nTemp x nEta x nGpt x nAbsorbers] array to + ! [nTemp x nEta x nContributors] array) + rayl_lower_sw, & ! Stored coefficients due to rayleigh scattering contribution + rayl_upper_sw ! Stored coefficients due to rayleigh scattering contribution real(kind_phys), dimension(:,:,:,:), allocatable :: & - kmajor_sw ! + kmajor_sw ! Stored absorption coefficients due to major absorbing gases character(len=32), dimension(:), allocatable :: & - gas_names_sw, & ! - gas_minor_sw, & ! - identifier_minor_sw, & ! - minor_gases_lower_sw, & ! - minor_gases_upper_sw, & ! - scaling_gas_lower_sw, & ! - scaling_gas_upper_sw ! + gas_names_sw, & ! Names of absorbing gases + gas_minor_sw, & ! Name of absorbing minor gas + identifier_minor_sw, & ! Unique string identifying minor gas + minor_gases_lower_sw, & ! Names of minor absorbing gases in lower atmosphere + minor_gases_upper_sw, & ! Names of minor absorbing gases in upper atmosphere + scaling_gas_lower_sw, & ! Absorption also depends on the concentration of this gas + scaling_gas_upper_sw ! Absorption also depends on the concentration of this gas logical(wl), dimension(:), allocatable :: & - minor_scales_with_density_lower_sw, & ! - minor_scales_with_density_upper_sw, & ! - scale_by_complement_lower_sw, & ! - scale_by_complement_upper_sw ! - ! Dimensions (to be broadcast across all processors) + minor_scales_with_density_lower_sw, & ! Density scaling is applied to minor absorption coefficients + minor_scales_with_density_upper_sw, & ! Density scaling is applied to minor absorption coefficients + scale_by_complement_lower_sw, & ! Absorption is scaled by concentration of scaling_gas (F) or its complement (T) + scale_by_complement_upper_sw ! Absorption is scaled by concentration of scaling_gas (F) or its complement (T) + ! Dimensions integer :: & - ntemps_sw, & ! - npress_sw, & ! - ngpts_sw, & ! - nabsorbers_sw, & ! - nextrabsorbers_sw, & ! - nminorabsorbers_sw, & ! - nmixingfracs_sw, & ! - nlayers_sw, & ! - nbnds_sw, & ! - npairs_sw, & ! - nminor_absorber_intervals_lower_sw, & ! - nminor_absorber_intervals_upper_sw, & ! - ncontributors_lower_sw, & ! - ncontributors_upper_sw ! + ntemps_sw, npress_sw, ngpts_sw, nabsorbers_sw, nextrabsorbers_sw, & + nminorabsorbers_sw, nmixingfracs_sw, nlayers_sw, nbnds_sw, npairs_sw, & + nminor_absorber_intervals_lower_sw, nminor_absorber_intervals_upper_sw, & + ncontributors_lower_sw, ncontributors_upper_sw ! Local variables - integer :: status,ncid_sw,dimid,varID,iGas - integer,dimension(:),allocatable :: temp1,temp2,temp3,temp4 + integer :: status, ncid_sw, dimid, varID, iGas + integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4 character(len=264) :: sw_gas_props_file #ifdef MPI integer :: ierr @@ -400,9 +392,6 @@ subroutine rrtmgp_sw_gas_optics_init(rrtmgp_root_dir, rrtmgp_sw_file_gas, rrtmgp scale_by_complement_upper_sw, kminor_start_lower_sw, kminor_start_upper_sw, & solar_source_sw, rayl_lower_sw, rayl_upper_sw)) - ! Set initial permutation seed for McICA, initially set to number of G-points - ipsdsw0 = sw_gas_props%get_ngpt() - end subroutine rrtmgp_sw_gas_optics_init ! ######################################################################################### @@ -417,7 +406,7 @@ subroutine rrtmgp_sw_gas_optics_run(doSWrad, nCol, nLev, nday, idxday, sw_gas_pr ! Inputs logical, intent(in) :: & - doSWrad ! Flag to calculate SW irradiances + doSWrad ! Flag to calculate SW irradiances integer,intent(in) :: & nDay, & ! Number of daylit points. nCol, & ! Number of horizontal points @@ -427,25 +416,25 @@ subroutine rrtmgp_sw_gas_optics_run(doSWrad, nCol, nLev, nday, idxday, sw_gas_pr type(ty_gas_optics_rrtmgp),intent(in) :: & sw_gas_props ! RRTMGP DDT: spectral information for RRTMGP SW radiation scheme real(kind_phys), dimension(ncol,nLev), intent(in) :: & - p_lay, & ! Pressure @ model layer-centers (hPa) - t_lay ! Temperature (K) + p_lay, & ! Pressure @ model layer-centers (hPa) + t_lay ! Temperature (K) real(kind_phys), dimension(ncol,nLev+1), intent(in) :: & - p_lev, & ! Pressure @ model layer-interfaces (hPa) + p_lev, & ! Pressure @ model layer-interfaces (hPa) t_lev ! Temperature @ model levels type(ty_gas_concs),intent(in) :: & - gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr) + gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr) real(kind_phys), intent(in) :: & solcon ! Solar constant integer, intent(in) :: & - rrtmgp_nGases ! Number of trace gases active in RRTMGP + rrtmgp_nGases ! Number of trace gases active in RRTMGP character(len=128),dimension(rrtmgp_nGases), intent(in) :: & - active_gases_array ! Character array containing trace gases to include in RRTMGP + active_gases_array ! Character array containing trace gases to include in RRTMGP ! Output character(len=*), intent(out) :: & - errmsg ! Error message + errmsg ! CCPP error message integer, intent(out) :: & - errflg ! Error code + errflg ! CCPP error code type(ty_optical_props_2str),intent(out) :: & sw_optical_props_clrsky ! RRTMGP DDT: clear-sky shortwave optical properties, spectral (tau,ssa,g) real(kind_phys), dimension(ncol,sw_gas_props%get_ngpt()), intent(out) :: & diff --git a/physics/rrtmgp_sw_gas_optics.meta b/physics/rrtmgp_sw_gas_optics.meta index 6a2b87a9a..bdcfd8cbb 100644 --- a/physics/rrtmgp_sw_gas_optics.meta +++ b/physics/rrtmgp_sw_gas_optics.meta @@ -77,14 +77,6 @@ type = integer intent = out optional = F -[ipsdsw0] - standard_name = initial_permutation_seed_sw - long_name = initial seed for McICA SW - units = none - dimensions = () - type = integer - intent = out - optional = F [sw_gas_props] standard_name = coefficients_for_sw_gas_optics long_name = DDT containing spectral information for RRTMGP SW radiation scheme