WAVEWATCH III  beta 0.0.1
w3nmlbouncmd.F90
Go to the documentation of this file.
1 #include "w3macros.h"
2 !/ ------------------------------------------------------------------- /
4  !/
5  !/ +-----------------------------------+
6  !/ | WAVEWATCH III NOAA/NCEP |
7  !/ | M. Accensi |
8  !/ | |
9  !/ | FORTRAN 90 |
10  !/ | Last update : 15-May-2018 |
11  !/ +-----------------------------------+
12  !/
13  !/ For updates see subroutines.
14  !/
15  ! 1. Purpose :
16  !
17  ! Manages namelists from configuration file ww3_bounc.nml for ww3_bounc program
18  !
19  !/ ------------------------------------------------------------------- /
20 
21  ! module defaults
22  IMPLICIT NONE
23 
24  PUBLIC
25 
26  ! bound structure
28  CHARACTER(5) :: mode
29  INTEGER :: interp
30  INTEGER :: verbose
31  CHARACTER(128) :: file
32  END TYPE nml_bound_t
33 
34 
35  ! miscellaneous
36  CHARACTER(256) :: msg
37  INTEGER :: ndsn
38 
39 
40 
41 
42 CONTAINS
43  !/ ------------------------------------------------------------------- /
44  SUBROUTINE w3nmlbounc (NDSI, INFILE, NML_BOUND, IERR)
45  !/
46  !/ +-----------------------------------+
47  !/ | WAVEWATCH III NOAA/NCEP |
48  !/ | M. Accensi |
49  !/ | |
50  !/ | FORTRAN 90 |
51  !/ | Last update : 15-May-2018 |
52  !/ +-----------------------------------+
53  !/
54  !
55  ! 1. Purpose :
56  !
57  ! Reads all the namelist to define the input boundary
58  !
59  ! 2. Method :
60  !
61  ! See source term routines.
62  !
63  ! 3. Parameters :
64  !
65  ! Parameter list
66  ! ----------------------------------------------------------------
67  ! NDSI Int.
68  ! INFILE Char.
69  ! NML_BOUND type.
70  ! IERR Int.
71  ! ----------------------------------------------------------------
72  !
73  ! 4. Subroutines used :
74  !
75  ! Name TYPE Module Description
76  ! ----------------------------------------------------------------
77  ! STRACE Subr. W3SERVMD SUBROUTINE tracing.
78  ! READ_BOUND_NML
79  ! ----------------------------------------------------------------
80  !
81  ! 5. Called by :
82  !
83  ! Name TYPE Module Description
84  ! ----------------------------------------------------------------
85  ! WW3_BOUNC Prog. N/A Preprocess input boundaries.
86  ! ----------------------------------------------------------------
87  !
88  ! 6. Error messages :
89  !
90  ! None.
91  !
92  ! 7. Remarks :
93  !
94  ! 8. Structure :
95  !
96  ! See source code.
97  !
98  ! 9. Switches :
99  !
100  ! 10. Source code :
101  !
102  !/ ------------------------------------------------------------------- /
103 
104  USE w3odatmd, ONLY: ndse
105 #ifdef W3_S
106  USE w3servmd, ONLY: strace
107 #endif
108 
109  IMPLICIT NONE
110 
111  INTEGER, INTENT(IN) :: NDSI
112  CHARACTER*(*), INTENT(IN) :: INFILE
113  TYPE(nml_bound_t), INTENT(INOUT) :: NML_BOUND
114  INTEGER, INTENT(OUT) :: IERR
115 #ifdef W3_S
116  INTEGER, SAVE :: IENT = 0
117 #endif
118 
119  ierr = 0
120 #ifdef W3_S
121  CALL strace (ient, 'W3NMLBOUNC')
122 #endif
123 
124  ! open namelist log file
125  ndsn = 3
126  OPEN (ndsn, file=trim(infile)//'.log', form='formatted', iostat=ierr)
127  IF (ierr.NE.0) THEN
128  WRITE (ndse,'(A)') 'ERROR: open full nml file '//trim(infile)//'.log failed'
129  RETURN
130  END IF
131 
132  ! open input file
133  OPEN (ndsi, file=trim(infile), form='formatted', status='old', iostat=ierr)
134  IF (ierr.NE.0) THEN
135  WRITE (ndse,'(A)') 'ERROR: open input file '//trim(infile)//' failed'
136  RETURN
137  END IF
138 
139  ! read bound namelist
140  CALL read_bound_nml (ndsi, nml_bound)
141  CALL report_bound_nml (nml_bound)
142 
143  ! close namelist files
144  CLOSE (ndsi)
145  CLOSE (ndsn)
146 
147  END SUBROUTINE w3nmlbounc
148 
149 
150  !/ ------------------------------------------------------------------- /
151 
152 
153 
154 
155 
156 
157  !/ ------------------------------------------------------------------- /
158 
159  SUBROUTINE read_bound_nml (NDSI, NML_BOUND)
160  !/
161  !/ +-----------------------------------+
162  !/ | WAVEWATCH III NOAA/NCEP |
163  !/ | M. Accensi |
164  !/ | |
165  !/ | FORTRAN 90 |
166  !/ | Last update : 15-May-2018 |
167  !/ +-----------------------------------+
168  !/
169  ! 1. Purpose :
170  !
171  !
172  ! 2. Method :
173  !
174  ! See source term routines.
175  !
176  ! 3. Parameters :
177  !
178  ! Parameter list
179  ! ----------------------------------------------------------------
180  ! NDSI Int.
181  ! NML_BOUND Type.
182  ! ----------------------------------------------------------------
183  !
184  ! 4. Subroutines used :
185  !
186  ! Name TYPE Module Description
187  ! ----------------------------------------------------------------
188  ! STRACE Subr. W3SERVMD SUBROUTINE tracing.
189  ! ----------------------------------------------------------------
190  !
191  ! 5. Called by :
192  !
193  ! Name TYPE Module Description
194  ! ----------------------------------------------------------------
195  ! W3NMLBOUNC Subr. N/A Namelist configuration routine.
196  ! ----------------------------------------------------------------
197  !
198  ! 6. Error messages :
199  !
200  ! None.
201  !
202  ! 7. Remarks :
203  !
204  ! 8. Structure :
205  !
206  ! See source code.
207  !
208  ! 9. Switches :
209  !
210  ! 10. Source code :
211  !
212  !/ ------------------------------------------------------------------- /
213 
214  USE w3odatmd, ONLY: ndse
215  USE w3servmd, ONLY: extcde
216 #ifdef W3_S
217  USE w3servmd, ONLY: strace
218 #endif
219 
220  IMPLICIT NONE
221 
222  INTEGER, INTENT(IN) :: NDSI
223  TYPE(nml_bound_t), INTENT(INOUT) :: NML_BOUND
224 
225  ! locals
226  INTEGER :: IERR
227  TYPE(nml_bound_t) :: BOUND
228  namelist /bound_nml/ bound
229 #ifdef W3_S
230  INTEGER, SAVE :: IENT = 0
231 #endif
232 
233  ierr = 0
234 #ifdef W3_S
235  CALL strace (ient, 'READ_BOUND_NML')
236 #endif
237 
238  ! set default values for track structure
239  bound%MODE = 'WRITE'
240  bound%INTERP = 2
241  bound%VERBOSE = 1
242  bound%FILE = 'spec.list'
243 
244  ! read bound namelist
245  rewind(ndsi)
246  READ (ndsi, nml=bound_nml, iostat=ierr, iomsg=msg)
247  IF (ierr.GT.0) THEN
248  WRITE (ndse,'(A,/A)') &
249  'ERROR: READ_BOUND_NML: namelist read error', &
250  'ERROR: '//trim(msg)
251  CALL extcde (1)
252  END IF
253 
254  ! save namelist
255  nml_bound = bound
256 
257  END SUBROUTINE read_bound_nml
258 
259  !/ ------------------------------------------------------------------- /
260 
261 
262 
263 
264 
265 
266 
267 
268  !/ ------------------------------------------------------------------- /
269 
270  SUBROUTINE report_bound_nml (NML_BOUND)
271  !/
272  !/ +-----------------------------------+
273  !/ | WAVEWATCH III NOAA/NCEP |
274  !/ | M. Accensi |
275  !/ | FORTRAN 90 |
276  !/ | Last update : 15-May-2018 |
277  !/ +-----------------------------------+
278  !/
279  !/
280  ! 1. Purpose :
281  !
282  !
283  ! 2. Method :
284  !
285  ! See source term routines.
286  !
287  ! 3. Parameters :
288  !
289  ! Parameter list
290  ! ----------------------------------------------------------------
291  ! NML_BOUND Type.
292  ! ----------------------------------------------------------------
293  !
294  ! 4. Subroutines used :
295  !
296  ! Name TYPE Module Description
297  ! ----------------------------------------------------------------
298  ! STRACE Subr. W3SERVMD SUBROUTINE tracing.
299  ! ----------------------------------------------------------------
300  !
301  ! 5. Called by :
302  !
303  ! Name TYPE Module Description
304  ! ----------------------------------------------------------------
305  ! W3NMLBOUNC Subr. N/A Namelist configuration routine.
306  ! ----------------------------------------------------------------
307  !
308  ! 6. Error messages :
309  !
310  ! None.
311  !
312  ! 7. Remarks :
313  !
314  ! 8. Structure :
315  !
316  ! See source code.
317  !
318  ! 9. Switches :
319  !
320  ! 10. Source code :
321  !
322  !/ ------------------------------------------------------------------- /
323 
324 #ifdef W3_S
325  USE w3servmd, ONLY: strace
326 #endif
327 
328  IMPLICIT NONE
329 
330  TYPE(nml_bound_t), INTENT(IN) :: NML_BOUND
331 #ifdef W3_S
332  INTEGER, SAVE :: IENT = 0
333 #endif
334 
335 #ifdef W3_S
336  CALL strace (ient, 'REPORT_BOUND_NML')
337 #endif
338 
339  WRITE (msg,'(A)') 'BOUND % '
340  WRITE (ndsn,'(A)')
341  WRITE (ndsn,10) trim(msg),'MODE = ', trim(nml_bound%MODE)
342  WRITE (ndsn,11) trim(msg),'INTERP = ', nml_bound%INTERP
343  WRITE (ndsn,11) trim(msg),'VERBOSE = ', nml_bound%VERBOSE
344  WRITE (ndsn,10) trim(msg),'FILE = ', trim(nml_bound%FILE)
345 
346 
347 10 FORMAT (a,2x,a,a)
348 11 FORMAT (a,2x,a,i8)
349 
350  END SUBROUTINE report_bound_nml
351 
352  !/ ------------------------------------------------------------------- /
353 
354 
355 
356 
357 END MODULE w3nmlbouncmd
358 
359 !/ ------------------------------------------------------------------- /
w3nmlbouncmd::msg
character(256) msg
Definition: w3nmlbouncmd.F90:36
w3nmlbouncmd::ndsn
integer ndsn
Definition: w3nmlbouncmd.F90:37
w3nmlbouncmd::w3nmlbounc
subroutine w3nmlbounc(NDSI, INFILE, NML_BOUND, IERR)
Definition: w3nmlbouncmd.F90:45
w3nmlbouncmd::read_bound_nml
subroutine read_bound_nml(NDSI, NML_BOUND)
Definition: w3nmlbouncmd.F90:160
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3servmd
Definition: w3servmd.F90:3
w3odatmd
Definition: w3odatmd.F90:3
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
interp
subroutine interp(MXM, MYM, XC, IX21, IX22, IY21, IY22, RD11, RD12, RD21, RD22, FILLVALUE, FA)
Interpolate from a field read from file to the wave grid.
Definition: ww3_prnc.F90:2580
w3nmlbouncmd
Definition: w3nmlbouncmd.F90:3
w3nmlbouncmd::report_bound_nml
subroutine report_bound_nml(NML_BOUND)
Definition: w3nmlbouncmd.F90:271
w3nmlbouncmd::nml_bound_t
Definition: w3nmlbouncmd.F90:27