diff --git a/model/src/mpicomm.F90 b/model/src/mpicomm.F90 index 263b4ba72..2adce80f1 100644 --- a/model/src/mpicomm.F90 +++ b/model/src/mpicomm.F90 @@ -65,268 +65,7 @@ MODULE MPICOMM ! module during initialization. LOGICAL :: IS_EXTERNAL_COMPONENT = .FALSE. !< IS_EXTERNAL_COMPONENT Flag for model invoked via external executable. ! -CONTAINS - -SUBROUTINE WW3_SEND_TO_ERF - - USE CONSTANTS - USE W3GDATMD ! HAS NX, NY - USE W3ADATMD, ONLY: HS, WLM - USE W3ODATMD, ONLY: NDST, UNDEF, IAPROC, NAPROC - USE W3ADATMD, ONLY: NSEALM - USE W3PARALL, ONLY : INIT_GET_ISEA, SYNCHRONIZE_GLOBAL_ARRAY - ! USE W3IOGOMD, ONLY: S2GRID -#ifdef W3_PDLIB - USE W3ODATMD, only : IAPROC, NAPROC, NTPROC - USE W3ADATMD, ONLY: MPI_COMM_WCMP - use yowDatapool, only: rtype, istatus - USE yowNodepool, only: npa - use yowNodepool, only: iplg - use yowDatapool, only: rkind -#endif - IMPLICIT NONE -#ifdef W3_MPI - INCLUDE "mpif.h" -#endif - - -! PARAMETER LIST -------------------------------------------------- * - INTEGER :: COUNTER -#define W3_MPMD -#ifdef W3_MPMD - LOGICAL :: FIRST_STEP = .TRUE., initialized, mpi_initialized_by_us - integer :: flag, myproc, nprocs, max_appnum, min_appnum, this_root, other_root, rank_offset, this_nboxes - integer :: p, appnum, all_appnum(10), napps, all_argc(10), IERR_MPI - CHARACTER(LEN=80) :: exename - REAL, ALLOCATABLE :: X1(:,:) - -! MY EDITS - INTEGER :: n_elements - REAL(8), allocatable :: magnitude_values(:) - REAL(8), allocatable :: theta_values(:) - -#ifdef W3_PDLIB - REAL(rkind) :: XY_SEND(NX*NY) - REAL(rkind) :: XY_SYNCH_SEND(NSEA) -#else - DOUBLE PRECISION :: XY_SEND(NX*NY) - DOUBLE PRECISION :: XY_SYNCH_SEND(NSEA) -#endif -#endif - - INTEGER :: JSEA, ISEA, IX, IY, I, J - -! BEGIN SEND ---------------------------------------------------------- * - -#ifdef W3_MPMD - -#ifdef W3_MPI - CALL MPI_COMM_SIZE ( MPI_COMM_WORLD, NPROCS, IERR_MPI ) -#endif -#ifdef W3_MPI - CALL MPI_COMM_RANK ( MPI_COMM_WORLD, MYPROC, IERR_MPI ) - MYPROC = MYPROC + 1 -#endif - -#ifdef W3_MPI - print*, "My rank is ",MYPROC," out of ",NPROCS," total ranks in my part of MPI_COMM_WORLD communicator ",MPI_COMM_WORLD, "and my rank is ",IAPROC," out of ",NAPROC," total ranks in my part of the split communicator ", MPI_COMM_WW3 - - rank_offset = MyProc - IAPROC; - if (rank_offset .eq. 0) then ! First program - this_root = 0 - other_root = NAPROC - else - this_root = rank_offset - other_root = 0 - end if - - ALLOCATE(X1(NX+1,NY)) -! ALLOCATE(XY_SEND(NX*NY)) - if (MyProc-1 .eq. this_root) then - if (rank_offset .eq. 0) then ! the first program - CALL MPI_Send(NX, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, IERR_MPI) - CALL MPI_Send(NY, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, IERR_MPI) - else ! the second program - CALL MPI_Send(NX, 1, MPI_INT, other_root, 1, MPI_COMM_WORLD, IERR_MPI) - CALL MPI_Send(NY, 1, MPI_INT, other_root, 7, MPI_COMM_WORLD, IERR_MPI) - end if - end if - - if (MyProc-1 .eq. this_root) then - if (rank_offset .eq. 0) then ! the first program - X1 = UNDEF - XY_SEND = UNDEF - ! CALL S2GRID(HS, X1) - XY_SYNCH_SEND = HS - CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) - - DO JSEA=1, NSEA - CALL INIT_GET_ISEA(ISEA, JSEA) - IX = MAPSF(ISEA,1) - IY = MAPSF(ISEA,2) - XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) - END DO - - CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 2, MPI_COMM_WORLD, IERR_MPI) - X1 = UNDEF - XY_SYNCH_SEND = WLM - CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) - DO JSEA=1, NSEA - CALL INIT_GET_ISEA(ISEA, JSEA) - IX = MAPSF(ISEA,1) - IY = MAPSF(ISEA,2) - XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) - END DO - CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 4, MPI_COMM_WORLD, IERR_MPI) - else ! the second program - X1 = UNDEF - XY_SEND = UNDEF - XY_SYNCH_SEND = HS - CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) - DO JSEA=1, NSEA - CALL INIT_GET_ISEA(ISEA, JSEA) - IX = MAPSF(ISEA,1) - IY = MAPSF(ISEA,2) - XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) - END DO - CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 3, MPI_COMM_WORLD, IERR_MPI) - X1 = UNDEF - XY_SYNCH_SEND = WLM - CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) - DO JSEA=1, NSEA - CALL INIT_GET_ISEA(ISEA, JSEA) - IX = MAPSF(ISEA,1) - IY = MAPSF(ISEA,2) - XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) - END DO - CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 5, MPI_COMM_WORLD, IERR_MPI) - end if - end if - -! MY EDITS HERE -! CHECK XY_SYNCH_SEND, SYNCH_GLOBAL_ARRAY - OPEN(5120, file='printmpi.txt', status='unknown', access='append', action="write") - - ! Write HS values to the new file - DO JSEA=1, NSEAL - CALL INIT_GET_ISEA(ISEA, JSEA) - IX = MAPSF(ISEA,1) - IY = MAPSF(ISEA,2) - - WRITE(5120, *) SIZE(XY_SEND), XY_SEND(ISEA), SIZE(XY_SYNCH_SEND), XY_SYNCH_SEND(ISEA) - END DO - CLOSE(5120) - DEALLOCATE(X1) -#endif -#endif - -! END SEND ----------------------------------------------------------------- * - -END SUBROUTINE WW3_SEND_TO_ERF - -SUBROUTINE WW3_RECEIVE_FROM_ERF - - USE CONSTANTS - USE W3GDATMD - USE W3ADATMD, ONLY: HS, WLM - USE W3ODATMD, ONLY: NDST, UNDEF, IAPROC, NAPROC - USE W3ADATMD, ONLY: NSEALM - USE W3PARALL, ONLY : INIT_GET_ISEA, SYNCHRONIZE_GLOBAL_ARRAY - ! USE W3IOGOMD, ONLY: S2GRID -#ifdef W3_PDLIB - USE W3ODATMD, only : IAPROC, NAPROC, NTPROC - USE W3ADATMD, ONLY: MPI_COMM_WCMP - use yowDatapool, only: rtype, istatus - USE yowNodepool, only: npa - use yowNodepool, only: iplg - use yowDatapool, only: rkind -#endif - IMPLICIT NONE -#ifdef W3_MPI - INCLUDE "mpif.h" -#endif -! PARAMETER LIST -------------------------------------------------- * - INTEGER :: COUNTER -#define W3_MPMD -#ifdef W3_MPMD - LOGICAL :: FIRST_STEP = .TRUE., initialized, mpi_initialized_by_us - integer :: flag, myproc, nprocs, max_appnum, min_appnum, this_root, other_root, rank_offset, this_nboxes - integer :: p, appnum, all_appnum(10), napps, all_argc(10), IERR_MPI - CHARACTER(LEN=80) :: exename - REAL, ALLOCATABLE :: X1(:,:) - -! MY EDITS - INTEGER :: n_elements - REAL(8), allocatable :: magnitude_values(:) - REAL(8), allocatable :: theta_values(:) - -#ifdef W3_PDLIB - REAL(rkind) :: XY_SEND(NX*NY) - REAL(rkind) :: XY_SYNCH_SEND(NSEA) -#else - DOUBLE PRECISION :: XY_SEND(NX*NY) - DOUBLE PRECISION :: XY_SYNCH_SEND(NSEA) -#endif -#endif - - INTEGER :: JSEA, ISEA, IX, IY, I, J - -#ifdef W3_MPMD - -#ifdef W3_MPI - CALL MPI_COMM_SIZE ( MPI_COMM_WORLD, NPROCS, IERR_MPI ) -#endif -#ifdef W3_MPI - CALL MPI_COMM_RANK ( MPI_COMM_WORLD, MYPROC, IERR_MPI ) - MYPROC = MYPROC + 1 -#endif - -#ifdef W3_MPI - print*, "My rank is ",MYPROC," out of ",NPROCS," total ranks in my part of MPI_COMM_WORLD communicator ",MPI_COMM_WORLD, "and my rank is ",IAPROC," out of ",NAPROC," total ranks in my part of the split communicator ", MPI_COMM_WW3 - - rank_offset = MyProc - IAPROC; - if (rank_offset .eq. 0) then ! First program - this_root = 0 - other_root = NAPROC - else - this_root = rank_offset - other_root = 0 - end if - -! BEGIN RECEIVE FROM ERF ---------------------------------------------------- * - -n_elements = NX * NY -PRINT *, "ABOUT TO RECEIVE FROM ERF" - if (MyProc-1 .eq. this_root) then - if (rank_offset .eq. 0) then ! the first program - - CALL MPI_RECV( n_elements, 1, MPI_INT, other_root, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE, IERR_MPI ); - - - allocate(magnitude_values(n_elements)) - allocate(theta_values(n_elements)) - - CALL MPI_RECV(magnitude_values, n_elements, MPI_DOUBLE, other_root, 12, MPI_COMM_WORLD,MPI_STATUS_IGNORE, IERR_MPI) - CALL MPI_RECV(theta_values, n_elements, MPI_DOUBLE, other_root, 14, MPI_COMM_WORLD, MPI_STATUS_IGNORE,IERR_MPI) - else ! the second program - - CALL MPI_RECV( n_elements, 1, MPI_INT, other_root, 11, MPI_COMM_WORLD, MPI_STATUS_IGNORE,IERR_MPI ); - - allocate(magnitude_values(n_elements)) - allocate(theta_values(n_elements)) - - call MPI_RECV(magnitude_values, n_elements, MPI_DOUBLE, other_root, 13, MPI_COMM_WORLD,MPI_STATUS_IGNORE, IERR_MPI) - call MPI_RECV(theta_values, n_elements, MPI_DOUBLE, other_root, 15, MPI_COMM_WORLD, MPI_STATUS_IGNORE, IERR_MPI) - end if - end if - - - print*, "JUST RECEIVED AND ALLOCATED MAG_VALUES(n-elements)"! MPI RECEIVE TEST -#endif -#endif - -! END RECEIVE ------------------------------------------------------------------ * -END SUBROUTINE WW3_RECEIVE_FROM_ERF +!CONTAINS !/ !/ End of module MPICOMM ------------------------------------------- / diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 0c84c596a..fbc5ce06d 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -410,7 +410,7 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, UA, UD, U10, U10D, AS #ifdef W3_MPI USE W3ADATMD, ONLY: MPI_COMM_WAVE, MPI_COMM_WCMP - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif USE W3IDATMD, ONLY: FLLEV, FLCUR, FLWIND, FLICE, FLTAUA, FLRHOA,& FLMDN, FLMTH, FLMVS, FLIC1, FLIC2, FLIC3, & diff --git a/model/src/w3iogomd.F90 b/model/src/w3iogomd.F90 index c8576c88e..bf5b03933 100644 --- a/model/src/w3iogomd.F90 +++ b/model/src/w3iogomd.F90 @@ -165,7 +165,268 @@ MODULE W3IOGOMD !/ CONTAINS !/ ------------------------------------------------------------------- / +SUBROUTINE WW3_SEND_TO_ERF + USE CONSTANTS + USE MPICOMM + USE W3GDATMD ! HAS NX, NY + USE W3ADATMD, ONLY: HS, WLM + USE W3ODATMD, ONLY: NDST, UNDEF, IAPROC, NAPROC + USE W3ADATMD, ONLY: NSEALM + USE W3PARALL, ONLY : INIT_GET_ISEA, SYNCHRONIZE_GLOBAL_ARRAY + ! USE W3IOGOMD, ONLY: S2GRID +#ifdef W3_PDLIB + USE W3ODATMD, only : IAPROC, NAPROC, NTPROC + USE W3ADATMD, ONLY: MPI_COMM_WCMP + use yowDatapool, only: rtype, istatus + USE yowNodepool, only: npa + use yowNodepool, only: iplg + use yowDatapool, only: rkind +#endif + IMPLICIT NONE +#ifdef W3_MPI + INCLUDE "mpif.h" +#endif + + +! PARAMETER LIST -------------------------------------------------- * + INTEGER :: COUNTER +#define W3_MPMD +#ifdef W3_MPMD + LOGICAL :: FIRST_STEP = .TRUE., initialized, mpi_initialized_by_us + integer :: flag, myproc, nprocs, max_appnum, min_appnum, this_root, other_root, rank_offset, this_nboxes + integer :: p, appnum, all_appnum(10), napps, all_argc(10), IERR_MPI + CHARACTER(LEN=80) :: exename + REAL, ALLOCATABLE :: X1(:,:) + +! MY EDITS + INTEGER :: n_elements + REAL(8), allocatable :: magnitude_values(:) + REAL(8), allocatable :: theta_values(:) + +#ifdef W3_PDLIB + REAL(rkind) :: XY_SEND(NX*NY) + REAL(rkind) :: XY_SYNCH_SEND(NSEA) +#else + DOUBLE PRECISION :: XY_SEND(NX*NY) + DOUBLE PRECISION :: XY_SYNCH_SEND(NSEA) +#endif +#endif + + INTEGER :: JSEA, ISEA, IX, IY, I, J + +! BEGIN SEND ---------------------------------------------------------- * + +#ifdef W3_MPMD + +#ifdef W3_MPI + CALL MPI_COMM_SIZE ( MPI_COMM_WORLD, NPROCS, IERR_MPI ) +#endif +#ifdef W3_MPI + CALL MPI_COMM_RANK ( MPI_COMM_WORLD, MYPROC, IERR_MPI ) + MYPROC = MYPROC + 1 +#endif + +#ifdef W3_MPI + print*, "My rank is ",MYPROC," out of ",NPROCS," total ranks in my part of MPI_COMM_WORLD communicator ",MPI_COMM_WORLD, "and my rank is ",IAPROC," out of ",NAPROC," total ranks in my part of the split communicator ", MPI_COMM_WW3 + + rank_offset = MyProc - IAPROC; + if (rank_offset .eq. 0) then ! First program + this_root = 0 + other_root = NAPROC + else + this_root = rank_offset + other_root = 0 + end if + + ALLOCATE(X1(NX+1,NY)) +! ALLOCATE(XY_SEND(NX*NY)) + if (MyProc-1 .eq. this_root) then + if (rank_offset .eq. 0) then ! the first program + CALL MPI_Send(NX, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, IERR_MPI) + CALL MPI_Send(NY, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, IERR_MPI) + else ! the second program + CALL MPI_Send(NX, 1, MPI_INT, other_root, 1, MPI_COMM_WORLD, IERR_MPI) + CALL MPI_Send(NY, 1, MPI_INT, other_root, 7, MPI_COMM_WORLD, IERR_MPI) + end if + end if + + if (MyProc-1 .eq. this_root) then + if (rank_offset .eq. 0) then ! the first program + X1 = UNDEF + XY_SEND = UNDEF + ! CALL S2GRID(HS, X1) + XY_SYNCH_SEND = HS + CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) + + DO JSEA=1, NSEA + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) + END DO + + CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 2, MPI_COMM_WORLD, IERR_MPI) + X1 = UNDEF + XY_SYNCH_SEND = WLM + CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) + DO JSEA=1, NSEA + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) + END DO + CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 4, MPI_COMM_WORLD, IERR_MPI) + else ! the second program + X1 = UNDEF + XY_SEND = UNDEF + XY_SYNCH_SEND = HS + CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) + DO JSEA=1, NSEA + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) + END DO + CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 3, MPI_COMM_WORLD, IERR_MPI) + X1 = UNDEF + XY_SYNCH_SEND = WLM + CALL SYNCHRONIZE_GLOBAL_ARRAY(XY_SYNCH_SEND) + DO JSEA=1, NSEA + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + XY_SEND((IX)+(IY-1)*NX)=XY_SYNCH_SEND(ISEA) + END DO + CALL MPI_Send(XY_SEND, NX*NY, MPI_DOUBLE, other_root, 5, MPI_COMM_WORLD, IERR_MPI) + end if + end if + +! MY EDITS HERE +! CHECK XY_SYNCH_SEND, SYNCH_GLOBAL_ARRAY + OPEN(5120, file='printmpi.txt', status='unknown', access='append', action="write") + + ! Write HS values to the new file + DO JSEA=1, NSEAL + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + + WRITE(5120, *) SIZE(XY_SEND), XY_SEND(ISEA), SIZE(XY_SYNCH_SEND), XY_SYNCH_SEND(ISEA) + END DO + CLOSE(5120) + DEALLOCATE(X1) +#endif +#endif + +! END SEND ----------------------------------------------------------------- * + +END SUBROUTINE WW3_SEND_TO_ERF + +SUBROUTINE WW3_RECEIVE_FROM_ERF + + USE CONSTANTS + USE MPICOMM + USE W3GDATMD + USE W3ADATMD, ONLY: HS, WLM + USE W3ODATMD, ONLY: NDST, UNDEF, IAPROC, NAPROC + USE W3ADATMD, ONLY: NSEALM + USE W3PARALL, ONLY : INIT_GET_ISEA, SYNCHRONIZE_GLOBAL_ARRAY + ! USE W3IOGOMD, ONLY: S2GRID +#ifdef W3_PDLIB + USE W3ODATMD, only : IAPROC, NAPROC, NTPROC + USE W3ADATMD, ONLY: MPI_COMM_WCMP + use yowDatapool, only: rtype, istatus + USE yowNodepool, only: npa + use yowNodepool, only: iplg + use yowDatapool, only: rkind +#endif + IMPLICIT NONE +#ifdef W3_MPI + INCLUDE "mpif.h" +#endif +! PARAMETER LIST -------------------------------------------------- * + INTEGER :: COUNTER +#define W3_MPMD +#ifdef W3_MPMD + LOGICAL :: FIRST_STEP = .TRUE., initialized, mpi_initialized_by_us + integer :: flag, myproc, nprocs, max_appnum, min_appnum, this_root, other_root, rank_offset, this_nboxes + integer :: p, appnum, all_appnum(10), napps, all_argc(10), IERR_MPI + CHARACTER(LEN=80) :: exename + REAL, ALLOCATABLE :: X1(:,:) + +! MY EDITS + INTEGER :: n_elements + REAL(8), allocatable :: magnitude_values(:) + REAL(8), allocatable :: theta_values(:) + +#ifdef W3_PDLIB + REAL(rkind) :: XY_SEND(NX*NY) + REAL(rkind) :: XY_SYNCH_SEND(NSEA) +#else + DOUBLE PRECISION :: XY_SEND(NX*NY) + DOUBLE PRECISION :: XY_SYNCH_SEND(NSEA) +#endif +#endif + + INTEGER :: JSEA, ISEA, IX, IY, I, J + +#ifdef W3_MPMD + +#ifdef W3_MPI + CALL MPI_COMM_SIZE ( MPI_COMM_WORLD, NPROCS, IERR_MPI ) +#endif +#ifdef W3_MPI + CALL MPI_COMM_RANK ( MPI_COMM_WORLD, MYPROC, IERR_MPI ) + MYPROC = MYPROC + 1 +#endif + +#ifdef W3_MPI + print*, "My rank is ",MYPROC," out of ",NPROCS," total ranks in my part of MPI_COMM_WORLD communicator ",MPI_COMM_WORLD, "and my rank is ",IAPROC," out of ",NAPROC," total ranks in my part of the split communicator ", MPI_COMM_WW3 + + rank_offset = MyProc - IAPROC; + if (rank_offset .eq. 0) then ! First program + this_root = 0 + other_root = NAPROC + else + this_root = rank_offset + other_root = 0 + end if + +! BEGIN RECEIVE FROM ERF ---------------------------------------------------- * + +n_elements = NX * NY +PRINT *, "ABOUT TO RECEIVE FROM ERF" + if (MyProc-1 .eq. this_root) then + if (rank_offset .eq. 0) then ! the first program + + CALL MPI_RECV( n_elements, 1, MPI_INT, other_root, 10, MPI_COMM_WORLD, MPI_STATUS_IGNORE, IERR_MPI ); + + + allocate(magnitude_values(n_elements)) + allocate(theta_values(n_elements)) + + CALL MPI_RECV(magnitude_values, n_elements, MPI_DOUBLE, other_root, 12, MPI_COMM_WORLD,MPI_STATUS_IGNORE, IERR_MPI) + CALL MPI_RECV(theta_values, n_elements, MPI_DOUBLE, other_root, 14, MPI_COMM_WORLD, MPI_STATUS_IGNORE,IERR_MPI) + else ! the second program + + CALL MPI_RECV( n_elements, 1, MPI_INT, other_root, 11, MPI_COMM_WORLD, MPI_STATUS_IGNORE,IERR_MPI ); + + allocate(magnitude_values(n_elements)) + allocate(theta_values(n_elements)) + + call MPI_RECV(magnitude_values, n_elements, MPI_DOUBLE, other_root, 13, MPI_COMM_WORLD,MPI_STATUS_IGNORE, IERR_MPI) + call MPI_RECV(theta_values, n_elements, MPI_DOUBLE, other_root, 15, MPI_COMM_WORLD, MPI_STATUS_IGNORE, IERR_MPI) + end if + end if + + + print*, "JUST RECEIVED AND ALLOCATED MAG_VALUES(n-elements)"! MPI RECEIVE TEST +#endif +#endif + +! END RECEIVE ------------------------------------------------------------------ * +END SUBROUTINE WW3_RECEIVE_FROM_ERF !> @brief Expand the seapoint array to full grid with handling of !> SMC regridding. !> @@ -2234,10 +2495,10 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) ! TESTING FUNCTION WW3_SEND_TO_ERF() CALL WW3_SEND_TO_ERF() -! CALL WW3_RECEIVE_FROM_ERF() +CALL WW3_RECEIVE_FROM_ERF() ! Uncomment if statement if we only want to receive from ERF -COMMENT = 0 +COMMENT = 2 if (COMMENT .eq. 1) then diff --git a/model/src/w3servmd.F90 b/model/src/w3servmd.F90 index 70dcc061f..3ae73bcef 100644 --- a/model/src/w3servmd.F90 +++ b/model/src/w3servmd.F90 @@ -80,7 +80,7 @@ MODULE W3SERVMD ! module default #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! implicit none diff --git a/model/src/w3strkmd.F90 b/model/src/w3strkmd.F90 index 212e14ba5..d395419fc 100644 --- a/model/src/w3strkmd.F90 +++ b/model/src/w3strkmd.F90 @@ -29,7 +29,7 @@ MODULE W3STRKMD !/ use constants, only: file_endian #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_multi.F90 b/model/src/ww3_multi.F90 index 046e8ba82..14e257aa6 100644 --- a/model/src/ww3_multi.F90 +++ b/model/src/ww3_multi.F90 @@ -96,7 +96,7 @@ PROGRAM W3MLTI #endif !/ #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_ounp.F90 b/model/src/ww3_ounp.F90 index d673775ab..bf1d55883 100644 --- a/model/src/ww3_ounp.F90 +++ b/model/src/ww3_ounp.F90 @@ -214,7 +214,7 @@ PROGRAM W3OUNP USE NETCDF ! #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_prnc.F90 b/model/src/ww3_prnc.F90 index 2646e0ea4..78bb0175c 100644 --- a/model/src/ww3_prnc.F90 +++ b/model/src/ww3_prnc.F90 @@ -226,7 +226,7 @@ PROGRAM W3PRNC USE NETCDF ! #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_prtide.F90 b/model/src/ww3_prtide.F90 index 65f68569c..dfea89471 100644 --- a/model/src/ww3_prtide.F90 +++ b/model/src/ww3_prtide.F90 @@ -140,7 +140,7 @@ PROGRAM W3PRTIDE USE W3IDATMD ! #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_sbs1.F90 b/model/src/ww3_sbs1.F90 index 8da309c62..1ca5571a9 100644 --- a/model/src/ww3_sbs1.F90 +++ b/model/src/ww3_sbs1.F90 @@ -178,7 +178,7 @@ PROGRAM W3SBS1 NRGRD, STIME, ETIME !/ #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_shel.F90 b/model/src/ww3_shel.F90 index db872f713..5159cfbec 100644 --- a/model/src/ww3_shel.F90 +++ b/model/src/ww3_shel.F90 @@ -319,7 +319,7 @@ PROGRAM W3SHEL USE OMP_LIB #endif #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif IMPLICIT NONE ! diff --git a/model/src/ww3_strt.F90 b/model/src/ww3_strt.F90 index 9f22c49f3..5e5b5ca68 100644 --- a/model/src/ww3_strt.F90 +++ b/model/src/ww3_strt.F90 @@ -242,7 +242,7 @@ PROGRAM W3STRT #endif !/ #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE diff --git a/model/src/ww3_systrk.F90 b/model/src/ww3_systrk.F90 index e00e5610d..1bfe3af3f 100644 --- a/model/src/ww3_systrk.F90 +++ b/model/src/ww3_systrk.F90 @@ -59,7 +59,7 @@ PROGRAM WW3_SYSTRK USE W3STRKMD USE W3TIMEMD, ONLY: TDIFF #ifdef W3_MPI - USE MPICOMM + USE MPICOMM, ONLY: MPI_COMM_WW3 #endif ! IMPLICIT NONE