prefor2.f 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. subroutine prefor2(b)
  2. use lsgvar
  3. implicit none
  4. !
  5. ! ------------------------------------------------------------------
  6. !
  7. !**** *prefor2*.
  8. !
  9. ! by E. Maier-Reimer.
  10. ! optimsed by E. Kirk (19-Jan-2009)
  11. !
  12. !** Purpose.
  13. ! --------
  14. ! *prefor2* computes the right hand side of the equation for the
  15. ! barotropic velocities, when *nsve*=2.
  16. !
  17. ! Input.
  18. ! ------
  19. ! zeta surface elevation
  20. ! p norm pressure
  21. ! taux windstress/density
  22. ! tauy windstress/density
  23. !
  24. ! Output.
  25. ! -------
  26. ! b array containing the value of the right hand side of
  27. ! the equation for the barotropic velocities.
  28. !
  29. ! Interface.
  30. ! ----------
  31. ! *call* *prefor2*(*b*)
  32. ! *b* an array with dimension b(matrx)
  33. !
  34. ! ------------------------------------------------------------------
  35. !
  36. ! Parameter declaration.
  37. ! ----------------------
  38. !
  39. real (kind=8) :: b(2,matrx/2)
  40. !
  41. ! ------------------------------------------------------------------
  42. !
  43. !
  44. ! Declaration of local variables.
  45. ! -------------------------------
  46. !
  47. integer :: i,j,k,l
  48. real (kind=8) :: zx,zy,zdli
  49. !
  50. !* 1. Computation of the terms.
  51. ! -------------------------
  52. !
  53. ! Computation of the terms containing windstress and surfaceslope
  54. ! and of the horizontal pressure differences in the entire water mass.
  55. !
  56. do j = 3 , jen-2
  57. zdli = dli(j)
  58. do i = 1 , ien
  59. if (numx(i,j) > 0) then
  60. l = mod(i,ien) + 1
  61. zx=taux(i,j)+g*zdli*depth(i,j)*(zeta(i,j )-zeta(l,j ))
  62. zy=tauy(i,j)+g*dpin*depth(i,j)*(zeta(l,j+1)-zeta(i,j-1))
  63. do k = 1 , ken
  64. zx = zx - zdli * (p(l,j ,k)-p(i,j ,k)) * delta(i,j,k)
  65. zy = zy - dpin * (p(i,j-1,k)-p(l,j+1,k)) * delta(i,j,k)
  66. enddo
  67. b(1,numx(i,j)) = zx / depth(i,j)
  68. b(2,numx(i,j)) = zy / depth(i,j)
  69. endif
  70. enddo
  71. enddo
  72. return
  73. end subroutine prefor2