p2zexp.F90 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. MODULE p2zexp
  2. !!======================================================================
  3. !! *** MODULE p2zsed ***
  4. !! TOP : LOBSTER Compute loss of organic matter in the sediments
  5. !!======================================================================
  6. !! History : - ! 1999 (O. Aumont, C. Le Quere) original code
  7. !! - ! 2001-05 (O. Aumont, E. Kestenare) add sediment computations
  8. !! 1.0 ! 2005-06 (A.-S. Kremeur) new temporal integration for sedpoc
  9. !! 2.0 ! 2007-12 (C. Deltel, G. Madec) F90
  10. !! 3.5 ! 2012-03 (C. Ethe) Merge PISCES-LOBSTER
  11. !!----------------------------------------------------------------------
  12. #if defined key_pisces_reduced
  13. !!----------------------------------------------------------------------
  14. !! 'key_pisces_reduced' LOBSTER bio-model
  15. !!----------------------------------------------------------------------
  16. !! p2z_exp : Compute loss of organic matter in the sediments
  17. !!----------------------------------------------------------------------
  18. USE oce_trc !
  19. USE trc
  20. USE sms_pisces
  21. USE p2zsed
  22. USE lbclnk
  23. USE prtctl_trc ! Print control for debbuging
  24. USE trd_oce
  25. USE trdtrc
  26. USE iom
  27. IMPLICIT NONE
  28. PRIVATE
  29. PUBLIC p2z_exp
  30. PUBLIC p2z_exp_init
  31. PUBLIC p2z_exp_alloc
  32. !
  33. REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: dminl !: fraction of sinking POC released in sediments
  34. REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: dmin3 !: fraction of sinking POC released at each level
  35. REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: sedpocb !: mass of POC in sediments
  36. REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: sedpocn !: mass of POC in sediments
  37. REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: cmask !: Coastal mask area
  38. REAL(wp) :: areacot !: surface coastal area
  39. !!* Substitution
  40. # include "top_substitute.h90"
  41. !!----------------------------------------------------------------------
  42. !! NEMO/TOP 3.3 , NEMO Consortium (2010)
  43. !! $Id: p2zexp.F90 2355 2015-05-20 07:11:50Z ufla $
  44. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  45. !!----------------------------------------------------------------------
  46. CONTAINS
  47. SUBROUTINE p2z_exp( kt )
  48. !!---------------------------------------------------------------------
  49. !! *** ROUTINE p2z_exp ***
  50. !!
  51. !! ** Purpose : MODELS EXPORT OF BIOGENIC MATTER (POC ''SOFT
  52. !! TISSUE'') AND ITS DISTRIBUTION IN WATER COLUMN
  53. !!
  54. !! ** Method : - IN THE SURFACE LAYER POC IS PRODUCED ACCORDING TO
  55. !! NURTRIENTS AVAILABLE AND GROWTH CONDITIONS. NUTRIENT UPTAKE
  56. !! KINETICS FOLLOW MICHAELIS-MENTON FORMULATION.
  57. !! THE TOTAL PARTICLE AMOUNT PRODUCED, IS DISTRIBUTED IN THE WATER
  58. !! COLUMN BELOW THE SURFACE LAYER.
  59. !!---------------------------------------------------------------------
  60. !!
  61. INTEGER, INTENT( in ) :: kt ! ocean time-step index
  62. !!
  63. INTEGER :: ji, jj, jk, jl, ikt
  64. REAL(wp) :: zgeolpoc, zfact, zwork, ze3t, zsedpocd, zmaskt
  65. REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrbio
  66. REAL(wp), POINTER, DIMENSION(:,:) :: zsedpoca
  67. CHARACTER (len=25) :: charout
  68. !!---------------------------------------------------------------------
  69. !
  70. IF( nn_timing == 1 ) CALL timing_start('p2z_exp')
  71. !
  72. IF( kt == nittrc000 ) CALL p2z_exp_init
  73. CALL wrk_alloc( jpi, jpj, zsedpoca )
  74. zsedpoca(:,:) = 0.
  75. IF( l_trdtrc ) THEN
  76. CALL wrk_alloc( jpi, jpj, jpk, ztrbio ) ! temporary save of trends
  77. ztrbio(:,:,:) = tra(:,:,:,jpno3)
  78. ENDIF
  79. ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
  80. ! POC IN THE WATER COLUMN
  81. ! (PARTS OF NEWLY FORMED MATTER REMAINING IN THE DIFFERENT
  82. ! LAYERS IS DETERMINED BY DMIN3 DEFINED IN sms_p2z.F90
  83. ! ----------------------------------------------------------------------
  84. DO jk = 1, jpkm1
  85. DO jj = 2, jpjm1
  86. DO ji = fs_2, fs_jpim1
  87. ze3t = 1. / fse3t(ji,jj,jk)
  88. tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + ze3t * dmin3(ji,jj,jk) * xksi(ji,jj)
  89. END DO
  90. END DO
  91. END DO
  92. ! Find the last level of the water column
  93. ! Compute fluxes due to sinking particles (slow)
  94. zgeolpoc = 0.e0 ! Initialization
  95. ! Release of nutrients from the "simple" sediment
  96. DO jj = 2, jpjm1
  97. DO ji = fs_2, fs_jpim1
  98. ikt = mbkt(ji,jj)
  99. tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) + sedlam * sedpocn(ji,jj) / fse3t(ji,jj,ikt)
  100. ! Deposition of organic matter in the sediment
  101. zwork = vsed * trn(ji,jj,ikt,jpdet)
  102. zsedpoca(ji,jj) = ( zwork + dminl(ji,jj) * xksi(ji,jj) &
  103. & - sedlam * sedpocn(ji,jj) - sedlostpoc * sedpocn(ji,jj) ) * rdt
  104. zgeolpoc = zgeolpoc + sedlostpoc * sedpocn(ji,jj) * e1e2t(ji,jj)
  105. END DO
  106. END DO
  107. DO jj = 2, jpjm1
  108. DO ji = fs_2, fs_jpim1
  109. tra(ji,jj,1,jpno3) = tra(ji,jj,1,jpno3) + zgeolpoc * cmask(ji,jj) / areacot / fse3t(ji,jj,1)
  110. END DO
  111. END DO
  112. CALL lbc_lnk( sedpocn, 'T', 1. )
  113. ! Oa & Ek: diagnostics depending on jpdia2d ! left as example
  114. IF( lk_iomput ) THEN
  115. CALL iom_put( "SEDPOC" , sedpocn )
  116. ELSE
  117. IF( ln_diatrc ) trc2d(:,:,jp_pcs0_2d + 18) = sedpocn(:,:)
  118. ENDIF
  119. ! Time filter and swap of arrays
  120. ! ------------------------------
  121. IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! Euler time-stepping at first time-step
  122. ! ! (only swap)
  123. sedpocn(:,:) = zsedpoca(:,:)
  124. !
  125. ELSE
  126. !
  127. DO jj = 1, jpj
  128. DO ji = 1, jpi
  129. zsedpocd = zsedpoca(ji,jj) - 2. * sedpocn(ji,jj) + sedpocb(ji,jj) ! time laplacian on tracers
  130. sedpocb(ji,jj) = sedpocn(ji,jj) + atfp * zsedpocd ! sedpocb <-- filtered sedpocn
  131. sedpocn(ji,jj) = zsedpoca(ji,jj) ! sedpocn <-- sedpoca
  132. END DO
  133. END DO
  134. !
  135. ENDIF
  136. !
  137. IF( lrst_trc ) THEN
  138. IF(lwp) WRITE(numout,*)
  139. IF(lwp) WRITE(numout,*) 'p2z_exp : POC in sediment fields written in ocean restart file ', &
  140. & 'at it= ', kt,' date= ', ndastp
  141. IF(lwp) WRITE(numout,*) '~~~~'
  142. CALL iom_rstput( kt, nitrst, numrtw, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
  143. CALL iom_rstput( kt, nitrst, numrtw, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
  144. ENDIF
  145. !
  146. IF( l_trdtrc ) THEN
  147. ztrbio(:,:,:) = tra(:,:,:,jpno3) - ztrbio(:,:,:)
  148. jl = jp_pcs0_trd + 16
  149. CALL trd_trc( ztrbio, jl, kt ) ! handle the trend
  150. CALL wrk_dealloc( jpi, jpj, jpk, ztrbio ) ! temporary save of trends
  151. ENDIF
  152. !
  153. CALL wrk_dealloc( jpi, jpj, zsedpoca) ! temporary save of trends
  154. IF(ln_ctl) THEN ! print mean trends (used for debugging)
  155. WRITE(charout, FMT="('exp')")
  156. CALL prt_ctl_trc_info(charout)
  157. CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
  158. ENDIF
  159. !
  160. IF( nn_timing == 1 ) CALL timing_stop('p2z_exp')
  161. !
  162. END SUBROUTINE p2z_exp
  163. SUBROUTINE p2z_exp_init
  164. !!----------------------------------------------------------------------
  165. !! *** ROUTINE p4z_exp_init ***
  166. !! ** purpose : specific initialisation for export
  167. !!----------------------------------------------------------------------
  168. INTEGER :: ji, jj, jk
  169. REAL(wp) :: zmaskt, zfluo, zfluu
  170. REAL(wp), POINTER, DIMENSION(:,: ) :: zrro
  171. REAL(wp), POINTER, DIMENSION(:,:,:) :: zdm0
  172. !!---------------------------------------------------------------------
  173. IF(lwp) THEN
  174. WRITE(numout,*)
  175. WRITE(numout,*) ' p2z_exp: LOBSTER export'
  176. WRITE(numout,*) ' ~~~~~~~'
  177. WRITE(numout,*) ' compute remineralisation-damping arrays for tracers'
  178. ENDIF
  179. !
  180. ! Allocate temporary workspace
  181. CALL wrk_alloc( jpi, jpj, zrro )
  182. CALL wrk_alloc( jpi, jpj, jpk, zdm0 )
  183. ! Calculate vertical distribution of newly formed biogenic poc
  184. ! in the water column in the case of max. possible bottom depth
  185. ! ------------------------------------------------------------
  186. zdm0 = 0._wp
  187. zrro = 1._wp
  188. DO jk = jpkb, jpkm1
  189. DO jj = 1, jpj
  190. DO ji = 1, jpi
  191. zfluo = ( fsdepw(ji,jj,jk ) / fsdepw(ji,jj,jpkb) )**xhr
  192. zfluu = ( fsdepw(ji,jj,jk+1) / fsdepw(ji,jj,jpkb) )**xhr
  193. IF( zfluo.GT.1. ) zfluo = 1._wp
  194. zdm0(ji,jj,jk) = zfluo - zfluu
  195. IF( jk <= jpkb-1 ) zdm0(ji,jj,jk) = 0._wp
  196. zrro(ji,jj) = zrro(ji,jj) - zdm0(ji,jj,jk)
  197. END DO
  198. END DO
  199. END DO
  200. !
  201. zdm0(:,:,jpk) = zrro(:,:)
  202. ! Calculate vertical distribution of newly formed biogenic poc
  203. ! in the water column with realistic topography (first "dry" layer
  204. ! contains total fraction, which has passed to the upper layers)
  205. ! ----------------------------------------------------------------------
  206. dminl(:,:) = 0._wp
  207. dmin3(:,:,:) = zdm0
  208. DO jk = 1, jpk
  209. DO jj = 1, jpj
  210. DO ji = 1, jpi
  211. IF( tmask(ji,jj,jk) == 0._wp ) THEN
  212. dminl(ji,jj) = dminl(ji,jj) + dmin3(ji,jj,jk)
  213. dmin3(ji,jj,jk) = 0._wp
  214. ENDIF
  215. END DO
  216. END DO
  217. END DO
  218. DO jj = 1, jpj
  219. DO ji = 1, jpi
  220. IF( tmask(ji,jj,1) == 0 ) dmin3(ji,jj,1) = 0._wp
  221. END DO
  222. END DO
  223. ! Coastal mask
  224. cmask(:,:) = 0._wp
  225. DO jj = 2, jpjm1
  226. DO ji = fs_2, fs_jpim1
  227. IF( tmask(ji,jj,1) /= 0. ) THEN
  228. zmaskt = tmask(ji+1,jj,1) * tmask(ji-1,jj,1) * tmask(ji,jj+1,1) * tmask(ji,jj-1,1)
  229. IF( zmaskt == 0. ) cmask(ji,jj) = 1._wp
  230. END IF
  231. END DO
  232. END DO
  233. CALL lbc_lnk( cmask , 'T', 1. ) ! lateral boundary conditions on cmask (sign unchanged)
  234. areacot = glob_sum( e1e2t(:,:) * cmask(:,:) )
  235. !
  236. IF( ln_rsttr ) THEN
  237. CALL iom_get( numrtr, jpdom_autoglo, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:) )
  238. CALL iom_get( numrtr, jpdom_autoglo, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:) )
  239. ELSE
  240. sedpocb(:,:) = 0._wp
  241. sedpocn(:,:) = 0._wp
  242. ENDIF
  243. !
  244. CALL wrk_dealloc( jpi, jpj, zrro )
  245. CALL wrk_dealloc( jpi, jpj, jpk, zdm0 )
  246. !
  247. END SUBROUTINE p2z_exp_init
  248. INTEGER FUNCTION p2z_exp_alloc()
  249. !!----------------------------------------------------------------------
  250. !! *** ROUTINE p2z_exp_alloc ***
  251. !!----------------------------------------------------------------------
  252. ALLOCATE( cmask(jpi,jpj) , dminl(jpi,jpj) , dmin3(jpi,jpj,jpk), &
  253. & sedpocb(jpi,jpj) , sedpocn(jpi,jpj), STAT=p2z_exp_alloc )
  254. IF( p2z_exp_alloc /= 0 ) CALL ctl_warn('p2z_exp_alloc : failed to allocate arrays.')
  255. !
  256. END FUNCTION p2z_exp_alloc
  257. #else
  258. !!======================================================================
  259. !! Dummy module : No PISCES bio-model
  260. !!======================================================================
  261. CONTAINS
  262. SUBROUTINE p2z_exp( kt ) ! Empty routine
  263. INTEGER, INTENT( in ) :: kt
  264. WRITE(*,*) 'p2z_exp: You should not have seen this print! error?', kt
  265. END SUBROUTINE p2z_exp
  266. #endif
  267. !!======================================================================
  268. END MODULE p2zexp