WAVEWATCH III  beta 0.0.1
w3wdasmd.F90
Go to the documentation of this file.
1 
6 
7 #include "w3macros.h"
8 !/ ------------------------------------------------------------------- /
37 MODULE w3wdasmd
38  !/
39  !/ +-----------------------------------+
40  !/ | WAVEWATCH III NOAA/NCEP |
41  !/ | H. L. Tolman |
42  !/ | FORTRAN 90 |
43  !/ | Last update : 06-Dec-2010 |
44  !/ +-----------------------------------+
45  !/
46  !/ 25-Jan-2002 : Origination. ( version 2.17 )
47  !/ 27-Dec-2004 : Multiple grid version. ( version 3.06 )
48  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
49  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
50  !/ specify index closure for a grid. ( version 3.14 )
51  !/ (T. J. Campbell, NRL)
52  !/
53  !/ Copyright 2009 National Weather Service (NWS),
54  !/ National Oceanic and Atmospheric Administration. All rights
55  !/ reserved. WAVEWATCH III is a trademark of the NWS.
56  !/ No unauthorized use without permission.
57  !/
58  ! 1. Purpose :
59  !
60  ! This module is intended as the interface for externally supplied
61  ! data assimlation software to be used with WAVEWATCH III. The
62  ! main subroutine W3WDAS is incorporated in the generic WAVEWATCH
63  ! III shell ww3_shel, and thus provides integrated time management
64  ! and running of the wave model and data assimilation side by side.
65  !
66  ! Present wave conditions (including dynamically changing wave
67  ! grids), as well as wave data are passed to the routine through
68  ! the dynamic data structrure, as introduced in model version 3.06
69  !
70  ! A three tier data structure is used with three separate data
71  ! sets. Tentatively, they are intended for mean wave parameters,
72  ! 1-D and 2-D spectral data. This separation is made only for
73  ! economy in file and menory usage. All three data sets are defined
74  ! here onlt by a record length and a number of records. All data are
75  ! treated as real numbers, but the meaing of all record components
76  ! is completely at the discretion of the author of the data
77  ! assimilation scheme.
78  !
79  ! To promote portability, it is suggested to use this module only
80  ! as an interface to your own assimilation routine(s).
81  !
82  ! 2. Variables and types :
83  !
84  ! Name Type Scope Description
85  ! ----------------------------------------------------------------
86  ! ----------------------------------------------------------------
87  !
88  ! 3. Subroutines and functions :
89  !
90  ! Name Type Scope Description
91  ! ----------------------------------------------------------------
92  ! W3WDAS Subr. Public Actual wave model.
93  ! ----------------------------------------------------------------
94  !
95  ! 4. Subroutines and functions used :
96  !
97  ! Name Type Module Description
98  ! ----------------------------------------------------------------
99  ! .... Subr. W3SERVMD Service routines.
100  ! ----------------------------------------------------------------
101  !
102  ! 5. Remarks :
103  !
104  ! - This module still requires an OpenMP or MPI setup to be made
105  ! compatible with WAVEWATCH III inside the user supplied
106  ! routines.
107  !
108  ! 6. Switches :
109  !
110  ! !/S Enable subroutine tracing.
111  ! !/T Test output.
112  !
113  ! 7. Source code :
114  !
115  !/ ------------------------------------------------------------------- /
116  PUBLIC
117  !/
118 CONTAINS
119  !/ ------------------------------------------------------------------- /
132  SUBROUTINE w3wdas ( DASFLAG, RECL, NDAT, DATA0, DATA1, DATA2 )
133  !/
134  !/ +-----------------------------------+
135  !/ | WAVEWATCH III NOAA/NCEP |
136  !/ | H. L. Tolman |
137  !/ | FORTRAN 90 |
138  !/ | Last update : 06-Dec-2010 |
139  !/ +-----------------------------------+
140  !/
141  !/ 25-Jan-2002 : Origination. ( version 2.17 )
142  !/ 27-Dec-2004 : Multiple grid version. ( version 3.06 )
143  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
144  !/ specify index closure for a grid. ( version 3.14 )
145  !/ (T. J. Campbell, NRL)
146  !/
147  ! 1. Purpose :
148  !
149  ! WAVEWATCH III data assimilation interface routine.
150  !
151  ! 3. Parameters :
152  !
153  ! Parameter list
154  ! ----------------------------------------------------------------
155  ! DASFLAG L.A. I FLags for three data sets.
156  ! RECLD I.A. I Record lengths for three data sets.
157  ! ND I.A. I Number of data for three data sets.
158  ! DATAn R.A. I Observations.
159  ! ----------------------------------------------------------------
160  !
161  ! Local parameters :
162  ! ----------------------------------------------------------------
163  ! ----------------------------------------------------------------
164  !
165  ! 4. Subroutines used :
166  !
167  ! Name Type Module Description
168  ! ----------------------------------------------------------------
169  ! STRACE Subr. W3SERVMD Subroutine tracing.
170  ! EXTCDE Subr. W3SERVMD Program abort.
171  ! ----------------------------------------------------------------
172  !
173  ! 5. Called by :
174  !
175  ! Any program shell or integrated model after initialization of
176  ! WAVEWATCH III (to assure availability of data in used modules).
177  !
178  ! 6. Error messages :
179  !
180  ! 7. Remarks :
181  !
182  ! 8. Structure :
183  !
184  ! See source code.
185  !
186  ! 9. Switches :
187  !
188  ! !/S Enable subroutine tracing.
189  ! !/T Enable test output.
190  !
191  ! 10. Source code :
192  !
193  !/ ------------------------------------------------------------------- /
194  USE w3gdatmd
195  USE w3wdatmd
196  USE w3adatmd
197  USE w3odatmd, ONLY: ndso, ndse, ndst, screen, naproc, iaproc, &
199 #ifdef W3_S
200  USE w3servmd, ONLY: strace
201 #endif
202  !
203  IMPLICIT NONE
204  !
205 #ifdef W3_MPI
206  include "mpif.h"
207 #endif
208  !/
209  !/ ------------------------------------------------------------------- /
210  !/ Parameter list
211  !/
212  INTEGER, INTENT(IN) :: RECL(3), NDAT(3)
213  REAL, INTENT(IN) :: DATA0(RECL(1),NDAT(1))
214  REAL, INTENT(IN) :: DATA1(RECL(2),NDAT(2))
215  REAL, INTENT(IN) :: DATA2(RECL(3),NDAT(3))
216  LOGICAL, INTENT(IN) :: DASFLAG(3)
217  !/
218  !/ ------------------------------------------------------------------- /
219  !/ Local parameters :
220  !/
221  INTEGER :: J
222 #ifdef W3_T
223  INTEGER :: MREC, MDAT, IREC, IDAT
224 #endif
225 #ifdef W3_S
226  INTEGER, SAVE :: IENT = 0
227 #endif
228 #ifdef W3_T
229  REAL, ALLOCATABLE :: TDATA(:,:)
230 #endif
231  !/
232  !/ ------------------------------------------------------------------- /
233  ! 1. Initializations and test output
234  ! 1.a Subroutine tracing
235  !
236 #ifdef W3_S
237  CALL strace (ient, 'W3WDAS')
238 #endif
239  !
240  ! 1.b Echo part of parameter list (test output only).
241  !
242 #ifdef W3_T
243  WRITE (ndst,9000) ndso, ndse, ndst, screen, naproc, iaproc, &
244  napout, naperr, time
245  DO j=1, 3
246  IF ( dasflag(j) ) THEN
247  WRITE (ndst,9001) j, dasflag(j), recl(j), ndat(j)
248  mrec = min(recl(j),6)
249  mdat = min(ndat(j),10)
250  IF ( ALLOCATED(tdata) ) DEALLOCATE (tdata)
251  ALLOCATE ( tdata(recl(j),mdat) )
252  IF ( j .EQ. 1 ) tdata = data0(:,1:mdat)
253  IF ( j .EQ. 2 ) tdata = data1(:,1:mdat)
254  IF ( j .EQ. 3 ) tdata = data2(:,1:mdat)
255  DO idat=1, mdat
256  WRITE (ndst,9002) idat, tdata(1:mrec,idat)
257  IF ( mrec .LT. recl(j) ) WRITE (ndst,9003) &
258  tdata(mrec+1:recl(j),idat)
259  END DO
260  ELSE
261  WRITE (ndst,9001) j, dasflag(j)
262  END IF
263  END DO
264  IF ( ALLOCATED(tdata) ) DEALLOCATE (tdata)
265 #endif
266  !
267  ! 1.c Test grid info from W3GDATMD
268  !
269 #ifdef W3_T
270  WRITE (ndst,9010) nx, ny, nsea, nseal, nk, nth, &
271  iclose, flagll, sx, sy, x0, y0
272 #endif
273  !
274  ! 2. Actual data assimilation routine ------------------------------- /
275  !
276  ! User-defined data assimilation routines to be plugged in here.
277  ! All that could be needed is avainalble in this subroutine,
278  ! including the grid definition from W3GDATMD. All
279  ! can thus be included in the parameter list, and no explcit links
280  ! to other WAVEWATCH III routines will be needed within the
281  ! data assimilation routines ( with the possible exception of the
282  ! CONSTANTS module ), If there is a reason to terminate the code,
283  ! pass an error code out of the routine and use EXTCDE to stop
284  ! the WAVEWATCH III run altogether. Check the system documentation
285  ! on how to ad your routines to the compile and link system.
286  !
287  ! CALL .....
288  !
289  ! IF ( ..... ) CALL EXTCDE ( 99 )
290  !
291  RETURN
292  !
293  ! Formats
294  !
295  !1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3WDAS :'/ &
296  ! ' ILLIGAL GRID SIZES INPUT : ',4I8/ &
297  ! ' GRID : ',4I8/)
298 #ifdef W3_T
299 9000 FORMAT ( ' TEST W3WDAS : UNIT NUMBERS : ',4i4/ &
300  ' MPI SETTINGS : ',4i4/ &
301  ' TIME : ',i8.8,i7.6)
302 9001 FORMAT ( ' DATASET INFO : ',i1,l2,2i8)
303 9002 FORMAT (17x,i2,6e10.3)
304 9003 FORMAT (19x, 6e10.3)
305 #endif
306  !
307 #ifdef W3_T
308 9010 FORMAT ( ' TEST W3WDAS : ARRAY DIMS. : ',6i8/ &
309  ' GRID : ',1i2,1l2,4e11.4)
310 #endif
311  !/
312  !/ End of W3WDAS ----------------------------------------------------- /
313  !/
314  END SUBROUTINE w3wdas
315  !/
316  !/ End of module W3WDASMD -------------------------------------------- /
317  !/
318 END MODULE w3wdasmd
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::nseal
integer, pointer nseal
Definition: w3gdatmd.F90:1097
include
cmake src_list cmake include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake) check_switches("$
Definition: CMakeLists.txt:15
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3wdasmd
Intended as the interface for externally supplied data assimilation software.
Definition: w3wdasmd.F90:37
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3gdatmd::sy
real, pointer sy
Definition: w3gdatmd.F90:1183
w3odatmd::iaproc
integer, pointer iaproc
Definition: w3odatmd.F90:457
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3gdatmd::ny
integer, pointer ny
Definition: w3gdatmd.F90:1097
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3odatmd::naperr
integer, pointer naperr
Definition: w3odatmd.F90:457
w3gdatmd::x0
real, pointer x0
Definition: w3gdatmd.F90:1183
w3gdatmd::nsea
integer, pointer nsea
Definition: w3gdatmd.F90:1097
w3servmd
Definition: w3servmd.F90:3
w3odatmd::naplog
integer, pointer naplog
Definition: w3odatmd.F90:457
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd
Definition: w3odatmd.F90:3
w3odatmd::screen
integer, pointer screen
Definition: w3odatmd.F90:456
w3odatmd::naproc
integer, pointer naproc
Definition: w3odatmd.F90:457
w3gdatmd::iclose
integer, pointer iclose
Definition: w3gdatmd.F90:1096
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3odatmd::ndso
integer, pointer ndso
Definition: w3odatmd.F90:456
w3odatmd::napout
integer, pointer napout
Definition: w3odatmd.F90:457
w3gdatmd::y0
real, pointer y0
Definition: w3gdatmd.F90:1183
w3wdasmd::w3wdas
subroutine w3wdas(DASFLAG, RECL, NDAT, DATA0, DATA1, DATA2)
WAVEWATCH III data assimilation interface routine.
Definition: w3wdasmd.F90:133
w3gdatmd::sx
real, pointer sx
Definition: w3gdatmd.F90:1183
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3gdatmd
Definition: w3gdatmd.F90:16
w3gdatmd::nx
integer, pointer nx
Definition: w3gdatmd.F90:1097
w3gdatmd::flagll
logical, pointer flagll
Definition: w3gdatmd.F90:1219