p2zopt.F90 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. MODULE p2zopt
  2. !!======================================================================
  3. !! *** MODULE p2zopt ***
  4. !! TOP : LOBSTER Compute the light availability in the water column
  5. !!======================================================================
  6. !! History : - ! 1995-05 (M. Levy) Original code
  7. !! - ! 1999-09 (J.-M. Andre, M. Levy)
  8. !! - ! 1999-11 (C. Menkes, M.-A. Foujols) itabe initial
  9. !! - ! 2000-02 (M.A. Foujols) change x**y par exp(y*log(x))
  10. !! NEMO 2.0 ! 2007-12 (C. Deltel, G. Madec) F90
  11. !! 3.2 ! 2009-04 (C. Ethe, G. Madec) minor optimisation + style
  12. !!----------------------------------------------------------------------
  13. #if defined key_pisces_reduced
  14. !!----------------------------------------------------------------------
  15. !! 'key_pisces_reduced' LOBSTER bio-model
  16. !!----------------------------------------------------------------------
  17. !! p2z_opt : Compute the light availability in the water column
  18. !!----------------------------------------------------------------------
  19. USE oce_trc !
  20. USE trc
  21. USE sms_pisces
  22. USE prtctl_trc ! Print control for debbuging
  23. IMPLICIT NONE
  24. PRIVATE
  25. PUBLIC p2z_opt !
  26. PUBLIC p2z_opt_init !
  27. REAL(wp), PUBLIC :: xkr0 !: water coefficient absorption in red
  28. REAL(wp), PUBLIC :: xkg0 !: water coefficient absorption in green
  29. REAL(wp), PUBLIC :: xkrp !: pigment coefficient absorption in red
  30. REAL(wp), PUBLIC :: xkgp !: pigment coefficient absorption in green
  31. REAL(wp), PUBLIC :: xlr !: exposant for pigment absorption in red
  32. REAL(wp), PUBLIC :: xlg !: exposant for pigment absorption in green
  33. REAL(wp), PUBLIC :: rpig !: chla/chla+phea ratio
  34. !
  35. REAL(wp), PUBLIC :: rcchl ! Carbone/Chlorophyl ratio [mgC.mgChla-1]
  36. REAL(wp), PUBLIC :: redf ! redfield ratio (C:N) for phyto
  37. REAL(wp), PUBLIC :: reddom ! redfield ratio (C:N) for DOM
  38. !!* Substitution
  39. # include "top_substitute.h90"
  40. !!----------------------------------------------------------------------
  41. !! NEMO/TOP 3.3 , NEMO Consortium (2010)
  42. !! $Id: p2zopt.F90 2442 2015-06-12 08:32:11Z ufla $
  43. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  44. !!----------------------------------------------------------------------
  45. CONTAINS
  46. SUBROUTINE p2z_opt( kt )
  47. !!---------------------------------------------------------------------
  48. !! *** ROUTINE p2z_opt ***
  49. !!
  50. !! ** Purpose : computes the light propagation in the water column
  51. !! and the euphotic layer depth
  52. !!
  53. !! ** Method : local par is computed in w layers using light propagation
  54. !! mean par in t layers are computed by integration
  55. !!
  56. !!gm please remplace the '???' by true comments
  57. !! ** Action : etot ???
  58. !! neln ???
  59. !!---------------------------------------------------------------------
  60. !!
  61. INTEGER, INTENT( in ) :: kt ! index of the time stepping
  62. !!
  63. INTEGER :: ji, jj, jk ! dummy loop indices
  64. CHARACTER (len=25) :: charout ! temporary character
  65. REAL(wp) :: zpig ! log of the total pigment
  66. REAL(wp) :: zkr, zkg ! total absorption coefficient in red and green
  67. REAL(wp) :: zcoef ! temporary scalar
  68. REAL(wp), POINTER, DIMENSION(:,: ) :: zpar100, zpar0m
  69. REAL(wp), POINTER, DIMENSION(:,:,:) :: zparr, zparg
  70. !!---------------------------------------------------------------------
  71. !
  72. IF( nn_timing == 1 ) CALL timing_start('p2z_opt')
  73. !
  74. ! Allocate temporary workspace
  75. CALL wrk_alloc( jpi, jpj, zpar100, zpar0m )
  76. CALL wrk_alloc( jpi, jpj, jpk, zparr, zparg )
  77. IF( kt == nittrc000 ) THEN
  78. IF(lwp) WRITE(numout,*)
  79. IF(lwp) WRITE(numout,*) ' p2z_opt : LOBSTER optic-model'
  80. IF(lwp) WRITE(numout,*) ' ~~~~~~~ '
  81. ENDIF
  82. ! ! surface irradiance
  83. ! ! ------------------
  84. IF( ln_dm2dc ) THEN ; zpar0m(:,:) = qsr_mean(:,:) * 0.43
  85. ELSE ; zpar0m(:,:) = qsr (:,:) * 0.43
  86. ENDIF
  87. zpar100(:,:) = zpar0m(:,:) * 0.01
  88. zparr (:,:,1) = zpar0m(:,:) * 0.5
  89. zparg (:,:,1) = zpar0m(:,:) * 0.5
  90. ! ! Photosynthetically Available Radiation (PAR)
  91. zcoef = 12 * redf / rcchl / rpig ! --------------------------------------
  92. DO jk = 2, jpk ! local par at w-levels
  93. DO jj = 1, jpj
  94. DO ji = 1, jpi
  95. zpig = LOG( MAX( TINY(0.), trn(ji,jj,jk-1,jpphy) ) * zcoef )
  96. zkr = xkr0 + xkrp * EXP( xlr * zpig )
  97. zkg = xkg0 + xkgp * EXP( xlg * zpig )
  98. zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * fse3t(ji,jj,jk-1) )
  99. zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * fse3t(ji,jj,jk-1) )
  100. END DO
  101. END DO
  102. END DO
  103. DO jk = 1, jpkm1 ! mean par at t-levels
  104. DO jj = 1, jpj
  105. DO ji = 1, jpi
  106. zpig = LOG( MAX( TINY(0.), trn(ji,jj,jk,jpphy) ) * zcoef )
  107. zkr = xkr0 + xkrp * EXP( xlr * zpig )
  108. zkg = xkg0 + xkgp * EXP( xlg * zpig )
  109. zparr(ji,jj,jk) = zparr(ji,jj,jk) / ( zkr * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkr * fse3t(ji,jj,jk) ) )
  110. zparg(ji,jj,jk) = zparg(ji,jj,jk) / ( zkg * fse3t(ji,jj,jk) ) * ( 1 - EXP( -zkg * fse3t(ji,jj,jk) ) )
  111. etot (ji,jj,jk) = MAX( zparr(ji,jj,jk) + zparg(ji,jj,jk), 1.e-15 )
  112. END DO
  113. END DO
  114. END DO
  115. ! ! Euphotic layer
  116. ! ! --------------
  117. neln(:,:) = 1 ! euphotic layer level
  118. DO jk = 1, jpk ! (i.e. 1rst T-level strictly below EL bottom)
  119. DO jj = 1, jpj
  120. DO ji = 1, jpi
  121. IF( etot(ji,jj,jk) >= zpar100(ji,jj) ) neln(ji,jj) = jk + 1
  122. ! ! nb. this is to ensure compatibility with
  123. ! ! nmld_trc definition in trd_mxl_trc_zint
  124. END DO
  125. END DO
  126. END DO
  127. ! ! Euphotic layer depth
  128. DO jj = 1, jpj
  129. DO ji = 1, jpi
  130. heup(ji,jj) = fsdepw(ji,jj,neln(ji,jj))
  131. END DO
  132. END DO
  133. IF(ln_ctl) THEN ! print mean trends (used for debugging)
  134. WRITE(charout, FMT="('opt')")
  135. CALL prt_ctl_trc_info( charout )
  136. CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
  137. ENDIF
  138. !
  139. CALL wrk_dealloc( jpi, jpj, zpar100, zpar0m )
  140. CALL wrk_dealloc( jpi, jpj, jpk, zparr, zparg )
  141. !
  142. IF( nn_timing == 1 ) CALL timing_stop('p2z_opt')
  143. !
  144. END SUBROUTINE p2z_opt
  145. SUBROUTINE p2z_opt_init
  146. !!----------------------------------------------------------------------
  147. !! *** ROUTINE p2z_opt_init ***
  148. !!
  149. !! ** Purpose : optical parameters
  150. !!
  151. !! ** Method : Read the namlobopt namelist and check the parameters
  152. !!
  153. !!----------------------------------------------------------------------
  154. NAMELIST/namlobopt/ xkg0, xkr0, xkgp, xkrp, xlg, xlr, rpig
  155. NAMELIST/namlobrat/ rcchl, redf, reddom
  156. INTEGER :: ios ! Local integer output status for namelist read
  157. !!----------------------------------------------------------------------
  158. REWIND( numnatp_ref ) ! Namelist namlobopt in reference namelist : Lobster options
  159. READ ( numnatp_ref, namlobopt, IOSTAT = ios, ERR = 901)
  160. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobopt in reference namelist', lwp )
  161. REWIND( numnatp_cfg ) ! Namelist namlobopt in configuration namelist : Lobster options
  162. READ ( numnatp_cfg, namlobopt, IOSTAT = ios, ERR = 902 )
  163. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobopt in configuration namelist', lwp )
  164. IF(lwm) WRITE ( numonp, namlobopt )
  165. IF(lwp) THEN
  166. WRITE(numout,*)
  167. WRITE(numout,*) ' Namelist namlobopt'
  168. WRITE(numout,*) ' green water absorption coeff xkg0 = ', xkg0
  169. WRITE(numout,*) ' red water absorption coeff xkr0 = ', xkr0
  170. WRITE(numout,*) ' pigment red absorption coeff xkrp = ', xkrp
  171. WRITE(numout,*) ' pigment green absorption coeff xkgp = ', xkgp
  172. WRITE(numout,*) ' green chl exposant xlg = ', xlg
  173. WRITE(numout,*) ' red chl exposant xlr = ', xlr
  174. WRITE(numout,*) ' chla/chla+phea ratio rpig = ', rpig
  175. WRITE(numout,*) ' '
  176. ENDIF
  177. !
  178. REWIND( numnatp_ref ) ! Namelist namlobrat in reference namelist : Lobster ratios
  179. READ ( numnatp_ref, namlobrat, IOSTAT = ios, ERR = 903)
  180. 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobrat in reference namelist', lwp )
  181. REWIND( numnatp_cfg ) ! Namelist namlobrat in configuration namelist : Lobster ratios
  182. READ ( numnatp_cfg, namlobrat, IOSTAT = ios, ERR = 904 )
  183. 904 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlobrat in configuration namelist', lwp )
  184. IF(lwm) WRITE ( numonp, namlobrat )
  185. IF(lwp) THEN
  186. WRITE(numout,*) ' Namelist namlobrat'
  187. WRITE(numout,*) ' carbone/chlorophyl ratio rcchl = ', rcchl
  188. WRITE(numout,*) ' redfield ratio c:n for phyto redf =', redf
  189. WRITE(numout,*) ' redfield ratio c:n for DOM reddom =', reddom
  190. WRITE(numout,*) ' '
  191. ENDIF
  192. !
  193. END SUBROUTINE p2z_opt_init
  194. #else
  195. !!======================================================================
  196. !! Dummy module : No PISCES bio-model
  197. !!======================================================================
  198. CONTAINS
  199. SUBROUTINE p2z_opt( kt ) ! Empty routine
  200. INTEGER, INTENT( in ) :: kt
  201. WRITE(*,*) 'p2z_opt: You should not have seen this print! error?', kt
  202. END SUBROUTINE p2z_opt
  203. #endif
  204. !!======================================================================
  205. END MODULE p2zopt