WAVEWATCH III  beta 0.0.1
w3sbs1md Module Reference

This module computes a scattering term based on the theory by Ardhuin and Magne (JFM 2007). More...

Functions/Subroutines

subroutine w3sbs1 (A, CG, WN, DEPTH, CX1, CY1, TAUSCX, TAUSCY, S, D)
 Bottom scattering source term. More...
 
subroutine insbs1 (inistep)
 Initialization for bottom scattering source term routine. More...
 

Variables

real, dimension(:,:), allocatable botspec
 
integer, parameter nkscat = 30
 
double precision, dimension(:,:,:), allocatable scatmatv
 
double precision, dimension(:,:,:), allocatable scatmata
 
double precision, dimension(:,:), allocatable scatmatd
 
character(len=10) botspec_indicator
 
integer nkbx
 
integer nkby
 
real dkbx
 
real dkby
 
real kwmin
 
real kwmax
 
real, parameter scattcutoff =0.
 
real curtx
 
real curty
 

Detailed Description

This module computes a scattering term based on the theory by Ardhuin and Magne (JFM 2007).

Author
F. Ardhuin
Date
14-Nov-2010

Function/Subroutine Documentation

◆ insbs1()

subroutine w3sbs1md::insbs1 ( integer, intent(in)  inistep)

Initialization for bottom scattering source term routine.

Parameters
[in]inistep
Author
F. Ardhuin
Date
23-Jun-2006

Definition at line 474 of file w3sbs1md.F90.

474  !/
475  !/ +-----------------------------------+
476  !/ | WAVEWATCH III NOAA/NCEP |
477  !/ | F. Ardhuin |
478  !/ | FORTRAN 90 |
479  !/ | Last update : 23-Jun-2006 |
480  !/ +-----------------------------------+
481  !/
482  !/ 23-Jun-2006 : Origination. ( version 3.09 )
483  !/
484  ! 1. Purpose :
485  !
486  ! Initialization for bottom scattering source term routine.
487  !
488  ! 2. Method :
489  !
490  ! 3. Parameters :
491  !
492  ! Parameter list
493  ! ----------------------------------------------------------------
494  ! ----------------------------------------------------------------
495  !
496  ! 4. Subroutines used :
497  !
498  ! Name Type Module Description
499  ! ----------------------------------------------------------------
500  ! STRACE Subr. W3SERVMD Subroutine tracing.
501  ! ----------------------------------------------------------------
502  !
503  ! 5. Called by :
504  !
505  ! Name Type Module Description
506  ! ----------------------------------------------------------------
507  ! W3SBS1 Subr. W3SBS1MD Corresponding source term.
508  ! ----------------------------------------------------------------
509  !
510  ! 6. Error messages :
511  !
512  ! None.
513  !
514  ! 7. Remarks :
515  !
516  ! 8. Structure :
517  !
518  ! See source code.
519  !
520  ! 9. Switches :
521  !
522  ! !/S Enable subroutine tracing.
523  !
524  ! 10. Source code :
525  !
526  !/ ------------------------------------------------------------------- /
527  USE w3gdatmd, ONLY: nk, nth, nspec, sig, dth, dden, ecos, esin
528  USE w3servmd, ONLY: diagonalize
529 #ifdef W3_S
530  USE w3servmd, ONLY: strace
531 #endif
532  !/
533  IMPLICIT NONE
534  !/
535  !/ ------------------------------------------------------------------- /
536  !/ Parameter list
537  !/
538  INTEGER, INTENT(IN) :: inistep
539  !/
540  !/ ------------------------------------------------------------------- /
541  !/ Local parameters
542  !/
543 #ifdef W3_S
544  INTEGER, SAVE :: IENT = 0
545 #endif
546  INTEGER :: I, J, K1, K2, IK, JK, NROT
547  REAL :: kbotx, kboty, kcurr, kcutoff, variance
548  REAL :: kbotxi, kbotyi, xk, yk
549  DOUBLE PRECISION, ALLOCATABLE,DIMENSION(:,:) :: AMAT, V
550  DOUBLE PRECISION, ALLOCATABLE,DIMENSION(:) :: D
551  !/
552  !/ ------------------------------------------------------------------- /
553  !/
554 #ifdef W3_S
555  CALL strace (ient, 'INSBS1')
556 #endif
557  !
558  IF (inistep.EQ.1) THEN
559  !
560  ! 1. Reads bottom spectrum
561  !
562  OPEN(183,file= 'bottomspectrum.inp', status='old')
563  READ(183,*) nkbx, nkby
564  READ(183,*) dkbx, dkby
565  WRITE(*,*) 'Bottom spec. dim.:', nkbx, nkby, dkbx, dkby
566  ALLOCATE(botspec(nkbx, nkby))
567  DO i=1, nkbx
568  READ(183,*) botspec(i,:)
569  END DO
570  CLOSE(183)
571  variance=0
572  DO i=1,nkbx
573  DO j=1,nkby
574  variance=variance+botspec(i,j)*dkbx*dkby
575  END DO
576  END DO
577  WRITE(*,*) 'Bottom variance:', variance
578  !
579  ELSE
580  !
581  ! 2. Precomputed the scatering matrices for zero current
582  !
583  ! The Scattering source term is expressed as a matrix problem for
584  ! a list of wavenumbers k0
585  ! in the range of wavenumbers used in the model.
586  ! i.e. S(k0,theta)=Kfactor*SCATMATA ** TRANSPOSE (E(k0,theta))
587  !
588  ! in which
589  !
590  ! Kfactor is a scalar computed in CALCSOURCE as
591  ! Kfactor=tailfactor*(Kp(I,J)**4)*2.*pi*FREQ(J)*pi*4./(SINH(HND)*(HND+SINH(HND)))
592  !
593  ! SCATMATA is a square matrix of size NTH*NTH
594  !
595  ! S(k0,theta) and E(k0,theta) are the vectors giving the directional source term
596  ! and spectrum at a fixed wavenumber
597  !
598  ALLOCATE(scatmata(0:nkscat-1,1:nth,1:nth))
599  ALLOCATE(amat(nth,nth))
600  DO i=0,nkscat-1
601  ! kcurr is the current surface wavenumber for which
602  ! the scattering matrices are evaluated
603  kcurr=kwmin+i*(kwmax-kwmin)/(nkscat-2)
604  kcutoff=scattcutoff*kcurr
605  DO k1=1,nth
606  DO k2=1,nth
607  kbotx=-kcurr*(ecos(k2)-ecos(k1))
608  kboty=-kcurr*(esin(k2)-esin(k1))
609  amat(k1,k2)=0.
610  ! Tests if the bottom wavenumber is larger than the cutoff
611  ! Otherwise the interaction is set to zero
612  IF ((kbotx**2+kboty**2) > (kcutoff**2)) THEN
613  !WARNING : THERE MAY BE A BUG : spectrum not symmetric when
614  ! nkbx is odd !!
615 
616  kbotxi=real(nkbx)/2.+1.+kbotx/dkbx
617  kbotyi=real(nkby)/2.+1.+kboty/dkby
618  !WRITE(6,*) 'Bottom wavenumber i:',kbotxi,kbotyi
619  ik=int(kbotxi)
620  xk=mod(kbotxi,1.0)
621  jk=int(kbotyi)
622  yk=mod(kbotyi,1.0)
623  IF (ik.GE.nkbx) ik=nkbx-1
624  IF (jk.GE.nkby) jk=nkby-1
625  IF (ik.LT.1) ik=1
626  IF (jk.LT.1) jk=1
627  ! Bilinear interpolation of the bottom spectrum
628  amat(k1,k2)=((botspec(ik,jk ) *(1-yk) &
629  +botspec(ik,jk+1) *yk )*(1-xk) &
630  +(botspec(ik+1,jk) *(1-yk) &
631  +botspec(ik+1,jk+1)*yk) *xk) &
632  *(ecos(k1)*ecos(k2)+esin(k1)*esin(k2))**2
633  END IF
634  END DO
635  amat(k1,k1)=amat(k1,k1)-sum(amat(k1,:))
636  END DO
637  amat(:,:)=dth*(amat(:,:)+transpose(amat(:,:)))*0.5
638  !makes sure the matrix is exactly symmetric
639  !which should already be the case if the bottom
640  ! spectrum is really symmetric
641  scatmata(i,:,:)=amat(:,:)
642  END DO
643  ALLOCATE(scatmatd(0:nkscat-1,nth))
644  ALLOCATE(scatmatv(0:nkscat-1,nth,nth))
645  ALLOCATE(v(nth,nth))
646  ALLOCATE(d(nth))
647  DO i=0,nkscat-1
648  amat(:,:)=scatmata(i,:,:)
649  !
650  !diagonalizes the matrix A
651  !D is a vector with the eigenvalues, V is the matrix made of the
652  !eigenvectors so that VD2Vt=A with D2(i,j)=delta(i,j)D(i)
653  !and VVt=Id, so that exp(A)=Vexp(D2)Vt
654  !
655  CALL diagonalize(amat,d,v,nrot)
656  scatmatd(i,:)=d(:) !eigen values
657  scatmatv(i,:,:)=v(:,:) !eigen vectors
658  kcurr=kwmin+i*(kwmax-kwmin)/(nkscat-2)
659  WRITE(*,*) 'Scattering matrix diagonalized for k= ',kcurr,',',i+1,'out of ',nkscat
660  END DO
661  END IF
662 
663  !/
664  !/ End of INSBS1 ----------------------------------------------------- /
665  !/

References botspec, w3gdatmd::dden, w3servmd::diagonalize(), dkbx, dkby, w3gdatmd::dth, w3gdatmd::ecos, w3gdatmd::esin, file(), kwmax, kwmin, w3gdatmd::nk, nkbx, nkby, nkscat, w3gdatmd::nspec, w3gdatmd::nth, scatmata, scatmatd, scatmatv, scattcutoff, w3gdatmd::sig, and w3servmd::strace().

Referenced by w3sbs1().

◆ w3sbs1()

subroutine w3sbs1md::w3sbs1 ( real, dimension(nth,nk), intent(in)  A,
real, dimension(nk), intent(in)  CG,
real, dimension(nk), intent(in)  WN,
real, intent(in)  DEPTH,
real, intent(in)  CX1,
real, intent(in)  CY1,
real, intent(out)  TAUSCX,
real, intent(out)  TAUSCY,
real, dimension(nspec), intent(out)  S,
real, dimension(nspec), intent(out)  D 
)

Bottom scattering source term.

Without current, goes through a diagonalization of the matrix problem S(f,:) = M(f,:,:)**E(f,:). With current, integrates the source term along the resonant locus.

Parameters
[in]AAction density spectrum (1-D)
[in]CGGroup velocities
[in]WNWavenumbers
[in]DEPTHMean water depth
[in]CX1Current components at ISEA
[in]CY1Current components at ISEA
[out]TAUSCXChange of wave momentum due to scattering
[out]TAUSCYChange of wave momentum due to scattering
[out]SSource term (1-D version)
[out]DDiagonal term of derivative (1-D version)
Author
F. Ardhuin
Date
23-Jun-2006

Definition at line 114 of file w3sbs1md.F90.

114  !/
115  !/ +-----------------------------------+
116  !/ | WAVEWATCH III NOAA/NCEP |
117  !/ | F. Ardhuin |
118  !/ | FORTRAN 90 |
119  !/ | Last update : 23-Jun-2006 |
120  !/ +-----------------------------------+
121  !/
122  !/ 15-Jul-2005 : Origination. ( version 3.07 )
123  !/ 23-Jun-2006 : Formatted for submitting code for ( version 3.09 )
124  !/ inclusion in WAVEWATCH III.
125  !/
126  ! 1. Purpose :
127  !
128  ! Bottom scattering source term
129  !
130  ! 2. Method :
131  !
132  ! Without current, goes through a diagonalization of the matrix
133  ! problem S(f,:) = M(f,:,:)**E(f,:)
134  ! With current, integrates the source term along the resonant locus
135  !
136  ! 3. Parameters :
137  !
138  ! Parameter list
139  ! ----------------------------------------------------------------
140  ! A R.A. I Action density spectrum (1-D)
141  ! CG R.A. I Group velocities.
142  ! WN R.A. I Wavenumbers.
143  ! DEPTH Real I Mean water depth.
144  ! S R.A. O Source term (1-D version).
145  ! D R.A. O Diagonal term of derivative (1-D version).
146  ! CX1-Y1 R.A. I Current components at ISEA.
147  ! TAUSCX-Y R.A. I Change of wave momentum due to scattering
148  ! ----------------------------------------------------------------
149  !
150  ! 4. Subroutines used :
151  !
152  ! Name Type Module Description
153  ! ----------------------------------------------------------------
154  ! STRACE Subr. W3SERVMD Subroutine tracing.
155  ! ----------------------------------------------------------------
156  !
157  ! 5. Called by :
158  !
159  ! Name Type Module Description
160  ! ----------------------------------------------------------------
161  ! W3SRCE Subr. W3SRCEMD Source term integration.
162  ! W3EXPO Subr. N/A Point output post-processor.
163  ! GXEXPO Subr. N/A GrADS point output post-processor.
164  ! ----------------------------------------------------------------
165  !
166  ! 6. Error messages :
167  !
168  ! None.
169  !
170  ! 7. Remarks :
171  !
172  ! 8. Structure :
173  !
174  ! See source code.
175  !
176  ! 9. Switches :
177  !
178  ! !/S Enable subroutine tracing.
179  !
180  ! 10. Source code :
181  !
182  !/ ------------------------------------------------------------------- /
183  USE constants
184  USE w3gdatmd, ONLY: nk, nth, nspec, sig, dth, dden, &
185  ecos, esin, ec2, mapth, mapwn, &
186  sig2, dsii
187 #ifdef W3_S
188  USE w3servmd, ONLY: strace
189 #endif
190  !/
191  !
192  IMPLICIT NONE
193  !/
194  !/ ------------------------------------------------------------------- /
195  !/ Parameter list
196  !/
197  REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH
198  REAL, INTENT(IN) :: A(NTH,NK)
199  REAL, INTENT(IN) :: CX1, CY1
200  REAL, INTENT(OUT) :: TAUSCX, TAUSCY
201  REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
202  !/
203  !/ ------------------------------------------------------------------- /
204  !/ Local parameters
205  !/
206  INTEGER :: ISPEC, IK, NSCUT, ITH, ITH2, i, j,iajust,iajust2
207 #ifdef W3_S
208  INTEGER, SAVE :: IENT = 0
209 #endif
210  LOGICAL, SAVE :: FIRST = .true.
211  INTEGER :: MATRICES = 0
212 
213  REAL :: R1, R2, R3
214 
215  REAL :: WN2(NSPEC, NTH), Ka(NSPEC), &
216  Kb(NSPEC, NTH), WNBOT(NSPEC, NTH), &
217  B(NSPEC, NTH)
218  REAL :: kbotxi, kbotyi, xbk, &
219  ybk,integral, kbotx, kboty, count,count2
220 
221  INTEGER :: ibk, jbk, ik2
222  REAL :: SIGP,KU, KPU, CGK, CGPK, WN2i, xk2, Ap, kcutoff, ECC2, &
223  variance , integral1,integral1b,integral2, SB(NK,NTH), integral3,&
224  ajust,absajust,aa,bb,LNORM,UdotL,KdotKP,MBANDC
225  REAL :: KD, Kfactor, kscaled, kmod , CHECKSUM, ETOT
226  REAL :: SMATRIX(NTH,NTH),SMATRIX2(NTH,NTH)
227  DOUBLE PRECISION :: AVECT(NTH)
228 
229  curtx=cx1
230  curty=cy1
231 
232  count=0
233  !/
234  !/ ------------------------------------------------------------------- /
235  !/
236 #ifdef W3_S
237  CALL strace (ient, 'W3SBS1')
238 #endif
239  !
240  ! 0. Initializations ------------------------------------------------ *
241  !
242  ! **********************************************************
243  ! *** The initialization routine should include all ***
244  ! *** initialization, including reading data from files. ***
245  ! **********************************************************
246  !
247  IF ( first ) THEN
248  CALL insbs1( 1 )
249  first = .false.
250  END IF
251  IF (( (abs(cx1)+abs(cy1)).EQ.0.).AND.(matrices.EQ.0) ) THEN
252  kwmin=max(max(dkbx,dkby),sig(1)**2/grav)
253  kwmax=min(nkbx*dkbx,nkby*dkby)*0.25
254  WRITE(*,*) 'k range:',kwmin,kwmax,sig(1)**2/grav
255  CALL insbs1( 2 )
256  matrices = 1
257  END IF
258  !
259  ! 1. Sets scattering term to zero
260  !
261  d = 0.
262  s = 0.
263  tauscx=0.
264  tauscy=0.
265  !
266  ! 3. Bottom scattering ================================================== *
267  !
268  IF ( depth*wn(1) .LE. 6 ) THEN
269  !
270  ! 3.a Ardhuin and Herbers JFM 2000: no current
271  !
272  IF ((abs(cx1)+abs(cy1).EQ.0.).AND.(matrices.EQ.1)) THEN
273  DO ik=1,nk
274  kd=wn(ik)*depth
275  IF ( kd .LE. 6 .AND.wn(ik).LT.kwmax ) THEN
276  ! Test on kwmax means that scattering is not computed if interaction goes beyond the shortest resolved
277  ! bottom component. This should probably be replaced by a warning...
278  kfactor=(wn(ik)**4)*sig(ik)*pi*4. &
279  /(sinh(2*kd)*(2*kd+sinh(2*kd)))
280  kscaled=(nkscat-2)*(wn(ik)-kwmin)/(kwmax-kwmin)
281  avect=dble(a(:,ik))
282  IF (kscaled.LT.0) THEN
283  ibk=0
284  kmod=0.
285  ELSE
286  ibk=int(kscaled)
287  kmod=mod(kscaled,1.0)
288  END IF
289  s((ik-1)*nth+1:ik*nth) &
290  =real(matmul(scatmatv(ibk,:,:),kfactor*scatmatd(ibk,:) &
291  *matmul(transpose(scatmatv(ibk,:,:)),avect))*(1.-kmod))
292  s((ik-1)*nth+1:ik*nth) &
293  =s((ik-1)*nth+1:ik*nth) &
294  +real(matmul(scatmatv(ibk+1,:,:),kfactor*scatmatd(ibk+1,:) &
295  *matmul(transpose(scatmatv(ibk+1,:,:)),avect))*kmod)
296  checksum=abs(sum(s((ik-1)*nth+1:ik*nth) ))
297  etot=sum(a(:,ik))
298  IF (checksum.GT.0.01*etot) WRITE(*,*) &
299  'Energy not conserved:',ik,depth,checksum,etot
300  ELSE
301  s((ik-1)*nth+1:ik*nth)=0.
302  END IF
303  END DO
304  ELSE
305  ! 3.b
306  ! Case with current (Ardhuin and Magne JFM 2007)
307  ! Compute k' (WN2) from k (WN) and U (CX1, CY1)
308  ! using : k'=(Cg+k.U/k)/(Cg+k'.U/k')
309  !
310  DO ith2=1, nth
311 
312  DO ispec=1, nspec
313 
314  ku=cx1 * ecos(mapth(ispec))+cy1 * esin(mapth(ispec))
315  kpu=cx1 * ecos(ith2)+ cy1 * esin(ith2)
316  cgk=cg(mapwn(ispec))
317  IF ((cgk+kpu).LT.0.1*cgk) kpu=-0.9*cgk
318  IF ((cgk+ku).LT.0.1*cgk) ku=-0.9*cg(mapwn(ispec))
319  wn2(ispec,ith2)= wn(mapwn(ispec))*(cgk+ku)/(cgk+kpu)
320  END DO
321 
322  END DO
323  !
324  ! 3.c Compute the coupling coefficient as a product of two terms
325  !
326  ! K=0.5*pi k'^2 * M(k,k')^2 / [sig*sig' *(k'*Cg'+k'.U)]
327  ! (Magne and Ardhuin JFM 2007)
328  !
329  ! K=Ka(k)*Kb(k,k',theta')
330  !
331  ! Ka = ...
332  ! here Mc is neglected
333  !
334  DO ispec=1, nspec
335  ka(ispec)= 4*pi*sig2(ispec) * wn(mapwn(ispec)) / &
336  sinh(min(2*wn(mapwn(ispec))*depth,20.))
337 
338  DO ith2=1, nth
339  ku=cx1 * ecos(mapth(ispec))+cy1 * esin(mapth(ispec))
340  kpu=cx1 * ecos(ith2)+ cy1 * esin(ith2)
341  sigp=sqrt(grav*wn2(ispec,ith2)*tanh(wn2(ispec,ith2)*depth))
342  cgpk=sigp*(0.5+wn2(ispec,ith2)*depth &
343  /sinh(min(2*wn2(ispec,ith2)*depth,20.)))/wn2(ispec, ith2)
344 
345  kb(ispec, ith2)= wn2(ispec, ith2)**3 &
346  *ec2(1+abs(mapth(ispec)-ith2)) / &
347  ( &
348  2*wn2(ispec, ith2)*depth + &
349  sinh(min(2*wn2(ispec,ith2)*depth,20.)) &
350  *(1+wn2(ispec,ith2)*kpu*2/sigp) &
351  )
352 
353  !
354  ! Other option for computing also Mc
355  !
356  ! UdotL=WN(MAPWN(ISPEC))*KU-KPU*WN2(ISPEC,ITH2)
357  ! KdotKP=EC(1+ABS(MAPTH(ISPEC)-ITH2))*WN2(ISPEC,ITH2)*WN(MAPWN(ISPEC))
358  ! LNORM=sqrt(WN(MAPWN(ISPEC))**2+WN2(ISPEC, ITH2)**2-2*KdotKP)
359  ! MBANDC=grav*KdotKP &
360  ! /(COSH(MIN(WN2(ISPEC,ITH2)*DEPTH,20.))*COSH(MIN(WN(MAPWN(ISPEC))*DEPTH,20.)
361  ! +(UdotL*(SIGP*(WN(MAPWN(ISPEC))**2-KdotKP)+SIG2(ISPEC)*(KdotKP-WN2(ISPEC, ITH2)**2)) &
362  ! - UdotL**2*(KdotKP-SIGP*SIG2(ISPEC)*(SIGP*SIG2(ISPEC)+UdotL**2)/GRAV**2)) &
363  ! /(LNORM*(UdotL**2/(GRAV*LNORM)-TANH(MIN(LNORM*DEPTH,20.)))*COSH(MIN(LNORM*DEPTH,20.)))
364  ! Kb(ISPEC,ITH2)= WN2(ISPEC, ITH2)**2
365  ! /((SIG2(ISPEC)*SIGP*WN2(ISPEC, ITH2)*(CGPK+KPU)) &
366  ! *MBANDC**2
367  !
368  END DO
369  END DO
370  !
371  ! 3.a Bilinear interpolation of the bottom spectrum BOTSPEC
372  ! along the locus -> B(ISPEC,ITH2)
373  !
374  b(:,:)=0
375  DO ispec=1, nspec
376  kcutoff=scattcutoff*wn(mapwn(ispec))
377  DO ith2=1,nth
378  kbotx=wn(mapwn(ispec))*ecos(mapth(ispec)) - &
379  wn2(ispec, ith2) * ecos(ith2)
380  kboty=wn(mapwn(ispec))*esin(mapth(ispec)) - &
381  wn2(ispec, ith2) * esin(ith2)
382  !
383  ! 3.a.1 test if the bottom wavenumber is larger than the cutoff
384  ! otherwise the interaction is set to zero
385 
386  IF ((kbotx**2+kboty**2)>(kcutoff**2)) THEN
387 
388  kbotxi=real(nkbx-mod(nkbx,2))/2.+1.+kbotx/dkbx ! The MOD(nkbx,2) is either 1 or 0
389  kbotyi=real(nkby-mod(nkby,2))/2.+1.+kboty/dkby ! k=0 is at ik=(nkbx-1)/2+1 if kkbx is odd
390 
391  ibk=max(min(int(kbotxi),nkbx-1),1)
392  xbk=mod(kbotxi,1.0)
393  jbk=max(min(int(kbotyi),nkby-1),1)
394  ybk=mod(kbotyi,1.0)
395 
396  b(ispec,ith2)=( &
397  (botspec(ibk,jbk)*(1-ybk)+ &
398  botspec(ibk,jbk+1)*ybk)*(1-xbk) &
399  + &
400  (botspec(ibk+1,jbk)*(1-ybk)+ &
401  botspec(ibk+1,jbk+1)*ybk)*xbk &
402  )
403  END IF
404  END DO
405  END DO
406  !
407  ! 4. compute Sbscat
408  ! 4.a linear interpolation of A(k', theta') -> Ap
409  !
410 
411  ! 4.b computation of the source term
412  integral2=0.
413  integral3=0.
414  smatrix(:,:)=0.
415  DO ispec=1, nspec
416  integral=0
417  DO ith2=1, nth
418  iajust=1
419  DO i=2,nk
420  if(wn2(ispec,ith2).GE.wn(i)) iajust=i
421  END DO
422  iajust=max(iajust,1)
423  iajust2=min(iajust+1,nk)
424  IF (iajust.EQ.iajust2) THEN
425  ap=a(ith2,iajust)
426  ELSE
427  bb=(wn2(ispec,ith2)-wn(iajust))/(wn(iajust2)-wn(iajust))
428  aa=(wn(iajust2)-wn2(ispec,ith2))/(wn(iajust2)-wn(iajust))
429  ap=(a(ith2,iajust)*aa+a(ith2,iajust2)*bb)
430  END IF
431 
432  integral=integral + ka(ispec)*kb(ispec, ith2)*b(ispec,ith2)* &
433  ( ap*wn(mapwn(ispec))/wn2(ispec,ith2)- a(mapth(ispec),mapwn(ispec))) *dth
434  ! the factor WN/WN2 accounts for the fact that N(K) and N(K')
435  ! have different Jacobian transforms from kx,ky to k,theta
436 
437  integral1=integral1+kb(ispec, ith2)*b(ispec,ith2)*ap*wn(mapwn(ispec))/wn2(ispec,ith2)*dth &
438  *dth*dsii(mapwn(ispec))/cg(mapwn(ispec))
439  integral1b=integral1b+kb(ispec, ith2)*b(ispec,ith2)*a(mapth(ispec),mapwn(ispec))*dth &
440  *dth*dsii(mapwn(ispec))/cg(mapwn(ispec))
441  END DO
442  s(ispec)=s(ispec)+integral
443 
444  integral2=integral2+s(ispec)*dth*dsii(mapwn(ispec))/cg(mapwn(ispec))
445  integral3=integral3+abs(s(ispec))*dth*dsii(mapwn(ispec))/cg(mapwn(ispec))
446  END DO
447  END IF
448 #ifdef W3_T
449  print*,'BOTTOM SCAT CHECKSUM:',integral2,integral3,integral1,integral1b
450 #endif
451 
452 #ifdef W3_T
453  DO ith=1,120
454  WRITE(6,'(120G15.7)') smatrix(ith,:)
455  END DO
456 #endif
457  END IF
458 
459  !/
460  !/ End of W3SBS1 ----------------------------------------------------- /
461  !/

References botspec, curtx, curty, w3gdatmd::dden, dkbx, dkby, w3gdatmd::dsii, w3gdatmd::dth, w3gdatmd::ec2, w3gdatmd::ecos, w3gdatmd::esin, constants::grav, insbs1(), kwmax, kwmin, w3gdatmd::mapth, w3gdatmd::mapwn, w3gdatmd::nk, nkbx, nkby, nkscat, w3gdatmd::nspec, w3gdatmd::nth, constants::pi, scatmatd, scatmatv, scattcutoff, w3gdatmd::sig, w3gdatmd::sig2, and w3servmd::strace().

Referenced by gxexpo(), w3exnc(), w3expo(), and w3srcemd::w3srce().

Variable Documentation

◆ botspec

real, dimension(:,:), allocatable w3sbs1md::botspec

Definition at line 79 of file w3sbs1md.F90.

79  REAL, DIMENSION(:,:), ALLOCATABLE :: BOTSPEC

Referenced by insbs1(), and w3sbs1().

◆ botspec_indicator

character(len=10) w3sbs1md::botspec_indicator

Definition at line 84 of file w3sbs1md.F90.

84  CHARACTER(len=10) :: botspec_indicator

◆ curtx

real w3sbs1md::curtx

Definition at line 88 of file w3sbs1md.F90.

88  REAL :: CURTX, CURTY

Referenced by w3sbs1().

◆ curty

real w3sbs1md::curty

Definition at line 88 of file w3sbs1md.F90.

Referenced by w3sbs1().

◆ dkbx

real w3sbs1md::dkbx

Definition at line 86 of file w3sbs1md.F90.

86  REAL :: dkbx, dkby, kwmin, kwmax

Referenced by insbs1(), and w3sbs1().

◆ dkby

real w3sbs1md::dkby

Definition at line 86 of file w3sbs1md.F90.

Referenced by insbs1(), and w3sbs1().

◆ kwmax

real w3sbs1md::kwmax

Definition at line 86 of file w3sbs1md.F90.

Referenced by insbs1(), and w3sbs1().

◆ kwmin

real w3sbs1md::kwmin

Definition at line 86 of file w3sbs1md.F90.

Referenced by insbs1(), and w3sbs1().

◆ nkbx

integer w3sbs1md::nkbx

Definition at line 85 of file w3sbs1md.F90.

85  INTEGER :: nkbx, nkby

Referenced by insbs1(), and w3sbs1().

◆ nkby

integer w3sbs1md::nkby

Definition at line 85 of file w3sbs1md.F90.

Referenced by insbs1(), and w3sbs1().

◆ nkscat

integer, parameter w3sbs1md::nkscat = 30

Definition at line 80 of file w3sbs1md.F90.

80  INTEGER, PARAMETER :: NKSCAT = 30 !number of wavenumbers

Referenced by insbs1(), and w3sbs1().

◆ scatmata

double precision, dimension(:,:,:), allocatable w3sbs1md::scatmata

Definition at line 82 of file w3sbs1md.F90.

82  DOUBLE PRECISION ,DIMENSION(:,:,:) , ALLOCATABLE :: SCATMATA !original matrix

Referenced by insbs1().

◆ scatmatd

double precision, dimension(:,:), allocatable w3sbs1md::scatmatd

Definition at line 83 of file w3sbs1md.F90.

83  DOUBLE PRECISION ,DIMENSION(:,:) , ALLOCATABLE :: SCATMATD

Referenced by insbs1(), and w3sbs1().

◆ scatmatv

double precision, dimension(:,:,:), allocatable w3sbs1md::scatmatv

Definition at line 81 of file w3sbs1md.F90.

81  DOUBLE PRECISION ,DIMENSION(:,:,:) , ALLOCATABLE :: SCATMATV !scattering matrices

Referenced by insbs1(), and w3sbs1().

◆ scattcutoff

real, parameter w3sbs1md::scattcutoff =0.

Definition at line 87 of file w3sbs1md.F90.

87  REAL, PARAMETER :: scattcutoff=0.

Referenced by insbs1(), and w3sbs1().

constants::pi
real, parameter pi
PI Value of Pi.
Definition: constants.F90:71
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3sbs1md::kwmax
real kwmax
Definition: w3sbs1md.F90:86
w3sbs1md::nkbx
integer nkbx
Definition: w3sbs1md.F90:85
w3sbs1md::kwmin
real kwmin
Definition: w3sbs1md.F90:86
w3sbs1md::botspec
real, dimension(:,:), allocatable botspec
Definition: w3sbs1md.F90:79
w3gdatmd::mapth
integer, dimension(:), pointer mapth
Definition: w3gdatmd.F90:1231
w3sbs1md::curtx
real curtx
Definition: w3sbs1md.F90:88
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3sbs1md::dkbx
real dkbx
Definition: w3sbs1md.F90:86
w3sbs1md::scattcutoff
real, parameter scattcutoff
Definition: w3sbs1md.F90:87
w3sbs1md::curty
real curty
Definition: w3sbs1md.F90:88
w3servmd
Definition: w3servmd.F90:3
w3gdatmd::dsii
real, dimension(:), pointer dsii
Definition: w3gdatmd.F90:1234
w3sbs1md::scatmatd
double precision, dimension(:,:), allocatable scatmatd
Definition: w3sbs1md.F90:83
w3sbs1md::scatmatv
double precision, dimension(:,:,:), allocatable scatmatv
Definition: w3sbs1md.F90:81
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3sbs1md::scatmata
double precision, dimension(:,:,:), allocatable scatmata
Definition: w3sbs1md.F90:82
w3gdatmd::sig2
real, dimension(:), pointer sig2
Definition: w3gdatmd.F90:1234
w3servmd::diagonalize
subroutine diagonalize(a1, d, v, nrot)
Definition: w3servmd.F90:1840
w3sbs1md::nkscat
integer, parameter nkscat
Definition: w3sbs1md.F90:80
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::mapwn
integer, dimension(:), pointer mapwn
Definition: w3gdatmd.F90:1231
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
w3sbs1md::dkby
real dkby
Definition: w3sbs1md.F90:86
w3gdatmd::ec2
real, dimension(:), pointer ec2
Definition: w3gdatmd.F90:1234
w3sbs1md::nkby
integer nkby
Definition: w3sbs1md.F90:85
constants::grav
real, parameter grav
GRAV Acc.
Definition: constants.F90:61
w3sbs1md::insbs1
subroutine insbs1(inistep)
Initialization for bottom scattering source term routine.
Definition: w3sbs1md.F90:474