From f35effe345487621f30aeaa9d8f56c09d9344c13 Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Fri, 25 Oct 2019 22:06:21 +0000 Subject: [PATCH] Some more changes in MPI commands within initialization --- physics/rrtmgp_lw_cloud_optics.F90 | 92 ++++++++++++++++-------- physics/rrtmgp_lw_gas_optics.F90 | 105 ++++++++++++++++----------- physics/rrtmgp_sw_cloud_optics.F90 | 94 ++++++++++++++++-------- physics/rrtmgp_sw_gas_optics.F90 | 110 +++++++++++++++++------------ 4 files changed, 254 insertions(+), 147 deletions(-) diff --git a/physics/rrtmgp_lw_cloud_optics.F90 b/physics/rrtmgp_lw_cloud_optics.F90 index 164c2cc0a..b3d36b070 100644 --- a/physics/rrtmgp_lw_cloud_optics.F90 +++ b/physics/rrtmgp_lw_cloud_optics.F90 @@ -126,11 +126,11 @@ subroutine rrtmgp_lw_cloud_optics_init(Model, mpicomm, mpirank, mpiroot, lw_clou status = nf90_inquire_dimension(ncid_lw_clds, dimid, len=npairsLWcldy) status = nf90_close(ncid_lw_clds) endif - endif - ! Check to ensure that number of ice-roughness categories is feasible. - if (Model%rrtmgp_nrghice .gt. nrghice_lw) then - errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' + ! Check to ensure that number of ice-roughness categories is feasible. + if (Model%rrtmgp_nrghice .gt. nrghice_lw) then + errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' + endif endif ! Broadcast dimensions to all processors @@ -258,34 +258,66 @@ subroutine rrtmgp_lw_cloud_optics_init(Model, mpicomm, mpirank, mpiroot, lw_clou ! Broadcast arrays to all processors #ifdef MPI if (Model%rrtmgp_cld_optics .eq. 1) then - call MPI_BCAST(radliq_lwr, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radliq_upr, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radliq_fac, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_lwr, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_upr, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_fac, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_extliq, size(lut_extliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_ssaliq, size(lut_ssaliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_asyliq, size(lut_asyliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_extice, size(lut_extice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_ssaice, size(lut_ssaice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_asyice, size(lut_asyice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims_cldy , size(band_lims_cldy), kind_phys, mpiroot, mpicomm, ierr) +#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 (Model%rrtmgp_cld_optics .eq. 2) then - call MPI_BCAST(pade_extliq, size(pade_extliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_ssaliq, size(pade_ssaliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_asyliq, size(pade_asyliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_extice, size(pade_extice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_ssaice, size(pade_ssaice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_asyice, size(pade_asyice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_extliq, size(pade_sizereg_extliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_ssaliq, size(pade_sizereg_ssaliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_asyliq, size(pade_sizereg_asyliq), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_extice, size(pade_sizereg_extice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_ssaice, size(pade_sizereg_ssaice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_asyice, size(pade_sizereg_asyice), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims_cldy, size(band_lims_cldy), kind_phys, mpiroot, mpicomm, ierr) +#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 diff --git a/physics/rrtmgp_lw_gas_optics.F90 b/physics/rrtmgp_lw_gas_optics.F90 index 03c168fe6..773bdeda4 100644 --- a/physics/rrtmgp_lw_gas_optics.F90 +++ b/physics/rrtmgp_lw_gas_optics.F90 @@ -325,20 +325,37 @@ subroutine rrtmgp_lw_gas_optics_init(Model, Radtend, mpicomm, mpirank, mpiroot, call MPI_BCAST(kminor_start_lower, size(kminor_start_lower), MPI_INTEGER, mpiroot, mpicomm, ierr) call MPI_BCAST(key_species, size(key_species), MPI_INTEGER, mpiroot, mpicomm, ierr) call MPI_BCAST(band2gpt, size(band2gpt), MPI_INTEGER, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims, size(band_lims), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(press_ref, size(press_ref), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref, size(temp_ref), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kminor_lower, size(kminor_lower), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kminor_upper, size(kminor_upper), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(scaling_gas_lower, size(scaling_gas_lower), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(scaling_gas_upper, size(scaling_gas_upper), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(vmr_ref, size(vmr_ref), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kmajor, size(kmajor), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref_p, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref_t, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(press_ref_trop, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(totplnk, size(totplnk), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(planck_frac, size(planck_frac), kind_phys, mpiroot, mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(band_lims, size(band_lims), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref, size(press_ref), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref, size(temp_ref), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_lower, size(kminor_lower), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_upper, size(kminor_upper), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_lower, size(scaling_gas_lower), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_upper, size(scaling_gas_upper), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(vmr_ref, size(vmr_ref), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kmajor, size(kmajor), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_p, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_t, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_trop, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(totplnk, size(totplnk), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(planck_frac, size(planck_frac), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(band_lims, size(band_lims), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref, size(press_ref), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref, size(temp_ref), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_lower, size(kminor_lower), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_upper, size(kminor_upper), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_lower, size(scaling_gas_lower), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_upper, size(scaling_gas_upper), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(vmr_ref, size(vmr_ref), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kmajor, size(kmajor), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_p, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_t, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_trop, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(totplnk, size(totplnk), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(planck_frac, size(planck_frac), MPI_REAL, mpiroot, mpicomm, ierr) +#endif ! Character arrays do ij=1,nabsorbers call MPI_BCAST(gas_names(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) @@ -355,37 +372,41 @@ subroutine rrtmgp_lw_gas_optics_init(Model, Radtend, mpicomm, mpirank, mpiroot, enddo ! Logical arrays (First convert to integer-array, then broadcast) ! - allocate(temp_log_array1(nminor_absorber_intervals_lower)) - where(minor_scales_with_density_lower) - temp_log_array1 = 1 - elsewhere - temp_log_array1 = 0 - end where - call MPI_BCAST(temp_log_array1, size(temp_log_array1), MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_scales_with_density_lower, nminor_absorber_intervals_lower, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scale_by_complement_lower, nminor_absorber_intervals_lower, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_scales_with_density_upper, nminor_absorber_intervals_upper, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scale_by_complement_upper, nminor_absorber_intervals_upper, MPI_LOGICAL, mpiroot, mpicomm, ierr) + !allocate(temp_log_array1(nminor_absorber_intervals_lower)) + !where(minor_scales_with_density_lower) + ! temp_log_array1 = 1 + !elsewhere + ! temp_log_array1 = 0 + !end where + !call MPI_BCAST(temp_log_array1, size(temp_log_array1), MPI_INTEGER, mpiroot, mpicomm, ierr) ! - allocate(temp_log_array2(nminor_absorber_intervals_lower)) - where(scale_by_complement_lower) - temp_log_array2 = 1 - elsewhere - temp_log_array2 = 0 - end where - call MPI_BCAST(temp_log_array2, size(temp_log_array2), MPI_INTEGER, mpiroot, mpicomm, ierr) + !allocate(temp_log_array2(nminor_absorber_intervals_lower)) + !where(scale_by_complement_lower) + ! temp_log_array2 = 1 + !elsewhere + ! temp_log_array2 = 0 + !end where + !call MPI_BCAST(temp_log_array2, size(temp_log_array2), MPI_INTEGER, mpiroot, mpicomm, ierr) ! - allocate(temp_log_array3(nminor_absorber_intervals_upper)) - where(minor_scales_with_density_upper) - temp_log_array3 = 1 - elsewhere - temp_log_array3 = 0 - end where - call MPI_BCAST(temp_log_array3, size(temp_log_array3), MPI_INTEGER, mpiroot, mpicomm, ierr) + !allocate(temp_log_array3(nminor_absorber_intervals_upper)) + !where(minor_scales_with_density_upper) + ! temp_log_array3 = 1 + !elsewhere + ! temp_log_array3 = 0 + !end where + !call MPI_BCAST(temp_log_array3, size(temp_log_array3), MPI_INTEGER, mpiroot, mpicomm, ierr) ! - allocate(temp_log_array4(nminor_absorber_intervals_upper)) - where(scale_by_complement_upper) - temp_log_array4 = 1 - elsewhere - temp_log_array4 = 0 - end where - call MPI_BCAST(temp_log_array4, size(temp_log_array4), MPI_INTEGER, mpiroot, mpicomm, ierr) + !allocate(temp_log_array4(nminor_absorber_intervals_upper)) + !where(scale_by_complement_upper) + ! temp_log_array4 = 1 + !elsewhere + ! temp_log_array4 = 0 + !end where + !call MPI_BCAST(temp_log_array4, size(temp_log_array4), MPI_INTEGER, mpiroot, mpicomm, ierr) #endif ! Initialize gas concentrations and gas optics class with data diff --git a/physics/rrtmgp_sw_cloud_optics.F90 b/physics/rrtmgp_sw_cloud_optics.F90 index aeab012a8..3d721ff12 100644 --- a/physics/rrtmgp_sw_cloud_optics.F90 +++ b/physics/rrtmgp_sw_cloud_optics.F90 @@ -124,18 +124,18 @@ subroutine rrtmgp_sw_cloud_optics_init(Model,mpicomm, mpirank, mpiroot, sw_cloud status = nf90_inquire_dimension(ncid_sw_clds, dimid, len=npairsSWcldy_sw) status = nf90_close(ncid_sw_clds) endif - endif - ! Check to ensure that number of ice-roughness categories is feasible. - if (Model%rrtmgp_nrghice .gt. nrghice_sw) then - errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' + ! Check to ensure that number of ice-roughness categories is feasible. + if (Model%rrtmgp_nrghice .gt. nrghice_sw) then + errmsg = 'Number of RRTMGP ice-roughness categories requested in namelist file is not allowed' + endif endif ! Broadcast dimensions to all processors #ifdef MPI if (Model%rrtmgp_cld_optics .eq. 1 .or. Model%rrtmgp_cld_optics .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(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) @@ -256,34 +256,66 @@ subroutine rrtmgp_sw_cloud_optics_init(Model,mpicomm, mpirank, mpiroot, sw_cloud ! Broadcast arrays to all processors #ifdef MPI if (Model%rrtmgp_cld_optics .eq. 1) then - call MPI_BCAST(radliq_lwr_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radliq_upr_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radliq_fac_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_lwr_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_upr_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(radice_fac_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_extliq_sw, size(lut_extliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_ssaliq_sw, size(lut_ssaliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_asyliq_sw, size(lut_asyliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_extice_sw, size(lut_extice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_ssaice_sw, size(lut_ssaice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(lut_asyice_sw, size(lut_asyice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), kind_phys, mpiroot, 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 endif if (Model%rrtmgp_cld_optics .eq. 2) then - call MPI_BCAST(pade_extliq_sw, size(pade_extliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_ssaliq_sw, size(pade_ssaliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_asyliq_sw, size(pade_asyliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_extice_sw, size(pade_extice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_ssaice_sw, size(pade_ssaice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_asyice_sw, size(pade_asyice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_extliq_sw, size(pade_sizereg_extliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_ssaliq_sw, size(pade_sizereg_ssaliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_asyliq_sw, size(pade_sizereg_asyliq_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_extice_sw, size(pade_sizereg_extice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_ssaice_sw, size(pade_sizereg_ssaice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(pade_sizereg_asyice_sw, size(pade_sizereg_asyice_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims_cldy_sw, size(band_lims_cldy_sw), kind_phys, mpiroot, 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 endif #endif diff --git a/physics/rrtmgp_sw_gas_optics.F90 b/physics/rrtmgp_sw_gas_optics.F90 index 3cb1046fc..8e73d42b1 100644 --- a/physics/rrtmgp_sw_gas_optics.F90 +++ b/physics/rrtmgp_sw_gas_optics.F90 @@ -320,21 +320,39 @@ subroutine rrtmgp_sw_gas_optics_init(Model, Radtend, mpicomm, mpirank, mpiroot, call MPI_BCAST(kminor_start_lower_sw, size(kminor_start_lower_sw), MPI_INTEGER, mpiroot, mpicomm, ierr) call MPI_BCAST(key_species_sw, size(key_species_sw), MPI_INTEGER, mpiroot, mpicomm, ierr) call MPI_BCAST(band2gpt_sw, size(band2gpt_sw), MPI_INTEGER, mpiroot, mpicomm, ierr) - call MPI_BCAST(band_lims_sw, size(band_lims_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(press_ref_sw, size(press_ref_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref_sw, size(temp_ref_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kminor_lower_sw, size(kminor_lower_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kminor_upper_sw, size(kminor_upper_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(scaling_gas_lower_sw, size(scaling_gas_lower_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(scaling_gas_upper_sw, size(scaling_gas_upper_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(vmr_ref_sw, size(vmr_ref_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(kmajor_sw, size(kmajor_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref_p_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(temp_ref_t_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(press_ref_trop_sw, 1, kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(solar_source_sw, size(solar_source_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(rayl_lower_sw, size(rayl_lower_sw), kind_phys, mpiroot, mpicomm, ierr) - call MPI_BCAST(rayl_upper_sw, size(rayl_upper_sw), kind_phys, mpiroot, mpicomm, ierr) +#ifndef SINGLE_PREC + call MPI_BCAST(band_lims_sw, size(band_lims_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_sw, size(press_ref_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_sw, size(temp_ref_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_lower_sw, size(kminor_lower_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_upper_sw, size(kminor_upper_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_lower_sw, size(scaling_gas_lower_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_upper_sw, size(scaling_gas_upper_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(vmr_ref_sw, size(vmr_ref_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(kmajor_sw, size(kmajor_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_p_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_t_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_trop_sw, 1, MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(solar_source_sw, size(solar_source_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(rayl_lower_sw, size(rayl_lower_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) + call MPI_BCAST(rayl_upper_sw, size(rayl_upper_sw), MPI_DOUBLE_PRECISION, mpiroot, mpicomm, ierr) +#else + call MPI_BCAST(band_lims_sw, size(band_lims_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_sw, size(press_ref_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_sw, size(temp_ref_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_lower_sw, size(kminor_lower_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kminor_upper_sw, size(kminor_upper_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_lower_sw, size(scaling_gas_lower_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scaling_gas_upper_sw, size(scaling_gas_upper_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(vmr_ref_sw, size(vmr_ref_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(kmajor_sw, size(kmajor_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_p_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(temp_ref_t_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(press_ref_trop_sw, 1, MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(solar_source_sw, size(solar_source_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(rayl_lower_sw, size(rayl_lower_sw), MPI_REAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(rayl_upper_sw, size(rayl_upper_sw), MPI_REAL, mpiroot, mpicomm, ierr) +#endif ! Character arrays do ij=1,nabsorbers_sw call MPI_BCAST(gas_names_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) @@ -351,37 +369,41 @@ subroutine rrtmgp_sw_gas_optics_init(Model, Radtend, mpicomm, mpirank, mpiroot, enddo ! Logical arrays (First convert to integer-array, then broadcast) ! - allocate(temp_log_array1(nminor_absorber_intervals_lower_sw)) - where(minor_scales_with_density_lower_sw) - temp_log_array1 = 1 - elsewhere - temp_log_array1 = 0 - end where - call MPI_BCAST(temp_log_array1, size(temp_log_array1), MPI_INTEGER, mpiroot, mpicomm, ierr) - ! - allocate(temp_log_array2(nminor_absorber_intervals_lower_sw)) - where(scale_by_complement_lower_sw) - temp_log_array2 = 1 - elsewhere - temp_log_array2 = 0 - end where - call MPI_BCAST(temp_log_array2, size(temp_log_array2), MPI_INTEGER, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_scales_with_density_lower_sw, nminor_absorber_intervals_lower_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scale_by_complement_lower_sw, nminor_absorber_intervals_lower_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_scales_with_density_upper_sw, nminor_absorber_intervals_upper_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr) + call MPI_BCAST(scale_by_complement_upper_sw, nminor_absorber_intervals_upper_sw, MPI_LOGICAL, mpiroot, mpicomm, ierr) + !allocate(temp_log_array1(nminor_absorber_intervals_lower_sw)) + !where(minor_scales_with_density_lower_sw) + ! temp_log_array1 = 1 + !elsewhere + ! temp_log_array1 = 0 + !end where + !call MPI_BCAST(temp_log_array1, size(temp_log_array1), MPI_INTEGER, mpiroot, mpicomm, ierr) ! - allocate(temp_log_array3(nminor_absorber_intervals_upper_sw)) - where(minor_scales_with_density_upper_sw) - temp_log_array3 = 1 - elsewhere - temp_log_array3 = 0 - end where - call MPI_BCAST(temp_log_array3, size(temp_log_array3), MPI_INTEGER, mpiroot, mpicomm, ierr) + !allocate(temp_log_array2(nminor_absorber_intervals_lower_sw)) + !where(scale_by_complement_lower_sw) + ! temp_log_array2 = 1 + !elsewhere + ! temp_log_array2 = 0 + !end where + !call MPI_BCAST(temp_log_array2, size(temp_log_array2), MPI_INTEGER, mpiroot, mpicomm, ierr) ! - allocate(temp_log_array4(nminor_absorber_intervals_upper_sw)) - where(scale_by_complement_upper_sw) - temp_log_array4 = 1 - elsewhere - temp_log_array4 = 0 - end where - call MPI_BCAST(temp_log_array4, size(temp_log_array4), MPI_INTEGER, mpiroot, mpicomm, ierr) + !allocate(temp_log_array3(nminor_absorber_intervals_upper_sw)) + !where(minor_scales_with_density_upper_sw) + ! temp_log_array3 = 1 + !elsewhere + ! temp_log_array3 = 0 + !end where + !call MPI_BCAST(temp_log_array3, size(temp_log_array3), MPI_INTEGER, mpiroot, mpicomm, ierr) + !! + !allocate(temp_log_array4(nminor_absorber_intervals_upper_sw)) + !where(scale_by_complement_upper_sw) + ! temp_log_array4 = 1 + !elsewhere + ! temp_log_array4 = 0 + !end where + !call MPI_BCAST(temp_log_array4, size(temp_log_array4), MPI_INTEGER, mpiroot, mpicomm, ierr) #endif ! Initialize gas concentrations and gas optics class with data