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/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA – NEMO

source: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcopt_medusa.F90 @ 9385

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

JPALM -- reverse MEDUSA cleaning and update MOCSY

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