357
355
!** this section take into account the dynamical effect of upstream lifting
359
select case (dynamics)
362
!** hydrostatic version:
366
denom=sigma**2 -coriolis**2
367
if(abs(real(denom)).lt.1E-18)denom=sign(1.,denom)*1E-18
368
mtermsq = (nterm**2/denom) * (kx**2 + ky**2)
370
!** propagating case:
371
if(mtermsq.ge.0.)then
372
mterm = cmplx(sign(sqrt(mtermsq),sigma),0.)
375
mterm = cmplx(0.,sqrt(-mtermsq ))
380
!** here we need two branches since NH-version doesn't ensure real sqrt(m);
381
!** non-hydrostatic vertical wave number:
383
denom=sigma**2 -coriolis**2
385
if(abs(real(denom)).lt.1E-18)then
386
denom=sign(1.,denom)*1E-18
387
if(nterm.eq.0. .and. coriolis.eq.0.)then !pot.flow case
388
mtermsq = - (kx**2 + ky**2)
392
mtermsq = ((nterm**2-sigma**2)/denom) * (kx**2 + ky**2)
396
!** propagating case:
397
if(mtermsq.ge.0.)then
398
mterm = cmplx(sign(sqrt(mtermsq),sigma),0.)
401
mterm = cmplx(0.,sqrt(-mtermsq ))
357
call m_term(mterm,sigma,kx,ky,nterm,coriolis,dynamics)
410
359
!* MICRO-PHYSICAL TIME SCALE
658
subroutine m_term(mterm,sigma,kx,ky,nterm,coriolis,dynamics)
659
!---------written by Idar Barstad-----------------
666
!! -DESCRIPTION: This routine will calculate the m-term (which is complex)
670
!----------------------------------------------------------
673
!** Variables and constants used in computations
674
complex, intent(out) :: mterm
675
real, intent(in) :: sigma
676
real, intent(in) :: kx,ky
677
real, intent(in) :: nterm
678
real, intent(in) :: coriolis
679
character(len=8), intent(in) :: dynamics
685
select case (dynamics)
687
!** HOW TO CHOOSE THE ROOT OF m-term:
688
! when interpreting what root of m and what sign it should have,
689
! we look at the expression for displacement in Fourier space:
690
! eta = terrain * exp(imz) and interpret this physically.
691
! If this expression is evanescent, we need exp(-|m| z),
692
! if this is trignometric, we need exp(i |m| z), using the sign(sigma)
693
! to make sure that the wave propagate upward.
696
!** hydrostatic version:
700
denom = sigma**2 -coriolis**2
702
if(abs(denom).lt.1E-18) denom = sign(1.,denom)*1E-18
704
mtermsq = (nterm**2/denom) * (kx**2 + ky**2)
707
! ** propagating case:
708
! ** ( you need the real part of the root and you will take the
709
! ** root that has the same sign as sigma, sign(sigma), to get
710
! ** the correct direction of the phase lines (upstream tilt) )
712
if(mtermsq.ge.0.)then
714
mterm = cmplx(sign(sqrt(mtermsq),sigma),0.)
718
! ** envanecent case:
719
! ** ( you need the imaginary part, and the root having the
720
! ** positive sign, which will become negative in eta-equation )
722
mterm = cmplx(0.,sqrt(-mtermsq ))
729
!** Non-hydrostatic case:
733
!** here we need two branches since NH-version doesn't ensure real sqrt(m);
734
!** non-hydrostatic vertical wave number:
736
denom=sigma**2 -coriolis**2
738
if(abs(denom).lt.1E-18)then
739
denom=sign(1.,denom)*1E-18
741
! ** potential flow case:
742
if(nterm.eq.0. .and. coriolis.eq.0.)then
743
mtermsq = - (kx**2 + ky**2)
749
mtermsq = (( nterm**2 - sigma**2 ) / denom) * (kx**2 + ky**2)
753
! ** propagating case:
754
! (non-dispersive waves)
755
! (you need the real part of the positive root)
757
if(mtermsq.ge.0.)then
758
mterm = cmplx(sign(sqrt(mtermsq),sigma),0.)
761
! ** envanecent case:
762
! ( you need imaginary part of the positive root )
765
mterm = cmplx(0.,sqrt(-mtermsq ))
774
end subroutine m_term
709
776
!***************************************
710
777
!*********** update you case-variables:
711
778
!***************************************