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.
asmlogchlbal_medusa.F90 in branches/UKMO/dev_r5518_GO6_package_asm_surf_bgc/NEMOGCM/NEMO/OPA_SRC/ASM – NEMO

source: branches/UKMO/dev_r5518_GO6_package_asm_surf_bgc/NEMOGCM/NEMO/OPA_SRC/ASM/asmlogchlbal_medusa.F90 @ 8436

Last change on this file since 8436 was 8436, checked in by dford, 7 years ago

Implement initial version of surface chlorophyll assimilation for MEDUSA.

File size: 23.0 KB
Line 
1MODULE asmlogchlbal_medusa
2   !!======================================================================
3   !!                       ***  MODULE asmlogchlbal_medusa  ***
4   !! Calculate increments to MEDUSA based on surface logchl increments
5   !!
6   !! IMPORTANT NOTE: This calls the bioanalysis routine of Hemmings et al.
7   !! For licensing reasons this is kept in its own internal Met Office
8   !! branch (dev/frdf/vn3.6_nitrogen_balancing) rather than in the Paris
9   !! repository, and must be merged in when building.
10   !!
11   !!======================================================================
12   !! History :  3.6  ! 2017-08 (D. Ford)  Adapted from asmlogchlbal_hadocc
13   !!----------------------------------------------------------------------
14#if defined key_asminc && defined key_medusa && defined key_foam_medusa
15   !!----------------------------------------------------------------------
16   !! 'key_asminc'          : assimilation increment interface
17   !! 'key_medusa'          : MEDUSA model
18   !! 'key_foam_medusa'     : MEDUSA extras for FOAM OBS and ASM
19   !!----------------------------------------------------------------------
20   !! asm_logchl_bal_medusa : routine to calculate increments to MEDUSA
21   !!----------------------------------------------------------------------
22   USE par_kind,      ONLY: wp             ! kind parameters
23   USE par_oce,       ONLY: jpi, jpj, jpk  ! domain array sizes
24   USE dom_oce,       ONLY: gdepw_n        ! domain information
25   USE zdfmxl                              ! mixed layer depth
26   USE iom                                 ! i/o
27   USE trc,           ONLY: trn, trb       ! MEDUSA variables
28   USE sms_medusa                          ! MEDUSA parameters
29   USE par_medusa                          ! MEDUSA parameters
30   USE par_trc,       ONLY: jptra          ! Tracer parameters
31   USE bioanalysis                         ! Nitrogen balancing
32
33   IMPLICIT NONE
34   PRIVATE                   
35
36   PUBLIC asm_logchl_bal_medusa
37
38   ! Default values for biological assimilation parameters
39   ! Should match Hemmings et al. (2008)
40   REAL(wp), PARAMETER :: balnutext  =  0.6    !: Default nutrient balancing factor
41   REAL(wp), PARAMETER :: balnutmin  =  0.1    !: Fraction of phytoplankton loss to nutrient
42   REAL(wp), PARAMETER :: r          =  1      !: Reliability of model specific growth rate
43   REAL(wp), PARAMETER :: beta_g     =  0.05   !: Low rate bias correction for growth rate estimator
44   REAL(wp), PARAMETER :: beta_l     =  0.05   !: Low rate bias correction for primary loss rate estimator
45   REAL(wp), PARAMETER :: beta_m     =  0.05   !: Low rate bias correction for secondary loss rate estimator
46   REAL(wp), PARAMETER :: a_g        =  0.2    !: Error s.d. for log10 of growth rate estimator
47   REAL(wp), PARAMETER :: a_l        =  0.4    !: Error s.d. for log10 of primary loss rate estimator
48   REAL(wp), PARAMETER :: a_m        =  0.7    !: Error s.d. for log10 of secondary loss rate estimator
49   REAL(wp), PARAMETER :: zfracb0    =  0.7    !: Base zooplankton fraction of loss to Z & D
50   REAL(wp), PARAMETER :: zfracb1    =  0      !: Phytoplankton sensitivity of zooplankton fraction
51   REAL(wp), PARAMETER :: qrfmax     =  1.1    !: Maximum nutrient limitation reduction factor
52   REAL(wp), PARAMETER :: qafmax     =  1.1    !: Maximum nutrient limitation amplification factor
53   REAL(wp), PARAMETER :: zrfmax     =  2      !: Maximum zooplankton reduction factor
54   REAL(wp), PARAMETER :: zafmax     =  2      !: Maximum zooplankton amplification factor
55   REAL(wp), PARAMETER :: prfmax     =  10     !: Maximum phytoplankton reduction factor (secondary)
56   REAL(wp), PARAMETER :: incphymin  =  0.0001 !: Minimum size of non-zero phytoplankton increment
57   REAL(wp), PARAMETER :: integnstep =  20     !: Number of steps for p.d.f. integral evaluation
58   REAL(wp), PARAMETER :: pthreshold =  0.01   !: Fractional threshold level for setting p.d.f.
59   !
60   LOGICAL,  PARAMETER :: diag_active           = .TRUE.  !: Depth-independent diagnostics
61   LOGICAL,  PARAMETER :: diag_fulldepth_active = .TRUE.  !: Full-depth diagnostics
62   LOGICAL,  PARAMETER :: gl_active             = .TRUE.  !: Growth/loss-based balancing
63   LOGICAL,  PARAMETER :: nbal_active           = .TRUE.  !: Nitrogen balancing
64   LOGICAL,  PARAMETER :: subsurf_active        = .TRUE.  !: Increments below MLD
65   LOGICAL,  PARAMETER :: deepneg_active        = .FALSE. !: Negative primary increments below MLD
66   LOGICAL,  PARAMETER :: deeppos_active        = .FALSE. !: Positive primary increments below MLD
67   LOGICAL,  PARAMETER :: nutprof_active        = .TRUE.  !: Secondary increments
68
69CONTAINS
70
71   SUBROUTINE asm_logchl_bal_medusa( logchl_bkginc, aincper, mld_choice_bgc, &
72      &                              k_maxchlinc, ld_logchlbal,              &
73      &                              pgrow_avg_bkg, ploss_avg_bkg,           &
74      &                              phyt_avg_bkg, mld_max_bkg,              &
75      &                              logchl_balinc )
76      !!---------------------------------------------------------------------------
77      !!                    ***  ROUTINE asm_logchl_bal_medusa  ***
78      !!
79      !! ** Purpose :   calculate increments to MEDUSA from logchl increments
80      !!
81      !! ** Method  :   convert logchl increments to chl increments
82      !!                average up MEDUSA to look like HadOCC
83      !!                call nitrogen balancing scheme
84      !!                separate back out to MEDUSA
85      !!
86      !! ** Action  :   populate logchl_balinc
87      !!
88      !! References :   Hemmings et al., 2008, J. Mar. Res.
89      !!                Ford et al., 2012, Ocean Sci.
90      !!---------------------------------------------------------------------------
91      !!
92      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: logchl_bkginc  ! logchl increments
93      REAL(wp), INTENT(in   )                               :: aincper        ! Assimilation period
94      INTEGER,  INTENT(in   )                               :: mld_choice_bgc ! MLD criterion
95      REAL(wp), INTENT(in   )                               :: k_maxchlinc    ! Max chl increment
96      LOGICAL,  INTENT(in   )                               :: ld_logchlbal   ! Balancing y/n
97      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: pgrow_avg_bkg  ! Avg phyto growth
98      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: ploss_avg_bkg  ! Avg phyto loss
99      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: phyt_avg_bkg   ! Avg phyto
100      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: mld_max_bkg    ! Max MLD
101      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj,jpk,jptra) :: logchl_balinc  ! Balancing increments
102      !!
103      INTEGER                                               :: ji, jj, jk, jn ! Loop counters
104      INTEGER                                               :: jkmax          ! Loop index
105      INTEGER,                 DIMENSION(6)                 :: i_tracer       ! Tracer indices
106      REAL(wp)                                              :: n2be_p         ! N:biomass for total phy
107      REAL(wp)                                              :: n2be_z         ! N:biomass for total zoo
108      REAL(wp)                                              :: n2be_d         ! N:biomass for detritus
109      REAL(wp)                                              :: zfrac_chn      ! Fraction of jpchn
110      REAL(wp)                                              :: zfrac_chd      ! Fraction of jpchd
111      REAL(wp)                                              :: zfrac_phn      ! Fraction of jpphn
112      REAL(wp)                                              :: zfrac_phd      ! Fraction of jpphd
113      REAL(wp)                                              :: zfrac_zmi      ! Fraction of jpzmi
114      REAL(wp)                                              :: zfrac_zme      ! Fraction of jpzme
115      REAL(wp)                                              :: zrat_pds_phd   ! Ratio of jppds:jpphd
116      REAL(wp)                                              :: zrat_chd_phd   ! Ratio of jpchd:jpphd
117      REAL(wp)                                              :: zrat_chn_phn   ! Ratio of jpchn:jpphn
118      REAL(wp)                                              :: zrat_dtc_det   ! Ratio of jpdtc:jpdet
119      REAL(wp),                DIMENSION(jpi,jpj)           :: chl_inc        ! Chlorophyll increments
120      REAL(wp),                DIMENSION(jpi,jpj)           :: medusa_chl     ! MEDUSA total chlorophyll
121      REAL(wp),                DIMENSION(jpi,jpj)           :: cchl_p         ! C:Chl for total phy
122      REAL(wp),                DIMENSION(jpi,jpj)           :: zmld           ! Mixed layer depth
123      REAL(wp),                DIMENSION(16)                :: modparm        ! Model parameters
124      REAL(wp),                DIMENSION(20)                :: assimparm      ! Assimilation parameters
125      REAL(wp),                DIMENSION(jpi,jpj,jpk,6)     :: bstate         ! Background state
126      REAL(wp),                DIMENSION(jpi,jpj,jpk,6)     :: outincs        ! Balancing increments
127      REAL(wp),                DIMENSION(jpi,jpj,22)        :: diag           ! Depth-indep diagnostics
128      REAL(wp),                DIMENSION(jpi,jpj,jpk,22)    :: diag_fulldepth ! Full-depth diagnostics
129      !!---------------------------------------------------------------------------
130
131      ! Convert log10(chlorophyll) increment back to a chlorophyll increment
132      ! In order to transform logchl incs to chl incs, need to account for model
133      ! background, cannot simply do 10^logchl_bkginc. Need to:
134      ! 1) Add logchl inc to log10(background) to get log10(analysis)
135      ! 2) Take 10^log10(analysis) to get analysis
136      ! 3) Subtract background from analysis to get chl incs
137      ! If k_maxchlinc > 0 then cap total absolute chlorophyll increment at that value
138      medusa_chl(:,:) = trb(:,:,1,jpchn) + trb(:,:,1,jpchd)
139      DO jj = 1, jpj
140         DO ji = 1, jpi
141            IF ( medusa_chl(ji,jj) > 0.0 ) THEN
142               chl_inc(ji,jj) = 10**( LOG10( medusa_chl(ji,jj) ) + logchl_bkginc(ji,jj) ) - medusa_chl(ji,jj)
143               IF ( k_maxchlinc > 0.0 ) THEN
144                  chl_inc(ji,jj) = MAX( -1.0 * k_maxchlinc, MIN( chl_inc(ji,jj), k_maxchlinc ) )
145               ENDIF
146            ELSE
147               chl_inc(ji,jj) = 0.0
148            ENDIF
149         END DO
150      END DO
151     
152      ! Select mixed layer
153      SELECT CASE( mld_choice_bgc )
154      CASE ( 1 )                   ! Turbocline/mixing depth [W points]
155         zmld(:,:) = hmld(:,:)
156      CASE ( 2 )                   ! Density criterion (0.01 kg/m^3 change from 10m) [W points]
157         zmld(:,:) = hmlp(:,:)
158      CASE ( 3 )                   ! Kara MLD [Interpolated]
159#if defined key_karaml
160         IF ( ln_kara ) THEN
161            zmld(:,:) = hmld_kara(:,:)
162         ELSE
163            CALL ctl_stop( ' Kara mixed layer requested for LogChl assimilation,', &
164               &           ' but ln_kara=.false.' )
165         ENDIF
166#else
167         CALL ctl_stop( ' Kara mixed layer requested for LogChl assimilation,', &
168            &           ' but is not defined' )
169#endif
170      CASE ( 4 )                   ! Temperature criterion (0.2 K change from surface) [T points]
171         !zmld(:,:) = hmld_tref(:,:)
172         CALL ctl_stop( ' hmld_tref mixed layer requested for LogChl assimilation,', &
173            &           ' but is not available in this version' )
174      CASE ( 5 )                   ! Density criterion (0.01 kg/m^3 change from 10m) [T points]
175         zmld(:,:) = hmlpt(:,:)
176      END SELECT
177     
178      IF ( ld_logchlbal ) THEN   ! Nitrogen balancing
179
180         ! Set up model parameters to be passed into Hemmings balancing routine.
181         ! For now these are hardwired to the standard HadOCC parameter values
182         ! (except C:N ratios) as this is what the scheme was developed for.
183         ! Obviously, HadOCC and MEDUSA are rather different models, so this
184         ! isn't ideal, but there's not always direct analogues between the two
185         ! parameter sets, so it's the easiest way to get something running.
186         ! In the longer term, some serious MarMOT-based development is required.
187         modparm(1)  = 0.1                               ! grow_sat
188         modparm(2)  = 2.0                               ! psmax
189         modparm(3)  = 0.845                             ! par
190         modparm(4)  = 0.02                              ! alpha
191         modparm(5)  = 0.05                              ! resp_rate
192         modparm(6)  = 0.05                              ! pmort_rate
193         modparm(7)  = 0.01                              ! phyto_min
194         modparm(8)  = 0.05                              ! z_mort_1
195         modparm(9)  = 1.0                               ! z_mort_2
196         modparm(10) = ( xthetapn  + xthetapd  ) / 2.0   ! c2n_p
197         modparm(11) = ( xthetazmi + xthetazme ) / 2.0   ! c2n_z
198         modparm(12) = xthetad                           ! c2n_d
199         modparm(13) = 0.01                              ! graze_threshold
200         modparm(14) = 2.0                               ! holling_coef
201         modparm(15) = 0.5                               ! graze_sat
202         modparm(16) = 2.0                               ! graze_max
203
204         ! Set up assimilation parameters to be passed into balancing routine
205         ! Not sure what assimparm(1) is meant to be, but it doesn't get used
206         assimparm(2)  = balnutext
207         assimparm(3)  = balnutmin
208         assimparm(4)  = r
209         assimparm(5)  = beta_g
210         assimparm(6)  = beta_l
211         assimparm(7)  = beta_m
212         assimparm(8)  = a_g
213         assimparm(9)  = a_l
214         assimparm(10) = a_m
215         assimparm(11) = zfracb0
216         assimparm(12) = zfracb1
217         assimparm(13) = qrfmax
218         assimparm(14) = qafmax
219         assimparm(15) = zrfmax
220         assimparm(16) = zafmax
221         assimparm(17) = prfmax
222         assimparm(18) = incphymin
223         assimparm(19) = integnstep
224         assimparm(20) = pthreshold
225
226         ! Set up external tracer indices array bstate
227         i_tracer(1) = 1   ! nutrient
228         i_tracer(2) = 2   ! phytoplankton
229         i_tracer(3) = 3   ! zooplankton
230         i_tracer(4) = 4   ! detritus
231         i_tracer(5) = 5   ! DIC
232         i_tracer(6) = 6   ! Alkalinity
233
234         ! Set background state
235         bstate(:,:,:,i_tracer(1)) = trb(:,:,:,jpdin)
236         bstate(:,:,:,i_tracer(2)) = trb(:,:,:,jpphn) + trb(:,:,:,jpphd)
237         bstate(:,:,:,i_tracer(3)) = trb(:,:,:,jpzmi) + trb(:,:,:,jpzme)
238         bstate(:,:,:,i_tracer(4)) = trb(:,:,:,jpdet)
239         bstate(:,:,:,i_tracer(5)) = trb(:,:,:,jpdic)
240         bstate(:,:,:,i_tracer(6)) = trb(:,:,:,jpalk)
241
242         ! Calculate carbon to chlorophyll ratio for combined phytoplankton
243         ! and nitrogen to biomass equivalent for PZD
244         ! Hardwire nitrogen mass to 14.01 for now as it doesn't seem to be set in MEDUSA
245         !cchl_p(:,:) = ( trb(:,:,1,jpchn) + trb(:,:,1,jpchd ) ) / &
246         !   &          ( ( trb(:,:,1,jpphn) * xthetapn ) + ( trb(:,:,1,jpphd) * xthetapd ) )
247         cchl_p(:,:) = 0.0
248         DO jj = 1, jpj
249            DO ji = 1, jpi
250               IF ( ( trb(ji,jj,1,jpchn) + trb(ji,jj,1,jpchd ) ) .GT. 0.0 ) THEN
251                  cchl_p(ji,jj) = ( ( trb(ji,jj,1,jpphn) * xthetapn ) + ( trb(ji,jj,1,jpphd) * xthetapd ) ) / &
252                     &            ( trb(ji,jj,1,jpchn) + trb(ji,jj,1,jpchd ) )
253               ENDIF
254            END DO
255         END DO
256         n2be_p = 14.01 + ( xmassc * ( ( xthetapn  + xthetapd  ) / 2.0 ) )
257         n2be_z = 14.01 + ( xmassc * ( ( xthetazmi + xthetazme ) / 2.0 ) )
258         n2be_d = 14.01 + ( xmassc * xthetad )
259         
260         WRITE(numout,*) 'DAF: nproc, min/max cchl_p, min/max chl_inc = ', nproc, MINVAL(cchl_p), MAXVAL(cchl_p), MINVAL(chl_inc), MAXVAL(chl_inc)
261
262         ! Call nitrogen balancing routine
263         CALL bio_analysis( jpi, jpj, jpk, gdepw_n(:,:,2:jpk), i_tracer, modparm,   &
264            &               n2be_p, n2be_z, n2be_d, assimparm,                      &
265            &               INT(aincper), 1, INT(SUM(tmask,3)), tmask(:,:,:),       &
266            &               zmld(:,:), mld_max_bkg(:,:), chl_inc(:,:), cchl_p(:,:), &
267            &               nbal_active, phyt_avg_bkg(:,:),                         &
268            &               gl_active, pgrow_avg_bkg(:,:), ploss_avg_bkg(:,:),      &
269            &               subsurf_active, deepneg_active,                         &
270            &               deeppos_active, nutprof_active,                         &
271            &               bstate, outincs,                                        &
272            &               diag_active, diag,                                      &
273            &               diag_fulldepth_active, diag_fulldepth )
274         
275         WRITE(numout,*) 'DAF: nproc, min/max outincs(phy)1,20 = ', nproc, MINVAL(outincs(:,:,1,i_tracer(2))), MAXVAL(outincs(:,:,1,i_tracer(2))), MINVAL(outincs(:,:,20,i_tracer(2))), MAXVAL(outincs(:,:,20,i_tracer(2)))
276
277         ! Loop over each grid point partioning the increments
278         logchl_balinc(:,:,:,:) = 0.0
279         DO jk = 1, jpk
280            DO jj = 1, jpj
281               DO ji = 1, jpi
282
283                  IF ( ( trb(ji,jj,jk,jpphn) > 0.0 ) .AND. ( trb(ji,jj,jk,jpphd) > 0.0 ) ) THEN
284                     ! Phytoplankton nitrogen and silicate split up based on existing ratios
285                     zfrac_phn = trb(ji,jj,jk,jpphn) / (trb(ji,jj,jk,jpphn) + trb(ji,jj,jk,jpphd))
286                     zfrac_phd = 1.0 - zfrac_phn
287                     zrat_pds_phd = trb(ji,jj,jk,jppds) / trb(ji,jj,jk,jpphd)
288                     logchl_balinc(ji,jj,jk,jpphn) = outincs(ji,jj,jk,i_tracer(2)) * zfrac_phn
289                     logchl_balinc(ji,jj,jk,jpphd) = outincs(ji,jj,jk,i_tracer(2)) * zfrac_phd
290                     logchl_balinc(ji,jj,jk,jppds) = logchl_balinc(ji,jj,jk,jpphd) * zrat_pds_phd
291
292                     ! Chlorophyll split up based on existing ratios to phytoplankton nitrogen
293                     ! Not using chl_inc directly as it's only 2D
294                     ! This method should give same results at surface as splitting chl_inc would
295                     zrat_chn_phn = trb(ji,jj,jk,jpchn) / trb(ji,jj,jk,jpphn)
296                     zrat_chd_phd = trb(ji,jj,jk,jpchd) / trb(ji,jj,jk,jpphd)
297                     logchl_balinc(ji,jj,jk,jpchn) = logchl_balinc(ji,jj,jk,jpphn) * zrat_chn_phn
298                     logchl_balinc(ji,jj,jk,jpchd) = logchl_balinc(ji,jj,jk,jpphd) * zrat_chd_phd
299                  ENDIF
300
301                  IF ( ( trb(ji,jj,jk,jpzmi) > 0.0 ) .AND. ( trb(ji,jj,jk,jpzme) > 0.0 ) ) THEN
302                     ! Zooplankton nitrogen split up based on existing ratios
303                     zfrac_zmi = trb(ji,jj,jk,jpzmi) / (trb(ji,jj,jk,jpzmi) + trb(ji,jj,jk,jpzme))
304                     zfrac_zme = 1.0 - zfrac_zmi
305                     logchl_balinc(ji,jj,jk,jpzmi) = outincs(ji,jj,jk,i_tracer(3)) * zfrac_zmi
306                     logchl_balinc(ji,jj,jk,jpzme) = outincs(ji,jj,jk,i_tracer(3)) * zfrac_zme
307                  ENDIF
308
309                  ! Nitrogen nutrient straight from balancing scheme
310                  logchl_balinc(ji,jj,jk,jpdin) = outincs(ji,jj,jk,i_tracer(1))
311
312                  ! Nitrogen detritus straight from balancing scheme
313                  logchl_balinc(ji,jj,jk,jpdet) = outincs(ji,jj,jk,i_tracer(4))
314
315                  ! DIC straight from balancing scheme
316                  logchl_balinc(ji,jj,jk,jpdic) = outincs(ji,jj,jk,i_tracer(5))
317
318                  ! Alkalinity straight from balancing scheme
319                  logchl_balinc(ji,jj,jk,jpalk) = outincs(ji,jj,jk,i_tracer(6))
320
321                  ! Remove diatom silicate increment from nutrient silicate to conserve mass
322                  IF ( ( trb(ji,jj,jk,jpsil) - logchl_balinc(ji,jj,jk,jppds) ) > 0.0 ) THEN
323                     logchl_balinc(ji,jj,jk,jpsil) = logchl_balinc(ji,jj,jk,jppds) * (-1.0)
324                  ENDIF
325
326                  IF ( ( trb(ji,jj,jk,jpdet) > 0.0 ) .AND. ( trb(ji,jj,jk,jpdtc) > 0.0 ) ) THEN
327                     ! Carbon detritus based on existing ratios
328                     zrat_dtc_det = trb(ji,jj,jk,jpdtc) / trb(ji,jj,jk,jpdet)
329                     logchl_balinc(ji,jj,jk,jpdtc) = logchl_balinc(ji,jj,jk,jpdet) * zrat_dtc_det
330                  ENDIF
331
332                  ! Do nothing with iron or oxygen for the time being
333                  logchl_balinc(ji,jj,jk,jpfer) = 0.0
334                  logchl_balinc(ji,jj,jk,jpoxy) = 0.0
335                 
336               END DO
337            END DO
338         END DO
339     
340      ELSE   ! No nitrogen balancing
341     
342         ! Initialise individual chlorophyll increments to zero
343         logchl_balinc(:,:,:,jpchn) = 0.0
344         logchl_balinc(:,:,:,jpchd) = 0.0
345         
346         ! Split up total surface chlorophyll increments
347         DO jj = 1, jpj
348            DO ji = 1, jpi
349               IF ( medusa_chl(ji,jj) > 0.0 ) THEN
350                  zfrac_chn = trb(ji,jj,1,jpchn) / medusa_chl(ji,jj)
351                  zfrac_chd = 1.0 - zfrac_chn
352                  logchl_balinc(ji,jj,1,jpchn) = chl_inc(ji,jj) * zfrac_chn
353                  logchl_balinc(ji,jj,1,jpchd) = chl_inc(ji,jj) * zfrac_chd
354               ENDIF
355            END DO
356         END DO
357         
358         ! Propagate through mixed layer
359         DO jj = 1, jpj
360            DO ji = 1, jpi
361               !
362               jkmax = jpk-1
363               DO jk = jpk-1, 1, -1
364                  IF ( ( zmld(ji,jj) >  gdepw_n(ji,jj,jk)   ) .AND. &
365                     & ( zmld(ji,jj) <= gdepw_n(ji,jj,jk+1) ) ) THEN
366                     zmld(ji,jj) = gdepw_n(ji,jj,jk+1)
367                     jkmax = jk
368                  ENDIF
369               END DO
370               !
371               DO jk = 2, jkmax
372                  logchl_balinc(ji,jj,jk,jpchn) = logchl_balinc(ji,jj,1,jpchn)
373                  logchl_balinc(ji,jj,jk,jpchd) = logchl_balinc(ji,jj,1,jpchd)
374               END DO
375               !
376            END DO
377         END DO
378
379         ! Set other balancing increments to zero
380         logchl_balinc(:,:,:,jpphn) = 0.0
381         logchl_balinc(:,:,:,jpphd) = 0.0
382         logchl_balinc(:,:,:,jppds) = 0.0
383         logchl_balinc(:,:,:,jpzmi) = 0.0
384         logchl_balinc(:,:,:,jpzme) = 0.0
385         logchl_balinc(:,:,:,jpdin) = 0.0
386         logchl_balinc(:,:,:,jpsil) = 0.0
387         logchl_balinc(:,:,:,jpfer) = 0.0
388         logchl_balinc(:,:,:,jpdet) = 0.0
389         logchl_balinc(:,:,:,jpdtc) = 0.0
390         logchl_balinc(:,:,:,jpdic) = 0.0
391         logchl_balinc(:,:,:,jpalk) = 0.0
392         logchl_balinc(:,:,:,jpoxy) = 0.0
393
394      ENDIF
395
396   END SUBROUTINE asm_logchl_bal_medusa
397
398#else
399   !!----------------------------------------------------------------------
400   !!   Default option : Empty routine
401   !!----------------------------------------------------------------------
402CONTAINS
403   SUBROUTINE asm_logchl_bal_medusa( logchl_bkginc, aincper, mld_choice_bgc, &
404      &                              k_maxchlinc, logchl_balinc )
405      REAL    :: logchl_bkginc(:,:)
406      REAL    :: aincper
407      INTEGER :: mld_choice_bgc
408      REAL    :: k_maxchlinc
409      REAL(   :: logchl_balinc(:,:,:,:)
410      WRITE(*,*) 'asm_logchl_bal_medusa: You should not have seen this print! error?'
411   END SUBROUTINE asm_logchl_bal_medusa
412#endif
413
414   !!======================================================================
415END MODULE asmlogchlbal_medusa
Note: See TracBrowser for help on using the repository browser.