traqsr.F90 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. MODULE traqsr
  2. !!======================================================================
  3. !! *** MODULE traqsr ***
  4. !! Ocean physics: solar radiation penetration in the top ocean levels
  5. !!======================================================================
  6. !! History : OPA ! 1990-10 (B. Blanke) Original code
  7. !! 7.0 ! 1991-11 (G. Madec)
  8. !! ! 1996-01 (G. Madec) s-coordinates
  9. !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module
  10. !! - ! 2005-11 (G. Madec) zco, zps, sco coordinate
  11. !! 3.2 ! 2009-04 (G. Madec & NEMO team)
  12. !! 3.4 ! 2012-05 (C. Rousset) store attenuation coef for use in ice model
  13. !! 3.6 ! 2015-12 (O. Aumont, J. Jouanno, C. Ethe) use vertical profile of chlorophyll
  14. !!----------------------------------------------------------------------
  15. !!----------------------------------------------------------------------
  16. !! tra_qsr : trend due to the solar radiation penetration
  17. !! tra_qsr_init : solar radiation penetration initialization
  18. !!----------------------------------------------------------------------
  19. USE oce ! ocean dynamics and active tracers
  20. USE dom_oce ! ocean space and time domain
  21. USE sbc_oce ! surface boundary condition: ocean
  22. USE trc_oce ! share SMS/Ocean variables
  23. USE trd_oce ! trends: ocean variables
  24. USE trdtra ! trends manager: tracers
  25. USE in_out_manager ! I/O manager
  26. USE phycst ! physical constants
  27. USE prtctl ! Print control
  28. USE iom ! I/O manager
  29. USE fldread ! read input fields
  30. USE restart ! ocean restart
  31. USE lib_mpp ! MPP library
  32. USE wrk_nemo ! Memory Allocation
  33. USE timing ! Timing
  34. IMPLICIT NONE
  35. PRIVATE
  36. PUBLIC tra_qsr ! routine called by step.F90 (ln_traqsr=T)
  37. PUBLIC tra_qsr_init ! routine called by nemogcm.F90
  38. ! !!* Namelist namtra_qsr: penetrative solar radiation
  39. LOGICAL , PUBLIC :: ln_traqsr !: light absorption (qsr) flag
  40. LOGICAL , PUBLIC :: ln_qsr_rgb !: Red-Green-Blue light absorption flag
  41. LOGICAL , PUBLIC :: ln_qsr_2bd !: 2 band light absorption flag
  42. LOGICAL , PUBLIC :: ln_qsr_bio !: bio-model light absorption flag
  43. LOGICAL , PUBLIC :: ln_qsr_ice !: light penetration for ice-model LIM3 (clem)
  44. INTEGER , PUBLIC :: nn_chldta !: use Chlorophyll data (=1) or not (=0)
  45. REAL(wp), PUBLIC :: rn_abs !: fraction absorbed in the very near surface (RGB & 2 bands)
  46. REAL(wp), PUBLIC :: rn_si0 !: very near surface depth of extinction (RGB & 2 bands)
  47. REAL(wp), PUBLIC :: rn_si1 !: deepest depth of extinction (water type I) (2 bands)
  48. ! Module variables
  49. REAL(wp) :: xsi0r !: inverse of rn_si0
  50. REAL(wp) :: xsi1r !: inverse of rn_si1
  51. TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_chl ! structure of input Chl (file informations, fields read)
  52. INTEGER, PUBLIC :: nksr ! levels below which the light cannot penetrate ( depth larger than 391 m)
  53. REAL(wp), DIMENSION(3,61) :: rkrgb !: tabulated attenuation coefficients for RGB absorption
  54. !! * Substitutions
  55. # include "domzgr_substitute.h90"
  56. # include "vectopt_loop_substitute.h90"
  57. !!----------------------------------------------------------------------
  58. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  59. !! $Id: traqsr.F90 4990 2014-12-15 16:42:49Z timgraham $
  60. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  61. !!----------------------------------------------------------------------
  62. CONTAINS
  63. SUBROUTINE tra_qsr( kt )
  64. !!----------------------------------------------------------------------
  65. !! *** ROUTINE tra_qsr ***
  66. !!
  67. !! ** Purpose : Compute the temperature trend due to the solar radiation
  68. !! penetration and add it to the general temperature trend.
  69. !!
  70. !! ** Method : The profile of the solar radiation within the ocean is defined
  71. !! through 2 wavebands (rn_si0,rn_si1) or 3 wavebands (RGB) and a ratio rn_abs
  72. !! Considering the 2 wavebands case:
  73. !! I(k) = Qsr*( rn_abs*EXP(z(k)/rn_si0) + (1.-rn_abs)*EXP(z(k)/rn_si1) )
  74. !! The temperature trend associated with the solar radiation penetration
  75. !! is given by : zta = 1/e3t dk[ I ] / (rau0*Cp)
  76. !! At the bottom, boudary condition for the radiation is no flux :
  77. !! all heat which has not been absorbed in the above levels is put
  78. !! in the last ocean level.
  79. !! In z-coordinate case, the computation is only done down to the
  80. !! level where I(k) < 1.e-15 W/m2. In addition, the coefficients
  81. !! used for the computation are calculated one for once as they
  82. !! depends on k only.
  83. !!
  84. !! ** Action : - update ta with the penetrative solar radiation trend
  85. !! - save the trend in ttrd ('key_trdtra')
  86. !!
  87. !! Reference : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp.
  88. !! Lengaigne et al. 2007, Clim. Dyn., V28, 5, 503-516.
  89. !! Morel, A. et Berthon, JF, 1989, Limnol Oceanogr 34(8), 1545-1562
  90. !!----------------------------------------------------------------------
  91. !
  92. INTEGER, INTENT(in) :: kt ! ocean time-step
  93. !
  94. INTEGER :: ji, jj, jk ! dummy loop indices
  95. INTEGER :: irgb ! local integers
  96. REAL(wp) :: zchl, zcoef, zfact ! local scalars
  97. REAL(wp) :: zc0, zc1, zc2, zc3 ! - -
  98. REAL(wp) :: zz0, zz1, z1_e3t ! - -
  99. REAL(wp) :: zCb, zCmax, zze, zpsi, zpsimax, zdelpsi, zCtot, zCze
  100. REAL(wp) :: zlogc, zlogc2, zlogc3
  101. REAL(wp), POINTER, DIMENSION(:,: ) :: zekb, zekg, zekr
  102. REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt, zchl3d
  103. !!--------------------------------------------------------------------------
  104. !
  105. IF( nn_timing == 1 ) CALL timing_start('tra_qsr')
  106. !
  107. CALL wrk_alloc( jpi, jpj, zekb, zekg, zekr )
  108. CALL wrk_alloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea, zchl3d )
  109. !
  110. IF( kt == nit000 ) THEN
  111. IF(lwp) WRITE(numout,*)
  112. IF(lwp) WRITE(numout,*) 'tra_qsr : penetration of the surface solar radiation'
  113. IF(lwp) WRITE(numout,*) '~~~~~~~'
  114. IF( .NOT.ln_traqsr ) RETURN
  115. ENDIF
  116. IF( l_trdtra ) THEN ! Save ta and sa trends
  117. CALL wrk_alloc( jpi, jpj, jpk, ztrdt )
  118. ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
  119. ENDIF
  120. ! Set before qsr tracer content field
  121. ! ***********************************
  122. IF( kt == nit000 ) THEN ! Set the forcing field at nit000 - 1
  123. ! ! -----------------------------------
  124. qsr_hc(:,:,:) = 0.e0
  125. !
  126. IF( ln_rstart .AND. & ! Restart: read in restart file
  127. & iom_varid( numror, 'qsr_hc_b', ldstop = .FALSE. ) > 0 ) THEN
  128. IF(lwp) WRITE(numout,*) ' nit000-1 qsr tracer content forcing field red in the restart file'
  129. zfact = 0.5e0
  130. CALL iom_get( numror, jpdom_autoglo, 'qsr_hc_b', qsr_hc_b ) ! before heat content trend due to Qsr flux
  131. ELSE ! No restart or restart not found: Euler forward time stepping
  132. zfact = 1.e0
  133. qsr_hc_b(:,:,:) = 0.e0
  134. ENDIF
  135. ELSE ! Swap of forcing field
  136. ! ! ---------------------
  137. zfact = 0.5e0
  138. qsr_hc_b(:,:,:) = qsr_hc(:,:,:)
  139. ENDIF
  140. ! Compute now qsr tracer content field
  141. ! ************************************
  142. ! ! ============================================== !
  143. IF( lk_qsr_bio .AND. ln_qsr_bio ) THEN ! bio-model fluxes : all vertical coordinates !
  144. ! ! ============================================== !
  145. DO jk = 1, jpkm1
  146. qsr_hc(:,:,jk) = r1_rau0_rcp * ( etot3(:,:,jk) - etot3(:,:,jk+1) )
  147. END DO
  148. ! Add to the general trend
  149. DO jk = 1, jpkm1
  150. DO jj = 2, jpjm1
  151. DO ji = fs_2, fs_jpim1 ! vector opt.
  152. z1_e3t = zfact / fse3t(ji,jj,jk)
  153. tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + ( qsr_hc_b(ji,jj,jk) + qsr_hc(ji,jj,jk) ) * z1_e3t
  154. END DO
  155. END DO
  156. END DO
  157. CALL iom_put( 'qsr3d', etot3 ) ! Shortwave Radiation 3D distribution
  158. ! clem: store attenuation coefficient of the first ocean level
  159. IF ( ln_qsr_ice ) THEN
  160. DO jj = 1, jpj
  161. DO ji = 1, jpi
  162. IF ( qsr(ji,jj) /= 0._wp ) THEN
  163. fraqsr_1lev(ji,jj) = ( qsr_hc(ji,jj,1) / ( r1_rau0_rcp * qsr(ji,jj) ) )
  164. ELSE
  165. fraqsr_1lev(ji,jj) = 1.
  166. ENDIF
  167. END DO
  168. END DO
  169. ENDIF
  170. ! ! ============================================== !
  171. ELSE ! Ocean alone :
  172. ! ! ============================================== !
  173. !
  174. ! ! ------------------------- !
  175. IF( ln_qsr_rgb) THEN ! R-G-B light penetration !
  176. ! ! ------------------------- !
  177. ! Set chlorophyl concentration
  178. IF( nn_chldta == 1 .OR. nn_chldta == 2 .OR. lk_vvl ) THEN !* Variable Chlorophyll or ocean volume
  179. !
  180. IF( nn_chldta == 1 ) THEN !* 2D Variable Chlorophyll
  181. !
  182. CALL fld_read( kt, 1, sf_chl ) ! Read Chl data and provides it at the current time step
  183. DO jk = 1, nksr + 1
  184. zchl3d(:,:,jk) = sf_chl(1)%fnow(:,:,1)
  185. ENDDO
  186. !
  187. ELSE IF( nn_chldta == 2 ) THEN !* -3-D Variable Chlorophyll
  188. !
  189. CALL fld_read( kt, 1, sf_chl ) ! Read Chl data and provides it at the current time step
  190. !CDIR NOVERRCHK !
  191. DO jj = 1, jpj
  192. !CDIR NOVERRCHK
  193. DO ji = 1, jpi
  194. zchl = sf_chl(1)%fnow(ji,jj,1)
  195. zCtot = 40.6 * zchl**0.459
  196. zze = 568.2 * zCtot**(-0.746)
  197. IF( zze > 102. ) zze = 200.0 * zCtot**(-0.293)
  198. zlogc = LOG( zchl )
  199. zlogc2 = zlogc * zlogc
  200. zlogc3 = zlogc * zlogc * zlogc
  201. zCb = 0.768 + 0.087 * zlogc - 0.179 * zlogc2 - 0.025 * zlogc3
  202. zCmax = 0.299 - 0.289 * zlogc + 0.579 * zlogc2
  203. zpsimax = 0.6 - 0.640 * zlogc + 0.021 * zlogc2 + 0.115 * zlogc3
  204. zdelpsi = 0.710 + 0.159 * zlogc + 0.021 * zlogc2
  205. zCze = 1.12 * (zchl)**0.803
  206. DO jk = 1, nksr + 1
  207. zpsi = fsdept(ji,jj,jk) / zze
  208. zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) )
  209. END DO
  210. !
  211. END DO
  212. END DO
  213. !
  214. ELSE !* Variable ocean volume but constant chrlorophyll
  215. DO jk = 1, nksr + 1
  216. zchl3d(:,:,jk) = 0.05
  217. ENDDO
  218. ENDIF
  219. !
  220. zcoef = ( 1. - rn_abs ) / 3.e0 ! equi-partition in R-G-B
  221. ze0(:,:,1) = rn_abs * qsr(:,:)
  222. ze1(:,:,1) = zcoef * qsr(:,:)
  223. ze2(:,:,1) = zcoef * qsr(:,:)
  224. ze3(:,:,1) = zcoef * qsr(:,:)
  225. zea(:,:,1) = qsr(:,:)
  226. !
  227. DO jk = 2, nksr+1
  228. !
  229. DO jj = 1, jpj ! Separation in R-G-B depending of vertical profile of Chl
  230. !CDIR NOVERRCHK
  231. DO ji = 1, jpi
  232. zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,jk) ) )
  233. irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 )
  234. zekb(ji,jj) = rkrgb(1,irgb)
  235. zekg(ji,jj) = rkrgb(2,irgb)
  236. zekr(ji,jj) = rkrgb(3,irgb)
  237. END DO
  238. END DO
  239. !CDIR NOVERRCHK
  240. DO jj = 1, jpj
  241. !CDIR NOVERRCHK
  242. DO ji = 1, jpi
  243. zc0 = ze0(ji,jj,jk-1) * EXP( - fse3t(ji,jj,jk-1) * xsi0r )
  244. zc1 = ze1(ji,jj,jk-1) * EXP( - fse3t(ji,jj,jk-1) * zekb(ji,jj) )
  245. zc2 = ze2(ji,jj,jk-1) * EXP( - fse3t(ji,jj,jk-1) * zekg(ji,jj) )
  246. zc3 = ze3(ji,jj,jk-1) * EXP( - fse3t(ji,jj,jk-1) * zekr(ji,jj) )
  247. ze0(ji,jj,jk) = zc0
  248. ze1(ji,jj,jk) = zc1
  249. ze2(ji,jj,jk) = zc2
  250. ze3(ji,jj,jk) = zc3
  251. zea(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,jk)
  252. END DO
  253. END DO
  254. END DO
  255. !
  256. DO jk = 1, nksr ! compute and add qsr trend to ta
  257. qsr_hc(:,:,jk) = r1_rau0_rcp * ( zea(:,:,jk) - zea(:,:,jk+1) )
  258. END DO
  259. zea(:,:,nksr+1:jpk) = 0.e0 ! below 400m set to zero
  260. CALL iom_put( 'qsr3d', zea ) ! Shortwave Radiation 3D distribution
  261. !
  262. IF ( ln_qsr_ice ) THEN ! store attenuation coefficient of the first ocean level
  263. !CDIR NOVERRCHK
  264. DO jj = 1, jpj ! Separation in R-G-B depending of the surface Chl
  265. !CDIR NOVERRCHK
  266. DO ji = 1, jpi
  267. zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,1) ) )
  268. irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 )
  269. zekb(ji,jj) = rkrgb(1,irgb)
  270. zekg(ji,jj) = rkrgb(2,irgb)
  271. zekr(ji,jj) = rkrgb(3,irgb)
  272. END DO
  273. END DO
  274. !
  275. DO jj = 1, jpj
  276. DO ji = 1, jpi
  277. zc0 = rn_abs * EXP( - fse3t(ji,jj,1) * xsi0r )
  278. zc1 = zcoef * EXP( - fse3t(ji,jj,1) * zekb(ji,jj) )
  279. zc2 = zcoef * EXP( - fse3t(ji,jj,1) * zekg(ji,jj) )
  280. zc3 = zcoef * EXP( - fse3t(ji,jj,1) * zekr(ji,jj) )
  281. fraqsr_1lev(ji,jj) = 1.0 - ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,2)
  282. END DO
  283. END DO
  284. !
  285. ENDIF
  286. !
  287. ELSE !* Constant Chlorophyll
  288. DO jk = 1, nksr
  289. qsr_hc(:,:,jk) = etot3(:,:,jk) * qsr(:,:)
  290. END DO
  291. ! store attenuation coefficient of the first ocean level
  292. IF( ln_qsr_ice ) THEN
  293. fraqsr_1lev(:,:) = etot3(:,:,1) / r1_rau0_rcp
  294. ENDIF
  295. ENDIF
  296. ENDIF
  297. ! ! ------------------------- !
  298. IF( ln_qsr_2bd ) THEN ! 2 band light penetration !
  299. ! ! ------------------------- !
  300. !
  301. IF( lk_vvl ) THEN !* variable volume
  302. zz0 = rn_abs * r1_rau0_rcp
  303. zz1 = ( 1. - rn_abs ) * r1_rau0_rcp
  304. DO jk = 1, nksr ! solar heat absorbed at T-point in the top 400m
  305. DO jj = 1, jpj
  306. DO ji = 1, jpi
  307. zc0 = zz0 * EXP( -fsdepw(ji,jj,jk )*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,jk )*xsi1r )
  308. zc1 = zz0 * EXP( -fsdepw(ji,jj,jk+1)*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,jk+1)*xsi1r )
  309. qsr_hc(ji,jj,jk) = qsr(ji,jj) * ( zc0*tmask(ji,jj,jk) - zc1*tmask(ji,jj,jk+1) )
  310. END DO
  311. END DO
  312. END DO
  313. ! clem: store attenuation coefficient of the first ocean level
  314. IF ( ln_qsr_ice ) THEN
  315. DO jj = 1, jpj
  316. DO ji = 1, jpi
  317. zc0 = zz0 * EXP( -fsdepw(ji,jj,1)*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,1)*xsi1r )
  318. zc1 = zz0 * EXP( -fsdepw(ji,jj,2)*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,2)*xsi1r )
  319. fraqsr_1lev(ji,jj) = ( zc0*tmask(ji,jj,1) - zc1*tmask(ji,jj,2) ) / r1_rau0_rcp
  320. END DO
  321. END DO
  322. ENDIF
  323. ELSE !* constant volume: coef. computed one for all
  324. DO jk = 1, nksr
  325. DO jj = 2, jpjm1
  326. DO ji = fs_2, fs_jpim1 ! vector opt.
  327. ! (ISF) no light penetration below the ice shelves
  328. qsr_hc(ji,jj,jk) = etot3(ji,jj,jk) * qsr(ji,jj) * tmask(ji,jj,1)
  329. END DO
  330. END DO
  331. END DO
  332. ! clem: store attenuation coefficient of the first ocean level
  333. IF ( ln_qsr_ice ) THEN
  334. fraqsr_1lev(:,:) = etot3(:,:,1) / r1_rau0_rcp
  335. ENDIF
  336. !
  337. ENDIF
  338. !
  339. ENDIF
  340. !
  341. ! Add to the general trend
  342. DO jk = 1, nksr
  343. DO jj = 2, jpjm1
  344. DO ji = fs_2, fs_jpim1 ! vector opt.
  345. z1_e3t = zfact / fse3t(ji,jj,jk)
  346. tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) + ( qsr_hc_b(ji,jj,jk) + qsr_hc(ji,jj,jk) ) * z1_e3t
  347. END DO
  348. END DO
  349. END DO
  350. !
  351. ENDIF
  352. !
  353. IF( lrst_oce ) THEN ! Write in the ocean restart file
  354. ! *******************************
  355. IF(lwp) WRITE(numout,*)
  356. IF(lwp) WRITE(numout,*) 'qsr tracer content forcing field written in ocean restart file ', &
  357. & 'at it= ', kt,' date= ', ndastp
  358. IF(lwp) WRITE(numout,*) '~~~~'
  359. CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b' , qsr_hc )
  360. CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev ) ! default definition in sbcssm
  361. !
  362. ENDIF
  363. IF( l_trdtra ) THEN ! qsr tracers trends saved for diagnostics
  364. ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
  365. CALL trd_tra( kt, 'TRA', jp_tem, jptra_qsr, ztrdt )
  366. CALL wrk_dealloc( jpi, jpj, jpk, ztrdt )
  367. ENDIF
  368. ! ! print mean trends (used for debugging)
  369. IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' qsr - Ta: ', mask1=tmask, clinfo3='tra-ta' )
  370. !
  371. CALL wrk_dealloc( jpi, jpj, zekb, zekg, zekr )
  372. CALL wrk_dealloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea, zchl3d )
  373. !
  374. IF( nn_timing == 1 ) CALL timing_stop('tra_qsr')
  375. !
  376. END SUBROUTINE tra_qsr
  377. SUBROUTINE tra_qsr_init
  378. !!----------------------------------------------------------------------
  379. !! *** ROUTINE tra_qsr_init ***
  380. !!
  381. !! ** Purpose : Initialization for the penetrative solar radiation
  382. !!
  383. !! ** Method : The profile of solar radiation within the ocean is set
  384. !! from two length scale of penetration (rn_si0,rn_si1) and a ratio
  385. !! (rn_abs). These parameters are read in the namtra_qsr namelist. The
  386. !! default values correspond to clear water (type I in Jerlov'
  387. !! (1968) classification.
  388. !! called by tra_qsr at the first timestep (nit000)
  389. !!
  390. !! ** Action : - initialize rn_si0, rn_si1 and rn_abs
  391. !!
  392. !! Reference : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp.
  393. !!----------------------------------------------------------------------
  394. !
  395. INTEGER :: ji, jj, jk ! dummy loop indices
  396. INTEGER :: irgb, ierror, ioptio, nqsr ! local integer
  397. INTEGER :: ios ! Local integer output status for namelist read
  398. REAL(wp) :: zz0, zc0 , zc1, zcoef ! local scalars
  399. REAL(wp) :: zz1, zc2 , zc3, zchl ! - -
  400. REAL(wp), POINTER, DIMENSION(:,: ) :: zekb, zekg, zekr
  401. REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea
  402. !
  403. CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files
  404. TYPE(FLD_N) :: sn_chl ! informations about the chlorofyl field to be read
  405. !!
  406. NAMELIST/namtra_qsr/ sn_chl, cn_dir, ln_traqsr, ln_qsr_rgb, ln_qsr_2bd, ln_qsr_bio, ln_qsr_ice, &
  407. & nn_chldta, rn_abs, rn_si0, rn_si1
  408. !!----------------------------------------------------------------------
  409. !
  410. IF( nn_timing == 1 ) CALL timing_start('tra_qsr_init')
  411. !
  412. CALL wrk_alloc( jpi, jpj, zekb, zekg, zekr )
  413. CALL wrk_alloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea )
  414. !
  415. REWIND( numnam_ref ) ! Namelist namtra_qsr in reference namelist : Ratio and length of penetration
  416. READ ( numnam_ref, namtra_qsr, IOSTAT = ios, ERR = 901)
  417. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_qsr in reference namelist', lwp )
  418. REWIND( numnam_cfg ) ! Namelist namtra_qsr in configuration namelist : Ratio and length of penetration
  419. READ ( numnam_cfg, namtra_qsr, IOSTAT = ios, ERR = 902 )
  420. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_qsr in configuration namelist', lwp )
  421. IF(lwm) WRITE ( numond, namtra_qsr )
  422. !
  423. IF(lwp) THEN ! control print
  424. WRITE(numout,*)
  425. WRITE(numout,*) 'tra_qsr_init : penetration of the surface solar radiation'
  426. WRITE(numout,*) '~~~~~~~~~~~~'
  427. WRITE(numout,*) ' Namelist namtra_qsr : set the parameter of penetration'
  428. WRITE(numout,*) ' Light penetration (T) or not (F) ln_traqsr = ', ln_traqsr
  429. WRITE(numout,*) ' RGB (Red-Green-Blue) light penetration ln_qsr_rgb = ', ln_qsr_rgb
  430. WRITE(numout,*) ' 2 band light penetration ln_qsr_2bd = ', ln_qsr_2bd
  431. WRITE(numout,*) ' bio-model light penetration ln_qsr_bio = ', ln_qsr_bio
  432. WRITE(numout,*) ' light penetration for ice-model LIM3 ln_qsr_ice = ', ln_qsr_ice
  433. WRITE(numout,*) ' RGB : Chl data (=1/2) or cst value (=0) nn_chldta = ', nn_chldta
  434. WRITE(numout,*) ' RGB & 2 bands: fraction of light (rn_si1) rn_abs = ', rn_abs
  435. WRITE(numout,*) ' RGB & 2 bands: shortess depth of extinction rn_si0 = ', rn_si0
  436. WRITE(numout,*) ' 2 bands: longest depth of extinction rn_si1 = ', rn_si1
  437. ENDIF
  438. IF( ln_traqsr ) THEN ! control consistency
  439. !
  440. IF( .NOT.lk_qsr_bio .AND. ln_qsr_bio ) THEN
  441. CALL ctl_warn( 'No bio model : force ln_qsr_bio = FALSE ' )
  442. ln_qsr_bio = .FALSE.
  443. ENDIF
  444. !
  445. ioptio = 0 ! Parameter control
  446. IF( ln_qsr_rgb ) ioptio = ioptio + 1
  447. IF( ln_qsr_2bd ) ioptio = ioptio + 1
  448. IF( ln_qsr_bio ) ioptio = ioptio + 1
  449. !
  450. IF( ioptio /= 1 ) &
  451. CALL ctl_stop( ' Choose ONE type of light penetration in namelist namtra_qsr', &
  452. & ' 2 bands, 3 RGB bands or bio-model light penetration' )
  453. !
  454. IF( ln_qsr_rgb .AND. nn_chldta == 0 ) nqsr = 1
  455. IF( ln_qsr_rgb .AND. nn_chldta == 1 ) nqsr = 2
  456. IF( ln_qsr_rgb .AND. nn_chldta == 2 ) nqsr = 3
  457. IF( ln_qsr_2bd ) nqsr = 4
  458. IF( ln_qsr_bio ) nqsr = 5
  459. !
  460. IF(lwp) THEN ! Print the choice
  461. WRITE(numout,*)
  462. IF( nqsr == 1 ) WRITE(numout,*) ' R-G-B light penetration - Constant Chlorophyll'
  463. IF( nqsr == 2 ) WRITE(numout,*) ' R-G-B light penetration - 2D Chl data '
  464. IF( nqsr == 3 ) WRITE(numout,*) ' R-G-B light penetration - 3D Chl data '
  465. IF( nqsr == 4 ) WRITE(numout,*) ' 2 bands light penetration'
  466. IF( nqsr == 5 ) WRITE(numout,*) ' bio-model light penetration'
  467. ENDIF
  468. !
  469. ENDIF
  470. ! ! ===================================== !
  471. IF( ln_traqsr ) THEN ! Initialisation of Light Penetration !
  472. ! ! ===================================== !
  473. !
  474. xsi0r = 1.e0 / rn_si0
  475. xsi1r = 1.e0 / rn_si1
  476. ! ! ---------------------------------- !
  477. IF( ln_qsr_rgb ) THEN ! Red-Green-Blue light penetration !
  478. ! ! ---------------------------------- !
  479. !
  480. CALL trc_oce_rgb( rkrgb ) !* tabulated attenuation coef.
  481. !
  482. ! !* level of light extinction
  483. IF( ln_sco ) THEN ; nksr = jpkm1
  484. ELSE ; nksr = trc_oce_ext_lev( r_si2, 0.33e2 )
  485. ENDIF
  486. IF(lwp) WRITE(numout,*) ' level of light extinction = ', nksr, ' ref depth = ', gdepw_1d(nksr+1), ' m'
  487. !
  488. IF( nn_chldta == 1 .OR. nn_chldta == 2 ) THEN !* Chl data : set sf_chl structure
  489. IF(lwp) WRITE(numout,*)
  490. IF(lwp) WRITE(numout,*) ' Chlorophyll read in a file'
  491. ALLOCATE( sf_chl(1), STAT=ierror )
  492. IF( ierror > 0 ) THEN
  493. CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' ) ; RETURN
  494. ENDIF
  495. ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1) )
  496. IF( sn_chl%ln_tint )ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
  497. ! ! fill sf_chl with sn_chl and control print
  498. CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init', &
  499. & 'Solar penetration function of read chlorophyll', 'namtra_qsr' )
  500. !
  501. ELSE !* constant Chl : compute once for all the distribution of light (etot3)
  502. IF(lwp) WRITE(numout,*)
  503. IF(lwp) WRITE(numout,*) ' Constant Chlorophyll concentration = 0.05'
  504. IF( lk_vvl ) THEN ! variable volume
  505. IF(lwp) WRITE(numout,*) ' key_vvl: light distribution will be computed at each time step'
  506. ELSE ! constant volume: computes one for all
  507. IF(lwp) WRITE(numout,*) ' fixed volume: light distribution computed one for all'
  508. !
  509. zchl = 0.05 ! constant chlorophyll
  510. irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 )
  511. zekb(:,:) = rkrgb(1,irgb) ! Separation in R-G-B depending of the chlorophyll
  512. zekg(:,:) = rkrgb(2,irgb)
  513. zekr(:,:) = rkrgb(3,irgb)
  514. !
  515. zcoef = ( 1. - rn_abs ) / 3.e0 ! equi-partition in R-G-B
  516. ze0(:,:,1) = rn_abs
  517. ze1(:,:,1) = zcoef
  518. ze2(:,:,1) = zcoef
  519. ze3(:,:,1) = zcoef
  520. zea(:,:,1) = tmask(:,:,1) ! = ( ze0+ze1+z2+ze3 ) * tmask
  521. DO jk = 2, nksr+1
  522. !CDIR NOVERRCHK
  523. DO jj = 1, jpj
  524. !CDIR NOVERRCHK
  525. DO ji = 1, jpi
  526. zc0 = ze0(ji,jj,jk-1) * EXP( - e3t_0(ji,jj,jk-1) * xsi0r )
  527. zc1 = ze1(ji,jj,jk-1) * EXP( - e3t_0(ji,jj,jk-1) * zekb(ji,jj) )
  528. zc2 = ze2(ji,jj,jk-1) * EXP( - e3t_0(ji,jj,jk-1) * zekg(ji,jj) )
  529. zc3 = ze3(ji,jj,jk-1) * EXP( - e3t_0(ji,jj,jk-1) * zekr(ji,jj) )
  530. ze0(ji,jj,jk) = zc0
  531. ze1(ji,jj,jk) = zc1
  532. ze2(ji,jj,jk) = zc2
  533. ze3(ji,jj,jk) = zc3
  534. zea(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,jk)
  535. END DO
  536. END DO
  537. END DO
  538. !
  539. DO jk = 1, nksr
  540. ! (ISF) no light penetration below the ice shelves
  541. etot3(:,:,jk) = r1_rau0_rcp * ( zea(:,:,jk) - zea(:,:,jk+1) ) * tmask(:,:,1)
  542. END DO
  543. etot3(:,:,nksr+1:jpk) = 0.e0 ! below 400m set to zero
  544. ENDIF
  545. ENDIF
  546. !
  547. ENDIF
  548. ! ! ---------------------------------- !
  549. IF( ln_qsr_2bd ) THEN ! 2 bands light penetration !
  550. ! ! ---------------------------------- !
  551. !
  552. ! ! level of light extinction
  553. nksr = trc_oce_ext_lev( rn_si1, 1.e2 )
  554. IF(lwp) THEN
  555. WRITE(numout,*)
  556. IF(lwp) WRITE(numout,*) ' level of light extinction = ', nksr, ' ref depth = ', gdepw_1d(nksr+1), ' m'
  557. ENDIF
  558. !
  559. IF( lk_vvl ) THEN ! variable volume
  560. IF(lwp) WRITE(numout,*) ' key_vvl: light distribution will be computed at each time step'
  561. ELSE ! constant volume: computes one for all
  562. zz0 = rn_abs * r1_rau0_rcp
  563. zz1 = ( 1. - rn_abs ) * r1_rau0_rcp
  564. DO jk = 1, nksr !* solar heat absorbed at T-point computed once for all
  565. DO jj = 1, jpj ! top 400 meters
  566. DO ji = 1, jpi
  567. zc0 = zz0 * EXP( -fsdepw(ji,jj,jk )*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,jk )*xsi1r )
  568. zc1 = zz0 * EXP( -fsdepw(ji,jj,jk+1)*xsi0r ) + zz1 * EXP( -fsdepw(ji,jj,jk+1)*xsi1r )
  569. etot3(ji,jj,jk) = ( zc0 * tmask(ji,jj,jk) - zc1 * tmask(ji,jj,jk+1) ) * tmask(ji,jj,1)
  570. END DO
  571. END DO
  572. END DO
  573. etot3(:,:,nksr+1:jpk) = 0.e0 ! below 400m set to zero
  574. !
  575. ENDIF
  576. ENDIF
  577. ! ! ===================================== !
  578. ELSE ! No light penetration !
  579. ! ! ===================================== !
  580. IF(lwp) THEN
  581. WRITE(numout,*)
  582. WRITE(numout,*) 'tra_qsr_init : NO solar flux penetration'
  583. WRITE(numout,*) '~~~~~~~~~~~~'
  584. ENDIF
  585. ENDIF
  586. !
  587. ! initialisation of fraqsr_1lev used in sbcssm
  588. IF( iom_varid( numror, 'fraqsr_1lev', ldstop = .FALSE. ) > 0 ) THEN
  589. CALL iom_get( numror, jpdom_autoglo, 'fraqsr_1lev' , fraqsr_1lev )
  590. ELSE
  591. fraqsr_1lev(:,:) = 1._wp ! default definition
  592. ENDIF
  593. !
  594. CALL wrk_dealloc( jpi, jpj, zekb, zekg, zekr )
  595. CALL wrk_dealloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea )
  596. !
  597. IF( nn_timing == 1 ) CALL timing_stop('tra_qsr_init')
  598. !
  599. END SUBROUTINE tra_qsr_init
  600. !!======================================================================
  601. END MODULE traqsr