WAVEWATCH III  beta 0.0.1
w3nmlboundmd.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 : 27-May-2021 |
11  !/ +-----------------------------------+
12  !/
13  !/ For updates see subroutines.
14  !/
15  ! 1. Purpose :
16  !
17  ! Manages namelists from configuration file ww3_bound.nml for ww3_bound 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 w3nmlbound (NDSI, INFILE, NML_BOUND, IERR)
45  !/
46  !/ +-----------------------------------+
47  !/ | WAVEWATCH III NOAA/NCEP |
48  !/ | M. Accensi |
49  !/ | |
50  !/ | FORTRAN 90 |
51  !/ | Last update : 27-May-2021 |
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_BOUND 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  !/S USE W3SERVMD, ONLY: STRACE
106 
107  IMPLICIT NONE
108 
109  INTEGER, INTENT(IN) :: NDSI
110  CHARACTER*(*), INTENT(IN) :: INFILE
111  TYPE(nml_bound_t), INTENT(INOUT) :: NML_BOUND
112  INTEGER, INTENT(OUT) :: IERR
113  !/S INTEGER, SAVE :: IENT = 0 !< strace error code
114 
115  ierr = 0
116  !/S CALL STRACE (IENT, 'W3NMLBOUND')
117 
118  ! open namelist log file
119  ndsn = 3
120  OPEN (ndsn, file=trim(infile)//'.log', form='formatted', iostat=ierr)
121  IF (ierr.NE.0) THEN
122  WRITE (ndse,'(A)') 'ERROR: open full nml file '//trim(infile)//'.log failed'
123  RETURN
124  END IF
125 
126  ! open input file
127  OPEN (ndsi, file=trim(infile), form='formatted', status='old', iostat=ierr)
128  IF (ierr.NE.0) THEN
129  WRITE (ndse,'(A)') 'ERROR: open input file '//trim(infile)//' failed'
130  RETURN
131  END IF
132 
133  ! read bound namelist
134  CALL read_bound_nml (ndsi, nml_bound)
135  CALL report_bound_nml (nml_bound)
136 
137  ! close namelist files
138  CLOSE (ndsi)
139  CLOSE (ndsn)
140 
141  END SUBROUTINE w3nmlbound
142 
143 
144  !/ ------------------------------------------------------------------- /
145 
146 
147 
148 
149 
150 
151  !/ ------------------------------------------------------------------- /
152 
153  SUBROUTINE read_bound_nml (NDSI, NML_BOUND)
154  !/
155  !/ +-----------------------------------+
156  !/ | WAVEWATCH III NOAA/NCEP |
157  !/ | M. Accensi |
158  !/ | |
159  !/ | FORTRAN 90 |
160  !/ | Last update : 27-May-2021 |
161  !/ +-----------------------------------+
162  !/
163  ! 1. Purpose :
164  !
165  !
166  ! 2. Method :
167  !
168  ! See source term routines.
169  !
170  ! 3. Parameters :
171  !
172  ! Parameter list
173  ! ----------------------------------------------------------------
174  ! NDSI Int.
175  ! NML_BOUND Type.
176  ! ----------------------------------------------------------------
177  !
178  ! 4. Subroutines used :
179  !
180  ! Name TYPE Module Description
181  ! ----------------------------------------------------------------
182  ! STRACE Subr. W3SERVMD SUBROUTINE tracing.
183  ! ----------------------------------------------------------------
184  !
185  ! 5. Called by :
186  !
187  ! Name TYPE Module Description
188  ! ----------------------------------------------------------------
189  ! W3NMLBOUND Subr. N/A Namelist configuration routine.
190  ! ----------------------------------------------------------------
191  !
192  ! 6. Error messages :
193  !
194  ! None.
195  !
196  ! 7. Remarks :
197  !
198  ! 8. Structure :
199  !
200  ! See source code.
201  !
202  ! 9. Switches :
203  !
204  ! 10. Source code :
205  !
206  !/ ------------------------------------------------------------------- /
207 
208  USE w3odatmd, ONLY: ndse
209  USE w3servmd, ONLY: extcde
210  !/S USE W3SERVMD, ONLY: STRACE
211 
212  IMPLICIT NONE
213 
214  INTEGER, INTENT(IN) :: NDSI
215  TYPE(nml_bound_t), INTENT(INOUT) :: NML_BOUND
216 
217  ! locals
218  INTEGER :: IERR
219  TYPE(nml_bound_t) :: BOUND
220  namelist /bound_nml/ bound
221  !/S INTEGER, SAVE :: IENT = 0 !< strace error code
222 
223  ierr = 0
224  !/S CALL STRACE (IENT, 'READ_BOUND_NML')
225 
226  ! set default values for track structure
227  bound%MODE = 'WRITE'
228  bound%INTERP = 2
229  bound%VERBOSE = 1
230  bound%FILE = 'spec.list'
231 
232  ! read bound namelist
233  rewind(ndsi)
234  READ (ndsi, nml=bound_nml, iostat=ierr, iomsg=msg)
235  IF (ierr.GT.0) THEN
236  WRITE (ndse,'(A,/A)') &
237  'ERROR: READ_BOUND_NML: namelist read error', &
238  'ERROR: '//trim(msg)
239  CALL extcde (1)
240  END IF
241 
242  ! save namelist
243  nml_bound = bound
244 
245  END SUBROUTINE read_bound_nml
246 
247  !/ ------------------------------------------------------------------- /
248 
249 
250 
251 
252 
253 
254 
255 
256  !/ ------------------------------------------------------------------- /
257 
258  SUBROUTINE report_bound_nml (NML_BOUND)
259  !/
260  !/ +-----------------------------------+
261  !/ | WAVEWATCH III NOAA/NCEP |
262  !/ | M. Accensi |
263  !/ | FORTRAN 90 |
264  !/ | Last update : 27-May-2021 |
265  !/ +-----------------------------------+
266  !/
267  !/
268  ! 1. Purpose :
269  !
270  !
271  ! 2. Method :
272  !
273  ! See source term routines.
274  !
275  ! 3. Parameters :
276  !
277  ! Parameter list
278  ! ----------------------------------------------------------------
279  ! NML_BOUND Type.
280  ! ----------------------------------------------------------------
281  !
282  ! 4. Subroutines used :
283  !
284  ! Name TYPE Module Description
285  ! ----------------------------------------------------------------
286  ! STRACE Subr. W3SERVMD SUBROUTINE tracing.
287  ! ----------------------------------------------------------------
288  !
289  ! 5. Called by :
290  !
291  ! Name TYPE Module Description
292  ! ----------------------------------------------------------------
293  ! W3NMLBOUND Subr. N/A Namelist configuration routine.
294  ! ----------------------------------------------------------------
295  !
296  ! 6. Error messages :
297  !
298  ! None.
299  !
300  ! 7. Remarks :
301  !
302  ! 8. Structure :
303  !
304  ! See source code.
305  !
306  ! 9. Switches :
307  !
308  ! 10. Source code :
309  !
310  !/ ------------------------------------------------------------------- /
311 
312  !/S USE W3SERVMD, ONLY: STRACE
313 
314  IMPLICIT NONE
315 
316  TYPE(nml_bound_t), INTENT(IN) :: NML_BOUND
317  !/S INTEGER, SAVE :: IENT = 0 ! strace error code
318 
319  !/S CALL STRACE (IENT, 'REPORT_BOUND_NML')
320 
321  WRITE (msg,'(A)') 'BOUND % '
322  WRITE (ndsn,'(A)')
323  WRITE (ndsn,10) trim(msg),'MODE = ', trim(nml_bound%MODE)
324  WRITE (ndsn,11) trim(msg),'INTERP = ', nml_bound%INTERP
325  WRITE (ndsn,11) trim(msg),'VERBOSE = ', nml_bound%VERBOSE
326  WRITE (ndsn,10) trim(msg),'FILE = ', trim(nml_bound%FILE)
327 
328 
329 10 FORMAT (a,2x,a,a)
330 11 FORMAT (a,2x,a,i8)
331 
332  END SUBROUTINE report_bound_nml
333 
334  !/ ------------------------------------------------------------------- /
335 
336 END MODULE w3nmlboundmd
337 
338 !/ ------------------------------------------------------------------- /
w3nmlboundmd::read_bound_nml
subroutine read_bound_nml(NDSI, NML_BOUND)
Definition: w3nmlboundmd.F90:154
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3nmlboundmd::ndsn
integer ndsn
namelist file unit
Definition: w3nmlboundmd.F90:37
w3nmlboundmd::msg
character(256) msg
report message
Definition: w3nmlboundmd.F90:36
w3servmd
Definition: w3servmd.F90:3
w3odatmd
Definition: w3odatmd.F90:3
w3nmlboundmd::report_bound_nml
subroutine report_bound_nml(NML_BOUND)
Definition: w3nmlboundmd.F90:259
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3nmlboundmd::w3nmlbound
subroutine w3nmlbound(NDSI, INFILE, NML_BOUND, IERR)
Definition: w3nmlboundmd.F90:45
w3nmlboundmd::nml_bound_t
Definition: w3nmlboundmd.F90:27
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
w3nmlboundmd
Definition: w3nmlboundmd.F90:3