trasbc.F90 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. MODULE trasbc
  2. !!==============================================================================
  3. !! *** MODULE trasbc ***
  4. !! Ocean active tracers: surface boundary condition
  5. !!==============================================================================
  6. !! History : OPA ! 1998-10 (G. Madec, G. Roullet, M. Imbard) Original code
  7. !! 8.2 ! 2001-02 (D. Ludicone) sea ice and free surface
  8. !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module
  9. !! 3.3 ! 2010-04 (M. Leclair, G. Madec) Forcing averaged over 2 time steps
  10. !! - ! 2010-09 (C. Ethe, G. Madec) Merge TRA-TRC
  11. !! 3.6 ! 2014-11 (P. Mathiot) isf melting forcing
  12. !!----------------------------------------------------------------------
  13. !!----------------------------------------------------------------------
  14. !! tra_sbc : update the tracer trend at ocean surface
  15. !!----------------------------------------------------------------------
  16. USE oce ! ocean dynamics and active tracers
  17. USE sbc_oce ! surface boundary condition: ocean
  18. USE dom_oce ! ocean space domain variables
  19. USE phycst ! physical constant
  20. USE sbcmod ! ln_rnf
  21. USE sbcrnf ! River runoff
  22. USE sbcisf ! Ice shelf
  23. USE traqsr ! solar radiation penetration
  24. USE trd_oce ! trends: ocean variables
  25. USE trdtra ! trends manager: tracers
  26. !
  27. USE in_out_manager ! I/O manager
  28. USE prtctl ! Print control
  29. USE iom
  30. USE lbclnk ! ocean lateral boundary conditions (or mpp link)
  31. USE wrk_nemo ! Memory Allocation
  32. USE timing ! Timing
  33. USE eosbn2
  34. IMPLICIT NONE
  35. PRIVATE
  36. PUBLIC tra_sbc ! routine called by step.F90
  37. !! * Substitutions
  38. # include "domzgr_substitute.h90"
  39. # include "vectopt_loop_substitute.h90"
  40. !!----------------------------------------------------------------------
  41. !! NEMO/OPA 3.7 , NEMO Consortium (2014)
  42. !! $Id: trasbc.F90 5628 2015-07-22 20:26:35Z mathiot $
  43. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  44. !!----------------------------------------------------------------------
  45. CONTAINS
  46. SUBROUTINE tra_sbc ( kt )
  47. !!----------------------------------------------------------------------
  48. !! *** ROUTINE tra_sbc ***
  49. !!
  50. !! ** Purpose : Compute the tracer surface boundary condition trend of
  51. !! (flux through the interface, concentration/dilution effect)
  52. !! and add it to the general trend of tracer equations.
  53. !!
  54. !! ** Method :
  55. !! Following Roullet and Madec (2000), the air-sea flux can be divided
  56. !! into three effects: (1) Fext, external forcing;
  57. !! (2) Fwi, concentration/dilution effect due to water exchanged
  58. !! at the surface by evaporation, precipitations and runoff (E-P-R);
  59. !! (3) Fwe, tracer carried with the water that is exchanged.
  60. !! - salinity : salt flux only due to freezing/melting
  61. !! sa = sa + sfx / rau0 / e3t for k=1
  62. !!
  63. !! Fext, flux through the air-sea interface for temperature and salt:
  64. !! - temperature : heat flux q (w/m2). If penetrative solar
  65. !! radiation q is only the non solar part of the heat flux, the
  66. !! solar part is added in traqsr.F routine.
  67. !! ta = ta + q /(rau0 rcp e3t) for k=1
  68. !! - salinity : no salt flux
  69. !!
  70. !! The formulation for Fwb and Fwi vary according to the free
  71. !! surface formulation (linear or variable volume).
  72. !! * Linear free surface
  73. !! The surface freshwater flux modifies the ocean volume
  74. !! and thus the concentration of a tracer and the temperature.
  75. !! First order of the effect of surface freshwater exchange
  76. !! for salinity, it can be neglected on temperature (especially
  77. !! as the temperature of precipitations and runoffs is usually
  78. !! unknown).
  79. !! - temperature : we assume that the temperature of both
  80. !! precipitations and runoffs is equal to the SST, thus there
  81. !! is no additional flux since in this case, the concentration
  82. !! dilution effect is balanced by the net heat flux associated
  83. !! to the freshwater exchange (Fwe+Fwi=0):
  84. !! (Tp P - Te E) + SST (P-E) = 0 when Tp=Te=SST
  85. !! - salinity : evaporation, precipitation and runoff
  86. !! water has a zero salinity but there is a salt flux due to
  87. !! freezing/melting, thus:
  88. !! sa = sa + emp * sn / rau0 / e3t for k=1
  89. !! + sfx / rau0 / e3t
  90. !! where emp, the surface freshwater budget (evaporation minus
  91. !! precipitation minus runoff) given in kg/m2/s is divided
  92. !! by rau0 (density of sea water) to obtain m/s.
  93. !! Note: even though Fwe does not appear explicitly for
  94. !! temperature in this routine, the heat carried by the water
  95. !! exchanged through the surface is part of the total heat flux
  96. !! forcing and must be taken into account in the global heat
  97. !! balance).
  98. !! * nonlinear free surface (variable volume, lk_vvl)
  99. !! contrary to the linear free surface case, Fwi is properly
  100. !! taken into account by using the true layer thicknesses to
  101. !! calculate tracer content and advection. There is no need to
  102. !! deal with it in this routine.
  103. !! - temperature: Fwe=SST (P-E+R) is added to Fext.
  104. !! - salinity: Fwe = 0, there is no surface flux of salt.
  105. !!
  106. !! ** Action : - Update the 1st level of (ta,sa) with the trend associated
  107. !! with the tracer surface boundary condition
  108. !! - send trends to trdtra module (l_trdtra=T)
  109. !!----------------------------------------------------------------------
  110. INTEGER, INTENT(in) :: kt ! ocean time-step index
  111. !!
  112. INTEGER :: ji, jj, jk, jn ! dummy loop indices
  113. INTEGER :: ikt, ikb
  114. INTEGER :: nk_isf
  115. REAL(wp) :: zfact, z1_e3t, zdep
  116. REAL(wp) :: zalpha, zhk
  117. REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdt, ztrds
  118. !!----------------------------------------------------------------------
  119. !
  120. IF( nn_timing == 1 ) CALL timing_start('tra_sbc')
  121. !
  122. IF( kt == nit000 ) THEN
  123. IF(lwp) WRITE(numout,*)
  124. IF(lwp) WRITE(numout,*) 'tra_sbc : TRAcer Surface Boundary Condition'
  125. IF(lwp) WRITE(numout,*) '~~~~~~~ '
  126. ENDIF
  127. IF( l_trdtra ) THEN !* Save ta and sa trends
  128. CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds )
  129. ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
  130. ztrds(:,:,:) = tsa(:,:,:,jp_sal)
  131. ENDIF
  132. !!gm IF( .NOT.ln_traqsr ) qsr(:,:) = 0.e0 ! no solar radiation penetration
  133. IF( .NOT.ln_traqsr ) THEN ! no solar radiation penetration
  134. qns(:,:) = qns(:,:) + qsr(:,:) ! total heat flux in qns
  135. qsr(:,:) = 0.e0 ! qsr set to zero
  136. ENDIF
  137. !----------------------------------------
  138. ! EMP, SFX and QNS effects
  139. !----------------------------------------
  140. ! Set before sbc tracer content fields
  141. ! ************************************
  142. IF( kt == nit000 ) THEN ! Set the forcing field at nit000 - 1
  143. ! ! -----------------------------------
  144. IF( ln_rstart .AND. & ! Restart: read in restart file
  145. & iom_varid( numror, 'sbc_hc_b', ldstop = .FALSE. ) > 0 ) THEN
  146. IF(lwp) WRITE(numout,*) ' nit000-1 surface tracer content forcing fields red in the restart file'
  147. zfact = 0.5_wp
  148. CALL iom_get( numror, jpdom_autoglo, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem) ) ! before heat content sbc trend
  149. CALL iom_get( numror, jpdom_autoglo, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal) ) ! before salt content sbc trend
  150. ELSE ! No restart or restart not found: Euler forward time stepping
  151. zfact = 1._wp
  152. sbc_tsc(:,:,:) = 0._wp
  153. sbc_tsc_b(:,:,:) = 0._wp
  154. ENDIF
  155. ELSE ! Swap of forcing fields
  156. ! ! ----------------------
  157. zfact = 0.5_wp
  158. sbc_tsc_b(:,:,:) = sbc_tsc(:,:,:)
  159. ENDIF
  160. ! Compute now sbc tracer content fields
  161. ! *************************************
  162. ! Concentration dilution effect on (t,s) due to
  163. ! evaporation, precipitation and qns, but not river runoff
  164. IF( lk_vvl ) THEN ! Variable Volume case ==>> heat content of mass flux is in qns
  165. DO jj = 1, jpj
  166. DO ji = 1, jpi
  167. sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj) ! non solar heat flux
  168. sbc_tsc(ji,jj,jp_sal) = r1_rau0 * sfx(ji,jj) ! salt flux due to freezing/melting
  169. END DO
  170. END DO
  171. ELSE ! Constant Volume case ==>> Concentration dilution effect
  172. DO jj = 2, jpj
  173. DO ji = fs_2, fs_jpim1 ! vector opt.
  174. ! temperature : heat flux
  175. sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj) & ! non solar heat flux
  176. & + r1_rau0 * emp(ji,jj) * tsn(ji,jj,1,jp_tem) ! concent./dilut. effect
  177. ! salinity : salt flux + concent./dilut. effect (both in sfx)
  178. sbc_tsc(ji,jj,jp_sal) = r1_rau0 * ( sfx(ji,jj) & ! salt flux (freezing/melting)
  179. & + emp(ji,jj) * tsn(ji,jj,1,jp_sal) ) ! concent./dilut. effect
  180. END DO
  181. END DO
  182. IF( iom_use('emp_x_sst') ) CALL iom_put( "emp_x_sst", emp (:,:) * tsn(:,:,1,jp_tem) ) ! c/d term on sst
  183. IF( iom_use('emp_x_sss') ) CALL iom_put( "emp_x_sss", emp (:,:) * tsn(:,:,1,jp_sal) ) ! c/d term on sss
  184. ENDIF
  185. ! Concentration dilution effect on (t,s) due to evapouration, precipitation and qns, but not river runoff
  186. DO jn = 1, jpts
  187. DO jj = 2, jpj
  188. DO ji = fs_2, fs_jpim1 ! vector opt.
  189. z1_e3t = zfact / fse3t(ji,jj,1)
  190. tsa(ji,jj,1,jn) = tsa(ji,jj,1,jn) + ( sbc_tsc_b(ji,jj,jn) + sbc_tsc(ji,jj,jn) ) * z1_e3t
  191. END DO
  192. END DO
  193. END DO
  194. ! Write in the ocean restart file
  195. ! *******************************
  196. IF( lrst_oce ) THEN
  197. IF(lwp) WRITE(numout,*)
  198. IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in ocean restart file ', &
  199. & 'at it= ', kt,' date= ', ndastp
  200. IF(lwp) WRITE(numout,*) '~~~~'
  201. CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem) )
  202. CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal) )
  203. ENDIF
  204. !
  205. !
  206. !----------------------------------------
  207. ! Ice Shelf effects (ISF)
  208. ! tbl treated as in Losh (2008) JGR
  209. !----------------------------------------
  210. !
  211. IF( nn_isf > 0 ) THEN
  212. zfact = 0.5e0
  213. DO jj = 2, jpj
  214. DO ji = fs_2, fs_jpim1
  215. ikt = misfkt(ji,jj)
  216. ikb = misfkb(ji,jj)
  217. ! level fully include in the ice shelf boundary layer
  218. ! if isfdiv, we have to remove heat flux due to inflow at 0oC (as in rnf when you add rnf at sst)
  219. ! sign - because fwf sign of evapo (rnf sign of precip)
  220. DO jk = ikt, ikb - 1
  221. ! compute tfreez for the temperature correction (we add water at freezing temperature)
  222. ! compute trend
  223. tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) &
  224. & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)) * r1_hisf_tbl(ji,jj)
  225. tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) &
  226. & + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj)
  227. END DO
  228. ! level partially include in ice shelf boundary layer
  229. ! compute tfreez for the temperature correction (we add water at freezing temperature)
  230. ! compute trend
  231. tsa(ji,jj,ikb,jp_tem) = tsa(ji,jj,ikb,jp_tem) &
  232. & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj)
  233. tsa(ji,jj,ikb,jp_sal) = tsa(ji,jj,ikb,jp_sal) &
  234. & + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj)
  235. END DO
  236. END DO
  237. END IF
  238. !
  239. !----------------------------------------
  240. ! River Runoff effects
  241. !----------------------------------------
  242. !
  243. IF( ln_rnf ) THEN ! input of heat and salt due to river runoff
  244. zfact = 0.5_wp
  245. DO jj = 2, jpj
  246. DO ji = fs_2, fs_jpim1
  247. IF( rnf(ji,jj) /= 0._wp ) THEN
  248. zdep = zfact / h_rnf(ji,jj)
  249. DO jk = 1, nk_rnf(ji,jj)
  250. tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) &
  251. & + ( rnf_tsc_b(ji,jj,jp_tem) + rnf_tsc(ji,jj,jp_tem) ) * zdep
  252. IF( ln_rnf_sal ) tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) &
  253. & + ( rnf_tsc_b(ji,jj,jp_sal) + rnf_tsc(ji,jj,jp_sal) ) * zdep
  254. END DO
  255. ENDIF
  256. END DO
  257. END DO
  258. ENDIF
  259. IF( iom_use('rnf_x_sst') ) CALL iom_put( "rnf_x_sst", rnf*tsn(:,:,1,jp_tem) ) ! runoff term on sst
  260. IF( iom_use('rnf_x_sss') ) CALL iom_put( "rnf_x_sss", rnf*tsn(:,:,1,jp_sal) ) ! runoff term on sss
  261. IF( l_trdtra ) THEN ! send trends for further diagnostics
  262. ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
  263. ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
  264. CALL trd_tra( kt, 'TRA', jp_tem, jptra_nsr, ztrdt )
  265. CALL trd_tra( kt, 'TRA', jp_sal, jptra_nsr, ztrds )
  266. CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )
  267. ENDIF
  268. !
  269. IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' sbc - Ta: ', mask1=tmask, &
  270. & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' )
  271. !
  272. IF( nn_timing == 1 ) CALL timing_stop('tra_sbc')
  273. !
  274. END SUBROUTINE tra_sbc
  275. !!======================================================================
  276. END MODULE trasbc