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.
trcopt_medusa.F90 in branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA – NEMO

source: branches/NERC/dev_r5518_NOC_MEDUSA_Stable/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcopt_medusa.F90 @ 7894

Last change on this file since 7894 was 7894, checked in by jpalmier, 7 years ago

JPALM -- 11-04-2017 -- MEDUSA spring tidy-up refreshning session

File size: 9.0 KB
Line 
1MODULE trcopt_medusa
2   !!======================================================================
3   !!                         ***  MODULE trcopt_medusa  ***
4   !! TOP :   MEDUSA 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   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
11   !!              -   !  2008-08  (K. Popova) adaptation for MEDUSA
12   !!              -   !  2008-11  (A. Yool) continuing adaptation for MEDUSA
13   !!              -   !  2010-03  (A. Yool) updated for branch inclusion
14   !!              -   !  2014-08  (A. Yool) correct 1% light level calculation
15   !!              -   !  2015-07  (A. Yool) updated for temporal averaging
16   !!              -   !  2017-03  (Jpalm) correct euphotic layer
17   !!----------------------------------------------------------------------
18#if defined key_medusa
19   !!----------------------------------------------------------------------
20   !!   'key_medusa'                                      MEDUSA bio-model
21   !!----------------------------------------------------------------------
22   !!   trc_opt_medusa        :   Compute the light availability in the water column
23   !!----------------------------------------------------------------------
24   USE oce_trc         !
25   USE trc
26   USE prtctl_trc      ! Print control for debbuging
27   USE sms_medusa
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   trc_opt_medusa   ! called in trcprg.F90
33
34   !!* Substitution
35#  include "domzgr_substitute.h90"
36   !!----------------------------------------------------------------------
37   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007)
38   !! $Id$
39   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
40   !!----------------------------------------------------------------------
41
42CONTAINS
43
44   SUBROUTINE trc_opt_medusa( kt )
45      !!---------------------------------------------------------------------
46      !!                     ***  ROUTINE trc_opt_medusa  ***
47      !!
48      !! ** Purpose :   computes the light propagation in the water column
49      !!              and the euphotic layer depth
50      !!
51      !! ** Method  :   local par is computed in w layers using light propagation
52      !!              mean par in t layers are computed by integration
53      !!---------------------------------------------------------------------
54      INTEGER, INTENT( in ) ::   kt   ! index of the time stepping
55      INTEGER  ::   ji, jj, jk
56      REAL(wp) ::   zpig                                    ! total pigment
57      REAL(wp) ::   zkr                                     ! total absorption coefficient in red
58      REAL(wp) ::   zkg                                     ! total absorption coefficient in green
59      REAL(wp) ::   totchl                                  ! total Chl concentreation
60      REAL(wp), DIMENSION(jpi,jpj)     ::   zpar100         ! irradiance at euphotic layer depth
61      REAL(wp), DIMENSION(jpi,jpj)     ::   zpar0m          ! irradiance just below the surface
62      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zparr, zparg    ! red and green compound of par
63
64      CHARACTER (len=25) :: charout
65      !!---------------------------------------------------------------------
66
67      !! AXY (20/11/14): alter this to report on first MEDUSA call
68      !! IF( kt == nit000 ) THEN
69      IF( kt == nittrc000 ) THEN
70         IF(lwp) WRITE(numout,*)
71         IF(lwp) WRITE(numout,*) ' trc_opt_medusa: MEDUSA optic-model'
72         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
73    IF(lwp) WRITE(numout,*) ' kt =',kt
74      ENDIF
75
76      ! determination of surface irradiance
77      ! -----------------------------------
78      ! AXY (23/07/15): the inclusion of empirical DMS calculations requires
79      !                 daily averages of a series of properties that are
80      !                 used as inputs; these include surface irradiance;
81      !                 here, this is taken advantage of to allow MEDUSA to
82      !                 base its submarine light field on daily average
83      !                 rather than "instantaneous" irradiance; largely
84      !                 because MEDUSA was originally formulated to work
85      !                 with diel average irradiance rather than a diel
86      !                 cycle; using key_avgqsr_medusa activates this
87      !                 functionality, while its absence gives default
88      !                 MEDUSA (which is whatever is supplied by NEMO)
89# if defined key_avgqsr_medusa
90      ! surface irradiance input is rolling average irradiance
91      zpar0m (:,:)   = zn_dms_qsr(:,:) * 0.43
92# else     
93      ! surface irradiance input is   instantaneous irradiance
94      zpar0m (:,:)   =        qsr(:,:) * 0.43
95# endif
96      ! AXY (22/08/14): when zpar0m = 0, zpar100 is also zero and calculating
97      !                 euphotic depth is not possible (cf. the Arctic Octopus);
98      !                 a "solution" to this is to set zpar0m to some minimal
99      !                 value such that zpar100 also has a non-zero value and
100      !                 euphotic depth can be calculated properly; note that,
101      !                 in older, non-diurnal versions of NEMO, this was much
102      !                 less of a problem; note also that, if pushed, I will
103      !                 claim that my minimal value of zpar0m refers to light
104      !                 from stars
105      DO jj = 1, jpj
106         DO ji = 1, jpi
107            IF( zpar0m(ji,jj) <= 0.0 ) zpar0m(ji,jj) = 0.001  ! = 1 mW/m2
108         ENDDO
109      ENDDO
110      zpar100(:,:)   = zpar0m(:,:) * 0.01
111      xpar   (:,:,1) = zpar0m(:,:)
112      zparr  (:,:,1) = 0.5 * zpar0m(:,:)
113      zparg  (:,:,1) = 0.5 * zpar0m(:,:)
114
115      ! determination of xpar
116      ! ---------------------
117
118      DO jk = 2, jpk                     ! determination of local par in w levels
119         DO jj = 1, jpj
120            DO ji = 1, jpi
121               totchl =trn(ji,jj,jk-1,jpchn)+trn(ji,jj,jk-1,jpchd)
122               zpig = MAX( TINY(0.), totchl/rpig) 
123               zkr  = xkr0 + xkrp * EXP( xlr * LOG( zpig ) )
124               zkg  = xkg0 + xkgp * EXP( xlg * LOG( zpig ) )
125               zparr(ji,jj,jk) = zparr(ji,jj,jk-1) * EXP( -zkr * fse3t(ji,jj,jk-1) )
126               zparg(ji,jj,jk) = zparg(ji,jj,jk-1) * EXP( -zkg * fse3t(ji,jj,jk-1) )
127            END DO
128        END DO
129      END DO
130
131      DO jk = 1, jpkm1                   ! mean par in t levels
132         DO jj = 1, jpj
133            DO ji = 1, jpi
134               totchl =trn(ji,jj,jk  ,jpchn)+trn(ji,jj,jk  ,jpchd)
135               zpig = MAX( TINY(0.), totchl/rpig) 
136               zkr  = xkr0 + xkrp * EXP( xlr * LOG( zpig ) )
137               zkg  = xkg0 + xkgp * EXP( xlg * LOG( zpig ) )
138               zparr(ji,jj,jk)    = zparr(ji,jj,jk) / zkr / fse3t(ji,jj,jk) * ( 1 - EXP( -zkr*fse3t(ji,jj,jk) ) )
139               zparg(ji,jj,jk)    = zparg(ji,jj,jk) / zkg / fse3t(ji,jj,jk) * ( 1 - EXP( -zkg*fse3t(ji,jj,jk) ) )
140               xpar (ji,jj,jk) = MAX( zparr(ji,jj,jk) + zparg(ji,jj,jk), 1.e-15 )
141            END DO
142         END DO
143      END DO
144
145      ! 3. Determination of euphotic layer depth
146      ! ----------------------------------------
147
148      ! Euphotic layer bottom level
149      neln(:,:) = 1                                           ! initialisation of EL level
150      DO jk = 1, jpkm1
151         DO jj = 1, jpj
152           DO ji = 1, jpi
153              IF( xpar(ji,jj,jk) >= zpar100(ji,jj) )   neln(ji,jj) = jk+1 ! 1rst T-level strictly below EL bottom
154              !                                                  ! nb. this is to ensure compatibility with
155              !                                                  ! nmld_trc definition in trd_mld_trc_zint
156           END DO
157         END DO
158      ENDDO
159
160      ! Euphotic layer depth
161      !! Jpalm -- 06-03-2017 -- add init xze, to avoid halo problems within the
162      !!                        writing process
163      xze(:,:) = 0.0
164      DO jj = 1, jpj
165         DO ji = 1, jpi
166            xze(ji,jj) = fsdepw( ji, jj, neln(ji,jj) )            ! exact EL depth
167         END DO
168      ENDDO 
169
170      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
171         WRITE(charout, FMT="('opt')")
172         CALL prt_ctl_trc_info(charout)
173         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
174      ENDIF
175
176   END SUBROUTINE trc_opt_medusa
177
178#else
179   !!======================================================================
180   !!  Dummy module :                                   No MEDUSA bio-model
181   !!======================================================================
182CONTAINS
183   SUBROUTINE trc_opt_medusa( kt )                   ! Empty routine
184      INTEGER, INTENT( in ) ::   kt
185      WRITE(*,*) 'trc_opt_medusa: You should not have seen this print! error?', kt
186   END SUBROUTINE trc_opt_medusa
187#endif 
188
189   !!======================================================================
190END MODULE  trcopt_medusa
Note: See TracBrowser for help on using the repository browser.