WAVEWATCH III  beta 0.0.1
ww3_multi.F90
Go to the documentation of this file.
1 
5 
6 #include "w3macros.h"
7 !/ ------------------------------------------------------------------- /
8 !
9 !
14 PROGRAM w3mlti
15  !/
16  !/ +-----------------------------------+
17  !/ | WAVEWATCH III NOAA/NCEP |
18  !/ | H. L. Tolman |
19  !/ | FORTRAN 90 |
20  !/ | Last update : 29-May-2009 |
21  !/ +-----------------------------------+
22  !/
23  !/ 04-May-2005 : Origination. ( version 3.07 )
24  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
25  !/ 17-Feb-2016 : New version from namelist use ( version 5.11 )
26  !/
27  !/ Copyright 2009 National Weather Service (NWS),
28  !/ National Oceanic and Atmospheric Administration. All rights
29  !/ reserved. WAVEWATCH III is a trademark of the NWS.
30  !/ No unauthorized use without permission.
31  !/
32  ! 1. Purpose :
33  !
34  ! Program shell or driver to run the multi-grid wave model
35  ! (uncoupled).
36  !
37  ! 2. Method :
38  !
39  ! 3. Parameters :
40  !
41  ! Local parameters.
42  ! ----------------------------------------------------------------
43  ! ----------------------------------------------------------------
44  !
45  ! 4. Subroutines used :
46  !
47  ! Name Type Module Description
48  ! ----------------------------------------------------------------
49  ! WMINIT Subr. WMINITMD Multi-grid model initialization.
50  ! WMFINL Subr. WMFINLMD Multi-grid model finalization.
51  !
52  ! MPI_INIT, MPI_COMM_SIZE, MPI_COMM_RANK, MPI_BARRIER,
53  ! MPI_FINALIZE
54  ! Subr. Standard MPI routines.
55  ! ----------------------------------------------------------------
56  !
57  ! 5. Called by :
58  !
59  ! None, stand-alone program.
60  !
61  ! 6. Error messages :
62  !
63  ! 7. Remarks :
64  !
65  ! - This is he third version, version 1 and 2 were use for proof
66  ! of concept only, and were not retained.
67  !
68  ! 8. Structure :
69  !
70  ! ----------------------------------------------------------------
71  ! 0. Initialization necessary for driver
72  ! a General I/O: (implicit in wmmdatmd)
73  ! b MPI environment
74  ! c Identifying output to "screen" unit
75  ! 1. Initialization of all wave models / grids ( WMINIT )
76  ! 2. Run the multi-grid models ( WMWAVE )
77  ! 3. Finalization of wave model ( WMFINL )
78  ! 4. Finalization of driver
79  ! ----------------------------------------------------------------
80  !
81  ! 9. Switches :
82  !
83  ! !/MPI Including MPI routines / environment.
84  !
85  ! 10. Source code :
86  !
87  !/ ------------------------------------------------------------------- /
88  USE wminitmd, ONLY: wminit, wminitnml
89  USE wmwavemd, ONLY: wmwave
90  USE wmfinlmd, ONLY: wmfinl
91  !/
92  USE wmmdatmd, ONLY: mdsi, mdso, mdss, mdst, mdse, &
94 #ifdef W3_OMPG
95  USE omp_lib
96 #endif
97  !/
98  IMPLICIT NONE
99  !
100 #ifdef W3_MPI
101  include "mpif.h"
102 #endif
103  !/
104  !/ ------------------------------------------------------------------- /
105  !/ Local parameters
106  !/
107  INTEGER :: i, mpi_comm = -99
108  INTEGER, ALLOCATABLE :: tend(:,:)
109  LOGICAL :: flgnml
110 #ifdef W3_MPI
111  INTEGER :: ierr_mpi
112  LOGICAL :: flhybr = .false.
113 #endif
114 #ifdef W3_OMPH
115  INTEGER :: thrlev
116 #endif
117  !/
118  !/ ------------------------------------------------------------------- /
119  ! 0. Initialization necessary for driver
120  ! 0.a General I/O: all can start with initialization in wmmdatmd
121  !
122  ! 0.b MPI environment: Here, we use MPI_COMM_WORLD
123  !
124 #ifdef W3_OMPH
125  flhybr = .true.
126  ! For hybrid MPI-OpenMP specify required thread level:
127  IF( flhybr ) THEN
128  CALL mpi_init_thread(mpi_thread_funneled, thrlev, ierr_mpi)
129  ELSE
130 #endif
131 #ifdef W3_MPI
132  CALL mpi_init ( ierr_mpi )
133 #endif
134 #ifdef W3_OMPH
135  ENDIF
136 #endif
137 #ifdef W3_MPI
138  mpi_comm = mpi_comm_world
139  CALL mpi_comm_size ( mpi_comm, nmproc, ierr_mpi )
140  CALL mpi_comm_rank ( mpi_comm, improc, ierr_mpi )
141  improc = improc + 1
142 #endif
143  !
144  ! 0.c Identifying output to "screen" unit
145  !
146  IF ( improc .EQ. nmpscr ) WRITE (*,900)
147 #ifdef W3_OMPH
148  IF ( improc .EQ. nmpscr ) WRITE (*,905) &
149  mpi_thread_funneled, thrlev
150 #endif
151  !
152 #ifdef W3_OMPG
153  IF( improc .EQ. nmpscr ) THEN
154  WRITE(*,906) omp_get_max_threads()
155  ENDIF
156 #endif
157  !
158  !/ ------------------------------------------------------------------- /
159  ! 1. Initialization of all wave models / grids
160  ! Use only one of the calls ....
161  !
162  ! ... Log and screen output, no separate test output file
163  !
164  ! CALL WMINIT ( MDSI, MDSO, MDSS, MDST, MDSE, 'ww3_multi.inp', MPI_COMM )
165  !
166  ! ... Screen output disabled
167  !
168  ! CALL WMINIT ( MDSI, MDSO, MDSO, MDST, MDSE, 'ww3_multi.inp', MPI_COMM )
169  !
170  ! ... Separate test output file and file preamble defined
171  !
172  ! CALL WMINIT ( MDSI, MDSO, MDSS, 10, MDSE, 'ww3_multi.inp', MPI_COMM, &
173  ! './data/' )
174  !
175  ! ... Separate test output file
176  !
177  INQUIRE(file="ww3_multi.nml", exist=flgnml)
178  IF (flgnml) THEN
179  CALL wminitnml ( mdsi, mdso, mdss, 10, mdse, 'ww3_multi.nml', mpi_comm )
180  ELSE
181  CALL wminit ( mdsi, mdso, mdss, 10, mdse, 'ww3_multi.inp', mpi_comm )
182  END IF
183  !
184 
185  !
186  !/ ------------------------------------------------------------------- /
187  ! 2. Run the wave model
188  !
189  ALLOCATE ( tend(2,nrgrd) )
190  !
191  DO i=1, nrgrd
192  tend(:,i) = etime(:)
193  END DO
194  !
195  CALL wmwave ( tend )
196  !
197  DEALLOCATE ( tend )
198  !
199  !/ ------------------------------------------------------------------- /
200  ! 3. Finalize the wave model
201  !
202  CALL wmfinl
203  !
204  !/ ------------------------------------------------------------------- /
205  ! 4 Finalize the driver
206  !
207  IF ( improc .EQ. nmpscr ) WRITE (*,999)
208  !
209 #ifdef W3_MPI
210  CALL mpi_barrier ( mpi_comm, ierr_mpi )
211  CALL mpi_finalize ( ierr_mpi )
212 #endif
213  !
214  ! Formats
215  !
216 900 FORMAT (/15x,' *** WAVEWATCH III Multi-grid shell *** '/ &
217  15x,'================================================='/)
218 #ifdef W3_OMPH
219 905 FORMAT ( ' Hybrid MPI/OMP thread support level:'/ &
220  ' Requested: ', i2/ &
221  ' Provided: ', i2/ )
222 #endif
223  !
224 #ifdef W3_OMPG
225 906 FORMAT ( ' OMP threading enabled. Number of threads: ', i3 / )
226 #endif
227  !
228 999 FORMAT(//' End of program '/ &
229  ' ========================================'/ &
230  ' WAVEWATCH III Multi-grid shell '/)
231  !/
232  !/ End of W3MLTI ----------------------------------------------------- /
233  !/
234 END PROGRAM w3mlti
include
cmake src_list cmake include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake) check_switches("$
Definition: CMakeLists.txt:15
wmmdatmd::mdse
integer mdse
MDSE.
Definition: wmmdatmd.F90:316
wmfinlmd
Finalization of the multi-grid wave model.
Definition: wmfinlmd.F90:14
wminitmd
Initialization of the multi-grid wave model.
Definition: wminitmd.F90:18
wmmdatmd::mdsi
integer mdsi
MDSI.
Definition: wmmdatmd.F90:312
wmwavemd::wmwave
subroutine wmwave(TEND)
Run multi-grid version of WAVEWATCH III.
Definition: wmwavemd.F90:91
wmmdatmd::nmpscr
integer nmpscr
NMPSCR.
Definition: wmmdatmd.F90:324
wmmdatmd::mdso
integer mdso
MDSO.
Definition: wmmdatmd.F90:313
wminitmd::wminit
subroutine wminit(IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, MPI_COMM, PREAMB)
Initialize multi-grid version of WAVEWATCH III.
Definition: wminitmd.F90:131
wmfinlmd::wmfinl
subroutine wmfinl
Initialize multi-grid version of WAVEWATCH III.
Definition: wmfinlmd.F90:75
wminitmd::wminitnml
subroutine wminitnml(IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, MPI_COMM, PREAMB)
Initialize multi-grid version of WAVEWATCH III.
Definition: wminitmd.F90:3502
wmmdatmd::mdss
integer mdss
MDSS.
Definition: wmmdatmd.F90:314
wmwavemd
Running the multi-grid version of WAVEWATCH III up to a given ending time for each grid.
Definition: wmwavemd.F90:14
wmmdatmd::improc
integer improc
IMPROC.
Definition: wmmdatmd.F90:322
wmmdatmd::nmproc
integer nmproc
NMPROC.
Definition: wmmdatmd.F90:321
wmmdatmd::nrgrd
integer nrgrd
NRGRD.
Definition: wmmdatmd.F90:330
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
wmmdatmd::mdst
integer mdst
MDST.
Definition: wmmdatmd.F90:315
w3mlti
program w3mlti
Program shell or driver to run the multi-grid wave model (uncoupled).
Definition: ww3_multi.F90:14
wmmdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: wmmdatmd.F90:16
wmmdatmd::etime
integer, dimension(2) etime
ETIME.
Definition: wmmdatmd.F90:329