diff --git a/cellular_automata_global.F90 b/cellular_automata_global.F90 index 9e1a15d..fb45182 100644 --- a/cellular_automata_global.F90 +++ b/cellular_automata_global.F90 @@ -11,6 +11,7 @@ subroutine cellular_automata_global(kstep,restart,first_time_step,ca1_cpl,ca2_cp nca,ncells,nlives,nfracseed,nseed,iseed_ca, mytile, & ca_smooth,nspinup,blocksize,nsmooth,ca_amplitude,mpiroot,mpicomm) +use mpi_f08 use kinddef, only: kind_dbl_prec, kind_phys use update_ca, only: update_cells_global,define_ca_domain use halo_exchange, only: atmosphere_scalar_field_halo @@ -30,7 +31,8 @@ subroutine cellular_automata_global(kstep,restart,first_time_step,ca1_cpl,ca2_cp !This program evolves a cellular automaton uniform over the globe -integer, intent(in) :: kstep,ncells,nca,nlives,nseed,nspinup,nsmooth,mpiroot,mpicomm +integer, intent(in) :: kstep,ncells,nca,nlives,nseed,nspinup,nsmooth,mpiroot +type(MPI_Comm), intent(in) :: mpicomm integer(kind=kind_dbl_prec), intent(in) :: iseed_ca integer, intent(in) :: mytile real(kind=kind_phys), intent(in) :: nfracseed,ca_amplitude diff --git a/cellular_automata_sgs.F90 b/cellular_automata_sgs.F90 index af2322d..3f7920e 100644 --- a/cellular_automata_sgs.F90 +++ b/cellular_automata_sgs.F90 @@ -12,6 +12,7 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak nca,ncells,nlives,nfracseed,nseed,iseed_ca,ca_advect, & nspinup,ca_trigger,blocksize,mpiroot,mpicomm) +use mpi_f08 use kinddef, only: kind_phys,kind_dbl_prec use update_ca, only: update_cells_sgs, define_ca_domain use random_numbers, only: random_01_CB @@ -44,7 +45,8 @@ subroutine cellular_automata_sgs(kstep,dtf,restart,first_time_step,sst,lsmsk,lak !CA_DEEP can be either number of plumes in a cluster (nca_plumes=true) or updraft !area fraction (nca_plumes=false) -integer,intent(in) :: kstep,ncells,nca,nlives,nseed,nspinup,mpiroot,mpicomm,mytile +integer,intent(in) :: kstep,ncells,nca,nlives,nseed,nspinup,mpiroot,mytile +type(MPI_Comm),intent(in) :: mpicomm integer(kind=kind_dbl_prec), intent(in) :: iseed_ca real(kind=kind_phys), intent(in) :: nfracseed,dtf,nthresh logical,intent(in) :: restart,ca_trigger,first_time_step,ca_advect diff --git a/mpi_wrapper.F90 b/mpi_wrapper.F90 index e756678..7ccd5a7 100644 --- a/mpi_wrapper.F90 +++ b/mpi_wrapper.F90 @@ -1,5 +1,7 @@ module mpi_wrapper + use mpi_f08 + implicit none private @@ -9,12 +11,10 @@ module mpi_wrapper public :: mp_reduce_min, mp_reduce_max, mp_reduce_sum public :: mp_bcst, mp_alltoall -#include "mpif.h" - integer, save :: mype = -999 integer, save :: npes = -999 integer, save :: root = -999 - integer, save :: comm = -999 + type(MPI_Comm), save :: comm logical, save :: initialized = .false. integer :: ierror @@ -78,7 +78,8 @@ logical function is_rootpe() end function is_rootpe subroutine mpi_wrapper_initialize(mpiroot, mpicomm) - integer, intent(in) :: mpiroot, mpicomm + integer, intent(in) :: mpiroot + type(MPI_Comm), intent(in) :: mpicomm if (initialized) return root = mpiroot comm = mpicomm @@ -92,7 +93,7 @@ subroutine mpi_wrapper_finalize() mype = -999 npes = -999 root = -999 - comm = -999 + comm%mpi_val = -999 initialized = .false. end subroutine mpi_wrapper_finalize diff --git a/stochastic_physics.F90 b/stochastic_physics.F90 index 3632f9a..0f1699f 100644 --- a/stochastic_physics.F90 +++ b/stochastic_physics.F90 @@ -2,6 +2,7 @@ !! the stochastic physics random pattern generators module stochastic_physics +use mpi_f08 use kinddef, only : kind_phys, kind_dbl_prec implicit none @@ -40,7 +41,8 @@ subroutine init_stochastic_physics(levs, blksz, dtp, sppt_amp, input_nml_file_in ! Interface variables -integer, intent(in) :: levs, nlunit, nthreads, mpiroot, mpicomm +integer, intent(in) :: levs, nlunit, nthreads, mpiroot +type(MPI_Comm), intent(in) :: mpicomm integer, intent(in) :: blksz(:) real(kind=kind_phys), intent(in) :: dtp real(kind=kind_phys), intent(out) :: sppt_amp @@ -280,8 +282,10 @@ subroutine init_stochastic_physics_ocn(delt,geoLonT,geoLatT,nx,ny,nz,pert_epbl_i real :: dx integer :: k,latghf,km +type(MPI_Comm) :: mpicomm_t ! FIXME once MOM6 updates to use mpi_f90 types rad2deg=180.0/con_pi -call mpi_wrapper_initialize(mpiroot,mpicomm) +mpicomm_t%mpi_val = mpicomm +call mpi_wrapper_initialize(mpiroot,mpicomm_t) gis_stochy_ocn%nodes = npes gis_stochy_ocn%mype = mype gis_stochy_ocn%nx=nx