WAVEWATCH III  beta 0.0.1
w3str1md Module Reference

Module for inclusion of triad nonlinear interaction according to Eldeberky's (1996) Lumped Triad Interaction (LTA) source term. More...

Functions/Subroutines

subroutine w3str1 (A, AOLD, CG, WN, DEPTH, IX, S, D)
 Triad interaction source term computed using the Lumped Triad Appproximation (LTA) of Eldeberky (1996). More...
 

Detailed Description

Module for inclusion of triad nonlinear interaction according to Eldeberky's (1996) Lumped Triad Interaction (LTA) source term.

Author
A. J. van der Westhuysen
Date
13-Jan-2013

Function/Subroutine Documentation

◆ w3str1()

subroutine w3str1md::w3str1 ( real, dimension(nspec), intent(in)  A,
real, dimension(nspec), intent(in)  AOLD,
real, dimension(nk), intent(in)  CG,
real, dimension(nk), intent(in)  WN,
real, intent(in)  DEPTH,
integer, intent(in)  IX,
real, dimension(nspec), intent(out)  S,
real, dimension(nspec), intent(out)  D 
)

Triad interaction source term computed using the Lumped Triad Appproximation (LTA) of Eldeberky (1996).

     The parametrized biphase is given by:

                                  0.2
     beta = - pi/2 + pi/2 tanh ( ----- )
                                   Ur

     where Ur is the Ursell number.

     The source term as function of frequency p is:

             +      -
     S(p) = S(p) + S(p)

     in which

      +
     S(p) = alpha Cp Cg,p (R(p/2,p/2))**2 sin (|beta|) ( E(p/2)**2 -2 E(p) E(p/2) )

      -          +
     S(p) = - 2 S(2p)

     with alpha a tunable coefficient and R(p/2,p/2) is the interaction
     coefficient of which the expression can be found in Eldeberky (1996).

     Note that a slightly adapted formulation of the LTA is used in
     in the SWAN model:

     - Only positive contributions to higher harmonics are considered
       here (no energy is transferred to lower harmonics).

     - The mean frequency in the expression of the Ursell number
       is calculated according to the first order moment over the
       zeroth order moment (personal communication, Y.Eldeberky, 1997).

     - The interactions are calculated up to 2.5 times the mean
       frequency only.

     - Since the spectral grid is logarithmically distributed in frequency
       space, the interactions between central bin and interacting bin
       are interpolated such that the distance between these bins is
       factor 2 (nearly).

     - The interactions are calculated in terms of energy density
       instead of action density. So the action density spectrum
       is firstly converted to the energy density grid, then the
       interactions are calculated and then the spectrum is converted
       to the action density spectrum back.
Parameters
[in]AAction density spectrum (1-D)
[in]CGGroup velocities.
[in]WNWavenumbers.
[in]DEPTHMean water depth.
[in]IX
[out]SSource term (1-D version).
[out]DDiagonal term of derivative (1-D version).
Author
A. J. van der Westhuysen
Date
13-Jan-2013

Definition at line 184 of file w3str1md.F90.

184  !/
185  !/ +-----------------------------------+
186  !/ | WAVEWATCH III NOAA/NCEP |
187  !/ | A. J. van der Westhuysen |
188  !/ | A. Roland |
189  !/ | FORTRAN 90 |
190  !/ | Last update : 13-Jan-2013 |
191  !/ +-----------------------------------+
192  !/
193  !/ 13 Jan-2013 : Origination, based on SWAN v40.91 code ( version 4.08 )
194  !/ 05 Oct-2016 : Avoiding divide by zero for EMEAN ( version 5.15 )
195  !/ 28 Feb-2023 : Improvement of efficiency and stability ( version 7.xx)
196  !/
197  ! 1. Purpose :
198  !
199  ! Triad interaction source term computed using the Lumped Triad
200  ! Appproximation (LTA) of Eldeberky (1996).
201  !
202  ! 2. Method :
203  !
204  ! (Taken from SWAN v40.91, based on code by Marcel Zijlema, TU Delft)
205  !
206  ! The parametrized biphase is given by:
207  !
208  ! 0.2
209  ! beta = - pi/2 + pi/2 tanh ( ----- )
210  ! Ur
211  !
212  ! where Ur is the Ursell number.
213  !
214  ! The source term as function of frequency p is:
215  !
216  ! + -
217  ! S(p) = S(p) + S(p)
218  !
219  ! in which
220  !
221  ! +
222  ! S(p) = alpha Cp Cg,p (R(p/2,p/2))**2 sin (|beta|) ( E(p/2)**2 -2 E(p) E(p/2) )
223  !
224  ! - +
225  ! S(p) = - 2 S(2p)
226  !
227  ! with alpha a tunable coefficient and R(p/2,p/2) is the interaction
228  ! coefficient of which the expression can be found in Eldeberky (1996).
229  !
230  ! Note that a slightly adapted formulation of the LTA is used in
231  ! in the SWAN model:
232  !
233  ! - Only positive contributions to higher harmonics are considered
234  ! here (no energy is transferred to lower harmonics).
235  !
236  ! - The mean frequency in the expression of the Ursell number
237  ! is calculated according to the first order moment over the
238  ! zeroth order moment (personal communication, Y.Eldeberky, 1997).
239  !
240  ! - The interactions are calculated up to 2.5 times the mean
241  ! frequency only.
242  !
243  ! - Since the spectral grid is logarithmically distributed in frequency
244  ! space, the interactions between central bin and interacting bin
245  ! are interpolated such that the distance between these bins is
246  ! factor 2 (nearly).
247  !
248  ! - The interactions are calculated in terms of energy density
249  ! instead of action density. So the action density spectrum
250  ! is firstly converted to the energy density grid, then the
251  ! interactions are calculated and then the spectrum is converted
252  ! to the action density spectrum back.
253  !
254  ! 3. Parameters :
255  !
256  ! Parameter list
257  ! ----------------------------------------------------------------
258  ! A R.A. I Action density spectrum (1-D)
259  ! CG R.A. I Group velocities.
260  ! WN R.A. I Wavenumbers.
261  ! DEPTH Real I Mean water depth.
262  ! EMEAN Real I Mean wave energy.
263  ! FMEAN Real I Mean wave frequency.
264  ! S R.A. O Source term (1-D version).
265  ! D R.A. O Diagonal term of derivative (1-D version).
266  ! ----------------------------------------------------------------
267  !
268  ! 4. Subroutines used :
269  !
270  ! Name Type Module Description
271  ! ----------------------------------------------------------------
272  ! STRACE Subr. W3SERVMD Subroutine tracing.
273  ! ----------------------------------------------------------------
274  !
275  ! 5. Called by :
276  !
277  ! Name Type Module Description
278  ! ----------------------------------------------------------------
279  ! W3SRCE Subr. W3SRCEMD Source term integration.
280  ! W3EXPO Subr. N/A Point output post-processor.
281  ! GXEXPO Subr. N/A GrADS point output post-processor.
282  ! ----------------------------------------------------------------
283  !
284  ! 6. Error messages :
285  !
286  ! None.
287  !
288  ! 7. Remarks :
289  !
290  ! 8. Structure :
291  !
292  ! Determine resonance condition and the maximum discrete freq.
293  ! for which the interactions are calculated.
294  !
295  ! If Ursell number larger than prescribed value compute interactions
296  ! Calculate biphase
297  ! Do for each direction
298  ! Convert action density to energy density
299  ! Do for all frequencies
300  ! Calculate interaction coefficient and interaction factor
301  ! Compute interactions and store results in matrix
302  !
303  ! 9. Switches :
304  !
305  ! !/S Enable subroutine tracing.
306  !
307  ! 10. Source code :
308  !
309  !/ ------------------------------------------------------------------- /
310  USE constants, ONLY: grav, pi, tpi
311  USE w3gdatmd, ONLY: nk, nth, nspec, dth, sig, dden, fte, ftf
312  USE w3odatmd, ONLY: ndse
313  USE w3servmd, ONLY: extcde
314 #ifdef W3_S
315  USE w3servmd, ONLY: strace
316 #endif
317  !/
318  IMPLICIT NONE
319  !/
320  !/ ------------------------------------------------------------------- /
321  !/ Parameter list
322  !/
323  REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH, A(NSPEC), AOLD(NSPEC)
324  INTEGER, INTENT(IN) :: IX
325  REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
326  !/
327  !/ ------------------------------------------------------------------- /
328  !/ Local parameters
329  !/
330  ! AUX1 : auxiliary real
331  ! AUX2 : auxiliary real
332  ! BIPH : parameterized biphase of the spectrum
333  ! C0 : phase velocity at central bin
334  ! CM : phase velocity at interacting bin
335  ! DEP : water depth
336  ! DEP_2 : water depth to power 2
337  ! DEP_3 : water depth to power 3
338  ! E : energy density as function of frequency
339  ! E0 : energy density at central bin
340  ! EM : energy density at interacting bin
341  ! HS : significant wave height
342  ! FT : auxiliary real indicating multiplication factor
343  ! for triad contribution
344  ! I1 : auxiliary integer
345  ! I2 : auxiliary integer
346  ! ID : counter
347  ! IDDUM : loop counter in direction space
348  ! IENT : number of entries
349  ! II : loop counter
350  ! IS : loop counter in frequency space
351  ! ISM : negative range for IS
352  ! ISM1 : negative range for IS
353  ! ISMAX : maximum of the counter in frequency space for
354  ! which the triad interactions are calculated (cut-off)
355  ! ISP : positive range for IS
356  ! ISP1 : positive range for IS
357  ! RINT : interaction coefficient
358  ! SA : interaction contribution of triad
359  ! SIGPICG : sigma times 2pi/Cg (a Jacobian for E(f) -> E(k))
360  ! SINBPH: absolute sine of biphase
361  ! STRI : total triad contribution
362  ! WISM : interpolation weight factor corresponding to lower harmonic
363  ! WISM1 : interpolation weight factor corresponding to lower harmonic
364  ! WISP : interpolation weight factor corresponding to higher harmonic
365  ! WISP1 : interpolation weight factor corresponding to higher harmonic
366  ! W0 : radian frequency of central bin
367  ! WM : radian frequency of interacting bin
368  ! WN0 : wave number at central bin
369  ! WNM : wave number at interacting bin
370  ! XIS : rate between two succeeding frequency counters
371  ! XISLN : log of XIS
372  !
373 #ifdef W3_S
374  INTEGER, SAVE :: IENT = 0
375 #endif
376  INTEGER :: I1, I2, ID, IDDUM, II, IS, ISM, ISM1, ISMAX
377  INTEGER :: ISP, ISP1, ITH, IK
378  REAL :: AUX1, AUX2, BIPH, C0, CM, DEP, DEP_2, DEP_3, E0, EM, HS
379  REAL :: FT, RINT, SIGPICG, SINBPH, STRI, WISM, WISM1, WISP
380  REAL :: WISP1, W0, WM, WN0, WNM, XIS, XISLN, EDM, ED0, G9DEP, STRI2
381  REAL :: E(NK), SA(NTH,100), SA2(NTH,100), A2(NSPEC), A3(NSPEC), HMAX
382  REAL :: EB(NK), EBAND, EMEAN, SIGM01, ED(NK)
383 !----- Temp (to be moved) -----
384  REAL :: EF(NK), JACEPS, DIFFSTR
385  REAL :: PTRIAD(5)
386  REAL :: URSELL, ALPHAR
387 !------------------------------
388 !/
389 !/ ------------------------------------------------------------------- /
390 !/
391 #ifdef W3_S
392  CALL strace (ient, 'W3STR1')
393 #endif
394 
395 !AR: todo: check all PRX routines for differences, check original thesis of elderberky.
396 !
397 ! 1. Integral over directions
398 !
399  sigm01 = 0.
400  emean = 0.
401  jaceps = 1e-12
402 
403  hmax = depth * 0.73
404 
405  DO ik=1, nk
406  eb(ik) = 0.
407  ed(ik) = 0.
408  DO ith=1, nth
409  eb(ik) = eb(ik) + a(ith+(ik-1)*nth)
410  ed(ik) = ed(ik) + a(ith+(ik-1)*nth) * dden(ik) / cg(ik)
411  END DO
412  END DO
413 !
414 ! 2. Integrate over frequencies.
415 !
416  DO ik=1, nk
417  eb(ik) = eb(ik) * dden(ik) / cg(ik)
418  emean = emean + eb(ik)
419  sigm01 = sigm01 + eb(ik)*sig(ik)
420  END DO
421 !
422 ! 3. Add tail beyond discrete spectrum
423 ! ( DTH * SIG(NK) absorbed in FTxx )
424 !
425  eband = eb(nk) / dden(nk)
426  emean = emean + eband * fte
427  sigm01 = sigm01 + eband * ftf
428 !
429 ! 4. Final processing
430 !
431  sigm01 = sigm01 / emean
432 
433 !---- Temporary parameters (to be replaced by namelists) -----
434 
435  ptriad(1) = 1.
436  ptriad(2) = 10.
437  ptriad(3) = 10. ! not used
438  ptriad(4) = 0.2
439  ptriad(5) = 0.01
440 
441  hs = 4.*sqrt( max(0.,emean) )
442  ursell = (grav*hs)/(2.*sqrt(2.)*sigm01**2*depth**2)
443 !---------------------------------------------
444 
445  dep = depth
446  dep_2 = dep**2
447  dep_3 = dep**3
448  g9dep = grav * dep
449 !
450 ! --- compute some indices in sigma space
451 !
452  i2 = int(float(nk) / 2.)
453  i1 = i2 - 1
454  xis = sig(i2) / sig(i1)
455  xisln = log( xis )
456 
457  isp = int( log(2.) / xisln )
458  isp1 = isp + 1
459  wisp = (2. - xis**isp) / (xis**isp1 - xis**isp)
460  wisp1 = 1. - wisp
461 
462  ism = int( log(0.5) / xisln )
463  ism1 = ism - 1
464  wism = (xis**ism -0.5) / (xis**ism - xis**ism1)
465  wism1 = 1. - wism
466 
467  e = 0.
468  sa = 0.
469 !
470 ! --- compute maximum frequency for which interactions are calculated
471 !
472  ismax = 1
473  DO ik = 1, nk
474  IF ( sig(ik) .LT. ( ptriad(2) * sigm01) ) THEN
475  ismax = ik
476  ENDIF
477  ENDDO
478  ismax = max( ismax , isp1 )
479 !
480 ! --- compute 3-wave interactions
481 !
482  IF (ursell.GE.ptriad(5) ) THEN ! AR: No need for switching it off from my point of view!
483 !
484 ! --- calculate biphase
485 !
486  biph = (0.5*pi)*(tanh(ptriad(4)/ursell)-1.)
487  sinbph = abs(sin(biph) )
488  ef = 0.
489 
490  DO ith = 1, nth
491  DO ik = 1, nk
492  e(ik) = a(ith+(ik-1)*nth) * tpi * sig(ik) / cg(ik)
493  ef(ik) = ef(ik) + e(ik)
494  END DO
495  DO ik = 1, ismax
496  e0 = e(ik)
497  ed0 = eb(ik)
498  w0 = sig(ik)
499  wn0 = wn(ik)
500  c0 = w0 / wn0
501  IF ( ik.GT.-ism1 ) THEN
502  em = wism * e(ik+ism1) + wism1 * e(ik+ism)
503  edm = wism * eb(ik+ism1) + wism1 * eb(ik+ism)
504  wm = wism * sig(ik+ism1) + wism1 * sig(ik+ism)
505  wnm = wism * wn(ik+ism1) + wism1 * wn(ik+ism)
506  cm = wm / wnm
507  ELSE
508  em = 0.
509  edm = 0.
510  wm = 0.
511  wnm = 0.
512  cm = 0.
513  END IF
514  aux1 = wnm**2 * ( g9dep + 2*cm**2 )
515  aux2 = wn0*dep* (g9dep+(2./15.)*grav*dep_3*wn0**2-(2./5.)*w0**2*dep_2)
516  rint = aux1 / aux2
517  ft = ptriad(1) * c0 * cg(ik) * rint**2 * sinbph
518  sa(ith,ik) = max(0.,ft * ( em * em - 2. * em * e0)) ! 1/(m²*s²) * m4 = m²/s² !!! [m²/s]
519  END DO
520  END DO
521 
522  DO ik = 1, nk - 1
523  sigpicg = sig(ik)*tpi/cg(ik) ! 1/s * s/m = 1/m
524  DO ith = 1, nth
525  stri = sa(ith,ik) - 2 * (wisp * sa(ith,ik+isp1) + wisp1 * sa(ith,ik+isp))
526  IF (a(ith+(ik-1)*nth) .gt. jaceps) THEN
527  d(ith+(ik-1)*nth) = stri / ((a(ith+(ik-1)*nth)) * sigpicg)
528  s(ith+(ik-1)*nth) = stri / sigpicg
529  ELSE
530  d(ith+(ik-1)*nth) = 0.
531  s(ith+(ik-1)*nth) = 0.
532  ENDIF
533  END DO
534  END DO
535  ELSE
536  d = 0.
537  s = 0.
538  END IF
539 
540  !/
541  !/ End of W3STR1 ----------------------------------------------------- /
542  !/

References w3gdatmd::dden, w3gdatmd::dth, w3servmd::extcde(), w3gdatmd::fte, w3gdatmd::ftf, constants::grav, w3odatmd::ndse, w3gdatmd::nk, w3gdatmd::nspec, w3gdatmd::nth, constants::pi, w3gdatmd::sig, w3servmd::strace(), and constants::tpi.

Referenced by w3srcemd::w3srce().

w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
constants::pi
real, parameter pi
PI Value of Pi.
Definition: constants.F90:71
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3gdatmd::nspec
integer, pointer nspec
Definition: w3gdatmd.F90:1230
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3servmd
Definition: w3servmd.F90:3
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd
Definition: w3odatmd.F90:3
constants::tpi
real, parameter tpi
TPI 2*Pi.
Definition: constants.F90:72
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::fte
real, pointer fte
Definition: w3gdatmd.F90:1232
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
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3gdatmd::ftf
real, pointer ftf
Definition: w3gdatmd.F90:1232
constants::grav
real, parameter grav
GRAV Acc.
Definition: constants.F90:61