oce.F90 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. MODULE oce
  2. !!======================================================================
  3. !! *** MODULE oce ***
  4. !! Ocean : dynamics and active tracers defined in memory
  5. !!======================================================================
  6. !! History : 1.0 ! 2002-11 (G. Madec) F90: Free form and module
  7. !! 3.1 ! 2009-02 (G. Madec, M. Leclair) pure z* coordinate
  8. !! 3.3 ! 2010-09 (C. Ethe) TRA-TRC merge: add ts, gtsu, gtsv 4D arrays
  9. !!----------------------------------------------------------------------
  10. USE par_oce ! ocean parameters
  11. USE lib_mpp ! MPP library
  12. IMPLICIT NONE
  13. PRIVATE
  14. PUBLIC oce_alloc ! routine called by nemo_init in nemogcm.F90
  15. LOGICAL, PUBLIC :: l_traldf_rot = .FALSE. !: rotated laplacian operator for lateral diffusion
  16. !! dynamics and tracer fields ! before ! now ! after ! the after trends becomes the fields
  17. !! -------------------------- ! fields ! fields ! trends ! only after tra_zdf and dyn_spg
  18. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ub , un , ua !: i-horizontal velocity [m/s]
  19. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: vb , vn , va !: j-horizontal velocity [m/s]
  20. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ua_sv, va_sv !: Saved trends (time spliting) [m/s2]
  21. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: wn !: vertical velocity [m/s]
  22. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: rotb , rotn !: relative vorticity [s-1]
  23. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: hdivb, hdivn !: horizontal divergence [s-1]
  24. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: tsb , tsn , tsa !: 4D T-S fields [Celcius,psu]
  25. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: rab_b, rab_n !: thermal/haline expansion coef. [Celcius-1,psu-1]
  26. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: rn2b , rn2 !: brunt-vaisala frequency**2 [s-2]
  27. !
  28. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: rhd !: in situ density anomalie rhd=(rho-rau0)/rau0 [no units]
  29. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: rhop !: potential volumic mass [kg/m3]
  30. !! free surface ! before ! now ! after !
  31. !! ------------ ! fields ! fields ! fields !
  32. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ub_b , un_b , ua_b !: Barotropic velocities at u-point [m/s]
  33. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: vb_b , vn_b , va_b !: Barotropic velocities at v-point [m/s]
  34. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sshb , sshn , ssha !: sea surface height at t-point [m]
  35. !
  36. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: spgu, spgv !: horizontal surface pressure gradient
  37. !! interpolated gradient (only used in zps case)
  38. !! ---------------------
  39. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: gtsu, gtsv !: horizontal gradient of T, S bottom u-point
  40. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: gru , grv !: horizontal gradient of rd at bottom u-point
  41. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: aru , arv
  42. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: gzu , gzv
  43. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ge3ru, ge3rv !: horizontal gradient of T, S and rd at top v-point
  44. !! (ISF) interpolated gradient (only used for ice shelf case)
  45. !! ---------------------
  46. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: gtui, gtvi !: horizontal gradient of T, S and rd at top u-point
  47. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: grui, grvi !: horizontal gradient of T, S and rd at top v-point
  48. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: arui, arvi !: horizontal average of rd at top v-point
  49. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: gzui, gzvi !: horizontal gradient of z at top v-point
  50. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ge3rui, ge3rvi !: horizontal gradient of T, S and rd at top v-point
  51. !! (ISF) ice load
  52. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: riceload
  53. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: rke !: kinetic energy
  54. !! arrays relating to embedding ice in the ocean. These arrays need to be declared
  55. !! even if no ice model is required. In the no ice model or traditional levitating
  56. !! ice cases they contain only zeros
  57. !! ---------------------
  58. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: snwice_mass !: mass of snow and ice at current ice time step [Kg/m2]
  59. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: snwice_mass_b !: mass of snow and ice at previous ice time step [Kg/m2]
  60. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: snwice_fmass !: time evolution of mass of snow+ice [Kg/m2/s]
  61. !! Energy budget of the leads (open water embedded in sea ice)
  62. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fraqsr_1lev !: fraction of solar net radiation absorbed in the first ocean level [-]
  63. !!----------------------------------------------------------------------
  64. !! NEMO/OPA 4.0 , NEMO Consortium (2011)
  65. !! $Id: oce.F90 4990 2014-12-15 16:42:49Z timgraham $
  66. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  67. !!----------------------------------------------------------------------
  68. CONTAINS
  69. INTEGER FUNCTION oce_alloc()
  70. !!----------------------------------------------------------------------
  71. !! *** FUNCTION oce_alloc ***
  72. !!----------------------------------------------------------------------
  73. INTEGER :: ierr(4)
  74. !!----------------------------------------------------------------------
  75. !
  76. ALLOCATE( ub (jpi,jpj,jpk) , un (jpi,jpj,jpk) , ua(jpi,jpj,jpk) , &
  77. & vb (jpi,jpj,jpk) , vn (jpi,jpj,jpk) , va(jpi,jpj,jpk) , &
  78. & ua_sv(jpi,jpj,jpk) , va_sv(jpi,jpj,jpk) , &
  79. & wn (jpi,jpj,jpk) , &
  80. & rotb (jpi,jpj,jpk) , rotn (jpi,jpj,jpk) , &
  81. & hdivb(jpi,jpj,jpk) , hdivn(jpi,jpj,jpk) , &
  82. & tsb (jpi,jpj,jpk,jpts) , tsn (jpi,jpj,jpk,jpts) , tsa(jpi,jpj,jpk,jpts) , &
  83. & rab_b(jpi,jpj,jpk,jpts) , rab_n(jpi,jpj,jpk,jpts) , &
  84. & rn2b (jpi,jpj,jpk) , rn2 (jpi,jpj,jpk) , STAT=ierr(1) )
  85. !
  86. ALLOCATE(rhd (jpi,jpj,jpk) , &
  87. & rhop(jpi,jpj,jpk) , &
  88. & rke(jpi,jpj,jpk) , &
  89. & sshb(jpi,jpj) , sshn(jpi,jpj) , ssha(jpi,jpj) , &
  90. & ub_b(jpi,jpj) , un_b(jpi,jpj) , ua_b(jpi,jpj) , &
  91. & vb_b(jpi,jpj) , vn_b(jpi,jpj) , va_b(jpi,jpj) , &
  92. & spgu (jpi,jpj) , spgv(jpi,jpj) , &
  93. & gtsu(jpi,jpj,jpts), gtsv(jpi,jpj,jpts), &
  94. & aru(jpi,jpj) , arv(jpi,jpj) , &
  95. & gzu(jpi,jpj) , gzv(jpi,jpj) , &
  96. & gru(jpi,jpj) , grv(jpi,jpj) , &
  97. & ge3ru(jpi,jpj) , ge3rv(jpi,jpj) , &
  98. & gtui(jpi,jpj,jpts), gtvi(jpi,jpj,jpts), &
  99. & arui(jpi,jpj) , arvi(jpi,jpj) , &
  100. & gzui(jpi,jpj) , gzvi(jpi,jpj) , &
  101. & ge3rui(jpi,jpj) , ge3rvi(jpi,jpj) , &
  102. & grui(jpi,jpj) , grvi(jpi,jpj) , &
  103. & riceload(jpi,jpj), STAT=ierr(2) )
  104. !
  105. ALLOCATE( snwice_mass(jpi,jpj) , snwice_mass_b(jpi,jpj), snwice_fmass(jpi,jpj) , STAT=ierr(3) )
  106. !
  107. ALLOCATE( fraqsr_1lev(jpi,jpj) , STAT=ierr(4) )
  108. !
  109. oce_alloc = MAXVAL( ierr )
  110. IF( oce_alloc /= 0 ) CALL ctl_warn('oce_alloc: failed to allocate arrays')
  111. !
  112. END FUNCTION oce_alloc
  113. !!======================================================================
  114. END MODULE oce