From a25d7142c7f200b57e73fe18a091bcb4c4179668 Mon Sep 17 00:00:00 2001 From: Dustin Swales Date: Mon, 9 Dec 2019 15:21:43 -0700 Subject: [PATCH] Changed MPI_BCAST() for character arrays. --- physics/rrtmgp_lw_gas_optics.F90 | 21 ++++++--------------- physics/rrtmgp_sw_gas_optics.F90 | 23 +++++++---------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/physics/rrtmgp_lw_gas_optics.F90 b/physics/rrtmgp_lw_gas_optics.F90 index fc4f06115..31cf78196 100644 --- a/physics/rrtmgp_lw_gas_optics.F90 +++ b/physics/rrtmgp_lw_gas_optics.F90 @@ -370,21 +370,12 @@ subroutine rrtmgp_lw_gas_optics_init(Model, mpicomm, mpirank, mpiroot, lw_gas_pr 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) - enddo - do ij=1,nminorabsorbers - call MPI_BCAST(gas_minor(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - call MPI_BCAST(identifier_minor(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - do ij=1,nminor_absorber_intervals_lower - call MPI_BCAST(minor_gases_lower(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - do ij=1,nminor_absorber_intervals_upper - call MPI_BCAST(minor_gases_upper(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - ! Logical arrays (First convert to integer-array, then broadcast) - ! + call MPI_BCAST(gas_names, size(gas_names), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(gas_minor, size(gas_minor), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(identifier_minor, size(identifier_minor), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_gases_lower, size(minor_gases_lower), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_gases_upper, size(minor_gases_upper), MPI_CHAR, mpiroot, mpicomm, ierr) + ! Logical arrays 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) diff --git a/physics/rrtmgp_sw_gas_optics.F90 b/physics/rrtmgp_sw_gas_optics.F90 index 4fa7070c9..5994cf5d0 100644 --- a/physics/rrtmgp_sw_gas_optics.F90 +++ b/physics/rrtmgp_sw_gas_optics.F90 @@ -370,22 +370,13 @@ subroutine rrtmgp_sw_gas_optics_init(Model, mpicomm, mpirank, mpiroot, sw_gas_p 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) - enddo - do ij=1,nminorabsorbers_sw - call MPI_BCAST(gas_minor_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - call MPI_BCAST(identifier_minor_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - do ij=1,nminor_absorber_intervals_lower_sw - call MPI_BCAST(minor_gases_lower_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - do ij=1,nminor_absorber_intervals_upper_sw - call MPI_BCAST(minor_gases_upper_sw(ij), 32, MPI_CHAR, mpiroot, mpicomm, ierr) - enddo - ! Logical arrays (First convert to integer-array, then broadcast) - ! + ! Character arrays + call MPI_BCAST(gas_names_sw, size(gas_names_sw), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(gas_minor_sw, size(gas_minor_sw), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(identifier_minor_sw, size(identifier_minor_sw), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_gases_lower_sw, size(minor_gases_lower_sw), MPI_CHAR, mpiroot, mpicomm, ierr) + call MPI_BCAST(minor_gases_upper_sw, size(minor_gases_upper_sw), MPI_CHAR, mpiroot, mpicomm, ierr) + ! Logical arrays 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)