WAVEWATCH III  beta 0.0.1
w3sbt1md.F90
Go to the documentation of this file.
1 
7 
8 #include "w3macros.h"
9 !/ ------------------------------------------------------------------- /
21 MODULE w3sbt1md
22  !/
23  !/ +-----------------------------------+
24  !/ | WAVEWATCH III NOAA/NCEP |
25  !/ | H. L. Tolman |
26  !/ | FORTRAN 90 |
27  !/ | Last update : 29-May-2009 |
28  !/ +-----------------------------------+
29  !/
30  !/ For updates see W3SBT1 documentation.
31  !/
32  ! 1. Purpose :
33  !
34  ! JONSWAP bottom friction routine.
35  !
36  ! 2. Variables and types :
37  !
38  ! 3. Subroutines and functions :
39  !
40  ! Name Type Scope Description
41  ! ----------------------------------------------------------------
42  ! W3SBT1 Subr. Public JONSWAP source term.
43  ! ----------------------------------------------------------------
44  !
45  ! 4. Subroutines and functions used :
46  !
47  ! See subroutine documentation.
48  !
49  ! 5. Remarks :
50  !
51  ! 6. Switches :
52  !
53  ! See subroutine documentation.
54  !
55  ! 7. Source code :
56  !/
57  !/ ------------------------------------------------------------------- /
58  !/
59  PUBLIC
60  !/
61 CONTAINS
62  !/ ------------------------------------------------------------------- /
88  SUBROUTINE w3sbt1 (A, CG, WN, DEPTH, S, D)
89  !/
90  !/ +-----------------------------------+
91  !/ | WAVEWATCH III NOAA/NCEP |
92  !/ | H. L. Tolman |
93  !/ | FORTRAN 90 |
94  !/ | Last update : 29-May-2009 |
95  !/ +-----------------------------------+
96  !/
97  !/ 05-Dec-1996 : Final FORTRAN 77. ( version 1.18 )
98  !/ 08-Dec-1999 : Upgrade to FORTRAN 90. ( version 2.00 )
99  !/ 20-Dec-2004 : Multiple model version. ( version 3.06 )
100  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
101  !/
102  !/ Copyright 2009 National Weather Service (NWS),
103  !/ National Oceanic and Atmospheric Administration. All rights
104  !/ reserved. WAVEWATCH III is a trademark of the NWS.
105  !/ No unauthorized use without permission.
106  !/
107  ! 1. Purpose :
108  !
109  ! Bottom friction source term according to the empirical JONSWAP
110  ! formulation.
111  !
112  ! 2. Method :
113  !
114  ! 2 GAMMA / CG \ SBTC1 / \ .
115  ! Sbt = ---------- | ------- - 0.5 | E = ----- | ... | E (1)
116  ! GRAV DEPTH \ SI/WN / DEPTH \ /
117  !
118  ! Where GAMMA = -0.038 m2/s3 (JONSWAP)
119  ! = -0.067 m2/s3 (Bouws and Komen 1983)
120  !
121  ! In the routine, the constant 2 GAMMA / GRAV = SBTC1.
122  !
123  ! 3. Parameters :
124  !
125  ! Parameter list
126  ! ----------------------------------------------------------------
127  ! A R.A. I Action density spectrum (1-D)
128  ! CG R.A. I Group velocities.
129  ! WN R.A. I Wavenumbers.
130  ! DEPTH Real I Mean water depth.
131  ! S R.A. O Source term (1-D version).
132  ! D R.A. O Diagonal term of derivative (1-D version).
133  ! ----------------------------------------------------------------
134  !
135  ! 4. Subroutines used :
136  !
137  ! Name Type Module Description
138  ! ----------------------------------------------------------------
139  ! STRACE Subr. W3SERVMD Subroutine tracing (!/S switch).
140  ! PRT2DS Subr. W3ARRYMD Print plot output (!/T1 switch).
141  ! OUTMAT Subr. W3ARRYMD Matrix output (!/T2 switch).
142  ! ----------------------------------------------------------------
143  !
144  ! 5. Called by :
145  !
146  ! Name Type Module Description
147  ! ----------------------------------------------------------------
148  ! W3SRCE Subr. W3SRCEMD Source term integration.
149  ! W3EXPO Subr. N/A Point output post-processor.
150  ! GXEXPO Subr. N/A GrADS point output post-processor.
151  ! ----------------------------------------------------------------
152  !
153  ! 6. Error messages :
154  !
155  ! None.
156  !
157  ! 7. Remarks :
158  !
159  ! 8. Structure :
160  !
161  ! See source code.
162  !
163  ! 9. Switches :
164  !
165  ! !/S Enable subroutine tracing.
166  ! !/T Enable general test output.
167  ! !/T0 2-D print plot of source term.
168  ! !/T1 Print arrays.
169  !
170  ! 10. Source code :
171  !
172  !/ ------------------------------------------------------------------- /
173  USE w3gdatmd, ONLY: nk, nth, nspec, sig, mapwn, sbtc1
174 #ifdef W3_T
175  USE w3odatmd, ONLY: ndst
176 #endif
177 #ifdef W3_S
178  USE w3servmd, ONLY: strace
179 #endif
180 #ifdef W3_T0
181  USE w3arrymd, ONLY: prt2ds
182 #endif
183 #ifdef W3_T1
184  USE w3arrymd, ONLY: outmat
185 #endif
186  !
187  IMPLICIT NONE
188  !/
189  !/ ------------------------------------------------------------------- /
190  !/ Parameter list
191  !/
192  REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH, A(NSPEC)
193  REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
194  !/
195  !/ ------------------------------------------------------------------- /
196  !/ Local parameters
197  !/
198  INTEGER :: IS, IK, NSCUT
199 #ifdef W3_S
200  INTEGER, SAVE :: IENT = 0
201 #endif
202 #ifdef W3_T0
203  INTEGER :: ITH
204 #endif
205  REAL :: FACTOR, CBETA(NK)
206 #ifdef W3_T0
207  REAL :: DOUT(NK,NTH)
208 #endif
209  !/
210  !/ ------------------------------------------------------------------- /
211  !/
212 #ifdef W3_S
213  CALL strace (ient, 'W3SBT1')
214 #endif
215  !
216  ! 1. Deep water ===================================================== *
217  !
218  IF ( depth*wn(1) .GT. 6 ) THEN
219  !
220  d = 0.
221  s = 0.
222  !
223  ! 2. Shallow water ================================================== *
224  !
225  ELSE
226  !
227  ! 2.a Set constant
228  !
229  factor = sbtc1 / depth
230  !
231 #ifdef W3_T
232  WRITE (ndst,9000) factor, depth
233 #endif
234  !
235  ! 2.b Wavenumber dependent part.
236  !
237  DO ik=1, nk
238  IF ( wn(ik)*depth .GT. 6. ) EXIT
239  cbeta(ik) = factor * &
240  max(0., (cg(ik)*wn(ik)/sig(ik)-0.5) )
241  END DO
242  !
243  ! 2.c Fill diagional matrix
244  !
245  nscut = (ik-1)*nth
246  !
247  DO is=1, nscut
248  d(is) = cbeta(mapwn(is))
249  END DO
250  !
251  DO is=nscut+1, nspec
252  d(is) = 0.
253  END DO
254  !
255  s = d * a
256  !
257  END IF
258  !
259  ! ... Test output of arrays
260  !
261 #ifdef W3_T0
262  DO ik=1, nk
263  DO ith=1, nth
264  dout(ik,ith) = d(ith+(ik-1)*nth)
265  END DO
266  END DO
267  CALL prt2ds (ndst, nk, nk, nth, dout, sig(1:), ' ', 1., &
268  0.0, 0.001, 'Diag Sbt', ' ', 'NONAME')
269 #endif
270  !
271 #ifdef W3_T1
272  CALL outmat (ndst, d, nth, nth, nk, 'diag Sbt')
273 #endif
274  !
275  RETURN
276  !
277  ! Formats
278  !
279 #ifdef W3_T
280 9000 FORMAT (' TEST W3SBT1 : FACTOR, DEPTH : ',2e10.3)
281 #endif
282  !/
283  !/ End of W3SBT1 ----------------------------------------------------- /
284  !/
285  END SUBROUTINE w3sbt1
286  !/
287  !/ End of module W3SBT1MD -------------------------------------------- /
288  !/
289 END MODULE w3sbt1md
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::nspec
integer, pointer nspec
Definition: w3gdatmd.F90:1230
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3sbt1md::w3sbt1
subroutine w3sbt1(A, CG, WN, DEPTH, S, D)
Bottom friction source term according to the empirical JONSWAP formulation.
Definition: w3sbt1md.F90:89
w3gdatmd::sbtc1
real, pointer sbtc1
Definition: w3gdatmd.F90:1384
w3arrymd::outmat
subroutine outmat(NDS, A, MX, NX, NY, MNAME)
Definition: w3arrymd.F90:988
w3servmd
Definition: w3servmd.F90:3
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::mapwn
integer, dimension(:), pointer mapwn
Definition: w3gdatmd.F90:1231
w3arrymd
Definition: w3arrymd.F90:3
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3sbt1md
JONSWAP bottom friction routine.
Definition: w3sbt1md.F90:21
w3gdatmd
Definition: w3gdatmd.F90:16
w3arrymd::prt2ds
subroutine prt2ds(NDS, NFR0, NFR, NTH, E, FR, UFR, FACSP, FSC, RRCUT, PRVAR, PRUNIT, PNTNME)
Definition: w3arrymd.F90:1943