WAVEWATCH III  beta 0.0.1
gx_outp.F90
Go to the documentation of this file.
1 
9 
10 #include "w3macros.h"
11 !/ ------------------------------------------------------------------- /
25 PROGRAM gxoutp
26  !/
27  !/ +-----------------------------------+
28  !/ | WAVEWATCH III NOAA/NCEP |
29  !/ | H. L. Tolman |
30  !/ | J.H. Alves |
31  !/ | F. Ardhuin |
32  !/ | FORTRAN 90 |
33  !/ | Last update : 27-Aug-2015 |
34  !/ +-----------------------------------+
35  !/
36  !/ 30-Jun-1999 : Final FORTRAN 77 ( version 1.18 )
37  !/ 24-Jan-2000 : Upgrade to FORTRAN 90 ( version 2.00 )
38  !/ 14-Feb-2000 : Exact nonlinear interactions ( version 2.01 )
39  !/ 25-Jan-2001 : Cartesian grid version ( version 2.06 )
40  !/ 02-Feb-2001 : Xnl version 3.0 ( version 2.07 )
41  !/ 13-Nov-2002 : Add stress vector. ( version 3.00 )
42  !/ 27-Nov-2002 : First version of VDIA and MDIA. ( version 3.01 )
43  !/ 01-Aug-2003 : Fix format for SH output points. ( version 3.03 )
44  !/ 24-Dec-2004 : Multiple grid version. ( version 3.06 )
45  !/ 23-Jun-2006 : Linear input added. ( version 3.09 )
46  !/ 29-Jun-2006 : Adding file name preamble. ( version 3.09 )
47  !/ 03-Jul-2006 : Separate flux modules. ( version 3.09 )
48  !/ 25-Jul-2006 : Grid ID for each point. ( version 3.10 )
49  !/ 25-Apr-2007 : EMEAN in W3SPR2 par list. ( version 3.11 )
50  !/ 09-Oct-2007 : WAM 4+ Sin and Sds added. ( version 3.13 )
51  !/ (F. Ardhuin)
52  !/ 09-Oct-2007 : Experimental Sbs (BS1) added. ( version 3.13 )
53  !/ (F. Ardhuin)
54  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
55  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
56  !/ (W. E. Rogers & T. J. Campbell, NRL)
57  !/ 30-Aug-2010 : Adding ST4 ( version 3.14 )
58  !/ 20-Apr-2010 : Fix initialization of USTAR. ( version 3.14.1 )
59  !/ 23-Aug-2012 : Adding movable bed friction BT4 ( version 4.07 )
60  !/ 16-Jul-2012 : Move GMD (SNL3) and nonlinear filter (SNLS)
61  !/ from 3.15 (HLT). ( version 4.08 )
62  !/ 26-Dec-2012 : Modified obsolete declarations. ( version 4.11 )
63  !/ 27-Aug-2015 : Sice add as additional output ( version 5.10 )
64  !/ (in source terms)
65  !/ 19-Jul-2021 : Momentum and air density support ( version 7.14 )
66  !/
67  !/ Copyright 2009-2012 National Weather Service (NWS),
68  !/ National Oceanic and Atmospheric Administration. All rights
69  !/ reserved. WAVEWATCH III is a trademark of the NWS.
70  !/ No unauthorized use without permission.
71  !/
72  ! 1. Purpose :
73  !
74  ! Post-processing of point output for GrADS post-processing.
75  !
76  ! 2. Method :
77  !
78  ! In order to be able to plot spectra and source terms as
79  ! fields, spectral data is written as if it is fields data.
80  ! The spectral direction becomes the longitude, 90.-FREQ
81  ! become the latitude. This way, polar plots can be made
82  ! using the GrADS 'NPS' map option. The level or z coordinate
83  ! is used to store spectra and source terms for separate
84  ! output points. The name of the output point is stored in
85  ! the control file as the 'description' of the field.
86  ! Also written is a separate file with mean input and wave
87  ! parameters. This file contains per level and per time a
88  ! single line containing :
89  !
90  ! Station ID, Longitude, Latitude, Depth, , Wind speed.
91  ! U and V components, Air-Sea Temperature difference,
92  ! Current velocity, U and V components, Significant
93  ! wave height.
94  !
95  ! The files generated are :
96  !
97  ! ww3.spec.ctl GrADS control file.
98  ! ww3.spec.grads GrADS data file.
99  ! ww3.mean.grads File with additional input and wave
100  ! parameters.
101  !
102  ! The first direction set to 90 degr. Grads NPS plot should
103  ! therefore have 'set lon -180 180' for oceanographic directional
104  ! convention.
105  !
106  ! Examples of using the three files can be found in spec.gs and
107  ! source.gs.
108  !
109  ! 3. Parameters :
110  !
111  ! 4. Subroutines used :
112  !
113  ! Name Type Module Description
114  ! ----------------------------------------------------------------
115  ! W3NMOD Subr. W3GDATMD Set number of model.
116  ! W3SETG Subr. Id. Point to selected model.
117  ! W3NDAT Subr. W3WDATMD Set number of model for wave data.
118  ! W3SETW Subr. Id. Point to selected model for wave data.
119  ! W3NAUX Subr. W3ADATMD Set number of model for aux data.
120  ! W3SETA Subr. Id. Point to selected model for aux data.
121  ! W3NOUT Subr. W3ODATMD Set number of model for output.
122  ! W3SETO Subr. Id. Point to selected model for output.
123  ! ITRACE Subr. W3SERVMD Subroutine tracing initialization.
124  ! STRACE Subr. Id. Subroutine tracing.
125  ! NEXTLN Subr. Id. Get next line from input filw
126  ! EXTCDE Subr. Id. Abort program as graceful as possible.
127  ! STME21 Subr. W3TIMEMD Convert time to string.
128  ! TICK21 Subr. Id. Advance time.
129  ! DSEC21 Func. Id. Difference between times.
130  ! W3IOGR Subr. W3IOGRMD Reading/writing model definition file.
131  ! W3IOPO Subr. W3IOPOMD Reading/writing raw point output file.
132  ! GXEXPO Subr. Internal Execute point output.
133  ! ----------------------------------------------------------------
134  !
135  ! 5. Called by :
136  !
137  ! None, stand-alone program.
138  !
139  ! 6. Error messages :
140  !
141  ! Checks on input, checks in W3IOxx.
142  ! Check on grid type.
143  !
144  ! 7. Remarks :
145  !
146  ! - Curvilinear grids currently not supported.
147  !
148  ! 8. Structure :
149  !
150  ! See source code.
151  !
152  ! 9. Switches :
153  !
154  ! !/S Enable subroutine tracing.
155  !
156  ! 10. Source code :
157  !
158  !/ ------------------------------------------------------------------- /
159  USE constants
160  !/
161  ! USE W3GDATMD, ONLY: W3NMOD, W3SETG
162  USE w3wdatmd, ONLY: w3setw, w3ndat
163 #ifdef W3_NL1
164  USE w3adatmd, ONLY: w3seta, w3naux
165 #endif
166  USE w3odatmd, ONLY: w3seto, w3nout
167  USE w3iogrmd, ONLY: w3iogr
168 #ifdef W3_BIN2NC
169  USE w3iopomd, ONLY: w3iopon
170 #else
171  USE w3iopomd, ONLY: w3iopo
172 #endif
173  USE w3servmd, ONLY : itrace, nextln, extcde
174 #ifdef W3_S
175  USE w3servmd, ONLY : strace
176 #endif
177  USE w3timemd, ONLY: stme21, tick21, dsec21
178  !/
179  USE w3gdatmd
180  USE w3wdatmd, ONLY: time
181  USE w3odatmd, ONLY: ndse, ndst, ndso, nopts, ptloc, ptnme, &
182  dpo, wao, wdo, aso, cao, cdo, spco, fnmpre, &
183  grdid, iceo, iceho, icefo
184 #ifdef W3_FLX5
185  USE w3odatmd, ONLY: tauao, taudo, dairo
186 #endif
187  !
188  IMPLICIT NONE
189  !/
190  !/ ------------------------------------------------------------------- /
191  !/ Local parameters
192  !/
193  INTEGER :: ndsi, ndsm, ndsop, ndsgrd, ndspnt, &
194  ndscgr, ndstrc, ntrace, ierr, &
195  iotest, i, tout(2), nout, tdum(2), &
196  nreq, ipoint, nlev, iout, time0(2), &
197  ih0, im0, id0, iid, ij0, iinc, ik, &
198  ireq, timen(2), j
199 #ifdef W3_S
200  INTEGER, SAVE :: ient = 0
201 #endif
202  REAL :: dtreq, dtest
203  REAL :: undefp = -99.e20
204  REAL :: fact
205  LOGICAL :: flsrce(7)
206  LOGICAL, ALLOCATABLE :: flreq(:)
207  CHARACTER :: comstr*1, idtime*23, iddday*11, &
208  cinc*2
209  CHARACTER(LEN=3) :: mnth(12)
210  CHARACTER(LEN=25) :: idsrce(7)
211  !/
212  !/ ------------------------------------------------------------------- /
213  !/
214  DATA idsrce / 'Spectrum ' , &
215  'Wind-wave interactions ' , &
216  'Nonlinear interactions ' , &
217  'Dissipation ' , &
218  'Wave-bottom interactions ' , &
219  'Wave-ice interactions ' , &
220  'Sum of selected sources ' /
221  DATA flsrce / .false. , .false. , .false. , &
222  .false. , .false. , .false., .false. /
223  DATA time0 / -1, 0 /
224  DATA mnth / 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', &
225  'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' /
226  !
227  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
228  ! 1. IO set-up.
229  !
230  CALL w3nmod ( 1, 6, 6 )
231  CALL w3setg ( 1, 6, 6 )
232  CALL w3ndat ( 6, 6 )
233  CALL w3setw ( 1, 6, 6 )
234 #ifdef W3_NL1
235  CALL w3naux ( 6, 6 )
236  CALL w3seta ( 1, 6, 6 )
237 #endif
238  CALL w3nout ( 6, 6 )
239  CALL w3seto ( 1, 6, 6 )
240  !
241  ndsi = 10
242  ndsm = 20
243  ndsop = 20
244  ndsgrd = 30
245  ndspnt = 31
246  ndscgr = 32
247  !
248  ndstrc = 6
249  ntrace = 0
250  !
251  WRITE (ndso,900)
252  !
253  CALL itrace ( ndstrc, ntrace )
254 #ifdef W3_S
255  CALL strace (ient, 'GXOUTP')
256 #endif
257  !
258  j = len_trim(fnmpre)
259  OPEN (ndsi,file=fnmpre(:j)//'gx_outp.inp',status='OLD', &
260  err=800,iostat=ierr)
261  READ (ndsi,'(A)',END=801,ERR=802) comstr
262  IF (comstr.EQ.' ') comstr = '$'
263  WRITE (ndso,901) comstr
264  !
265  OPEN (ndsgrd,file=fnmpre(:j)//'ww3.spec.grads', &
266  form='UNFORMATTED', convert=file_endian)
267  OPEN (ndspnt,file=fnmpre(:j)//'ww3.mean.grads',form='FORMATTED')
268  OPEN (ndscgr,file=fnmpre(:j)//'ww3.spec.ctl',form='FORMATTED')
269  !
270  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
271  ! 2. Read model definition file.
272  !
273  CALL w3iogr ( 'READ', ndsm )
274  WRITE (ndso,920) gname
275  IF ( flagll ) THEN
276  fact = 1.
277  ELSE
278  fact = 1.e-3
279  END IF
280  !
281  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
282  ! 3. Read general data and first fields from file
283  !
284 #ifdef W3_BIN2NC
285  CALL w3iopon ( 'READ', ndsop, iotest )
286 #else
287  CALL w3iopo ( 'READ', ndsop, iotest )
288 #endif
289  ALLOCATE ( flreq(nopts) )
290  !
291  WRITE (ndso,930)
292  DO i=1, nopts
293  IF ( flagll ) THEN
294  WRITE (ndso,931) ptnme(i), fact*ptloc(1,i), fact*ptloc(2,i)
295  ELSE
296  WRITE (ndso,932) ptnme(i), fact*ptloc(1,i), fact*ptloc(2,i)
297  END IF
298  END DO
299  !
300  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
301  ! 4. Read requests from input file.
302  ! Output times
303  !
304  CALL nextln ( comstr , ndsi , ndse )
305  READ (ndsi,*,END=801,ERR=802) TOUT, DTREQ, nout
306  dtreq = max( 0. , dtreq )
307  IF ( dtreq.EQ.0 ) nout = 1
308  nout = max( 1 , nout )
309  !
310  CALL stme21 ( tout , idtime )
311  WRITE (ndso,940) idtime
312  !
313  tdum = 0
314  CALL tick21 ( tdum , dtreq )
315  CALL stme21 ( tdum , idtime )
316  IF ( dtreq .GE. 86400. ) THEN
317  WRITE (iddday,'(I10,1X)') int(dtreq/86400.)
318  ELSE
319  iddday = ' '
320  END IF
321  idtime(1:11) = iddday
322  idtime(21:23) = ' '
323  WRITE (ndso,941) idtime, nout
324  !
325  ! ... Output points
326  !
327  flreq = .false.
328  nreq = 0
329  !
330  DO
331  CALL nextln ( comstr , ndsi , ndse )
332  READ (ndsi,*,END=801,ERR=802) ipoint
333  IF ( ipoint .GT. 0 ) THEN
334  IF ( ipoint .LE. nopts ) THEN
335  IF ( .NOT. flreq(ipoint) ) nreq = nreq + 1
336  flreq(ipoint) = .true.
337  END IF
338  ELSE
339  EXIT
340  END IF
341  END DO
342  !
343  ! ... Output of output points
344  !
345  WRITE (ndso,950) nreq
346  DO i=1, nopts
347  IF (flreq(i)) THEN
348  IF ( flagll ) THEN
349  WRITE (ndso,951) ptnme(i), fact*ptloc(1,i), &
350  fact*ptloc(2,i)
351  ELSE
352  WRITE (ndso,956) ptnme(i), fact*ptloc(1,i), &
353  fact*ptloc(2,i)
354  END IF
355  END IF
356  END DO
357  !
358  ! ... Output of output points
359  !
360  CALL nextln ( comstr , ndsi , ndse )
361  READ (ndsi,*,END=801,ERR=802) flsrce
362  WRITE (ndso,952)
363  nlev = 0
364  DO i=1, 7
365  IF ( flsrce(i) ) THEN
366  WRITE (ndst,953) idsrce(i)
367  nlev = nlev + 1
368  END IF
369  END DO
370  !
371  WRITE (ndso,955)
372  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
373  ! 5. Time management.
374  !
375  iout = 0
376  !
377  DO
378  dtest = dsec21( time , tout )
379  IF ( dtest .GT. 0. ) THEN
380 #ifdef W3_BIN2NC
381  CALL w3iopon ( 'READ', ndsop, iotest )
382 #else
383  CALL w3iopo ( 'READ', ndsop, iotest )
384 #endif
385  IF ( iotest .EQ. -1 ) THEN
386  WRITE (ndso,998)
387  EXIT
388  END IF
389  cycle
390  END IF
391  IF ( dtest .LT. 0. ) THEN
392  CALL tick21 ( tout , dtreq )
393  cycle
394  END IF
395  !
396  iout = iout + 1
397  CALL stme21 ( tout , idtime )
398  !
399  CALL gxexpo
400  timen = tout
401  !
402  IF ( time0(1) .EQ. -1 ) time0 = time
403  !
404  CALL tick21 ( tout , dtreq )
405  IF ( iout .GE. nout ) EXIT
406  END DO
407  !
408  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
409  ! 6. Close data file and write control file
410  ! 6.a Close data sets
411  !
412  WRITE (ndso,960)
413  !
414  WRITE (ndso,961)
415  CLOSE (ndsgrd)
416  CLOSE (ndspnt)
417  !
418  WRITE (ndso,962)
419  !
420  ! 6.b Set up timing info
421  !
422  ih0 = time0(2)/10000
423  im0 = mod(time0(2)/100,100)
424  id0 = mod(time0(1),100)
425  iid = mod(time0(1)/100,100)
426  ij0 = time0(1)/10000
427  !
428  IF ( iout .GT. 1 ) dtreq = dsec21( time0, timen ) / real(iout-1)
429  IF ( iout .EQ. 1 ) dtreq = 3600.
430  IF ( dtreq .GT. 3599. ) THEN
431  cinc = 'HR'
432  iinc = nint(dtreq/3600.)
433  IF ( mod(nint(dtreq),3600) .NE. 0 ) GOTO 820
434  ELSE
435  cinc = 'MN'
436  iinc = nint(dtreq/60.)
437  END IF
438  !
439  WRITE (ndso,963) iout, ih0, im0, id0, mnth(iid), ij0, iinc, cinc
440  !
441  ! 6.c Write control file for spectral data
442  !
443  WRITE (ndso,964)
444  !
445  WRITE (ndscgr,970) undefp, nth, 90.+th(1)*rade, dth*rade, &
446  nk, (90.-tpiinv*sig(ik),ik=nk,max(1,nk-4),-1)
447  WRITE (ndscgr,971) (90.-tpiinv*sig(ik),ik=nk-5,1,-1)
448  WRITE (ndscgr,972) nlev, 1., 1., &
449  iout, ih0, im0, id0, mnth(iid), ij0, &
450  iinc, cinc, nreq
451  !
452  ireq = 0
453  DO i=1, nopts
454  IF ( flreq(i) ) THEN
455  ireq = ireq + 1
456  WRITE (ndscgr,973) ireq, nlev, 99, ptnme(i)
457  END IF
458  END DO
459  !
460  WRITE (ndscgr,974)
461  !
462  GOTO 888
463  !
464  ! Escape locations read errors :
465  !
466 800 CONTINUE
467  WRITE (ndse,1000) ierr
468  CALL extcde ( 10 )
469  !
470 801 CONTINUE
471  WRITE (ndse,1001)
472  CALL extcde ( 11 )
473  !
474 802 CONTINUE
475  WRITE (ndse,1002) ierr
476  CALL extcde ( 12 )
477  !
478 820 CONTINUE
479  WRITE (ndse,1020) dtreq
480  CALL extcde ( 20 )
481  !
482 821 CONTINUE
483  WRITE (ndse,1021)
484  CALL extcde ( 21 )
485  !
486 888 CONTINUE
487  !
488  WRITE (ndso,999)
489  !
490  ! Formats
491  !
492 900 FORMAT (/12x,' *** WAVEWATCH III GrADS point output post.*** '/ &
493  12x,'====================================================='/)
494 901 FORMAT ( ' Comment character is ''',a,''''/)
495  !
496 920 FORMAT ( ' Grid name : ',a/)
497  !
498 930 FORMAT ( ' Points in file : '/ &
499  ' ------------------------------------')
500 
501 931 FORMAT ( ' ',a,2f10.2)
502 
503 932 FORMAT ( ' ',a,2(f8.1,'E3'))
504  !
505 940 FORMAT (/' Output time data : '/ &
506  ' --------------------------------------------------'/ &
507  ' First time : ',a)
508 941 FORMAT ( ' Interval : ',a/ &
509  ' Number of requests : ',i4)
510  !
511 950 FORMAT (/' Requested output for',i3,' points : '/ &
512  ' --------------------------------------------------')
513 
514 951 FORMAT ( ' ',a,2f10.2)
515 
516 956 FORMAT ( ' ',a,2(f8.1,'E3'))
517 
518 952 FORMAT (/' Requested output fields :'/ &
519  ' --------------------------------------------------')
520 953 FORMAT ( ' ',a)
521 955 FORMAT (/' Output times :'/ &
522  ' --------------------------------------------------')
523  !
524 960 FORMAT (//' Final file management '/ &
525  ' -----------------------------------------------------')
526 961 FORMAT ( ' Closing file ww3.spec.grads'/ &
527  ' Closing file ww3.mean.grads')
528 962 FORMAT ( ' Preparing control files :')
529 963 FORMAT ( ' Number of times : ',i6/ &
530  ' Initial time ID : ',i2.2,':',i2.2,'Z',i2.2,a3,i4/ &
531  ' Time step ID : ',i2,a2)
532 964 FORMAT ( ' Writing ww3.spec.ctl'/)
533  !
534 970 FORMAT ('DSET ww3.spec.grads'/ &
535  'TITLE WAVEWATCH III spectra and source terms'/ &
536  'OPTIONS sequential'/ &
537  'OPTIONS big_endian'/ &
538  'UNDEF ',e10.2/ &
539  'XDEF ',i4,' LINEAR ',2f8.2/ &
540  'YDEF ',i4,' LEVELS ',5f8.4)
541 971 FORMAT (22x,5f8.4)
542 972 FORMAT ('ZDEF ',i4,' LINEAR ',2f8.2/ &
543  'TDEF ',i4,' LINEAR ',i6.2,':',i2.2,'Z',i2.2,a3,i4, &
544  2x,i2,a2/ &
545  'VARS ',i4)
546 973 FORMAT ('LOC',i3.3,2i4,2x,a)
547 974 FORMAT ('ENDVARS')
548  !
549 998 FORMAT (/' End of file reached '/)
550  !
551 999 FORMAT (/' End of program '/ &
552  ' ========================================='/ &
553  ' WAVEWATCH III GrADS point output '/)
554  !
555 1000 FORMAT (/' *** WAVEWATCH III ERROR IN GXOUTP : '/ &
556  ' ERROR IN OPENING INPUT FILE'/ &
557  ' IOSTAT =',i5/)
558  !
559 1001 FORMAT (/' *** WAVEWATCH III ERROR IN GXOUTP : '/ &
560  ' PREMATURE END OF INPUT FILE'/)
561  !
562 1002 FORMAT (/' *** WAVEWATCH III ERROR IN GXOUTP : '/ &
563  ' ERROR IN READING FROM INPUT FILE'/ &
564  ' IOSTAT =',i5/)
565  !
566 1020 FORMAT (/' *** WAVEWATCH III ERROR IN GXOUTF : '/ &
567  ' FIELD INCREMENT > 1HR BUT NOT MULTIPLE',f10.0/)
568  !
569 1021 FORMAT (/' *** WAVEWATCH III ERROR IN GXOUTF : '/ &
570  ' UPDATE PARS IN LOOP 610 !!!'/)
571  !/
572  !/ Internal subroutine GXEXPO ---------------------------------------- /
573  !/
574 CONTAINS
575  !/ ------------------------------------------------------------------- /
582  SUBROUTINE gxexpo
583  !/
584  !/ +-----------------------------------+
585  !/ | WAVEWATCH III NOAA/NCEP |
586  !/ | H. L. Tolman |
587  !/ | FORTRAN 90 |
588  !/ | Last update : 16-Jul-2012 |
589  !/ +-----------------------------------+
590  !/
591  !/ 30-Jun-1999 : Final FORTRAN 77 ( version 1.18 )
592  !/ 24-Jan-2000 : Upgrade to FORTRAN 90 ( version 2.00 )
593  !/ Massive changes to logistics
594  !/ 25-Jan-2001 : Cartesian grid version ( version 2.06 )
595  !/ 02-Feb-2001 : Xnl version 5 ( version 2.07 )
596  !/ 01-Aug-2003 : Fix format for SH output points. ( version 3.03 )
597  !/ 24-Dec-2004 : Multiple grid version. ( version 3.06 )
598  !/ 23-Jun-2006 : Linear input added. ( version 3.09 )
599  !/ 03-Jul-2006 : Separate flux modules. ( version 3.09 )
600  !/ 25-Jul-2006 : Grid ID for each point. ( version 3.10 )
601  !/ 25-Apr-2007 : EMEAN in W3SPR2 par list. ( version 3.11 )
602  !/ 09-Oct-2007 : WAM 4+ Sin and Sds added. ( version 3.13 )
603  !/ (F. Ardhuin)
604  !/ 09-Oct-2007 : Experimental Sbs (BS1) added. ( version 3.13 )
605  !/ (F. Ardhuin)
606  !/ 16-Jul-2012 : Move GMD (SNL3) and nonlinear filter (SNLS)
607  !/ from 3.15 (HLT). ( version 4.08 )
608  !/ 18-Aug-2018 : S_{ice} IC5 (Q. Liu) ( version 6.06 )
609  !/
610  ! 1. Purpose :
611  !
612  ! Perform actual point output.
613  !
614  ! 3. Parameters :
615  !
616  ! 4. Subroutines used :
617  !
618  ! Name Type Module Description
619  ! ----------------------------------------------------------------
620  ! W3SPRn Subr. W3SRCnMD Mean wave parameters for use in
621  ! source terms.
622  ! W3FLXn Subr. W3FLXnMD Flux/stress computation.
623  ! W3SLNn Subr. W3SLNnMD Linear input.
624  ! W3SINn Subr. W3SRCnMD Input source term.
625  ! W3SDSn Subr. W3SRCnMD Whitecapping source term
626  ! W3SNLn Subr. W3SNLnMD Nonlinear interactions.
627  ! W3SBTn Subr. W3SBTnMD Bottom friction source term.
628  ! W3SDBn Subr. W3SBTnMD Depth induced breaking source term.
629  ! W3STRn Subr. W3STRnMD Triad interaction source term.
630  ! W3SBSn Subr. W3SBSnMD Bottom scattering source term.
631  ! W3SXXn Subr. W3SXXnMD Unclassified source term.
632  ! STRACE Subr. W3SERVMD Subroutine tracing.
633  ! STME21 Subr. W3TIMEMD Convert time to string.
634  ! ----------------------------------------------------------------
635  !
636  ! 5. Called by :
637  !
638  ! Program in which it is contained.
639  !
640  ! 6. Error messages :
641  !
642  ! None.
643  !
644  ! 7. Remarks :
645  !
646  ! - Spectra are relative frequency energy spectra.
647  ! - Note that arrays CX and CY of the main program now contain
648  ! the absolute current speed and direction respectively.
649  !
650  ! 8. Structure :
651  !
652  ! See source code.
653  !
654  ! 9. Switches :
655  !
656  ! !/S Enable subroutine tracing.
657  ! !/T Enable test output.
658  !
659  ! !/FLXx Flux/stress computation.
660  ! !/LNx Linear input package
661  ! !/STx Source term package
662  ! !/NLx Nonlinear interaction package
663  ! !/BTx Bottom friction package
664  ! !/ICx Ice source term package
665  ! !/DBx Depth-induced breaking package
666  ! !/TRx Triad interaction package
667  ! !/BSx Bottom scattering package
668  !
669  ! !/STAB2 Stability correction for !/ST2
670  !
671  ! 10. Source code :
672  !
673  !/ ------------------------------------------------------------------- /
674 #ifdef W3_FLX1
675  USE w3flx1md
676 #endif
677 #ifdef W3_FLX2
678  USE w3flx2md
679 #endif
680 #ifdef W3_FLX3
681  USE w3flx3md
682 #endif
683 #ifdef W3_FLX4
684  USE w3flx4md
685 #endif
686 #ifdef W3_FLX5
687  USE w3flx5md
688 #endif
689 #ifdef W3_LN1
690  USE w3sln1md
691 #endif
692 #ifdef W3_ST1
693  USE w3src1md
694 #endif
695 #ifdef W3_ST2
696  USE w3src2md
697 #endif
698 #ifdef W3_ST3
699  USE w3src3md
700 #endif
701 #ifdef W3_ST4
702  USE w3src4md, ONLY : w3spr4, w3sin4, w3sds4
703 #endif
704 #ifdef W3_ST6
705  USE w3src6md
706  USE w3swldmd, ONLY : w3swl6
707  USE w3gdatmd, ONLY : swl6s6
708 #endif
709 #ifdef W3_NL1
710  USE w3snl1md
711 #endif
712 #ifdef W3_NL2
713  USE w3snl2md
714 #endif
715 #ifdef W3_NL3
716  USE w3snl3md
717 #endif
718 #ifdef W3_NL4
719  USE w3snl4md
720 #endif
721 #ifdef W3_NLS
722  USE w3snlsmd
723 #endif
724 #ifdef W3_BT1
725  USE w3sbt1md
726 #endif
727 #ifdef W3_BT4
728  USE w3sbt4md
729 #endif
730 #ifdef W3_BT8
731  USE w3sbt8md
732 #endif
733 #ifdef W3_IC1
734  USE w3sic1md
735 #endif
736 #ifdef W3_IC2
737  USE w3sic2md
738 #endif
739 #ifdef W3_IC3
740  USE w3sic3md
741 #endif
742 #ifdef W3_IC4
743  USE w3sic4md
744 #endif
745 #ifdef W3_IC5
746  USE w3sic5md
747 #endif
748 #ifdef W3_DB1
749  USE w3sdb1md
750 #endif
751 #ifdef W3_BS1
752  USE w3sbs1md
753 #endif
754 #ifdef W3_IS2
755  USE w3sis2md
756 #endif
757  !/
759  ecg1, ewn1, dsie
760  !
761  IMPLICIT NONE
762  !/
763  !/ ------------------------------------------------------------------- /
764  !/ Local parameters
765  !/
766  INTEGER :: J, I1, I2, IK, ITH, ISPEC, IKM, IKL, &
767  IKH, ITT, IX, IY, ISEA
768 #ifdef W3_S
769  INTEGER, SAVE :: IENT = 0
770 #endif
771  REAL :: XL, XH, XL2, XH2, DEPTH, SQRTH, UDIR,&
772  UDIRR, UABS, CDIR, SIX, R1, R2, ET, &
773  EWN, ETR, ETX, ETY, EBND, EBX, EBY, &
774  HSIG, WLEN, TMEAN, THMEAN, THSPRD, &
775  EMAX, EL, EH, DENOM, FP, THP, SPP, &
776  FACTOR, CD, USTAR, FHIGH, ZWND, ICE, &
777  USTD, Z0, CHARN, EMEAN, FMEAN, WNMEAN,&
778  ICETHICK, ICECON, ICEF
779 #ifdef W3_FLX5
780  REAL ::TAUA, TAUADIR, RHOAIR
781 #endif
782 #ifdef W3_IS2
783  REAL :: ICEDMAX
784 #endif
785 #ifdef W3_ST1
786  REAL :: AMAX, FH1, FH2
787 #endif
788 #ifdef W3_ST2
789  REAL :: AMAX, ALPHA(NK), FPI
790 #endif
791 #ifdef W3_ST3
792  REAL :: FMEANS, FMEANWS, TAUWX, TAUWY, AMAX, &
793  TAUWNX, TAUWNY
794 #endif
795 #ifdef W3_ST4
796  REAL :: FMEANWS, TAUWX, TAUWY, AMAX, &
797  TAUWNX, TAUWNY, FMEAN1, WHITECAP(1:4), DLWMEAN
798 #endif
799 #ifdef W3_ST6
800  REAL :: AMAX, TAUWX, TAUWY, TAUWNX, TAUWNY
801 #endif
802 #ifdef W3_BS1
803  REAL :: TAUSCX, TAUSCY
804 #endif
805 #ifdef W3_BT3
806  REAL :: D50
807 #endif
808 #ifdef W3_BT4
809  REAL :: D50, PSIC, BEDFORM(3), TAUBBL(2)
810 #endif
811 #ifdef W3_STAB2
812  REAL :: STAB0, STAB, THARG1, THARG2, COR1, &
813  COR2, ASFAC
814 #endif
815  REAL :: HSMIN = 0.05
816  REAL :: WN(NK), CG(NK), E(NK,NTH), E1(NK), &
817  APM(NK), THBND(NK), SPBND(NK), &
818  A(NTH,NK), WN2(NTH,NK),WN_R(NK), &
819  ALPHA_LIU(NK), CG_ICE(NK), R(NK)
820  REAL :: DIA(NTH,NK), SWI(NK,NTH), SNL(NK,NTH),&
821  SDS(NK,NTH), SBT(NK,NTH), SIS(NK,NTH),&
822  STT(NK,NTH), DIA2(NK,NTH)
823  REAL :: XLN(NTH,NK), XWI(NTH,NK), XNL(NTH,NK),&
824  XTR(NTH,NK), XDS(NTH,NK), XDB(NTH,NK),&
825  XBT(NTH,NK), XBS(NTH,NK), XXX(NTH,NK),&
826  XWL(NTH,NK), XIS(NTH,NK)
827  LOGICAL :: LBREAK
828 #ifdef W3_ST3
829  LOGICAL :: LLWS(NTH,NK)
830 #endif
831 #ifdef W3_ST4
832  LOGICAL :: LLWS(NTH,NK)
833  REAL :: LAMBDA(NSPEC)
834 #endif
835  CHARACTER :: DTME21*23
836  !/
837  !/ ------------------------------------------------------------------- /
838  !/
839 #ifdef W3_S
840  CALL strace (ient, 'GXEXPO')
841 #endif
842  !
843  xl = 1./xfr - 1.
844  xh = xfr - 1.
845  xl2 = xl**2
846  xh2 = xh**2
847  ice = 0.
848  !
849  xln = 0.
850  xwi = 0.
851  xnl = 0.
852  xtr = 0.
853  xds = 0.
854  xdb = 0.
855  xbt = 0.
856  xbs = 0.
857  xwl = 0.
858  xis = 0.
859  xxx = 0.
860  !
861 #ifdef W3_T
862  WRITE (ndst,9000) (flreq(j),j=1,nopts)
863  WRITE (ndst,9001) flsrce
864 #endif
865  !
866  ! Output of time
867  !
868  CALL stme21 ( time , dtme21 )
869  WRITE (ndso,905) dtme21
870  !
871  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
872  ! Loop over output points.
873  !
874  DO j=1, nopts
875  IF ( flreq(j) ) THEN
876  !
877 #ifdef W3_T
878  WRITE (ndst,9002) ptnme(j)
879 #endif
880  !
881  ! 2. Calculate grid parameters using and inlined version of WAVNU1.
882  !
883  depth = max( dmin, dpo(j) )
884  sqrth = sqrt( depth )
885  udir = mod( 270. - wdo(j)*rade , 360. )
886  udirr = wdo(j)
887  uabs = max( 0.001 , wao(j) )
888 #ifdef W3_FLX5
889  taua = max( 0.001 , tauao(j))
890  tauadir = mod( 270. - taudo(j)*rade , 360. )
891  rhoair = max( 0. , dairo(j))
892 #endif
893  cdir = mod( 270. - cdo(j)*rade , 360. )
894 #ifdef W3_IS2
895  icedmax = max( 0., icefo(j))
896 #endif
897 #ifdef W3_IC2
898  icef = 0.
899 #endif
900 #ifdef W3_IS2
901  icef = icedmax
902 #endif
903  icethick = max(0., iceho(j))
904  icecon = max(0., iceo(j))
905  !
906 #ifdef W3_STAB2
907  stab0 = zwind * grav / 273.
908  stab = stab0 * aso(j) / max(5.,wao(j))**2
909  stab = max( -1. , min( 1. , stab ) )
910  tharg1 = max( 0. , ffng*(stab-ofstab))
911  tharg2 = max( 0. , ffps*(stab-ofstab))
912  cor1 = ccng * tanh(tharg1)
913  cor2 = ccps * tanh(tharg2)
914  asfac = sqrt( (1.+cor1+cor2)/shstab )
915 #endif
916  !
917 #ifdef W3_T
918  WRITE (ndst,9010) depth
919 #endif
920  DO ik=1, nk
921  six = sig(ik) * sqrth
922  i1 = int(six/dsie)
923  IF (i1.LE.n1max) THEN
924  i2 = i1 + 1
925  r1 = six/dsie - real(i1)
926  r2 = 1. - r1
927  wn(ik) = ( r2*ewn1(i1) + r1*ewn1(i2) ) / depth
928  cg(ik) = ( r2*ecg1(i1) + r1*ecg1(i2) ) * sqrth
929  ELSE
930  wn(ik) = sig(ik)*sig(ik)/grav
931  cg(ik) = 0.5 * grav / sig(ik)
932  END IF
933 #ifdef W3_T
934  WRITE (ndst,9011) ik, tpi/sig(ik), wn(ik), cg(ik)
935 #endif
936  !
937  END DO
938 
939  IF (iicedisp) THEN
940  CALL liu_forward_dispersion (icethick,0.,depth, &
941  sig,wn_r,cg_ice,alpha_liu)
942  ELSE
943  wn_r=wn
944  cg_ice=cg
945  END IF
946  r(:)=1 ! In case IC2 is defined but not IS2
947 
948  !
949  ! 3. Prepare spectra etc.
950  ! 3.a Mean wave parameters.
951  !
952  et = 0.
953  ewn = 0.
954  etr = 0.
955  etx = 0.
956  ety = 0.
957  DO ik=1, nk
958  ebnd = 0.
959  ebx = 0.
960  eby = 0.
961  DO ith=1, nth
962  ispec = ith + (ik-1)*nth
963  e(ik,ith) = spco(ispec,j)
964  ebnd = ebnd + spco(ispec,j)
965  ebx = ebx + spco(ispec,j)*ecos(ith)
966  eby = eby + spco(ispec,j)*esin(ith)
967  END DO
968  e1(ik) = ebnd * dth
969  apm(ik)= e1(ik) / ( tpi * grav**2 / sig(ik)**5 )
970  IF ( e1(ik) .GT. 1.e-5) THEN
971  thbnd(ik) = mod(630.- rade*atan2(eby,ebx),360.)
972  spbnd(ik) = rade * sqrt( max( 0. , 2.*( 1. - &
973  sqrt( max(0.,(ebx**2+eby**2)/ebnd**2) ) ) ) )
974  ELSE
975  thbnd(ik) = -999.9
976  spbnd(ik) = -999.9
977  END IF
978  ebnd = e1(ik) * dsii(ik) * tpiinv
979  et = et + ebnd
980  ewn = ewn + ebnd / wn(ik)
981  etr = etr + ebnd / sig(ik)
982  etx = etx + ebx * dsii(ik)
983  ety = ety + eby * dsii(ik)
984  END DO
985  !
986  ! tail factors for radian action etc ...!
987  !
988  ebnd = e1(nk) * tpiinv / ( sig(nk) * dth )
989  et = et + fte *ebnd
990  ewn = ewn + ftwl*ebnd
991  etr = etr + fttr*ebnd
992  etx = dth*etx*tpiinv + fte*ebx*tpiinv/sig(nk)
993  ety = dth*ety*tpiinv + fte*eby*tpiinv/sig(nk)
994  !
995  hsig = 4. * sqrt( et )
996  IF ( hsig .GT. hsmin ) THEN
997  wlen = ewn / et * tpi
998  tmean = etr / et * tpi
999  thmean = mod( 630. - rade*atan2(ety,etx) , 360. )
1000  thsprd = rade * sqrt( max( 0. , 2.*( 1. - sqrt( &
1001  max(0.,(etx**2+ety**2)/et**2) ) ) ) )
1002  ELSE
1003  wlen = 0.
1004  tmean = 0.
1005  thmean = 0.
1006  thsprd = 0.
1007  DO ik=1, nk
1008  e1(ik) = 0.
1009  DO ith=1, nth
1010  e(ik,ith) = 0.
1011  END DO
1012  END DO
1013  END IF
1014  !
1015  ! peak frequency
1016  !
1017  emax = e1(nk)
1018  ikm = nk
1019  !
1020  DO ik=nk-1, 1, -1
1021  IF ( e1(ik) .GT. emax ) THEN
1022  emax = e1(ik)
1023  ikm = ik
1024  END IF
1025  END DO
1026  !
1027  ikl = max( 1 , ikm-1 )
1028  ikh = min( nk , ikm+1 )
1029  el = e1(ikl) - e1(ikm)
1030  eh = e1(ikh) - e1(ikm)
1031  denom = xl*eh - xh*el
1032  !
1033  IF ( hsig .GE. hsmin ) THEN
1034  fp = sig(ikm) * ( 1. + 0.5 * ( xl2*eh - xh2*el ) &
1035  / sign( max(abs(denom),1.e-15) , denom ) )
1036  thp = thbnd(ikm)
1037  spp = spbnd(ikm)
1038  ELSE
1039  fp = 0.
1040  thp = 0.
1041  spp = 0.
1042  END IF
1043  !
1044  ! 3.4 source terms
1045  !
1046  DO ik=1, nk
1047  factor = tpiinv * cg(ik) / sig(ik)
1048  DO ith=1, nth
1049  ispec = ith + (ik-1)*nth
1050  a(ith,ik) = factor * spco(ispec,j)
1051  wn2(ith,ik) = wn(ik)
1052  END DO
1053  END DO
1054  !
1055 #ifdef W3_STAB2
1056  uabs = uabs / asfac
1057 #endif
1058  !
1059 #ifdef W3_ST0
1060  zwnd = 10.
1061 #endif
1062 #ifdef W3_ST1
1063  zwnd = 10.
1064 #endif
1065 #ifdef W3_ST2
1066  zwnd = zwind
1067 #endif
1068 #ifdef W3_ST3
1069  zwnd = zzwnd
1070  tauwx = 0.
1071  tauwy = 0.
1072  llws(:,:) = .true.
1073 #endif
1074  ustar = 1.
1075 #ifdef W3_ST4
1076  zwnd = zzwnd
1077  tauwx = 0.
1078  tauwy = 0.
1079 #endif
1080 #ifdef W3_ST6
1081  zwnd = 10.
1082 #endif
1083  !
1084 #ifdef W3_ST0
1085  fhigh = sig(nk)
1086 #endif
1087 #ifdef W3_ST1
1088  CALL w3spr1 (a, cg, wn, emean, fmean, wnmean, amax)
1089  fp = 0.85 * fmean
1090  fh1 = fxfm * fmean
1091  fh2 = fxpm / ustar
1092  fhigh = max( fh1 , fh2 )
1093 #endif
1094 #ifdef W3_ST2
1095  CALL w3spr2 (a, cg, wn, depth, fp , uabs, ustar, &
1096  emean, fmean, wnmean, amax, alpha, fp )
1097 #endif
1098 #ifdef W3_ST3
1099  CALL w3spr3 (a, cg, wn, emean, fmean, fmeans, &
1100  wnmean, amax, uabs, udirr, ustar, ustd, &
1101  tauwx, tauwy, cd, z0, charn, llws, fmeanws)
1102 #endif
1103 #ifdef W3_ST4
1104  CALL w3spr4 (a, cg, wn, emean, fmean, fmean1, &
1105  wnmean, amax, uabs, udirr, &
1106 #ifdef W3_FLX5
1107  taua, tauadir, rhoair, &
1108 #endif
1109  ustar, ustd, tauwx, tauwy, cd, z0, &
1110  charn, llws, fmeanws, dlwmean )
1111 #endif
1112 #ifdef W3_ST6
1113  CALL w3spr6 (a, cg, wn, emean, fmean, wnmean, amax, fp)
1114 #endif
1115  !
1116 #ifdef W3_FLX1
1117  CALL w3flx1 ( zwnd, uabs, udirr, &
1118  ustar, ustd, z0, cd )
1119 #endif
1120 #ifdef W3_FLX2
1121  CALL w3flx2 ( zwnd, depth, fp, uabs, udirr, &
1122  ustar, ustd, z0, cd )
1123 #endif
1124 #ifdef W3_FLX3
1125  CALL w3flx3 ( zwnd, depth, fp, uabs, udirr, &
1126  ustar, ustd, z0, cd )
1127 #endif
1128 #ifdef W3_FLX4
1129  CALL w3flx4 ( zwnd, uabs, udirr, ustar, ustd, z0, cd )
1130 #endif
1131 #ifdef W3_FLX5
1132  CALL w3flx5 ( zwnd, uabs, udirr, taua, tauadir, &
1133  rhoair, ustar, ustd, z0, cd, charn )
1134 #endif
1135  !
1136  DO itt=1, 3
1137 #ifdef W3_ST2
1138  CALL w3sin2 (a, cg, wn2, uabs, udirr, cd, z0, &
1139  fpi, xwi, dia )
1140  CALL w3spr2 (a, cg, wn, depth, fpi, uabs, ustar, &
1141  emean, fmean, wnmean, amax, alpha, fp )
1142 #endif
1143 #ifdef W3_ST3
1144  CALL w3sin3 (a, cg, wn2, uabs, ustar, dair/dwat, &
1145  aso(j), udirr, z0, cd, tauwx, tauwy, &
1146  tauwnx, tauwny, &
1147  ice, xwi, dia, llws, ix, iy )
1148  CALL w3spr3 (a, cg, wn, emean, fmean, fmeans, &
1149  wnmean, amax, uabs, udirr, ustar, ustd, &
1150  tauwx, tauwy, cd, z0, charn, llws, fmeanws)
1151 #endif
1152 #ifdef W3_ST4
1153  CALL w3sin4 (a, cg, wn2, uabs, ustar, dair/dwat, &
1154  aso(j), udirr, z0, cd, tauwx, tauwy, &
1155  tauwnx, tauwny, xwi, dia, llws, ix, iy, lambda )
1156  CALL w3spr4 (a, cg, wn, emean, fmean, fmean1, &
1157  wnmean, amax, uabs, udirr, &
1158 #ifdef W3_FLX5
1159  taua, tauadir, rhoair, &
1160 #endif
1161  ustar, ustd, tauwx, tauwy, cd, z0, &
1162  charn, llws, fmeanws, dlwmean )
1163 #endif
1164 #ifdef W3_FLX2
1165  CALL w3flx2 ( zwnd, depth, fp, uabs, udirr, &
1166  ustar, ustd, z0, cd )
1167 #endif
1168 #ifdef W3_FLX3
1169  CALL w3flx3 ( zwnd, depth, fp, uabs, udirr, &
1170  ustar, ustd, z0, cd )
1171 #endif
1172  END DO
1173  !
1174 #ifdef W3_ST2
1175  fhigh = xfc * fpi
1176 #endif
1177  !
1178  IF ( flsrce(2) ) THEN
1179 #ifdef W3_LN1
1180  CALL w3sln1 ( wn, fhigh, ustar, udirr, xln )
1181 #endif
1182  !
1183 #ifdef W3_ST1
1184  CALL w3sin1 (a, wn2, ustar, udirr, xwi, dia )
1185 #endif
1186 #ifdef W3_ST2
1187  CALL w3sin2 (a, cg, wn2, uabs, udirr, cd, z0, &
1188  fpi, xwi, dia )
1189 #endif
1190 #ifdef W3_ST3
1191  CALL w3sin3 (a, cg, wn2, uabs, ustar, dair/dwat, &
1192  aso(j), udirr, z0, cd, &
1193  tauwx, tauwy, tauwnx, tauwny, &
1194  ice, xwi, dia, llws, ix, iy )
1195 #endif
1196 #ifdef W3_ST4
1197  CALL w3sin4 (a, cg, wn2, uabs, ustar, dair/dwat, &
1198  aso(j), udirr, z0, cd, &
1199  tauwx, tauwy, tauwnx, tauwny, &
1200  xwi, dia, llws, ix, iy, lambda )
1201 #endif
1202 #ifdef W3_ST6
1203  CALL w3sin6 (a, cg, wn2, uabs, ustar, udirr, cd, &
1204  dair, tauwx, tauwy, tauwnx, tauwny, xwi, dia )
1205 #endif
1206  END IF
1207  IF ( flsrce(3) ) THEN
1208 #ifdef W3_NL1
1209  CALL w3snl1 ( a, cg, wnmean*depth, xnl, dia )
1210 #endif
1211 #ifdef W3_NL2
1212  CALL w3snl2 ( a, cg, depth, xnl, dia )
1213 #endif
1214 #ifdef W3_NL3
1215  CALL w3snl3 ( a, cg, wn, depth, xnl, dia )
1216 #endif
1217 #ifdef W3_NL4
1218  CALL w3snl4 ( a, cg, wn, depth, xnl, dia )
1219 #endif
1220  END IF
1221  IF ( flsrce(4) ) THEN
1222 #ifdef W3_ST1
1223  CALL w3sds1 ( a, wn2, emean, fmean, wnmean, xds, dia )
1224 #endif
1225 #ifdef W3_ST2
1226  CALL w3sds2 ( a, cg, wn, fpi, ustar, alpha, xds, dia )
1227 #endif
1228 #ifdef W3_ST3
1229  CALL w3sds3 ( a, wn, cg, emean, fmeans, wnmean, &
1230  ustar, ustd, depth, xds, dia, ix, iy )
1231 #endif
1232 #ifdef W3_ST4
1233  CALL w3sds4 ( a, wn, cg, &
1234  ustar, ustd, depth, dair, xds, dia, ix, iy, lambda, whitecap , dlwmean)
1235 #endif
1236 #ifdef W3_ST6
1237  CALL w3sds6 ( a, cg, wn, xds, dia )
1238  IF (swl6s6) CALL w3swl6 ( a, cg, wn, xwl, dia )
1239 #endif
1240  !
1241 #ifdef W3_DB1
1242  CALL w3sdb1 ( j, a, depth, emean, fmean, wnmean, cg, &
1243  lbreak, xdb, dia )
1244 #endif
1245  !
1246  END IF
1247  IF ( flsrce(5) ) THEN
1248 
1249 #ifdef W3_BT1
1250  CALL w3sbt1 ( a, cg, wn, depth, xbt, dia )
1251 #endif
1252 
1253 #ifdef W3_IC1
1254  CALL w3sic1 ( a, depth, cg, ix, iy, xbt, dia )
1255 #endif
1256 #ifdef W3_IC2
1257  CALL w3sic2 ( a, depth, icethick, icef ,cg, wn, ix, iy, xbt, dia, wn_r, &
1258  cg_ice, alpha_liu, r )
1259 #endif
1260 #ifdef W3_IC3
1261  CALL w3sic3 ( a, depth, cg, wn, ix, iy, xbt, dia )
1262 #endif
1263 #ifdef W3_IC4
1264  CALL w3sic4 ( a, depth, cg, ix, iy, xbt, dia )
1265 #endif
1266 #ifdef W3_IC5
1267  CALL w3sic5 ( a, depth, cg, wn, ix, iy, xbt, dia )
1268 #endif
1269 
1270 #ifdef W3_BT4
1271  ix=1 ! to be fixed later
1272  iy=1 ! to be fixed later
1273  isea=1 ! to be fixed later
1274  d50 = sed_d50(isea)
1275  psic= sed_psic(isea)
1276 #endif
1277 
1278 #ifdef W3_BT4
1279  CALL w3sbt4 ( a, cg, wn, depth, d50, psic, taubbl, &
1280  bedform, xbt, dia, ix, iy )
1281 #endif
1282  !
1283 
1284 #ifdef W3_BT8
1285  CALL w3sbt8 ( a, depth, xbt, dia, ix, iy )
1286 #endif
1287 
1288 #ifdef W3_BS1
1289  CALL w3sbs1 ( a, cg, wn, depth, cao(j)*cos(cdo(j)), &
1290  cao(j)*sin(cdo(j)), &
1291  tauscx, tauscy, xbs, dia )
1292 #endif
1293  END IF
1294 
1295  IF ( flsrce(6) ) THEN
1296 
1297 #ifdef W3_IS2
1298  CALL w3sis2(a, depth, icecon, icethick, icef, icedmax, ix, iy, &
1299  xis, dia, dia2, wn, cg, wn_r, cg_ice, r)
1300 #endif
1301  END IF
1302  !
1303 #ifdef W3_STAB2
1304  uabs = uabs * asfac
1305 #endif
1306  !
1307  DO ik=1, nk
1308  factor = tpi / cg(ik) * sig(ik)
1309  DO ith=1, nth
1310  ispec = ith + (ik-1)*nth
1311  e(ik,ith) = spco(ispec,j)
1312  swi(ik,ith) = ( xwi(ith,ik) + xln(ith,ik) ) * factor
1313  snl(ik,ith) = ( xnl(ith,ik) + xtr(ith,ik) ) * factor
1314  sds(ik,ith) = ( xds(ith,ik) + xdb(ith,ik) ) * factor
1315 #ifdef W3_ST6
1316  sds(ik,ith) = sds(ik,ith) +(xwl(ith,ik) * factor)
1317 #endif
1318  sbt(ik,ith) = ( xbt(ith,ik) + xbs(ith,ik) ) * factor
1319  sis(ik,ith) = xis(ith,ik) * factor
1320  stt(ik,ith) = xxx(ith,ik) * factor
1321  END DO
1322  END DO
1323  stt = stt + swi + snl + sds + sbt + sis
1324 
1325  !
1326  ! 4.a Perform output
1327  !
1328  IF ( flsrce(1) ) WRITE (ndsgrd) &
1329  ((e(ik,ith),ith=1,nth),ik=nk,1,-1)
1330  IF ( flsrce(2) ) WRITE (ndsgrd) &
1331  ((swi(ik,ith),ith=1,nth),ik=nk,1,-1)
1332  IF ( flsrce(3) ) WRITE (ndsgrd) &
1333  ((snl(ik,ith),ith=1,nth),ik=nk,1,-1)
1334  IF ( flsrce(4) ) WRITE (ndsgrd) &
1335  ((sds(ik,ith),ith=1,nth),ik=nk,1,-1)
1336  IF ( flsrce(5) ) WRITE (ndsgrd) &
1337  ((sbt(ik,ith),ith=1,nth),ik=nk,1,-1)
1338  IF ( flsrce(6) ) WRITE (ndsgrd) &
1339  ((sis(ik,ith),ith=1,nth),ik=nk,1,-1)
1340  IF ( flsrce(7) ) WRITE (ndsgrd) &
1341  ((stt(ik,ith),ith=1,nth),ik=nk,1,-1)
1342  !
1343  IF ( flagll ) THEN
1344  WRITE (ndspnt,940) ptnme(j), &
1345  fact*ptloc(1,j), fact*ptloc(2,j), dpo(j), wao(j), &
1346  wao(j)*cos(wdo(j)), wao(j)*sin(wdo(j)), aso(j), &
1347  cao(j), cao(j)*cos(cdo(j)), cao(j)*sin(cdo(j)), &
1348  hsig, grdid(j)
1349  ELSE
1350  WRITE (ndspnt,941) ptnme(j), &
1351  fact*ptloc(1,j), fact*ptloc(2,j), dpo(j), wao(j), &
1352  wao(j)*cos(wdo(j)), wao(j)*sin(wdo(j)), aso(j), &
1353  cao(j), cao(j)*cos(cdo(j)), cao(j)*sin(cdo(j)), &
1354  hsig, grdid(j)
1355  END IF
1356  !
1357  ! ... End of points loop
1358  !
1359  END IF
1360  END DO
1361  !
1362  RETURN
1363  !
1364  ! Formats
1365  !
1366 905 FORMAT (9x,a)
1367 
1368 940 FORMAT (a10,1x,2f6.1,f7.1,3f7.1,f8.2,3f7.2,f6.2,2x,a)
1369 
1370 941 FORMAT (a10,1x,2f8.1,f7.1,3f7.1,f8.2,3f7.2,f6.2,2x,a)
1371 
1372  !
1373 #ifdef W3_T
1374 9000 FORMAT (' TEST GXEXPO : FLAGS :',40l2)
1375 9001 FORMAT (' TEST GXEXPO : FLSRCE :',6l2)
1376 9002 FORMAT (' TEST GXEXPO : OUTPUT POINT : ',a)
1377 9010 FORMAT (' TEST GXEXPO : DEPTH =',f7.1,' IK, T, K, CG :')
1378 9011 FORMAT (' ',i3,f8.2,f8.4,f8.2)
1379 #endif
1380  !/
1381  !/ End of GXEXPO ----------------------------------------------------- /
1382  !/
1383  END SUBROUTINE gxexpo
1384  !/
1385  !/ End of GXOUTP ----------------------------------------------------- /
1386  !/
1387 END PROGRAM gxoutp
w3dispmd::dfac
real, parameter dfac
Definition: w3dispmd.F90:75
w3timemd::dsec21
real function dsec21(TIME1, TIME2)
Definition: w3timemd.F90:333
w3servmd::nextln
subroutine nextln(CHCKC, NDSI, NDSE)
Definition: w3servmd.F90:222
w3sln1md
Definition: w3sln1md.F90:3
w3sln1md::w3sln1
subroutine w3sln1(K, FHIGH, USTAR, USDIR, S)
Definition: w3sln1md.F90:57
w3src3md::w3sin3
subroutine w3sin3(A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, TAUWX, TAUWY, TAUWNX, TAUWNY, ICE, S, D, LLWS, IX, IY)
Calculate diagonal and input source term for WAM4+ approach.
Definition: w3src3md.F90:386
w3gdatmd::swl6s6
logical, pointer swl6s6
Definition: w3gdatmd.F90:1338
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3swldmd
Source term module for swell dissipation.
Definition: w3swldmd.F90:18
w3flx5md::w3flx5
subroutine w3flx5(ZWND, U10, U10D, TAUA, TAUADIR, RHOAIR, UST, USTD, Z0, CD, CHARN)
Unified process to obtain friction velocity and drag when stresses are an input (from atmospheric mod...
Definition: w3flx5md.F90:119
w3snl1md::w3snl1
subroutine w3snl1(A, CG, KDMEAN, S, D)
Calculate nonlinear interactions and the diagonal term of its derivative.
Definition: w3snl1md.F90:115
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3flx4md::w3flx4
subroutine w3flx4(ZWND, U10, U10D, UST, USTD, Z0, CD)
Flux/stress computations according to Hwang (JTECH, 2011).
Definition: w3flx4md.F90:106
w3odatmd::nopts
integer, pointer nopts
Definition: w3odatmd.F90:484
w3sbt1md::w3sbt1
subroutine w3sbt1(A, CG, WN, DEPTH, S, D)
Bottom friction source term according to the empirical JONSWAP formulation.
Definition: w3sbt1md.F90:89
w3src2md::w3sds2
subroutine w3sds2(A, CG, K, FPI, USTAR, ALFA, S, D)
Calculate whitecapping source term and diagonal term of derivative.
Definition: w3src2md.F90:583
w3sdb1md
Dummy slot for bottom friction source term.
Definition: w3sdb1md.F90:24
w3odatmd::grdid
character(len=13), dimension(:), pointer grdid
Definition: w3odatmd.F90:502
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3flx2md::w3flx2
subroutine w3flx2(ZWIND, DEPTH, FP, U, UDIR, UST, USTD, Z0, CD)
FLux/stress computations according Tolman and Chalikov (1996).
Definition: w3flx2md.F90:91
w3sic2md::w3sic2
subroutine, public w3sic2(A, DEPTH, ICEH, ICEF, CG, WN, IX, IY, S, D, WN_R, CG_ICE, ALPHA, R)
S_{ice} source term using 5 parameters read from input files.
Definition: w3sic2md.F90:122
w3odatmd::fnmpre
character(len=80) fnmpre
Definition: w3odatmd.F90:330
w3sbt4md::w3sbt4
subroutine w3sbt4(A, CG, WN, DEPTH, D50, PSIC, TAUBBL, BEDFORM, S, D, IX, IY)
Computes the SHOWEX bottom friction with movable bed effects.
Definition: w3sbt4md.F90:341
w3odatmd::dpo
real, dimension(:), pointer dpo
Definition: w3odatmd.F90:492
w3src4md::w3sds4
subroutine w3sds4(A, K, CG, USTAR, USDIR, DEPTH, DAIR, SRHS, DDIAG, IX, IY, BRLAMBDA, WHITECAP, DLWMEAN)
Calculate whitecapping source term and diagonal term of derivative.
Definition: w3src4md.F90:2034
w3odatmd::wdo
real, dimension(:), pointer wdo
Definition: w3odatmd.F90:492
w3src6md::w3sin6
subroutine, public w3sin6(A, CG, WN2, UABS, USTAR, USDIR, CD, DAIR, TAUWX, TAUWY, TAUNWX, TAUNWY, S, D)
Observation-based source term for wind input.
Definition: w3src6md.F90:292
w3snl4md::w3snl4
subroutine w3snl4(A, CG, WN, DEPTH, S, D)
Interface module for TSA type nonlinear interactions.
Definition: w3snl4md.F90:611
w3src2md::w3sin2
subroutine w3sin2(A, CG, K, U, UDIR, CD, Z0, FPI, S, D)
Calculate input source term.
Definition: w3src2md.F90:309
w3gdatmd::w3setg
subroutine w3setg(IMOD, NDSE, NDST)
Definition: w3gdatmd.F90:2152
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3flx3md
FLux/stress computations according Tolman and Chalikov (1996).
Definition: w3flx3md.F90:23
w3flx4md
Flux/stress computations according to Hwang ( 2011).
Definition: w3flx4md.F90:27
w3flx5md
Unified process to obtain friction velocity and drag when stresses are an input (from atmospheric mod...
Definition: w3flx5md.F90:28
w3dispmd::ewn1
real, dimension(0:nar1d) ewn1
Definition: w3dispmd.F90:78
w3flx1md
Flux/stress computations according to Wu (1980).
Definition: w3flx1md.F90:21
w3adatmd::w3seta
subroutine w3seta(IMOD, NDSE, NDST)
Select one of the WAVEWATCH III grids / models.
Definition: w3adatmd.F90:2645
w3odatmd::ptloc
real, dimension(:,:), pointer ptloc
Definition: w3odatmd.F90:492
w3flx2md
FLux/stress computations according Tolman and Chalikov (1996).
Definition: w3flx2md.F90:21
w3src4md::w3sin4
subroutine w3sin4(A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, TAUWX, TAUWY, TAUWNX, TAUWNY, S, D, LLWS, IX, IY, BRLAMBDA)
Calculate diagonal and input source term for WAM4+ approach.
Definition: w3src4md.F90:426
w3sdb1md::w3sdb1
subroutine w3sdb1(IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D)
Compute depth-induced breaking using Battjes and Janssen bore model approach.
Definition: w3sdb1md.F90:97
w3wdatmd::w3ndat
subroutine w3ndat(NDSE, NDST)
Set up the number of grids to be used.
Definition: w3wdatmd.F90:210
w3servmd
Definition: w3servmd.F90:3
w3timemd::tick21
subroutine tick21(TIME, DTIME)
Definition: w3timemd.F90:84
w3sic4md::w3sic4
subroutine, public w3sic4(A, DEPTH, CG, IX, IY, S, D)
S_{ice} source term using 5 parameters read from input files.
Definition: w3sic4md.F90:121
w3wdatmd::w3setw
subroutine w3setw(IMOD, NDSE, NDST)
Select one of the WAVEWATCH III grids / models.
Definition: w3wdatmd.F90:660
w3odatmd::wao
real, dimension(:), pointer wao
Definition: w3odatmd.F90:492
w3odatmd::w3seto
subroutine w3seto(IMOD, NDSERR, NDSTST)
Definition: w3odatmd.F90:1523
w3timemd::stme21
subroutine stme21(TIME, DTME21)
Definition: w3timemd.F90:682
w3snlsmd
Nonlinear interaction based ‘smoother’ for high frequencies.
Definition: w3snlsmd.F90:21
w3dispmd::liu_forward_dispersion
subroutine liu_forward_dispersion(H_ICE, VISC, H_WDEPTH, SIGMA, K_SOLUTION, CG, ALPHA)
Definition: w3dispmd.F90:688
w3odatmd
Definition: w3odatmd.F90:3
w3dispmd::ecg1
real, dimension(0:nar1d) ecg1
Definition: w3dispmd.F90:78
w3adatmd::w3naux
subroutine w3naux(NDSE, NDST)
Set up the number of grids to be used.
Definition: w3adatmd.F90:704
w3sbs1md::w3sbs1
subroutine w3sbs1(A, CG, WN, DEPTH, CX1, CY1, TAUSCX, TAUSCY, S, D)
Bottom scattering source term.
Definition: w3sbs1md.F90:114
w3iogrmd::w3iogr
subroutine w3iogr(INXOUT, NDSM, IMOD, FEXT ifdef W3_ASCII
Reading and writing of the model definition file.
Definition: w3iogrmd.F90:117
w3sic5md::w3sic5
subroutine, public w3sic5(A, DEPTH, CG, WN, IX, IY, S, D)
Calculate ice source term S_{ice} according to 3 different sea ice models.
Definition: w3sic5md.F90:169
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3iogrmd
Reading/writing of model definition file.
Definition: w3iogrmd.F90:20
w3iopomd::w3iopon
subroutine w3iopon(INXOUT, NDSOP, IOTST, IMOD)
Read or write the netCDF point output file, depending on the value of the first parameter.
Definition: w3iopomd.F90:1747
w3odatmd::ptnme
character(len=40), dimension(:), pointer ptnme
Definition: w3odatmd.F90:501
w3src1md::w3sin1
subroutine w3sin1(A, K, USTAR, USDIR, S, D)
Calculate diagonal of input source (actual source term put together in W3SRCE).
Definition: w3src1md.F90:256
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3src6md::w3spr6
subroutine, public w3spr6(A, CG, WN, EMEAN, FMEAN, WNMEAN, AMAX, FP)
Calculate mean wave parameters.
Definition: w3src6md.F90:122
gxoutp
program gxoutp
Post-processing of point output for GrADS post-processing.
Definition: gx_outp.F90:25
w3snl2md::w3snl2
subroutine w3snl2(A, CG, DEPTH, S, D)
Interface to exact interactions.
Definition: w3snl2md.F90:96
w3odatmd::ndso
integer, pointer ndso
Definition: w3odatmd.F90:456
w3gdatmd::w3nmod
subroutine w3nmod(NUMBER, NDSE, NDST, NAUX)
Definition: w3gdatmd.F90:1433
w3sis2md
Floe-size dependant scattering of waves in the marginal ice zone.
Definition: w3sis2md.F90:33
w3sbt8md::w3sbt8
subroutine w3sbt8(AC, H_WDEPTH, S, D, IX, IY)
Compute dissipation by viscous fluid mud using Dalrymple and Liu (1978).
Definition: w3sbt8md.F90:112
w3sbt8md
Contains routines for computing dissipation by viscous fluid mud using Dalrymple and Liu (1978) "Thin...
Definition: w3sbt8md.F90:25
w3src3md::w3spr3
subroutine w3spr3(A, CG, WN, EMEAN, FMEAN, FMEANS, WNMEAN, AMAX, U, UDIR, USTAR, USDIR, TAUWX, TAUWY, CD, Z0, CHARN, LLWS, FMEANWS)
Calculate mean wave parameters for the use in the source term routines.
Definition: w3src3md.F90:137
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3src2md::w3spr2
subroutine w3spr2(A, CG, WN, DEPTH, FPI, U, USTAR, EMEAN, FMEAN, WNMEAN, AMAX, ALFA, FP)
Calculate mean wave parameters for the use in the source term routines (Tolman and Chalikov).
Definition: w3src2md.F90:127
w3sbt4md
SHOWEX bottom friction source term (Ardhuin et al.
Definition: w3sbt4md.F90:25
w3sbt1md
JONSWAP bottom friction routine.
Definition: w3sbt1md.F90:21
w3src3md::w3sds3
subroutine w3sds3(A, K, CG, EMEAN, FMEAN, WNMEAN, USTAR, USDIR, DEPTH, S, D, IX, IY)
Calculate whitecapping source term and diagonal term of derivative.
Definition: w3src3md.F90:1255
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3gdatmd
Definition: w3gdatmd.F90:16
w3swldmd::w3swl6
subroutine, public w3swl6(A, CG, WN, S, D)
Turbulent dissipation of narrow-banded swell.
Definition: w3swldmd.F90:252
w3dispmd::nar1d
integer, parameter nar1d
Definition: w3dispmd.F90:74
w3sbs1md
This module computes a scattering term based on the theory by Ardhuin and Magne (JFM 2007).
Definition: w3sbs1md.F90:22
w3sis2md::w3sis2
subroutine, public w3sis2(A, DEPTH, CICE, ICEH, ICEF, ICEDMAX, IX, IY, S, D, DISSIP, WN, CG, WN_R, CG_ICE, R)
Wave scattering in the MIZ, adapted from Dumont et al.
Definition: w3sis2md.F90:654
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3odatmd::w3nout
subroutine w3nout(NDSERR, NDSTST)
Definition: w3odatmd.F90:561
w3src6md::w3sds6
subroutine, public w3sds6(A, CG, WN, S, D)
Observation-based source term for dissipation.
Definition: w3src6md.F90:547
w3snl3md
Generalized and optimized multiple DIA implementation.
Definition: w3snl3md.F90:24
w3snl4md
Generic shallow-water Boltzmann integral (FBI or TSA).
Definition: w3snl4md.F90:25
w3src3md
The 'WAM4+' source terms based on P.A.E.M.
Definition: w3src3md.F90:30
w3src4md
The 'SHOM/Ifremer' source terms based on P.A.E.M.
Definition: w3src4md.F90:28
w3servmd::itrace
subroutine itrace(NDS, NMAX)
Definition: w3servmd.F90:91
w3snl1md
Bundles routines to calculate nonlinear wave-wave interactions according to the Discrete Interaction ...
Definition: w3snl1md.F90:25
w3src6md
Observation-based wind input and dissipation after Donelan et al (2006), and Babanin et al.
Definition: w3src6md.F90:27
w3snl2md
Interface module to exact nonlinear interactions.
Definition: w3snl2md.F90:23
w3src1md
Bundle WAM cycle 3 input and dissipation source terms with their defining parameters.
Definition: w3src1md.F90:15
w3src2md
Tolman and Chalikov (1996) input and dissipation source terms.
Definition: w3src2md.F90:16
w3snl3md::w3snl3
subroutine w3snl3(A, CG, WN, DEPTH, S, D)
Multiple Discrete Interaction Parameterization for arbitrary depths with generalized quadruplet layou...
Definition: w3snl3md.F90:181
gxexpo
subroutine gxexpo
Perform actual point output.
Definition: gx_outp.F90:583
w3flx3md::w3flx3
subroutine w3flx3(ZWIND, DEPTH, FP, U, UDIR, UST, USTD, Z0, CD)
FLux/stress computations according Tolman and Chalikov (1996).
Definition: w3flx3md.F90:96
w3timemd
Definition: w3timemd.F90:3
w3src4md::w3spr4
subroutine w3spr4(A, CG, WN, EMEAN, FMEAN, FMEAN1, WNMEAN, AMAX, U, UDIR, ifdef W3_FLX5
Calculate mean wave parameters for the use in the source term routines.
Definition: w3src4md.F90:145
w3flx1md::w3flx1
subroutine w3flx1(ZWND, U10, U10D, UST, USTD, Z0, CD)
FLux/stress computations according to Wu (1980).
Definition: w3flx1md.F90:89
w3odatmd::aso
real, dimension(:), pointer aso
Definition: w3odatmd.F90:492
w3iopomd::w3iopo
subroutine w3iopo(INXOUT, NDSOP, IOTST, IMOD ifdef W3_ASCII
Read or write point output.
Definition: w3iopomd.F90:1907
w3dispmd
Definition: w3dispmd.F90:3
w3sic3md::w3sic3
subroutine, public w3sic3(A, DEPTH, CG, WN, IX, IY, S, D)
Definition: w3sic3md.F90:97
w3dispmd::n1max
integer n1max
Definition: w3dispmd.F90:77
w3src1md::w3sds1
subroutine w3sds1(A, K, EMEAN, FMEAN, WNMEAN, S, D)
Calculate whitecapping source term and diagonal term of derivative.
Definition: w3src1md.F90:433
w3iopomd
Process point output.
Definition: w3iopomd.F90:19
w3src1md::w3spr1
subroutine w3spr1(A, CG, WN, EMEAN, FMEAN, WNMEAN, AMAX)
Definition: w3src1md.F90:88
w3sic3md
Definition: w3sic3md.F90:3
w3sic4md
Calculate ice source term S_{ice} according to simple methods.
Definition: w3sic4md.F90:27
w3sic5md
Calculate ice source term S_{ice} according to different ice models:
Definition: w3sic5md.F90:25
w3dispmd::dsie
real dsie
Definition: w3dispmd.F90:78
w3sic1md
Calculate ice source term S_{ice} according to simple methods.
Definition: w3sic1md.F90:23
w3sic2md
Calculate ice dissipation source term S_{ice}.
Definition: w3sic2md.F90:27
w3sic1md::w3sic1
subroutine, public w3sic1(A, DEPTH, CG, IX, IY, S, D)
S_{ice} source term using 5 parameters read from input files.
Definition: w3sic1md.F90:94