WAVEWATCH III  beta 0.0.1
w3snlsmd Module Reference

Nonlinear interaction based ‘smoother’ for high frequencies. More...

Functions/Subroutines

subroutine w3snls (A, CG, WN, DEPTH, UABS, DT, SNL, AA)
 High-frequeny filter based on the nonlinear interactions for an uresolved quadruplet. More...
 
subroutine insnls
 Initializations for the Snl / filter source term for high frequencies. More...
 

Variables

real, parameter abmax = 0.25
 

Detailed Description

Nonlinear interaction based ‘smoother’ for high frequencies.

Author
H. L. Tolman
Date
13-Jul-2012

Function/Subroutine Documentation

◆ insnls()

subroutine w3snlsmd::insnls

Initializations for the Snl / filter source term for high frequencies.

Precompute weight functions and store in array.

Author
H. L. Tolman
Date
04-Aug-2008

Definition at line 667 of file w3snlsmd.F90.

667  !/
668  !/ +-----------------------------------+
669  !/ | WAVEWATCH-III NOAA/NCEP |
670  !/ | H. L. Tolman |
671  !/ | FORTRAN 90 |
672  !/ | Last update : 04-Aug-2008 |
673  !/ +-----------------------------------+
674  !/
675  !/ 04-Aug-2008 : Origination. ( version 3.13 )
676  !/
677  ! 1. Purpose :
678  !
679  ! Initializations for the Snl / filter source term for high
680  ! frequencies.
681  !
682  ! 2. Method :
683  !
684  ! Precompute weight functions and store in array.
685  !
686  ! 3. Parameters :
687  !
688  ! No parameter list.
689  !
690  ! 4. Subroutines used :
691  !
692  ! Name Type Module Description
693  ! ----------------------------------------------------------------
694  ! WAVNU2 Subr. W3DISPMD Solve dispersion relation.
695  ! STRACE Subr. W3SERVMD Subroutine tracing.
696  ! EXTCDE Subr. W3SERVMD Program abort.
697  ! ----------------------------------------------------------------
698  !
699  ! 5. Called by :
700  !
701  ! Name Type Module Description
702  ! ----------------------------------------------------------------
703  ! W3IOGR Subr. W3IOGRMD Process model definition file.
704  ! ----------------------------------------------------------------
705  !
706  ! 6. Error messages :
707  !
708  ! - Check a34, b4 and b5 against MAXAB to assure that the values
709  ! are consistent with a reduced 5-point stencil for unresolved
710  ! quadruplets. a34 is checked in ww3_grid, b3 and b4 are not.
711  !
712  ! 7. Remarks :
713  !
714  ! - Small quadruplet compared to grid size reduces interactions
715  ! so that distribution of results is purely local. This results
716  ! in a much simpler model initialization than for the general
717  ! MDIA.
718  !
719  ! 8. Structure :
720  !
721  ! See source code.
722  !
723  ! 9. Switches :
724  !
725  ! !/S Enable subroutine tracing.
726  ! !/T Enable test output.
727  !
728  ! 10. Source code :
729  !
730  !/ ------------------------------------------------------------------- /
731  USE constants
732  USE w3odatmd, ONLY: ndst, ndse
733  USE w3gdatmd, nfr => nk, a34 => cnlsa
734  !
735  USE w3dispmd, ONLY: wavnu2
736  USE w3servmd, ONLY: extcde
737 #ifdef W3_S
738  USE w3servmd, ONLY: strace
739 #endif
740  !/
741  IMPLICIT NONE
742  !/
743  !/ ------------------------------------------------------------------- /
744  !/ Parameter list
745  !/
746  !/ ------------------------------------------------------------------- /
747  !/ Local parameters
748  !/
749  INTEGER :: IKD, IERR
750 #ifdef W3_S
751  INTEGER, SAVE :: IENT = 0
752 #endif
753  REAL :: DEPTH, SITMAX, OFF, S0, WN0, CG0, &
754  S3, WN3, CG3, S4, WN4, CG4, WN12, &
755  DT3, DT4, B3, B4
756  !/
757  !/ ------------------------------------------------------------------- /
758  !/
759 #ifdef W3_S
760  CALL strace (ient, 'INSNLS')
761 #endif
762  !
763  ! 1. Initializations ------------------------------------------------ *
764  ! 1.a Set up relative depths
765  !
766  depth = 1.
767  sitmin = sqrt( kdmin * tanh(kdmin) )
768  sitmax = sqrt( kdmax * tanh(kdmax) )
769  xsit = (sitmax/sitmin)**(1./real(nkd-1))
770  !
771 #ifdef W3_T
772  WRITE (ndst,9010) nkd, kdmin, kdmax, xsit
773 #endif
774  !
775  ! 1.b Set up quadruplet
776  !
777  off = (xfr-1.) * a34
778  !
779  ! 1.c Set up storage
780  !
781  nthx = nth + 2
782  nfrx = nfr + 2
783  nspl = - nthx
784  nsph = nfrx*nthx - 1
785  !
786  ALLOCATE ( mpars(igrid)%SNLPS%SNSST(6,nkd) )
787  snsst => mpars(igrid)%SNLPS%SNSST
788  !
789  ! 2. Building quadruplet data base ---------------------------------- *
790  ! For quadruplet and interaction strength evaluation
791  !
792  s0 = sitmin * sqrt( grav / depth ) / xsit
793  !
794  ! 2.a Loop over relative depths
795  !
796  DO ikd=1, nkd
797  !
798  ! 2.b Base quadruplet set up
799  !
800  s0 = s0 * xsit
801  s3 = ( 1. + off ) * s0
802  s4 = ( 1. - off ) * s0
803  !
804  CALL wavnu2 ( s0, depth, wn0, cg0, 1.e-6, 25, ierr)
805  CALL wavnu2 ( s3, depth, wn3, cg3, 1.e-6, 25, ierr)
806  CALL wavnu2 ( s4, depth, wn4, cg4, 1.e-6, 25, ierr)
807  !
808 #ifdef W3_T
809  WRITE (ndst,9020) ikd, wn0*depth, s0*tpiinv, depth
810 #endif
811  !
812  ! 2.c Offset angles
813  !
814  wn12 = 2. * wn0
815  dt3 = acos( (wn3**2+wn12**2-wn4**2) / (2.*wn12*wn3) )
816  dt4 = acos( (wn4**2+wn12**2-wn3**2) / (2.*wn12*wn4) )
817  !
818  b3 = dt3 / dth
819  b4 = dt4 / dth
820  !
821 #ifdef W3_T
822  WRITE (ndst,9021) a34, b3, b4, dt3*rade, dt4*rade
823 #endif
824  !
825  IF ( a34.GT.abmax .OR. b3.GT.abmax .OR. b4.GT.abmax .OR. &
826  a34.LT.0. .OR. b3.LT.0. .OR. b4.LT.0. ) GOTO 801
827  !
828  ! 2.d Store weights
829  !
830  snsst( 1,ikd) = 2.*a34 + b3 + b4
831  snsst( 2,ikd) = 1. - a34 - b3
832  snsst( 3,ikd) = b3
833  snsst( 4,ikd) = a34
834  snsst( 5,ikd) = 1. - a34 - b4
835  snsst( 6,ikd) = b4
836  !
837  ! ... End loop 2.a
838  !
839  END DO
840  !
841  RETURN
842  !
843  ! Error escape locations
844  !
845 801 CONTINUE
846  WRITE (ndse,1001) a34, b3, b4
847  CALL extcde (1001)
848  !
849  ! Formats
850  !
851 1001 FORMAT (/' *** WAVEWATCH-III ERROR IN INSNLS :'/ &
852  ' PARAMETER FORCED OUT OF RANGE '/ &
853  ' A34, B3, B4 :', 3f10.4/)
854  !
855 #ifdef W3_T
856 9010 FORMAT (/' TEST INSNLS: NKD, KDMIN/MAX/X :',i5,3f10.4)
857 9020 FORMAT ( ' IKD, KD, F, D :',i5,3f10.4)
858 9021 FORMAT ( ' A34, B3,B4, TH3/4:',3f7.3,2f6.2)
859 #endif
860  !/
861  ! /End of INSNLS ------------------------------------------------------/
862  !/

References w3gdatmd::cnlsa, w3gdatmd::dth, w3servmd::extcde(), constants::grav, w3gdatmd::igrid, w3gdatmd::mpars, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nfrx, w3gdatmd::nk, w3gdatmd::nsph, w3gdatmd::nspl, w3gdatmd::nth, w3gdatmd::nthx, constants::rade, w3gdatmd::snsst, w3servmd::strace(), constants::tpiinv, w3dispmd::wavnu2(), and w3gdatmd::xfr.

Referenced by w3iogrmd::w3iogr().

◆ w3snls()

subroutine w3snlsmd::w3snls ( real, dimension(nth,nfr), intent(in)  A,
real, dimension(nfr), intent(in)  CG,
real, dimension(nfr), intent(in)  WN,
real, intent(in)  DEPTH,
real, intent(in)  UABS,
real, intent(in)  DT,
real, dimension(nth,nfr), intent(out), optional  SNL,
real, dimension(nth,nfr), intent(out), optional  AA 
)

High-frequeny filter based on the nonlinear interactions for an uresolved quadruplet.

Compute interactions for a quadruplet that is not resolved by the discrete spectral rsolution, and then reduces to a simple five-point stencil. Furthermore interactions are filtered by frequency to allow for high-frequency impact only, and the integration schem is embedded, and reduces to a filter technique for large time steps or strong interactions.

Parameters
[in]AAction spectrum A(ITH,IK) as a function of direction (rad) and wavenumber.
[in]CGGroup velocities (dimension NK).
[in]WNWavenumbers (dimension NK).
[in]DEPTHWater depth in meters.
[in]UABSWind speed (m/s).
[in]DTNumerical time step (s).
[out]SNLNonlinear source term.
[out]AAAveraged spectrum.
Author
H. L. Tolman
Date
04-Aug-2008

Definition at line 132 of file w3snlsmd.F90.

132  !/
133  !/ +-----------------------------------+
134  !/ | WAVEWATCH-III NOAA/NCEP |
135  !/ | H. L. Tolman |
136  !/ | FORTRAN 90 |
137  !/ | Last update : 04-Aug-2008 |
138  !/ +-----------------------------------+
139  !/
140  !/ 04-Aug-2008 : Origination. ( version 3.13 )
141  !/
142  ! 1. Purpose :
143  !
144  ! High-frequeny filter based on the nonlinear interactions for
145  ! an uresolved quadruplet.
146  !
147  ! 2. Method :
148  !
149  ! Compute interactions for a quadruplet that is not resolved by
150  ! the discrete spectral rsolution, and then reduces to a simple
151  ! five-point stencil. Furthermore interactions are filtered by
152  ! frequency to allow for high-frequency impact only, and the
153  ! integration schem is embedded, and reduces to a filter technique
154  ! for large time steps or strong interactions.
155  !
156  ! 3. Parameters :
157  !
158  ! Parameter list
159  ! ----------------------------------------------------------------
160  ! A R.A. I Action spectrum A(ITH,IK) as a function of
161  ! direction (rad) and wavenumber.
162  ! CG R.A. I Group velocities (dimension NK).
163  ! WN R.A. I Wavenumbers (dimension NK).
164  ! DEPTH Real I Water depth in meters.
165  ! UABS Real I Wind speed (m/s).
166  ! DT Real I Numerical time step (s).
167  ! SNL R.A. O Nonlinear source term. (Opt)
168  ! AA R.A. O Averaged spectrum. (Opt)
169  ! ----------------------------------------------------------------
170  ! Note: A and AA may safely be same array/address.
171  !
172  ! 4. Subroutines used :
173  !
174  ! Name Type Module Description
175  ! ----------------------------------------------------------------
176  ! WAVNU1 Subr. W3DISPMD Solve dispersion relation.
177  ! STRACE Subr. W3SERVMD Subroutine tracing.
178  ! ----------------------------------------------------------------
179  !
180  ! 5. Called by :
181  !
182  ! Name Type Module Description
183  ! ----------------------------------------------------------------
184  ! W3SRCE Subr. W3SRCEMD Source term integration.
185  ! W3EXPO Subr. N/A Point output post-processor.
186  ! GXEXPO Subr. N/A GrADS point output post-processor.
187  ! ----------------------------------------------------------------
188  !
189  ! 6. Error messages :
190  !
191  ! None.
192  !
193  ! 7. Remarks :
194  !
195  ! 8. Structure :
196  !
197  ! See source code.
198  !
199  ! 9. Switches :
200  !
201  ! !/S Enable subroutine tracing.
202  ! !/T Enable test output.
203  ! !/T1 Test output frequency filter.
204  !
205  ! 10. Source code :
206  !
207  !/ ------------------------------------------------------------------- /
208  USE constants
209  USE w3gdatmd, ONLY: nfr => nk, nth, sig, xfr, fachfa, dth, &
210  nthx, nfrx, nspl, nsph, snsst, cnlsc, &
212  USE w3odatmd, ONLY: ndst, ndse
213  !
214  USE w3dispmd, ONLY: wavnu1
215 #ifdef W3_S
216  USE w3servmd, ONLY: strace
217 #endif
218 #ifdef W3_T2
219  USE w3arrymd, ONLY: prt2ds
220 #endif
221  !/
222  IMPLICIT NONE
223  !/
224  !/ ------------------------------------------------------------------- /
225  !/ Parameter list
226  !/
227  REAL, INTENT(IN) :: A(NTH,NFR), CG(NFR), WN(NFR), &
228  DEPTH, UABS, DT
229  REAL, INTENT(OUT), OPTIONAL :: SNL(NTH,NFR), AA(NTH,NFR)
230  !/
231  !/ ------------------------------------------------------------------- /
232  !/ Local parameters
233  !/
234  INTEGER :: IFR, IFRMIN, ITH, IFRMN2, &
235  IKD, JKD(0:NFR+2), ISPX0, ISPX
236 #ifdef W3_S
237  INTEGER, SAVE :: IENT = 0
238 #endif
239  REAL :: SIGP, CP, CM, XL, XH, EL, EH, DENOM, &
240  SIT, XSITLN, MC, F3A, F3B, F3C, &
241  F4A, F4B, F4C, F00, F31, F32, F41, &
242  F42, AUXB, AUX11, AUX21, AUX12, &
243  AUX22, FC1, FC2, FC3, FC4
244  REAL :: XSI(NFR+2), XWN(NFR+2), XCG(NFR+2), &
245  UP(NSPL:NSPH), UN(NSPL:NSPH), &
246  E1(0:NFR+2), FILTFP(NFR+2), &
247  FPROP(NFR+2), DS1(NSPL:NSPH), &
248  DS2(NSPL:NSPH), DS3(NSPL:NSPH), &
249  DA1(NSPL:NSPH), DA2(NSPL:NSPH), &
250  DA3(NSPL:NSPH)
251  !/
252  !/ ------------------------------------------------------------------- /
253  !/
254 #ifdef W3_S
255  CALL strace (ient, 'W3SNLS')
256 #endif
257  !
258 #ifdef W3_T
259  WRITE (ndst,9000) depth, uabs, dt
260 #endif
261  !
262  ! 1. Initializations ------------------------------------------------ *
263  ! 1.a Expanded frequency range
264  !
265  xsi(1:nfr) = sig(1:nfr)
266  xwn(1:nfr) = wn
267  xcg(1:nfr) = cg
268  !
269  xsi(nfr+1) = xsi(nfr) * xfr
270  CALL wavnu1 ( xsi(nfr+1), depth, xwn(nfr+1), xcg(nfr+1) )
271  xsi(nfr+2) = xsi(nfr+1) * xfr
272  CALL wavnu1 ( xsi(nfr+2), depth, xwn(nfr+2), xcg(nfr+2) )
273  !
274  ! 1.b Expanded psuedo spectrum
275  !
276  CALL expand ( up, un )
277  !
278  ! 1.c Get relevant spectral peak frequency
279  !
280 #ifdef W3_T1
281  e1 = -1.
282 #endif
283  sigp = - tpi
284  xl = 1./xfr - 1.
285  xh = xfr - 1.
286  !
287  ! 1.c.1 Wind too weak
288  !
289  IF ( uabs .LT. xsi(nfr)/xwn(nfr) ) THEN
290  sigp = grav / max( 0.01 , uabs )
291  ELSE
292  !
293  ! 1.c.2 Compute 1D spectrum
294  !
295  e1(nfr+2) = sum(a(:,nfr)) * fachfa**2 * xsi(nfr+2) &
296  / xcg(nfr+2) * tpi * dth
297  e1(nfr+1) = sum(a(:,nfr)) * fachfa * xsi(nfr+1) &
298  / xcg(nfr+1) * tpi * dth
299  !
300  DO ifr=nfr, 1, -1
301  e1(ifr) = sum(a(:,ifr)) * xsi(ifr) / xcg(ifr) * tpi * dth
302  !
303  ! 1.c.3 Reached PM frequency
304  !
305  IF ( uabs .LT. xsi(ifr)/xwn(ifr) ) THEN
306  cp = xsi(ifr)/xwn(ifr)
307  cm = xsi(ifr+1)/xwn(ifr+1)
308  sigp = xsi( ifr ) * (uabs-cm)/(cp-cm) + &
309  xsi(ifr+1) * (cp-uabs)/(cp-cm)
310  EXIT
311  !
312  ELSE IF ( e1(ifr) .LT. e1(ifr+1) ) THEN
313  !
314  ! 1.c.4 Reached first peak
315  !
316  el = e1(ifr ) - e1(ifr+1)
317  eh = e1(ifr+2) - e1(ifr+1)
318  denom = xl*eh - xh*el
319  sigp = xsi(ifr+1) * (1.+0.5*(xl**2*eh-xh**2*el) &
320  / sign( max(abs(denom),1.e-15) , denom ) )
321  EXIT
322  ENDIF
323  !
324  ! ... End loop 1.c.2
325  !
326  END DO
327  !
328  ! 1.c.5 Nothing found
329  !
330  IF ( sigp .LT. 0. ) THEN
331  !
332  ! 1.c.5.a No energy there
333  !
334  IF ( e1(1) .EQ. 0. ) THEN
335  sigp = 2. * sig(nfr)
336  !
337  ! 1.c.5.b Peak at low boundary
338  !
339  ELSE
340  sigp = xsi(1)
341  END IF
342  END IF
343  !
344  END IF
345  !
346  ! 1.d Set up filter function etc.
347  !
348  xsitln = log(xsit)
349  ifrmin = 1
350  jkd = 1
351 #ifdef W3_T1
352  filtfp = -1.
353 #endif
354  !
355  DO ifr=nfr+2, 1, -1
356  !
357  filtfp(ifr) = exp(-cnlsc1/(xsi(ifr)/(cnlsc2*sigp))**cnlsc3)
358  fprop(ifr) = filtfp(ifr) * cnlsc * xwn(ifr)**8 * &
359  xsi(ifr)**4 / tpi**9 / xcg(ifr)
360  sit = xsi(ifr) * sqrt(depth/grav)
361  ikd = 1 + nint( ( log(sit) - log(sitmin) ) / xsitln )
362  jkd(ifr) = max( 1 , min(ikd,nkd) )
363  !
364  IF ( filtfp(ifr) .LT. 1.e-10 ) THEN
365  ifrmin = ifr
366  EXIT
367  END IF
368  !
369  END DO
370  !
371  ifrmn2 = max( 1 , ifrmin - 1 )
372  sit = xsi(ifrmn2) * sqrt(depth/grav)
373  ikd = 1 + nint( ( log(sit) - log(sitmin) ) / xsitln )
374  jkd(ifrmn2) = max( 1 , min(ikd,nkd) )
375  !
376 #ifdef W3_T
377  WRITE (ndst,9010) ifrmin, sigp * tpiinv
378 #endif
379 #ifdef W3_T1
380  WRITE (ndst,9011)
381  DO ifr=1, nfr
382  WRITE (ndst,9012) ifr, xsi(ifr)/tpi, xsi(ifr)/xwn(ifr), &
383  e1(ifr), filtfp(ifr)
384  END DO
385 #endif
386  !
387  ! 1.e Initialize arrays
388  !
389  !
390  ! 2. Compute base interactions -------------------------------------- *
391  ! 2.a Loop over frequencies
392  !
393  DO ifr=ifrmin, nfr+1
394  !
395  ispx0 = (ifr-1)*nthx
396  ikd = jkd(ifr)
397  !
398  mc = snsst( 1,ikd)
399  f3a = snsst( 2,ikd)
400  f3b = snsst( 3,ikd)
401  f3c = snsst( 4,ikd)
402  f4a = snsst( 5,ikd)
403  f4b = snsst( 6,ikd)
404  f4c = f3c
405  !
406  ! 2.b Loop over directions
407  !
408  DO ith=1, nth
409  !
410  ispx = ispx0 + ith
411  !
412  f00 = up(ispx)
413  f31 = up(ispx)*f3a + up(ispx+1)*f3b + up(ispx+nthx)*f3c
414  f41 = up(ispx)*f4a + up(ispx-1)*f4b + up(ispx-nthx)*f4c
415  f32 = up(ispx)*f3a + up(ispx-1)*f3b + up(ispx+nthx)*f3c
416  f42 = up(ispx)*f4a + up(ispx+1)*f4b + up(ispx-nthx)*f4c
417  !
418  ds1(ispx) = fprop(ifr) * (f00**2*(f31+f41)-2.*f00*f31*f41)
419  ds2(ispx) = fprop(ifr) * (f00**2*(f32+f42)-2.*f00*f32*f42)
420  !
421  aux11 = dt * ds1(ispx)
422  aux21 = dt * ds2(ispx)
423  auxb = cnlsfm * filtfp(ifr) * max(1.e-10,un(ispx)) / &
424  max( 1.e-10 , abs(aux11)+abs(aux21) ) / mc
425  aux12 = auxb * abs(aux11)
426  aux22 = auxb * abs(aux21)
427  !
428  ! Expensive but more smooth limiter
429  !
430  ! DA1(ISPX) = AUX12 * TANH(AUX11/MAX(1.E-10,AUX12))
431  ! DA2(ISPX) = AUX22 * TANH(AUX21/MAX(1.E-10,AUX22))
432  !
433  ! Crude but cheaper limiter
434  !
435  da1(ispx) = max( -aux12 , min( aux11 , aux12 ) )
436  da2(ispx) = max( -aux22 , min( aux21 , aux22 ) )
437  !
438  END DO
439  !
440  ! ... End loop 2.b
441  !
442  END DO
443  !
444  ! 2.c Complete expanded arrays
445  !
446  ! ... End loop 2.a
447  !
448  ! 3. Compute source term if requested ------------------------------- *
449  ! 3.a Check for request
450  !
451  IF ( PRESENT(snl) ) THEN
452 #ifdef W3_T
453  WRITE (ndst,9030) 'YES/--'
454 #endif
455  !
456  ! 3.b Initializations
457  !
458  snl(:,1:ifrmn2-1) = 0.
459  !
460  ds1(nspl:ifrmn2*nthx-1) = 0.
461  ds2(nspl:ifrmn2*nthx-1) = 0.
462  ds3(nspl:ifrmn2*nthx-1) = 0.
463  !
464  ispx = ifrmn2*nthx
465  ds1(ispx+nth+1:nsph:nthx) = ds1(ispx+ 1 :nsph:nthx)
466  ds1(ispx :nsph:nthx) = ds1(ispx+nth:nsph:nthx)
467  ds2(ispx+nth+1:nsph:nthx) = ds2(ispx+ 1 :nsph:nthx)
468  ds2(ispx :nsph:nthx) = ds2(ispx+nth:nsph:nthx)
469  ds3(ifrmn2*nthx:nsph) = ds1(ifrmn2*nthx:nsph) + &
470  ds2(ifrmn2*nthx:nsph)
471  !
472  ! 3.c Loop over frequencies
473  !
474  DO ifr=ifrmn2, nfr
475  !
476  ispx0 = (ifr-1)*nthx
477  ikd = jkd(ifr)
478  !
479  fc1 = - snsst(1,ikd)
480  fc2 = snsst(4,ikd)
481  fc3 = snsst(3,ikd)
482  fc4 = snsst(6,ikd)
483  !
484  ! 3.d Loop over directions
485  !
486  DO ith=1, nth
487  ispx = ispx0 + ith
488  snl(ith,ifr) = fc1 * ds3( ispx ) &
489  + fc2 * ( ds3(ispx-nthx) + ds3(ispx+nthx) ) &
490  + fc3 * ( ds1(ispx- 1 ) + ds2(ispx+ 1 ) ) &
491  + fc4 * ( ds1(ispx+ 1 ) + ds2(ispx- 1 ) )
492  !
493  END DO
494  !
495  ! ... End loop 3.d
496  !
497  END DO
498  !
499  ! ... End loop 3.c
500  !
501 #ifdef W3_T
502  ELSE
503  WRITE (ndst,9030) '---/NO'
504 #endif
505  END IF
506  !
507  ! 4. Compute filtered spectrum if requested ------------------------- *
508  ! 4.a Check for request
509  !
510  IF ( PRESENT(aa) ) THEN
511 #ifdef W3_T
512  WRITE (ndst,9040) 'YES/--'
513 #endif
514  !
515  ! 4.b Initializations
516  !
517  aa(:,1:ifrmn2-1) = a(:,1:ifrmn2-1)
518  !
519  da1(nspl:ifrmn2*nthx-1) = 0.
520  da2(nspl:ifrmn2*nthx-1) = 0.
521  da3(nspl:ifrmn2*nthx-1) = 0.
522  !
523  ispx = ifrmn2*nthx
524  da1(ispx+nth+1:nsph:nthx) = da1(ispx+ 1 :nsph:nthx)
525  da1(ispx :nsph:nthx) = da1(ispx+nth:nsph:nthx)
526  da2(ispx+nth+1:nsph:nthx) = da2(ispx+ 1 :nsph:nthx)
527  da2(ispx :nsph:nthx) = da2(ispx+nth:nsph:nthx)
528  da3(ifrmn2*nthx:nsph) = da1(ifrmn2*nthx:nsph) + &
529  da2(ifrmn2*nthx:nsph)
530  !
531  ! 4.c Loop over frequencies
532  !
533  DO ifr=ifrmn2, nfr
534  !
535  ispx0 = (ifr-1)*nthx
536  ikd = jkd(ifr)
537  !
538  fc1 = - snsst(1,ikd)
539  fc2 = snsst(4,ikd)
540  fc3 = snsst(3,ikd)
541  fc4 = snsst(6,ikd)
542  !
543  ! 4.d Loop over directions
544  !
545  DO ith=1, nth
546  ispx = ispx0 + ith
547  aa(ith,ifr) = max( 0. , a(ith,ifr) + &
548  fc1 * da3(ispx) &
549  + fc2 * ( da3(ispx-nthx) + da3(ispx+nthx) ) &
550  + fc3 * ( da1(ispx- 1 ) + da2(ispx+ 1 ) ) &
551  + fc4 * ( da1(ispx+ 1 ) + da2(ispx- 1 ) ) )
552  END DO
553  !
554  ! ... End loop 4.d
555  !
556  END DO
557  !
558  ! ... End loop 4.c
559  !
560 #ifdef W3_T
561  ELSE
562  WRITE (ndst,9040) '---/NO'
563 #endif
564  END IF
565  !
566 #ifdef W3_T
567  stop
568 #endif
569  RETURN
570  !
571  ! Formats
572  !
573 #ifdef W3_T
574 9000 FORMAT (/' TEST W3SNLS: DEPTH, UABS, DT :',f9.2,f7.2,f7.2)
575 9010 FORMAT ( ' IFRMIN, FP :',i4,f8.4)
576 9030 FORMAT ( ' TEST W3SNLS: SOURCE TERM REQUESTED : ',a)
577 9040 FORMAT ( ' TEST W3SNLS: AVERAGING REQUESTED : ',a)
578 #endif
579 #ifdef W3_T1
580 9011 FORMAT ( ' TEST W3SNLS: IFR, FR, C, E1, FILT :')
581 9012 FORMAT (13x,i4,f10.4,2f10.2,f10.4)
582 #endif
583  !/
584  !/ Embedded subroutines
585  !/
586  CONTAINS
587  !/ ------------------------------------------------------------------- /
597  SUBROUTINE expand ( PSPC, SPEC )
598  !/
599  !/ +-----------------------------------+
600  !/ | WAVEWATCH-III NOAA/NCEP |
601  !/ | H. L. Tolman |
602  !/ | FORTRAN 90 |
603  !/ | Last update : 23-Jul-2008 |
604  !/ +-----------------------------------+
605  !/
606  ! 1. Purpose :
607  !
608  ! Expand spectrum to simplify indirect addressing.
609  !
610  ! 3. Parameters :
611  !
612  ! Parameter list
613  ! ----------------------------------------------------------------
614  ! PSPC R.A. O Expanded spectrum.
615  ! SPEC R.A. O Expanded spectrum.
616  ! ----------------------------------------------------------------
617  !
618  ! 10. Source code :
619  !
620  !/ ------------------------------------------------------------------- /
621  IMPLICIT NONE
622  !/
623  !/ Parameter list
624  !/
625  REAL, INTENT(OUT) :: PSPC(0:NTH+1,0:NFR+2), &
626  SPEC(0:NTH+1,0:NFR+2)
627  !/
628  !/ Local parameters
629  !/
630  INTEGER :: IFR, ITH
631  !/
632  !/ ------------------------------------------------------------------- /
633  !
634  spec(:,0) = 0.
635  !
636  spec(1:nth,1:nfr) = a
637  spec(1:nth,nfr+1) = spec(1:nth,nfr) * fachfa
638  spec(1:nth,nfr+2) = spec(1:nth,nfr+1) * fachfa
639  !
640  spec(nth+1,1:nfr+2) = spec( 1 ,1:nfr+2)
641  spec( 0 ,1:nfr+2) = spec(nth,1:nfr+2)
642  !
643  DO ifr=1, nfr+2
644  pspc(:,ifr) = spec(:,ifr) / xwn(ifr)
645  END DO
646  !
647  RETURN
648  !/
649  !/ End of EXPAND ----------------------------------------------------- /
650  !/
651  END SUBROUTINE expand
652  !/
653  !/ End of W3SNLS ----------------------------------------------------- /
654  !/

References w3gdatmd::cnlsc, w3gdatmd::cnlsc1, w3gdatmd::cnlsc2, w3gdatmd::cnlsc3, w3gdatmd::cnlsfm, w3gdatmd::dth, expand(), w3gdatmd::fachfa, constants::grav, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nfrx, w3gdatmd::nk, w3gdatmd::nsph, w3gdatmd::nspl, w3gdatmd::nth, w3gdatmd::nthx, w3arrymd::prt2ds(), w3gdatmd::sig, w3gdatmd::snsst, w3servmd::strace(), constants::tpi, constants::tpiinv, w3dispmd::wavnu1(), and w3gdatmd::xfr.

Referenced by w3srcemd::w3srce().

Variable Documentation

◆ abmax

real, parameter w3snlsmd::abmax = 0.25

Definition at line 101 of file w3snlsmd.F90.

101  REAL, PARAMETER :: ABMAX = 0.25
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3gdatmd::nspl
integer, pointer nspl
Definition: w3gdatmd.F90:1376
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
constants::rade
real, parameter rade
RADE Conversion factor from radians to degrees.
Definition: constants.F90:76
w3gdatmd::snsst
real, dimension(:,:), pointer snsst
Definition: w3gdatmd.F90:1377
w3tidemd::mc
integer, parameter mc
Definition: w3tidemd.F90:92
w3gdatmd::cnlsc2
real, pointer cnlsc2
Definition: w3gdatmd.F90:1377
expand
subroutine expand(SPEC)
Expand spectrum, subroutine used to simplify addressing.
Definition: w3snl3md.F90:644
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3gdatmd::nkd
integer, parameter nkd
Definition: w3gdatmd.F90:636
w3gdatmd::fachfa
real, pointer fachfa
Definition: w3gdatmd.F90:1232
w3gdatmd::nsph
integer, pointer nsph
Definition: w3gdatmd.F90:1376
w3dispmd::wavnu2
subroutine wavnu2(W, H, K, CG, EPS, NMAX, ICON)
Definition: w3dispmd.F90:204
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
w3gdatmd::nthx
integer, pointer nthx
Definition: w3gdatmd.F90:1376
w3odatmd
Definition: w3odatmd.F90:3
w3gdatmd::igrid
integer igrid
Definition: w3gdatmd.F90:618
w3gdatmd::nfrx
integer, pointer nfrx
Definition: w3gdatmd.F90:1376
constants::tpi
real, parameter tpi
TPI 2*Pi.
Definition: constants.F90:72
w3gdatmd::cnlsc1
real, pointer cnlsc1
Definition: w3gdatmd.F90:1377
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3adatmd::nfr
integer, pointer nfr
Definition: w3adatmd.F90:657
w3arrymd
Definition: w3arrymd.F90:3
w3gdatmd::xfr
real, pointer xfr
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
Definition: w3gdatmd.F90:16
w3dispmd::wavnu1
subroutine wavnu1(SI, H, K, CG)
Definition: w3dispmd.F90:85
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3arrymd::prt2ds
subroutine prt2ds(NDS, NFR0, NFR, NTH, E, FR, UFR, FACSP, FSC, RRCUT, PRVAR, PRUNIT, PNTNME)
Definition: w3arrymd.F90:1943
w3gdatmd::cnlsc
real, pointer cnlsc
Definition: w3gdatmd.F90:1377
w3gdatmd::cnlsa
real, pointer cnlsa
Definition: w3gdatmd.F90:1377
w3gdatmd::cnlsc3
real, pointer cnlsc3
Definition: w3gdatmd.F90:1377
w3gdatmd::mpars
type(mpar), dimension(:), allocatable, target mpars
Definition: w3gdatmd.F90:1090
w3dispmd
Definition: w3dispmd.F90:3
w3gdatmd::cnlsfm
real, pointer cnlsfm
Definition: w3gdatmd.F90:1377
constants::grav
real, parameter grav
GRAV Acc.
Definition: constants.F90:61