New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
traqsr.F90 in branches/2016/dev_r6325_SIMPLIF_1/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2016/dev_r6325_SIMPLIF_1/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90 @ 6347

Last change on this file since 6347 was 6347, checked in by gm, 8 years ago

#1683: SIMPLIF-1 : Phase with the v3.6_Stable (DOC+ZDF+traqsr+lbedo)

  • Property svn:keywords set to Id
File size: 23.2 KB
Line 
1MODULE 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.6  !  2012-05  (C. Rousset) store attenuation coef for use in ice model
13   !!             -   !  2015-12  (O. Aumont, J. Jouanno, C. Ethe) use vertical profile of chlorophyll
14   !!            3.7  !  2016-01  (G. Madec, A. Coward)  remove optimisation for fix volume
15   !!----------------------------------------------------------------------
16
17   !!----------------------------------------------------------------------
18   !!   tra_qsr       : temperature trend due to the penetration of solar radiation
19   !!   tra_qsr_init  : initialization of the qsr penetration
20   !!----------------------------------------------------------------------
21   USE oce            ! ocean dynamics and active tracers
22   USE phycst         ! physical constants
23   USE dom_oce        ! ocean space and time domain
24   USE sbc_oce        ! surface boundary condition: ocean
25   USE trc_oce        ! share SMS/Ocean variables
26   USE trd_oce        ! trends: ocean variables
27   USE trdtra         ! trends manager: tracers
28   !
29   USE in_out_manager ! I/O manager
30   USE prtctl         ! Print control
31   USE iom            ! I/O manager
32   USE fldread        ! read input fields
33   USE restart        ! ocean restart
34   USE lib_mpp        ! MPP library
35   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
36   USE wrk_nemo       ! Memory Allocation
37   USE timing         ! Timing
38
39   IMPLICIT NONE
40   PRIVATE
41
42   PUBLIC   tra_qsr       ! routine called by step.F90 (ln_traqsr=T)
43   PUBLIC   tra_qsr_init  ! routine called by nemogcm.F90
44
45   !                                 !!* Namelist namtra_qsr: penetrative solar radiation
46   LOGICAL , PUBLIC ::   ln_traqsr    !: light absorption (qsr) flag
47   LOGICAL , PUBLIC ::   ln_qsr_rgb   !: Red-Green-Blue light absorption flag 
48   LOGICAL , PUBLIC ::   ln_qsr_2bd   !: 2 band         light absorption flag
49   LOGICAL , PUBLIC ::   ln_qsr_bio   !: bio-model      light absorption flag
50   LOGICAL , PUBLIC ::   ln_qsr_ice   !: light penetration for ice-model LIM3 (clem)
51   INTEGER , PUBLIC ::   nn_chldta    !: use Chlorophyll data (=1) or not (=0)
52   REAL(wp), PUBLIC ::   rn_abs       !: fraction absorbed in the very near surface (RGB & 2 bands)
53   REAL(wp), PUBLIC ::   rn_si0       !: very near surface depth of extinction      (RGB & 2 bands)
54   REAL(wp), PUBLIC ::   rn_si1       !: deepest depth of extinction (water type I)       (2 bands)
55   !
56   INTEGER , PUBLIC ::   nksr         !: levels below which the light cannot penetrate (depth larger than 391 m)
57 
58   INTEGER, PARAMETER ::   np_RGB    = 1   ! R-G-B     light penetration with constant Chlorophyll
59   INTEGER, PARAMETER ::   np_2BD    = 2   ! 2 bands   light penetration
60   INTEGER, PARAMETER ::   np_BIO    = 3   ! bio-model light penetration
61   !
62   INTEGER  ::   nqsr    ! user choice of the type of light penetration
63   REAL(wp) ::   xsi0r   ! inverse of rn_si0
64   REAL(wp) ::   xsi1r   ! inverse of rn_si1
65   
66   REAL(wp) ::   rChl_0 = 0.05_wp   ! value of Chlorophyll used in case of constant Chlorophyll
67   !
68   REAL(wp) , DIMENSION(3,61)           ::   rkrgb    ! tabulated attenuation coefficients for RGB absorption
69   TYPE(FLD), DIMENSION(:), ALLOCATABLE ::   sf_chl   ! structure of input Chl (file informations, fields read)
70
71   !! * Substitutions
72#  include "vectopt_loop_substitute.h90"
73   !!----------------------------------------------------------------------
74   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
75   !! $Id$
76   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
77   !!----------------------------------------------------------------------
78CONTAINS
79
80   SUBROUTINE tra_qsr( kt )
81      !!----------------------------------------------------------------------
82      !!                  ***  ROUTINE tra_qsr  ***
83      !!
84      !! ** Purpose :   Compute the temperature trend due to the solar radiation
85      !!              penetration and add it to the general temperature trend.
86      !!
87      !! ** Method  : The profile of the solar radiation within the ocean is defined
88      !!      through 2 wavebands (rn_si0,rn_si1) or 3 wavebands (RGB) and a ratio rn_abs
89      !!      Considering the 2 wavebands case:
90      !!         I(k) = Qsr*( rn_abs*EXP(z(k)/rn_si0) + (1.-rn_abs)*EXP(z(k)/rn_si1) )
91      !!         The temperature trend associated with the solar radiation penetration
92      !!         is given by : zta = 1/e3t dk[ I ] / (rau0*Cp)
93      !!         At the bottom, boudary condition for the radiation is no flux :
94      !!      all heat which has not been absorbed in the above levels is put
95      !!      in the last ocean level.
96      !!         The computation is only done down to the level where
97      !!      I(k) < 1.e-15 W/m2 (i.e. over the top nksr levels) .
98      !!
99      !! ** Action  : - update ta with the penetrative solar radiation trend
100      !!              - send  trend for further diagnostics (l_trdtra=T)
101      !!
102      !! Reference  : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp.
103      !!              Lengaigne et al. 2007, Clim. Dyn., V28, 5, 503-516.
104      !!              Morel, A. and Berthon, J.F., 1989, Limnol Oceanogr 34(8), 1545-1562
105      !!----------------------------------------------------------------------
106      INTEGER, INTENT(in) ::   kt     ! ocean time-step
107      !
108      INTEGER  ::   ji, jj, jk               ! dummy loop indices
109      INTEGER  ::   irgb                     ! local integers
110      REAL(wp) ::   zchl, zcoef, z1_2        ! local scalars
111      REAL(wp) ::   zc0 , zc1 , zc2 , zc3    !    -         -
112      REAL(wp) ::   zz0 , zz1                !    -         -
113      REAL(wp) ::   zCb, zCmax, zze, z1_ze, zpsi, zpsimax, zdelpsi, zCtot, zCze
114      REAL(wp) ::   zlogc, zlogc2, zlogc3 
115      REAL(wp), POINTER, DIMENSION(:,:)   :: zekb, zekg, zekr
116      REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, zchl3d, ztrdt
117      REAL(wp), POINTER, DIMENSION(:,:,:) :: zetot
118      !!----------------------------------------------------------------------
119      !
120      IF( nn_timing == 1 )  CALL timing_start('tra_qsr')
121      !
122      IF( kt == nit000 ) THEN
123         IF(lwp) WRITE(numout,*)
124         IF(lwp) WRITE(numout,*) 'tra_qsr : penetration of the surface solar radiation'
125         IF(lwp) WRITE(numout,*) '~~~~~~~'
126      ENDIF
127      !
128      IF( l_trdtra ) THEN      ! trends diagnostic: save the input temperature trend
129         CALL wrk_alloc( jpi,jpj,jpk,   ztrdt ) 
130         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
131      ENDIF
132      !
133      !                         !-----------------------------------!
134      !                         !  before qsr induced heat content  !
135      !                         !-----------------------------------!
136      IF( kt == nit000 ) THEN          !==  1st time step  ==!
137!!gm case neuler  not taken into account....
138         IF( ln_rstart .AND. iom_varid( numror, 'qsr_hc_b', ldstop = .FALSE. ) > 0 ) THEN    ! read in restart
139            IF(lwp) WRITE(numout,*) '          nit000-1 qsr tracer content forcing field read in the restart file'
140            z1_2 = 0.5_wp
141            CALL iom_get( numror, jpdom_autoglo, 'qsr_hc_b', qsr_hc_b )   ! before heat content trend due to Qsr flux
142         ELSE                                           ! No restart or restart not found: Euler forward time stepping
143            z1_2 = 1._wp
144            qsr_hc_b(:,:,:) = 0._wp
145         ENDIF
146      ELSE                             !==  Swap of qsr heat content  ==!
147         z1_2 = 0.5_wp
148         qsr_hc_b(:,:,:) = qsr_hc(:,:,:)
149      ENDIF
150      !
151      !                         !--------------------------------!
152      SELECT CASE( nqsr )       !  now qsr induced heat content  !
153      !                         !--------------------------------!
154      !
155      CASE( np_BIO )                !==  bio-model fluxes  ==!
156         !
157         DO jk = 1, nksr
158            qsr_hc(:,:,jk) = r1_rau0_rcp * ( etot3(:,:,jk) - etot3(:,:,jk+1) )
159         END DO
160         !
161      CASE( np_RGB )                !==  R-G-B fluxes  ==!
162         !
163         CALL wrk_alloc( jpi,jpj,       zekb, zekg, zekr                ) 
164         CALL wrk_alloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d ) 
165         !
166         SELECT CASE( nn_chldta )         ! set 3D chlorophyll field
167         !
168         CASE( 0 )                           ! constant
169            DO jk = 1, nksr + 1
170               zchl3d(:,:,jk) = rChl_0
171            END DO
172            !
173         CASE( 1 )                           ! surface chlorophyl data spread uniformly on the vertical
174            CALL fld_read( kt, 1, sf_chl )         ! Read Chl data and provides it at the current time step
175            DO jk = 1, nksr + 1                    ! uniform vertical profile
176               zchl3d(:,:,jk) = sf_chl(1)%fnow(:,:,1) 
177            END DO
178            !
179         CASE( 2 )                           ! surface chlorophyl data + Morel and Berthon (1989) profile
180            CALL fld_read( kt, 1, sf_chl )         ! Read Chl data and provides it at the current time step
181            DO jj = 2, jpjm1                       ! Chl profile = F( surface Chl value)
182               DO ji = fs_2, fs_jpim1
183                  zchl    = sf_chl(1)%fnow(ji,jj,1)
184                  zCtot   =  40.6_wp *  zchl**0.459
185                  zze     = 568.2_wp * zCtot**(-0.746)
186                  IF( zze > 102. )   zze = 200.0 * zCtot**(-0.293)
187                  zlogc   = LOG( zchl )
188!!gm : instead of this :
189                  zlogc2  = zlogc * zlogc
190                  zlogc3  = zlogc * zlogc * zlogc
191                  zCb     = 0.768 + 0.087 * zlogc - 0.179 * zlogc2 - 0.025 * zlogc3
192                  zCmax   = 0.299 - 0.289 * zlogc + 0.579 * zlogc2
193                  zpsimax = 0.6   - 0.640 * zlogc + 0.021 * zlogc2 + 0.115 * zlogc3
194                  zdelpsi = 0.710 + 0.159 * zlogc + 0.021 * zlogc2
195!!gm faster & more precise:
196!                  zCb     = 0.768 + zlogc * (  (  0.087 + zlogc * (- 0.179 - zlogc * 0.025 )  )
197!                  zCmax   = 0.299 + zlogc * (   - 0.289 + zlogc *    0.579  )
198!                  zpsimax = 0.6   + zlogc * (  (- 0.640 + zlogc * (  0.021 + zlogc * 0.115 )  )
199!                  zdelpsi = 0.710 + zlogc * (     0.159 + zlogc *    0.021  )
200!!gm end         
201                  zCze    = 1.12_wp * (zchl)**0.803 
202                  z1_ze   = 1._wp / zze
203                  DO jk = 1, nksr + 1
204                     zpsi = gdept_n(ji,jj,jk) * z1_ze
205                     zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) )
206                  END DO
207               END DO
208            END DO
209            !
210         END SELECT
211         !
212         zcoef  = ( 1. - rn_abs ) / 3._wp    !* surface equi-partition in R-G-B
213         DO jj = 2, jpjm1
214            DO ji = fs_2, fs_jpim1
215               ze0(ji,jj,1) = rn_abs * qsr(ji,jj)
216               ze1(ji,jj,1) = zcoef  * qsr(ji,jj)
217               ze2(ji,jj,1) = zcoef  * qsr(ji,jj)
218               ze3(ji,jj,1) = zcoef  * qsr(ji,jj)
219               zea(ji,jj,1) =          qsr(ji,jj)
220            END DO
221         END DO
222         !
223         DO jk = 2, nksr+1                   !* interior partition in R-G-B function of 3D Chl
224            DO jj = 2, jpjm1
225               DO ji = fs_2, fs_jpim1
226                  zchl = MIN( 10._wp , MAX( 0.03_wp , zchl3d(ji,jj,jk) ) )
227                  irgb = NINT( 41._wp + 20._wp * LOG10(zchl) + 1.e-15 )
228                  zekb(ji,jj) = rkrgb(1,irgb)
229                  zekg(ji,jj) = rkrgb(2,irgb)
230                  zekr(ji,jj) = rkrgb(3,irgb)
231               END DO
232            END DO
233            DO jj = 2, jpjm1
234               DO ji = fs_2, fs_jpim1
235                  zc0 = ze0(ji,jj,jk-1) * EXP( - e3t_n(ji,jj,jk-1) * xsi0r       )
236                  zc1 = ze1(ji,jj,jk-1) * EXP( - e3t_n(ji,jj,jk-1) * zekb(ji,jj) )
237                  zc2 = ze2(ji,jj,jk-1) * EXP( - e3t_n(ji,jj,jk-1) * zekg(ji,jj) )
238                  zc3 = ze3(ji,jj,jk-1) * EXP( - e3t_n(ji,jj,jk-1) * zekr(ji,jj) )
239                  ze0(ji,jj,jk) = zc0
240                  ze1(ji,jj,jk) = zc1
241                  ze2(ji,jj,jk) = zc2
242                  ze3(ji,jj,jk) = zc3
243                  zea(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * wmask(ji,jj,jk)
244               END DO
245            END DO
246         END DO
247         !
248         DO jk = 1, nksr                     !* now qsr induced heat content
249            DO jj = 2, jpjm1
250               DO ji = fs_2, fs_jpim1
251                  qsr_hc(ji,jj,jk) = r1_rau0_rcp * ( zea(ji,jj,jk) - zea(ji,jj,jk+1) )
252               END DO
253            END DO
254         END DO
255         !
256         CALL wrk_dealloc( jpi,jpj,       zekb, zekg, zekr                ) 
257         CALL wrk_dealloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d ) 
258         !
259      CASE( np_2BD  )            !==  2-bands fluxes  ==!
260         !
261         zz0 =        rn_abs   * r1_rau0_rcp      ! surface equi-partition in 2-bands
262         zz1 = ( 1. - rn_abs ) * r1_rau0_rcp
263         DO jk = 1, nksr                          ! solar heat absorbed at T-point in the top 400m
264            DO jj = 2, jpjm1
265               DO ji = fs_2, fs_jpim1
266                  zc0 = zz0 * EXP( -gdepw_n(ji,jj,jk  )*xsi0r ) + zz1 * EXP( -gdepw_n(ji,jj,jk  )*xsi1r )
267                  zc1 = zz0 * EXP( -gdepw_n(ji,jj,jk+1)*xsi0r ) + zz1 * EXP( -gdepw_n(ji,jj,jk+1)*xsi1r )
268                  qsr_hc(ji,jj,jk) = qsr(ji,jj) * ( zc0 * wmask(ji,jj,jk) - zc1 * wmask(ji,jj,jk+1) ) 
269               END DO
270            END DO
271         END DO
272         !
273      END SELECT
274      !
275      !                          !-----------------------------!
276      DO jk = 1, nksr            !  update to the temp. trend  !
277         DO jj = 2, jpjm1        !-----------------------------!
278            DO ji = fs_2, fs_jpim1   ! vector opt.
279               tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem)   &
280                  &                 + z1_2 * ( qsr_hc_b(ji,jj,jk) + qsr_hc(ji,jj,jk) ) / e3t_n(ji,jj,jk)
281            END DO
282         END DO
283      END DO
284      !
285      IF( ln_qsr_ice ) THEN      ! sea-ice: store the 1st ocean level attenuation coefficient
286         DO jj = 2, jpjm1 
287            DO ji = fs_2, fs_jpim1   ! vector opt.
288               IF( qsr(ji,jj) /= 0._wp ) THEN   ;   fraqsr_1lev(ji,jj) = qsr_hc(ji,jj,1) / ( r1_rau0_rcp * qsr(ji,jj) )
289               ELSE                             ;   fraqsr_1lev(ji,jj) = 1._wp
290               ENDIF
291            END DO
292         END DO
293         ! Update haloes since lim_thd needs fraqsr_1lev to be defined everywhere
294         CALL lbc_lnk( fraqsr_1lev(:,:), 'T', 1._wp )
295      ENDIF
296      !
297      IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution
298         CALL wrk_alloc( jpi,jpj,jpk,   zetot )
299         !
300         zetot(:,:,nksr+1:jpk) = 0._wp     ! below ~400m set to zero
301         DO jk = nksr, 1, -1
302            zetot(:,:,jk) = zetot(:,:,jk+1) + qsr_hc(:,:,jk) / r1_rau0_rcp
303         END DO         
304         CALL iom_put( 'qsr3d', zetot )   ! 3D distribution of shortwave Radiation
305         !
306         CALL wrk_dealloc( jpi,jpj,jpk,   zetot ) 
307      ENDIF
308      !
309      IF( lrst_oce ) THEN     ! write in the ocean restart file
310         CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc      )
311         CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev ) 
312      ENDIF
313      !
314      IF( l_trdtra ) THEN     ! qsr tracers trends saved for diagnostics
315         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
316         CALL trd_tra( kt, 'TRA', jp_tem, jptra_qsr, ztrdt )
317         CALL wrk_dealloc( jpi,jpj,jpk,   ztrdt ) 
318      ENDIF
319      !                       ! print mean trends (used for debugging)
320      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' qsr  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
321      !
322      IF( nn_timing == 1 )  CALL timing_stop('tra_qsr')
323      !
324   END SUBROUTINE tra_qsr
325
326
327   SUBROUTINE tra_qsr_init
328      !!----------------------------------------------------------------------
329      !!                  ***  ROUTINE tra_qsr_init  ***
330      !!
331      !! ** Purpose :   Initialization for the penetrative solar radiation
332      !!
333      !! ** Method  :   The profile of solar radiation within the ocean is set
334      !!      from two length scale of penetration (rn_si0,rn_si1) and a ratio
335      !!      (rn_abs). These parameters are read in the namtra_qsr namelist. The
336      !!      default values correspond to clear water (type I in Jerlov'
337      !!      (1968) classification.
338      !!         called by tra_qsr at the first timestep (nit000)
339      !!
340      !! ** Action  : - initialize rn_si0, rn_si1 and rn_abs
341      !!
342      !! Reference : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp.
343      !!----------------------------------------------------------------------
344      INTEGER  ::   ji, jj, jk                  ! dummy loop indices
345      INTEGER  ::   ios, irgb, ierror, ioptio   ! local integer
346!      REAL(wp) ::   zz0, zc0 , zc1, zcoef      ! local scalars
347!      REAL(wp) ::   zz1, zc2 , zc3, zchl       !   -      -
348      !
349      CHARACTER(len=100) ::   cn_dir   ! Root directory for location of ssr files
350      TYPE(FLD_N)        ::   sn_chl   ! informations about the chlorofyl field to be read
351      !!
352      NAMELIST/namtra_qsr/  sn_chl, cn_dir, ln_qsr_rgb, ln_qsr_2bd, ln_qsr_bio, ln_qsr_ice,  &
353         &                  nn_chldta, rn_abs, rn_si0, rn_si1
354      !!----------------------------------------------------------------------
355      !
356      IF( nn_timing == 1 )   CALL timing_start('tra_qsr_init')
357      !
358      REWIND( numnam_ref )       ! Namelist namtra_qsr in reference     namelist
359      READ  ( numnam_ref, namtra_qsr, IOSTAT = ios, ERR = 901)
360901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_qsr in reference namelist', lwp )
361      !
362      REWIND( numnam_cfg )       ! Namelist namtra_qsr in configuration namelist
363      READ  ( numnam_cfg, namtra_qsr, IOSTAT = ios, ERR = 902 )
364902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_qsr in configuration namelist', lwp )
365      IF(lwm) WRITE ( numond, namtra_qsr )
366      !
367      IF(lwp) THEN               ! control print
368         WRITE(numout,*)
369         WRITE(numout,*) 'tra_qsr_init : penetration of the surface solar radiation'
370         WRITE(numout,*) '~~~~~~~~~~~~'
371         WRITE(numout,*) '   Namelist namtra_qsr : set the parameter of penetration'
372         WRITE(numout,*) '      RGB (Red-Green-Blue) light penetration       ln_qsr_rgb = ', ln_qsr_rgb
373         WRITE(numout,*) '      2 band               light penetration       ln_qsr_2bd = ', ln_qsr_2bd
374         WRITE(numout,*) '      bio-model            light penetration       ln_qsr_bio = ', ln_qsr_bio
375         WRITE(numout,*) '      light penetration for ice-model (LIM3)       ln_qsr_ice = ', ln_qsr_ice
376         WRITE(numout,*) '      RGB : Chl data (=1,2) or cst value (=0)      nn_chldta  = ', nn_chldta
377         WRITE(numout,*) '      RGB & 2 bands: fraction of light (rn_si1)    rn_abs     = ', rn_abs
378         WRITE(numout,*) '      RGB & 2 bands: shortess depth of extinction  rn_si0     = ', rn_si0
379         WRITE(numout,*) '      2 bands: longest depth of extinction         rn_si1     = ', rn_si1
380         WRITE(numout,*)
381      ENDIF
382      !
383      ioptio = 0                 ! Parameter control
384      IF( ln_qsr_rgb  )   ioptio = ioptio + 1
385      IF( ln_qsr_2bd  )   ioptio = ioptio + 1
386      IF( ln_qsr_bio  )   ioptio = ioptio + 1
387      !
388      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE type of light penetration in namelist namtra_qsr',  &
389         &                               ' 2 bands, 3 RGB bands or bio-model light penetration' )
390      !
391      IF( ln_qsr_rgb .AND. nn_chldta == 0 )   nqsr = np_RGB 
392      IF( ln_qsr_2bd                      )   nqsr = np_2BD
393      IF( ln_qsr_bio                      )   nqsr = np_BIO
394      !
395      !                          ! Initialisation
396      xsi0r = 1._wp / rn_si0
397      xsi1r = 1._wp / rn_si1
398      !
399      SELECT CASE( nqsr )
400      !                               
401      CASE( np_RGB )             !==  Red-Green-Blue light penetration  ==!
402         !                             
403         IF(lwp)   WRITE(numout,*) '   R-G-B   light penetration '
404         !
405         CALL trc_oce_rgb( rkrgb )                 ! tabulated attenuation coef.
406         !                                   
407         nksr = trc_oce_ext_lev( r_si2, 33._wp )   ! level of light extinction
408         !
409         IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksr, ' ref depth = ', gdepw_1d(nksr+1), ' m'
410         !
411         SELECT CASE( nn_chldta )         ! set 3D chlorophyll field
412         CASE( 0 )                           ! constant
413            IF(lwp) WRITE(numout,*) '        constant Chlorophyll set to rChl_0 =', rChl_0 
414            !
415         CASE( 1 , 2 )                       ! 3D chlorophyl field : read 2D surface data
416            !
417            IF(lwp) WRITE(numout,*) '        surface 2D Chlorophyll field read in a file'
418            ALLOCATE( sf_chl(1), STAT=ierror )
419            IF( ierror > 0 ) THEN
420               CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' )   ;   RETURN
421            ENDIF
422            ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   )
423            IF( sn_chl%ln_tint )   ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
424            !                                        ! fill sf_chl with sn_chl and control print
425            CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   &
426               &           'Solar penetration function of read chlorophyll', 'namtra_qsr' )
427            !
428            IF( lwp .AND. nn_chldta == 1 )   WRITE(numout,*) '        profile of chlorophyll : Chl(z) = Chl(z=0)'
429            IF( lwp .AND. nn_chldta == 2 )   WRITE(numout,*) '        profile of chlorophyll : Chl(z) = Func[Chl(z=0)]'
430            !
431         END SELECT
432         !
433      CASE( np_2BD )             !==  2 bands light penetration  ==!
434         !
435         IF(lwp)  WRITE(numout,*) '   2 bands light penetration'
436         !
437         nksr = trc_oce_ext_lev( rn_si1, 100._wp )    ! level of light extinction
438         IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksr, ' ref depth = ', gdepw_1d(nksr+1), ' m'
439         !
440      CASE( np_BIO )                         !==  BIO light penetration  ==!
441         !
442         IF(lwp) WRITE(numout,*) '   bio-model light penetration'
443         IF( .NOT.lk_qsr_bio )   CALL ctl_stop( 'No bio model : ln_qsr_bio = true impossible ' )
444         !
445      END SELECT
446      !
447      qsr_hc(:,:,:) = 0._wp     ! now qsr heat content set to zero where it will not be computed
448      !
449      ! 1st ocean level attenuation coefficient (used in sbcssm)
450      IF( iom_varid( numror, 'fraqsr_1lev', ldstop = .FALSE. ) > 0 ) THEN
451         CALL iom_get( numror, jpdom_autoglo, 'fraqsr_1lev'  , fraqsr_1lev  )
452      ELSE
453         fraqsr_1lev(:,:) = 1._wp   ! default : no penetration
454      ENDIF
455      !
456      IF( nn_timing == 1 )   CALL timing_stop('tra_qsr_init')
457      !
458   END SUBROUTINE tra_qsr_init
459
460   !!======================================================================
461END MODULE traqsr
Note: See TracBrowser for help on using the repository browser.