79 REAL,
DIMENSION(:,:),
ALLOCATABLE ::
botspec
81 DOUBLE PRECISION ,
DIMENSION(:,:,:) ,
ALLOCATABLE ::
scatmatv
82 DOUBLE PRECISION ,
DIMENSION(:,:,:) ,
ALLOCATABLE ::
scatmata
83 DOUBLE PRECISION ,
DIMENSION(:,:) ,
ALLOCATABLE ::
scatmatd
112 SUBROUTINE w3sbs1(A, CG, WN, DEPTH, CX1, CY1, &
113 TAUSCX, TAUSCY, S, D)
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)
206 INTEGER :: ISPEC, IK, NSCUT, ITH, ITH2, i, j,iajust,iajust2
208 INTEGER,
SAVE :: IENT = 0
210 LOGICAL,
SAVE :: FIRST = .true.
211 INTEGER :: MATRICES = 0
215 REAL :: WN2(NSPEC, NTH), Ka(NSPEC), &
216 Kb(NSPEC, NTH), WNBOT(NSPEC, NTH), &
218 REAL :: kbotxi, kbotyi, xbk, &
219 ybk,integral, kbotx, kboty, count,count2
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)
237 CALL strace (ient,
'W3SBS1')
251 IF (( (abs(cx1)+abs(cy1)).EQ.0.).AND.(matrices.EQ.0) )
THEN
268 IF ( depth*wn(1) .LE. 6 )
THEN
272 IF ((abs(cx1)+abs(cy1).EQ.0.).AND.(matrices.EQ.1))
THEN
275 IF ( kd .LE. 6 .AND.wn(ik).LT.
kwmax )
THEN
278 kfactor=(wn(ik)**4)*
sig(ik)*
pi*4. &
279 /(sinh(2*kd)*(2*kd+sinh(2*kd)))
282 IF (kscaled.LT.0)
THEN
287 kmod=mod(kscaled,1.0)
289 s((ik-1)*nth+1:ik*nth) &
291 *matmul(transpose(
scatmatv(ibk,:,:)),avect))*(1.-kmod))
292 s((ik-1)*nth+1:ik*nth) &
293 =s((ik-1)*nth+1:ik*nth) &
295 *matmul(transpose(
scatmatv(ibk+1,:,:)),avect))*kmod)
296 checksum=abs(sum(s((ik-1)*nth+1:ik*nth) ))
298 IF (checksum.GT.0.01*etot)
WRITE(*,*) &
299 'Energy not conserved:',ik,depth,checksum,etot
301 s((ik-1)*nth+1:ik*nth)=0.
315 kpu=cx1 *
ecos(ith2)+ cy1 *
esin(ith2)
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)
336 sinh(min(2*wn(
mapwn(ispec))*depth,20.))
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)
345 kb(ispec, ith2)= wn2(ispec, ith2)**3 &
348 2*wn2(ispec, ith2)*depth + &
349 sinh(min(2*wn2(ispec,ith2)*depth,20.)) &
350 *(1+wn2(ispec,ith2)*kpu*2/sigp) &
379 wn2(ispec, ith2) *
ecos(ith2)
381 wn2(ispec, ith2) *
esin(ith2)
386 IF ((kbotx**2+kboty**2)>(kcutoff**2))
THEN
391 ibk=max(min(int(kbotxi),
nkbx-1),1)
393 jbk=max(min(int(kbotyi),
nkby-1),1)
398 botspec(ibk,jbk+1)*ybk)*(1-xbk) &
401 botspec(ibk+1,jbk+1)*ybk)*xbk &
420 if(wn2(ispec,ith2).GE.wn(i)) iajust=i
423 iajust2=min(iajust+1,nk)
424 IF (iajust.EQ.iajust2)
THEN
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)
432 integral=integral + ka(ispec)*kb(ispec, ith2)*b(ispec,ith2)* &
437 integral1=integral1+kb(ispec, ith2)*b(ispec,ith2)*ap*wn(
mapwn(ispec))/wn2(ispec,ith2)*
dth &
439 integral1b=integral1b+kb(ispec, ith2)*b(ispec,ith2)*a(
mapth(ispec),
mapwn(ispec))*
dth &
442 s(ispec)=s(ispec)+integral
449 print*,
'BOTTOM SCAT CHECKSUM:',integral2,integral3,integral1,integral1b
454 WRITE(6,
'(120G15.7)') smatrix(ith,:)
473 SUBROUTINE insbs1( inistep )
538 INTEGER,
INTENT(IN) :: inistep
544 INTEGER,
SAVE :: IENT = 0
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
555 CALL strace (ient,
'INSBS1')
558 IF (inistep.EQ.1)
THEN
562 OPEN(183,
file=
'bottomspectrum.inp', status=
'old')
577 WRITE(*,*)
'Bottom variance:', variance
612 IF ((kbotx**2+kboty**2) > (kcutoff**2))
THEN
628 amat(k1,k2)=((
botspec(ik,jk ) *(1-yk) &
629 +
botspec(ik,jk+1) *yk )*(1-xk) &
635 amat(k1,k1)=amat(k1,k1)-sum(amat(k1,:))
637 amat(:,:)=
dth*(amat(:,:)+transpose(amat(:,:)))*0.5
655 CALL diagonalize(amat,d,v,nrot)
659 WRITE(*,*)
'Scattering matrix diagonalized for k= ',kcurr,
',',i+1,
'out of ',
nkscat