-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw3src0md.ftn
198 lines (198 loc) · 5.85 KB
/
w3src0md.ftn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#include "w3macros.h"
!/ ------------------------------------------------------------------- /
MODULE W3SRC0MD
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 29-May-2009 |
!/ +-----------------------------------+
!/
!/ 05-Jul-2006 : Origination. ( version 3.09 )
!/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
!/
!/ Copyright 2009 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
!/ reserved. WAVEWATCH III is a trademark of the NWS.
!/ No unauthorized use without permission.
!/
! 1. Purpose :
!
! Mean wave parameter computation for case without input and
! dissipation.
!
! 2. Variables and types :
!
! 3. Subroutines and functions :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! W3SPR0 Subr. Public Mean parameters from spectrum.
! ----------------------------------------------------------------
!
! 4. Subroutines and functions used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! STRACE Subr. W3SERVMD Subroutine tracing. ( !/S )
! ----------------------------------------------------------------
!
! 5. Remarks :
!
! 6. Switches :
!
! !/S Enable subroutine tracing.
! !/T Test output, see subroutines.
!
! 7. Source code :
!
!/ ------------------------------------------------------------------- /
!/
PUBLIC
!/
CONTAINS
!/ ------------------------------------------------------------------- /
SUBROUTINE W3SPR0 (A, CG, WN, EMEAN, FMEAN, WNMEAN, AMAX)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 05-Jul-2006 |
!/ +-----------------------------------+
!/
!/ 05-Jul-2006 : Origination. ( version 3.09 )
!/
! 1. Purpose :
!
! Calculate mean wave parameters.
!
! 2. Method :
!
! See source term routines.
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! A R.A. I Action as a function of direction and
! wavenumber.
! CG R.A. I Group velocities.
! WN R.A. I Wavenumbers.
! EMEAN Real O Mean wave energy.
! FMEAN Real O Mean wave frequency.
! WNMEAN Real O Mean wavenumber.
! AMAX Real O Maximum action density in spectrum.
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! STRACE Subr. W3SERVMD Subroutine tracing.
! ----------------------------------------------------------------
!
! 5. Called by :
!
! Name Type Module Description
! ----------------------------------------------------------------
! W3SRCE Subr. W3SRCEMD Source term integration.
! W3EXPO Subr. N/A Point output post-processor.
! GXEXPO Subr. N/A GrADS point output post-processor.
! ----------------------------------------------------------------
!
! 6. Error messages :
!
! None.
!
! 7. Remarks :
!
! 8. Structure :
!
! See source code.
!
! 9. Switches :
!
! !/S Enable subroutine tracing.
! !/T Enable test output.
!
! 10. Source code :
!
!/ ------------------------------------------------------------------- /
USE CONSTANTS
USE W3GDATMD, ONLY: NK, NTH, SIG, DDEN, FTE, FTF, FTWN
!/T USE W3ODATMD, ONLY: NDST
!/S USE W3SERVMD, ONLY: STRACE
!
IMPLICIT NONE
!/
!/ ------------------------------------------------------------------- /
!/ Parameter list
!/
REAL, INTENT(IN) :: A(NTH,NK), CG(NK), WN(NK)
REAL, INTENT(OUT) :: EMEAN, FMEAN, WNMEAN, AMAX
!/
!/ ------------------------------------------------------------------- /
!/ Local parameters
!/
INTEGER :: IK, ITH
!/S INTEGER, SAVE :: IENT = 0
REAL :: EB(NK), EBAND
!/
!/ ------------------------------------------------------------------- /
!/
!/S CALL STRACE (IENT, 'W3SPR0')
!
EMEAN = 0.
FMEAN = 0.
WNMEAN = 0.
AMAX = 0.
!
! 1. Integral over directions
!
DO IK=1, NK
EB(IK) = 0.
DO ITH=1, NTH
EB(IK) = EB(IK) + A(ITH,IK)
AMAX = MAX ( AMAX , A(ITH,IK) )
END DO
END DO
!
! 2. Integrate over directions
!
DO IK=1, NK
EB(IK) = EB(IK) * DDEN(IK) / CG(IK)
EMEAN = EMEAN + EB(IK)
FMEAN = FMEAN + EB(IK) / SIG(IK)
WNMEAN = WNMEAN + EB(IK) / SQRT(WN(IK))
END DO
!
! 3. Add tail beyond discrete spectrum
! ( DTH * SIG absorbed in FTxx )
!
EBAND = EB(NK) / DDEN(NK)
EMEAN = EMEAN + EBAND * FTE
FMEAN = FMEAN + EBAND * FTF
WNMEAN = WNMEAN + EBAND * FTWN
!
! 4. Final processing
!
FMEAN = TPIINV * EMEAN / MAX ( 1.E-7 , FMEAN )
WNMEAN = ( EMEAN / MAX ( 1.E-7 , WNMEAN ) )**2
!
!/T WRITE (NDST,9000) EMEAN, FMEAN, WNMEAN
!
RETURN
!
! Formats
!
!/T 9000 FORMAT (' TEST W3SPR0 : E,F,WN MEAN ',3E10.3)
!/
!/ End of W3SPR0 ----------------------------------------------------- /
!/
END SUBROUTINE W3SPR0
!/
!/ End of module W3SRC0MD -------------------------------------------- /
!/
END MODULE W3SRC0MD