WAVEWATCH III  beta 0.0.1
w3src0md.F90
Go to the documentation of this file.
1 
6 
7 #include "w3macros.h"
8 
14 !/ ------------------------------------------------------------------- /
15 MODULE w3src0md
16  !/
17  !/ +-----------------------------------+
18  !/ | WAVEWATCH III NOAA/NCEP |
19  !/ | H. L. Tolman |
20  !/ | FORTRAN 90 |
21  !/ | Last update : 29-May-2009 |
22  !/ +-----------------------------------+
23  !/
24  !/ 05-Jul-2006 : Origination. ( version 3.09 )
25  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
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  ! Mean wave parameter computation for case without input and
35  ! dissipation.
36  !
37  ! 2. Variables and types :
38  !
39  ! 3. Subroutines and functions :
40  !
41  ! Name Type Scope Description
42  ! ----------------------------------------------------------------
43  ! W3SPR0 Subr. Public Mean parameters from spectrum.
44  ! ----------------------------------------------------------------
45  !
46  ! 4. Subroutines and functions used :
47  !
48  ! Name Type Module Description
49  ! ----------------------------------------------------------------
50  ! STRACE Subr. W3SERVMD Subroutine tracing. ( !/S )
51  ! ----------------------------------------------------------------
52  !
53  ! 5. Remarks :
54  !
55  ! 6. Switches :
56  !
57  ! !/S Enable subroutine tracing.
58  ! !/T Test output, see subroutines.
59  !
60  ! 7. Source code :
61  !
62  !/ ------------------------------------------------------------------- /
63  !/
64  PUBLIC
65  !/
66 CONTAINS
67  !/ ------------------------------------------------------------------- /
81  SUBROUTINE w3spr0 (A, CG, WN, EMEAN, FMEAN, WNMEAN, AMAX)
82  !/
83  !/ +-----------------------------------+
84  !/ | WAVEWATCH III NOAA/NCEP |
85  !/ | H. L. Tolman |
86  !/ | FORTRAN 90 |
87  !/ | Last update : 05-Jul-2006 |
88  !/ +-----------------------------------+
89  !/
90  !/ 05-Jul-2006 : Origination. ( version 3.09 )
91  !/
92  ! 1. Purpose :
93  !
94  ! Calculate mean wave parameters.
95  !
96  ! 2. Method :
97  !
98  ! See source term routines.
99  !
100  ! 3. Parameters :
101  !
102  ! Parameter list
103  ! ----------------------------------------------------------------
104  ! A R.A. I Action as a function of direction and
105  ! wavenumber.
106  ! CG R.A. I Group velocities.
107  ! WN R.A. I Wavenumbers.
108  ! EMEAN Real O Mean wave energy.
109  ! FMEAN Real O Mean wave frequency.
110  ! WNMEAN Real O Mean wavenumber.
111  ! AMAX Real O Maximum action density in spectrum.
112  ! ----------------------------------------------------------------
113  !
114  ! 4. Subroutines used :
115  !
116  ! Name Type Module Description
117  ! ----------------------------------------------------------------
118  ! STRACE Subr. W3SERVMD Subroutine tracing.
119  ! ----------------------------------------------------------------
120  !
121  ! 5. Called by :
122  !
123  ! Name Type Module Description
124  ! ----------------------------------------------------------------
125  ! W3SRCE Subr. W3SRCEMD Source term integration.
126  ! W3EXPO Subr. N/A Point output post-processor.
127  ! GXEXPO Subr. N/A GrADS point output post-processor.
128  ! ----------------------------------------------------------------
129  !
130  ! 6. Error messages :
131  !
132  ! None.
133  !
134  ! 7. Remarks :
135  !
136  ! 8. Structure :
137  !
138  ! See source code.
139  !
140  ! 9. Switches :
141  !
142  ! !/S Enable subroutine tracing.
143  ! !/T Enable test output.
144  !
145  ! 10. Source code :
146  !
147  !/ ------------------------------------------------------------------- /
148  USE constants
149  USE w3gdatmd, ONLY: nk, nth, sig, dden, fte, ftf, ftwn
150 #ifdef W3_T
151  USE w3odatmd, ONLY: ndst
152 #endif
153 #ifdef W3_S
154  USE w3servmd, ONLY: strace
155 #endif
156  !
157  IMPLICIT NONE
158  !/
159  !/ ------------------------------------------------------------------- /
160  !/ Parameter list
161  !/
162  REAL, INTENT(IN) :: A(NTH,NK), CG(NK), WN(NK)
163  REAL, INTENT(OUT) :: EMEAN, FMEAN, WNMEAN, AMAX
164  !/
165  !/ ------------------------------------------------------------------- /
166  !/ Local parameters
167  !/
168  INTEGER :: IK, ITH
169 #ifdef W3_S
170  INTEGER, SAVE :: IENT = 0
171 #endif
172  REAL :: EB(NK), EBAND
173  !/
174  !/ ------------------------------------------------------------------- /
175  !/
176 #ifdef W3_S
177  CALL strace (ient, 'W3SPR0')
178 #endif
179  !
180  emean = 0.
181  fmean = 0.
182  wnmean = 0.
183  amax = 0.
184  !
185  ! 1. Integral over directions
186  !
187  DO ik=1, nk
188  eb(ik) = 0.
189  DO ith=1, nth
190  eb(ik) = eb(ik) + a(ith,ik)
191  amax = max( amax , a(ith,ik) )
192  END DO
193  END DO
194  !
195  ! 2. Integrate over directions
196  !
197  DO ik=1, nk
198  eb(ik) = eb(ik) * dden(ik) / cg(ik)
199  emean = emean + eb(ik)
200  fmean = fmean + eb(ik) / sig(ik)
201  wnmean = wnmean + eb(ik) / sqrt(wn(ik))
202  END DO
203  !
204  ! 3. Add tail beyond discrete spectrum
205  ! ( DTH * SIG absorbed in FTxx )
206  !
207  eband = eb(nk) / dden(nk)
208  emean = emean + eband * fte
209  fmean = fmean + eband * ftf
210  wnmean = wnmean + eband * ftwn
211  !
212  ! 4. Final processing
213  !
214  fmean = tpiinv * emean / max( 1.e-7 , fmean )
215  wnmean = ( emean / max( 1.e-7 , wnmean ) )**2
216  !
217 #ifdef W3_T
218  WRITE (ndst,9000) emean, fmean, wnmean
219 #endif
220  !
221  RETURN
222  !
223  ! Formats
224  !
225 #ifdef W3_T
226 9000 FORMAT (' TEST W3SPR0 : E,F,WN MEAN ',3e10.3)
227 #endif
228  !/
229  !/ End of W3SPR0 ----------------------------------------------------- /
230  !/
231  END SUBROUTINE w3spr0
232  !/
233  !/ End of module W3SRC0MD -------------------------------------------- /
234  !/
235 END MODULE w3src0md
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3servmd
Definition: w3servmd.F90:3
constants::tpiinv
real, parameter tpiinv
TPIINV Inverse of 2*Pi.
Definition: constants.F90:74
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd
Definition: w3odatmd.F90:3
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::fte
real, pointer fte
Definition: w3gdatmd.F90:1232
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3gdatmd::dden
real, dimension(:), pointer dden
Definition: w3gdatmd.F90:1234
w3gdatmd
Definition: w3gdatmd.F90:16
w3src0md
Mean wave parameter computation for case without input and dissipation.
Definition: w3src0md.F90:15
w3gdatmd::ftf
real, pointer ftf
Definition: w3gdatmd.F90:1232
w3gdatmd::ftwn
real, pointer ftwn
Definition: w3gdatmd.F90:1232
w3src0md::w3spr0
subroutine w3spr0(A, CG, WN, EMEAN, FMEAN, WNMEAN, AMAX)
Calculate mean wave parameters.
Definition: w3src0md.F90:82