Go to the documentation of this file.
68 PRIVATE :: calc_wbtv2, inpout
70 PRIVATE :: nsel, psea, pnms
74 INTEGER,
ALLOCATABLE,
SAVE :: PSEA(:)
75 CHARACTER(LEN=10),
ALLOCATABLE,
SAVE :: PNMS(:)
98 SUBROUTINE w3snl5(A, CG, WN, FMEAN, T1ABS, U10, UDIR, JSEA, &
204 REAL,
INTENT(IN) :: a(
nth,
nk)
205 REAL,
INTENT(IN) :: cg(
nk)
206 REAL,
INTENT(IN) :: wn(
nk)
207 REAL,
INTENT(IN) :: fmean
208 INTEGER,
INTENT(IN) :: t1abs(2)
209 REAL,
INTENT(IN) :: u10
210 REAL,
INTENT(IN) :: udir
211 INTEGER,
INTENT(IN) :: jsea
212 REAL,
INTENT(OUT) :: s(
nth,
nk), &
218 REAL,
PARAMETER :: btlow = 10., bthgh = 500.
219 REAL :: t0rel, t1rel, tdel1, tdel2
223 INTEGER :: ik, ith, ispec, isea, jloc
224 INTEGER,
ALLOCATABLE :: pdiff(:)
225 LOGICAL,
SAVE :: fstout = .true.
227 REAL :: pm_prev, pm_ival, pm_delt
231 INTEGER,
SAVE :: ient = 0
238 CALL strace (ient,
'W3SNL5')
253 IF(t1rel < 0.) t1rel = 0.
260 WRITE(
screen,
'(A, 2(I10.8, I7.6), E12.3)') &
261 " ⊚ → [WW3 SNL₅] QI5TBEG, T1ABS, T1REL:", &
267 WRITE(
screen,
'(A, 2(I10.8, I7.6), E12.3)', advance=
'no') &
268 " ⊚ → [WW3 SNL₅] QI5TBEG, T1ABS, T1REL, T1REL[P]:", &
275 IF (abs(fmean) < 1e-7)
THEN
276 pm_ival = real(
qi5pmx) * 1.
278 pm_ival = real(
qi5pmx) * (1. / fmean)
281 ELSE IF (
qi5pmx .LT. 0)
THEN
284 wbt = calc_wbtv2(a, cg, wn,
qr5dpt, u10, udir)
287 btinv = max(btlow, min(1./max(1e-6, wbt), bthgh))
288 IF (abs(fmean) < 1e-7)
THEN
291 pm_ival = btinv * (1. / fmean)
299 pm_delt = t1rel - pm_prev
300 IF (pm_delt .GE. pm_ival)
THEN
308 WRITE(
screen,
'(F9.1)') t1rel
309 IF (
qi5pmx .LT. 0 )
WRITE(
screen,
'(A, F6.3)')
'↔ bT: ', wbt
317 ispec = ith + (ik-1) *
nth
318 cvk1(ispec) = a(ith, ik) / wn(ik) *
grav
326 t0rel, t1rel, cvk0, cvk1, &
327 inpqr0, snl, dnl, kurt)
334 ispec = ith + (ik-1) *
nth
335 s(ith, ik) = snl(ispec) * wn(ik) /
grav
352 ' ⊚ → [WW3 SNL₅] Point ouptut initialization'
353 WRITE(
screen,
'(A, I4)') &
354 ' ⊚ → [WW3 SNL₅] # of valid points: ', nsel
364 .AND.
flout(2) .AND. nsel .GT. 0)
THEN
370 IF (abs(tdel1) < 1e-6 .OR. abs(tdel2) < 1e-6)
THEN
374 IF (
ALLOCATED(pdiff))
DEALLOCATE(pdiff);
ALLOCATE(pdiff(nsel))
375 pdiff = abs(psea(1:nsel) - isea)
376 IF (any(pdiff .EQ. 0))
THEN
377 jloc = minloc(pdiff, 1)
380 WRITE(
screen,
'(3A, I10.8, I7.6)') &
381 '✓ Point output for |', pnms(jloc),
'| @', t1abs
386 a2(:, ith) = a(ith, :) * factor
387 s2(:, ith) = s(ith, :) * factor
392 WRITE(
screen, *)
'★★★ Warning: find NaN in E(f, θ) &
407 OPEN(iunt,
file=
'NL5_'//trim(pnms(jloc))//
'_src.dat', &
408 form=
'formatted', status=
'old', &
409 position=
'append', action=
'write')
410 WRITE(iunt,
'(I10.8, I7.6)') t1abs
411 WRITE(iunt,
'(ES11.3)') kurt
420 113
FORMAT ((10es11.3))
506 INTEGER,
SAVE :: ient = 0
512 CALL strace (ient,
'INSNL5')
532 WRITE(
screen,
'(A, F6.1)')
" ⊚ → [WW3 SNL₅]: water depth : ",
qr_depth
533 WRITE(
screen,
'(A, F7.2)')
" ⊚ → [WW3 SNL₅]: ω λc cut off : ",
qr_oml
534 WRITE(
screen,
'(A, I4)' )
" ⊚ → [WW3 SNL₅]: Discretiza. : ",
qi_disc
535 WRITE(
screen,
'(A, I4)' )
" ⊚ → [WW3 SNL₅]: GKE version : ",
qi_kev
536 WRITE(
screen,
'(A, I12)' )
" ⊚ → [WW3 SNL₅]: # of quartets : ",
qi_nnz
538 WRITE(
screen,
'(A, I4)' )
" ⊚ → [WW3 SNL₅]: phase mixing : ",
qi5pmx
562 FUNCTION calc_wbtv2 (A, CG, WN, DPT, U10, UDIR)
606 REAL,
INTENT(IN) :: a(
nth,
nk)
607 REAL,
INTENT(IN) :: cg(
nk)
608 REAL,
INTENT(IN) :: wn(
nk)
609 REAL,
INTENT(IN) :: dpt
610 REAL,
INTENT(IN) :: u10
611 REAL,
INTENT(IN) :: udir
618 INTEGER,
SAVE :: ient = 0
621 REAL,
PARAMETER :: beta = 1.2
624 REAL :: sinu, cosu, tc, tforce
626 REAL :: factor, et, hs, etp, hsp, sigp, kp, &
632 CALL strace (ient,
'CALC_WBTv2')
656 tc =
sig(ik) / wn(ik)
657 factor =
sig(ik) / cg(ik)
658 factor = factor *
dth
661 tforce = tc - u10 * (cosu*
ecos(ith)+sinu*
esin(ith)) &
664 IF (tforce .LT. 0.)
THEN
665 esig(ik) = esig(ik) + a(ith, ik) * factor
674 et = sum(esig *
dsii)
675 hs = 4. * sqrt(max(0., et))
679 sigp = sum(esig**4. *
sig(1:
nk) *
dsii) / &
680 max(1e-10, sum(esig**4. *
dsii))
681 IF (abs(sigp) < 1e-7) sigp =
sig(
nk)
684 CALL wavnu1 (sigp, dpt, kp, cgp)
691 IF ( (
sig(ik) >= 0.7 * sigp) .AND. &
692 (
sig(ik) <= 1.3 * sigp) )
THEN
693 etp = etp + esig(ik) *
dsii(ik)
696 hsp = 4. * sqrt(max(0., etp))
700 wstp = 0.5 * kp * hsp
704 twbt = 85.1 * (max(0.0, wstp - 0.055) * (1 + hs/dpt))**2.33
705 twbt = min(1.0, twbt)
713 END FUNCTION calc_wbtv2
781 INTEGER :: ixs(4), iys(4), ix, iy, ipt, is, &
782 jloc, jx, jy, isea, smap(4), iunt
783 REAL :: plon, plat, xlon, ylat, dist(4)
787 IF (
ALLOCATED(psea))
DEALLOCATE(psea);
ALLOCATE(psea(
nopts))
788 IF (
ALLOCATED(pnms))
DEALLOCATE(pnms);
ALLOCATE(pnms(
nopts))
800 ixs(:) =
iptint(1, :, ipt)
801 iys(:) =
iptint(2, :, ipt)
809 IF (
mapsta(iy, ix) .EQ. 0) cycle
812 dist(is) = dist_sphere(plon, plat, xlon, ylat)
814 dist(is) = sqrt((plon - xlon)**2. + (plat - ylat)**2.)
821 IF (all(dist < 0.)) cycle
823 jloc = minloc(dist, 1, dist >= 0.)
831 WRITE(
screen,
"(A, 2F10.3, A, 2F10.3, A)") &
832 '✗ (PLON, PLAT): (', plon, plat,
') | (XGRD, YGRD): (',&
836 WRITE(
screen,
"(A, 2E10.3, A, 2E10.3, A)") &
837 '✗ (PLON, PLAT): (', plon, plat,
') | (XGRD, YGRD): (',&
844 pnms(nsel) =
ptnme(ipt)
859 OPEN(iunt,
file=
'NL5_'//trim(pnms(nsel))//
'_src.dat', &
860 form=
'formatted', status=
'replace', action=
'write')
861 WRITE(iunt,
'(2ES11.3)') plon, plat
862 WRITE(iunt,
'(ES11.3)' )
qr5dpt
863 WRITE(iunt,
'(2I5)')
nk,
nth
870 113
FORMAT ((10es11.3))
872 END SUBROUTINE inpout
886 FUNCTION hasnan(NK, NTH, ARR2D)
903 INTEGER,
INTENT(IN) :: nk, nth
904 REAL,
INTENT(IN) :: arr2d(nk, nth)
909 IF ( all(arr2d .GE. -huge(arr2d(1, 1))) .AND. &
910 all(arr2d .LE. huge(arr2d(1, 1))) )
THEN
real, dimension(:), pointer qr5tim0
real function dsec21(TIME1, TIME2)
integer, dimension(:,:,:), pointer iptint
integer, dimension(:), pointer tosnl5
double precision, dimension(:,:), pointer ygrd
Define data structures to set up wave model dynamic data for several models simultaneously.
integer, parameter rlgtype
real, dimension(:), pointer sig
double precision, dimension(:,:), pointer xgrd
complex, dimension(:, :), pointer qc5int0
real, dimension(:), pointer ecos
real, dimension(:), pointer th
real, dimension(:,:), pointer ptloc
integer, dimension(:,:), pointer mapfs
real, dimension(:), pointer esin
real, dimension(:), pointer qr5tmix
integer, parameter clgtype
real, dimension(:), pointer dsii
subroutine, public w3snl5(A, CG, WN, FMEAN, T1ABS, U10, UDIR, JSEA, S, D, KURT)
Interface to CalcQRSNL subroutine of the GKE module.
real, dimension(:, :), pointer qr5cvk0
integer(kind=8), pointer qi5nnz
subroutine, public prepkernelio(nk, nth, sig, th, act)
integer, dimension(:,:), pointer tolast
integer, public qi_interp
logical function hasnan(NK, NTH, ARR2D)
Check if the 2D array ARR2D contains NaN.
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
character(len=40), dimension(:), pointer ptnme
integer, dimension(:), pointer qi5tbeg
logical, dimension(:), pointer flout
real, parameter tpi
TPI 2*Pi.
subroutine strace(IENT, SNAME)
subroutine, public insnl5
Initialization for the GKE module (Prepare wavenumber grid & kernel coefficients).
Define some much-used constants for global use (all defined as PARAMETER).
subroutine wavnu1(SI, H, K, CG)
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Interface module for GKE (resonant & quasi-resonant four-wave interactions).
subroutine, public calcqrsnl(nk, nth, sig, th, t0, t1, Cvk0, Cvk1, Inpqr0, Snl, Dnl, Kurt)
Parallel routines for implicit solver.
integer(kind=8), public qi_nnz
integer, dimension(:,:), pointer mapsta
real function dist_sphere(lo1, la1, lo2, la2)
real, parameter grav
GRAV Acc.
subroutine init_get_isea(ISEA, JSEA)
Set ISEA for all schemes.