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.
p4zsed.F90 in branches/CNRS/dev_r6270_PISCES_QUOTA/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z – NEMO

source: branches/CNRS/dev_r6270_PISCES_QUOTA/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90 @ 6841

Last change on this file since 6841 was 6841, checked in by aumont, 8 years ago

Various bug fixes + explicit gamma function for lability

  • Property svn:keywords set to Id
File size: 22.5 KB
Line 
1MODULE p4zsed
2   !!======================================================================
3   !!                         ***  MODULE p4sed  ***
4   !! TOP :   PISCES Compute loss of organic matter in the sediments
5   !!======================================================================
6   !! History :   1.0  !  2004-03 (O. Aumont) Original code
7   !!             2.0  !  2007-12 (C. Ethe, G. Madec)  F90
8   !!             3.4  !  2011-06 (C. Ethe) USE of fldread
9   !!             3.5  !  2012-07 (O. Aumont) improvment of river input of nutrients
10   !!----------------------------------------------------------------------
11#if defined key_pisces
12   !!----------------------------------------------------------------------
13   !!   'key_pisces'                                       PISCES bio-model
14   !!----------------------------------------------------------------------
15   !!   p4z_sed        :  Compute loss of organic matter in the sediments
16   !!----------------------------------------------------------------------
17   USE oce_trc         !  shared variables between ocean and passive tracers
18   USE trc             !  passive tracers common variables
19   USE sms_pisces      !  PISCES Source Minus Sink variables
20   USE p4zsink         !  vertical flux of particulate matter due to sinking
21   USE p4zopt          !  optical model
22   USE p4zlim          !  Co-limitations of differents nutrients
23   USE p4zsbc          !  External source of nutrients
24   USE p4zint          !  interpolation and computation of various fields
25   USE iom             !  I/O manager
26   USE prtctl_trc      !  print control for debugging
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   p4z_sed 
32   PUBLIC   p4z_sed_alloc
33 
34
35   !! * Module variables
36   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: nitrpot    !: Nitrogen fixation
37   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:  ) :: sdenit     !: Nitrate reduction in the sediments
38   REAL(wp) :: r1_rday                  !: inverse of rday
39
40   !!* Substitution
41#  include "top_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
44   !! $Id$
45   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47CONTAINS
48
49   SUBROUTINE p4z_sed( kt, knt )
50      !!---------------------------------------------------------------------
51      !!                     ***  ROUTINE p4z_sed  ***
52      !!
53      !! ** Purpose :   Compute loss of organic matter in the sediments. This
54      !!              is by no way a sediment model. The loss is simply
55      !!              computed to balance the inout from rivers and dust
56      !!
57      !! ** Method  : - ???
58      !!---------------------------------------------------------------------
59      !
60      INTEGER, INTENT(in) ::   kt, knt ! ocean time step
61      INTEGER  ::   ji, jj, jk, ikt
62#if ! defined key_sed
63      REAL(wp) ::   zsumsedsi, zsumsedpo4, zsumsedcal
64      REAL(wp) ::   zrivalk, zrivsil, zrivno3
65#endif
66      REAL(wp) ::  zwflux, zfminus, zfplus
67      REAL(wp) ::  zlim, zfact, zfactcal
68      REAL(wp) ::  zo2, zno3, zflx, zpdenit, z1pdenit, zdenitt, zolimit
69      REAL(wp) ::  zsiloss, zcaloss, zws3, zws4, zwsc, zdep, zwstpoc
70      REAL(wp) ::  ztrfer, ztrpo4, zwdust, zlight
71      !
72      CHARACTER (len=25) :: charout
73      REAL(wp), POINTER, DIMENSION(:,:  ) :: zpdep, zsidep, zwork1, zwork2, zwork3
74      REAL(wp), POINTER, DIMENSION(:,:)   :: zsedcal, zsedsi, zsedc
75      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdenit2d, zironice, zbureff
76      REAL(wp), POINTER, DIMENSION(:,:  ) :: zwsbio3, zwsbio4, zwscal
77      REAL(wp), POINTER, DIMENSION(:,:,:) :: zirondep, zsoufer
78#if defined key_ligand
79      REAL(wp) ::  zwssfep
80      REAL(wp), POINTER, DIMENSION(:,:  ) :: zwsfep
81#endif
82      !!---------------------------------------------------------------------
83      !
84      IF( nn_timing == 1 )  CALL timing_start('p4z_sed')
85      !
86      IF( kt == nittrc000 .AND. knt == 1 )   r1_rday  = 1. / rday
87      !
88      ! Allocate temporary workspace
89      CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
90      CALL wrk_alloc( jpi, jpj, zsedcal,  zsedsi, zsedc )
91      CALL wrk_alloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
92      CALL wrk_alloc( jpi, jpj, jpk, zsoufer )
93#if defined key_ligand
94      CALL wrk_alloc( jpi, jpj, zwsfep )
95#endif
96
97      zdenit2d(:,:) = 0.e0
98      zbureff (:,:) = 0.e0
99      zwork1  (:,:) = 0.e0
100      zwork2  (:,:) = 0.e0
101      zwork3  (:,:) = 0.e0
102      zsedsi   (:,:) = 0.e0
103      zsedcal  (:,:) = 0.e0
104      zsedc    (:,:) = 0.e0
105
106      ! Iron input/uptake due to sea ice : Crude parameterization based on Lancelot et al.
107      ! ----------------------------------------------------
108      IF( ln_ironice ) THEN 
109         !                                             
110         CALL wrk_alloc( jpi, jpj, zironice )
111         !                                             
112         DO jj = 1, jpj
113            DO ji = 1, jpi
114               zdep    = rfact2 / fse3t(ji,jj,1)
115               zwflux  = fmmflx(ji,jj) / 1000._wp
116               zfminus = MIN( 0._wp, -zwflux ) * trb(ji,jj,1,jpfer) * zdep
117               zfplus  = MAX( 0._wp, -zwflux ) * icefeinput * zdep
118               zironice(ji,jj) =  zfplus + zfminus
119            END DO
120         END DO
121         !
122         tra(:,:,1,jpfer) = tra(:,:,1,jpfer) + zironice(:,:) 
123         !
124         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironice" ) )   &
125            &   CALL iom_put( "Ironice", zironice(:,:) * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1) ) ! iron flux from ice
126         !
127         CALL wrk_dealloc( jpi, jpj, zironice )
128         !                                             
129      ENDIF
130
131      ! Add the external input of nutrients from dust deposition
132      ! ----------------------------------------------------------
133      IF( ln_dust ) THEN
134         !                                             
135         CALL wrk_alloc( jpi, jpj,      zpdep, zsidep )
136         CALL wrk_alloc( jpi, jpj, jpk, zirondep      )
137         !                                              ! Iron and Si deposition at the surface
138         IF( ln_solub ) THEN
139            zirondep(:,:,1) = solub(:,:) * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / 55.85 + 3.e-10 * r1_ryyss 
140         ELSE
141            zirondep(:,:,1) = dustsolub  * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / 55.85 + 3.e-10 * r1_ryyss 
142         ENDIF
143         zsidep(:,:) = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / 28.1 
144         zpdep (:,:) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / fse3t(:,:,1) / 31. / po4r 
145         !                                              ! Iron solubilization of particles in the water column
146         !                                              ! dust in kg/m2/s ---> 1/55.85 to put in mol/Fe ;  wdust in m/j
147         zwdust = 0.03 * rday / ( wdust * 55.85 ) / ( 270. * rday )
148         DO jk = 2, jpkm1
149            zirondep(:,:,jk) = dust(:,:) * mfrac * zwdust * rfact2 * EXP( -fsdept(:,:,jk) / 540. )
150         END DO
151         !                                              ! Iron solubilization of particles in the water column
152         tra(:,:,1,jppo4) = tra(:,:,1,jppo4) + zpdep   (:,:)
153         tra(:,:,1,jpsil) = tra(:,:,1,jpsil) + zsidep  (:,:)
154         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + zirondep(:,:,:) 
155         !
156         IF( lk_iomput ) THEN
157            IF( knt == nrdttrc ) THEN
158                IF( iom_use( "Irondep" ) )   &
159                &  CALL iom_put( "Irondep", zirondep(:,:,1) * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1) ) ! surface downward dust depo of iron
160                IF( iom_use( "pdust" ) )   &
161                &  CALL iom_put( "pdust"  , dust(:,:) / ( wdust * rday )  * tmask(:,:,1) ) ! dust concentration at surface
162            ENDIF
163         ELSE                                   
164            IF( ln_diatrc )  &
165              &  trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1) * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1)
166         ENDIF
167         CALL wrk_dealloc( jpi, jpj,      zpdep, zsidep )
168         CALL wrk_dealloc( jpi, jpj, jpk, zirondep      )
169         !                                             
170      ENDIF
171     
172      ! Add the external input of nutrients from river
173      ! ----------------------------------------------------------
174      IF( ln_river ) THEN
175         DO jj = 1, jpj
176            DO ji = 1, jpi
177               DO jk = 1, nk_rnf(ji,jj)
178                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) +  rivdip(ji,jj) * rfact2
179                  tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) +  rivdin(ji,jj) * rfact2
180                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) +  rivdic(ji,jj) * 5.e-5 * rfact2
181                  tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) +  rivdsi(ji,jj) * rfact2
182                  tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +  rivdic(ji,jj) * rfact2
183                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) +  ( rivalk(ji,jj) - rno3 * rivdin(ji,jj) ) * rfact2
184               ENDDO
185            ENDDO
186         ENDDO
187      ENDIF
188     
189      ! Add the external input of nutrients from nitrogen deposition
190      ! ----------------------------------------------------------
191      IF( ln_ndepo ) THEN
192         tra(:,:,1,jpno3) = tra(:,:,1,jpno3) + nitdep(:,:) * rfact2
193         tra(:,:,1,jptal) = tra(:,:,1,jptal) - rno3 * nitdep(:,:) * rfact2
194      ENDIF
195
196      ! Add the external input of iron from sediment mobilization
197      ! ------------------------------------------------------
198      IF( ln_ironsed ) THEN
199         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + ironsed(:,:,:) * rfact2
200#if defined key_ligand
201         trn(:,:,:,jpfep) = trn(:,:,:,jpfep) + (ironsed(:,:,:) * fep_rats ) * rfact2
202#endif
203         !
204         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironsed" ) )   &
205            &   CALL iom_put( "Ironsed", ironsed(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! iron inputs from sediments
206      ENDIF
207
208      ! Add the external input of iron from hydrothermal vents
209      ! ------------------------------------------------------
210      IF( ln_hydrofe ) THEN
211         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2
212#if defined key_ligand
213         trn(:,:,:,jpfep) = trn(:,:,:,jpfep) + ( hydrofe(:,:,:) * fep_rath ) * rfact2
214         trn(:,:,:,jplgw) = trn(:,:,:,jplgw) + ( hydrofe(:,:,:) * 0.5 ) * rfact2
215#endif
216         !
217         IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "HYDR" ) )   &
218            &   CALL iom_put( "HYDR", hydrofe(:,:,:) * 1.e+3 * tmask(:,:,:) ) ! hydrothermal iron input
219      ENDIF
220
221      ! OA: Warning, the following part is necessary, especially with Kriest
222      ! to avoid CFL problems above the sediments
223      ! --------------------------------------------------------------------
224      DO jj = 1, jpj
225         DO ji = 1, jpi
226            ikt  = mbkt(ji,jj)
227            zdep = fse3t(ji,jj,ikt) / xstep
228            zwsbio4(ji,jj) = MIN( 0.99 * zdep, wsbio4(ji,jj,ikt) )
229            zwscal (ji,jj) = MIN( 0.99 * zdep, wscal (ji,jj,ikt) )
230            zwsbio3(ji,jj) = MIN( 0.99 * zdep, wsbio3(ji,jj,ikt) )
231#if defined key_ligand
232            zwsfep(ji,jj)  = MIN( 0.99 * zdep, wsfep(ji,jj,ikt)  )
233#endif
234         END DO
235      END DO
236
237#if ! defined key_sed
238      ! Computation of the sediment denitrification proportion: The metamodel from midlleburg (2006) is being used
239      ! Computation of the fraction of organic matter that is permanently buried from Dunne's model
240      ! -------------------------------------------------------
241      DO jj = 1, jpj
242         DO ji = 1, jpi
243           IF( tmask(ji,jj,1) == 1 ) THEN
244              ikt = mbkt(ji,jj)
245# if defined key_kriest
246              zflx =    trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)    * 1E3 * 1E6 / 1E4
247# else
248              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
249                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) )  * 1E3 * 1E6 / 1E4
250#endif
251              zflx  = LOG10( MAX( 1E-3, zflx ) )
252              zo2   = LOG10( MAX( 10. , trb(ji,jj,ikt,jpoxy) * 1E6 ) )
253              zno3  = LOG10( MAX( 1.  , trb(ji,jj,ikt,jpno3) * 1E6 * rno3 ) )
254              zdep  = LOG10( fsdepw(ji,jj,ikt+1) )
255              zdenit2d(ji,jj) = -2.2567 - 1.185 * zflx - 0.221 * zflx**2 - 0.3995 * zno3 * zo2 + 1.25 * zno3    &
256              &                + 0.4721 * zo2 - 0.0996 * zdep + 0.4256 * zflx * zo2
257              zdenit2d(ji,jj) = 10.0**( zdenit2d(ji,jj) )
258              !
259              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
260                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) ) * 1E6
261              zbureff(ji,jj) = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2
262           ENDIF
263         END DO
264      END DO 
265
266      ! Loss of biogenic silicon, Caco3 organic carbon in the sediments.
267      ! First, the total loss is computed.
268      ! The factor for calcite comes from the alkalinity effect
269      ! -------------------------------------------------------------
270      DO jj = 1, jpj
271         DO ji = 1, jpi
272            IF( tmask(ji,jj,1) == 1 ) THEN
273               ikt = mbkt(ji,jj) 
274# if defined key_kriest
275               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwscal (ji,jj)
276               zwork2(ji,jj) = trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)
277# else
278               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwsbio4(ji,jj)
279               zwork2(ji,jj) = trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj) + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) 
280# endif
281               ! For calcite, burial efficiency is made a function of saturation
282               zfactcal      = MIN( excess(ji,jj,ikt), 0.2 )
283               zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
284               zwork3(ji,jj) = trb(ji,jj,ikt,jpcal) * zwscal(ji,jj) * 2.e0 * zfactcal
285            ENDIF
286         END DO
287      END DO
288      zsumsedsi  = glob_sum( zwork1(:,:) * e1e2t(:,:) ) * r1_rday
289      zsumsedpo4 = glob_sum( zwork2(:,:) * e1e2t(:,:) ) * r1_rday
290      zsumsedcal = glob_sum( zwork3(:,:) * e1e2t(:,:) ) * r1_rday
291#endif
292
293      ! This loss is scaled at each bottom grid cell for equilibrating the total budget of silica in the ocean.
294      ! Thus, the amount of silica lost in the sediments equal the supply at the surface (dust+rivers)
295      ! ------------------------------------------------------
296#if ! defined key_sed
297      zrivsil =  1._wp - ( sumdepsi + rivdsiinput * r1_ryyss ) / ( zsumsedsi + rtrn )
298#endif
299
300      DO jj = 1, jpj
301         DO ji = 1, jpi
302            ikt  = mbkt(ji,jj)
303            zdep = xstep / fse3t(ji,jj,ikt) 
304            zws4 = zwsbio4(ji,jj) * zdep
305            zwsc = zwscal (ji,jj) * zdep
306# if defined key_kriest
307            zsiloss = trb(ji,jj,ikt,jpgsi) * zws4
308# else
309            zsiloss = trb(ji,jj,ikt,jpgsi) * zwsc
310# endif
311            zcaloss = trb(ji,jj,ikt,jpcal) * zwsc
312            !
313            tra(ji,jj,ikt,jpgsi) = tra(ji,jj,ikt,jpgsi) - zsiloss
314            tra(ji,jj,ikt,jpcal) = tra(ji,jj,ikt,jpcal) - zcaloss
315#if ! defined key_sed
316            tra(ji,jj,ikt,jpsil) = tra(ji,jj,ikt,jpsil) + zsiloss * zrivsil 
317            zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
318            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
319            zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / ( zsumsedcal + rtrn )
320            tra(ji,jj,ikt,jptal) =  tra(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0
321            tra(ji,jj,ikt,jpdic) =  tra(ji,jj,ikt,jpdic) + zcaloss * zrivalk
322            zsedcal(ji,jj) = (1.0 - zrivalk) * zcaloss / zdep
323            zsedsi (ji,jj) = (1.0 - zrivsil) * zsiloss / zdep
324#endif
325         END DO
326      END DO
327
328      DO jj = 1, jpj
329         DO ji = 1, jpi
330            ikt  = mbkt(ji,jj)
331            zdep = xstep / fse3t(ji,jj,ikt) 
332            zws4 = zwsbio4(ji,jj) * zdep
333            zws3 = zwsbio3(ji,jj) * zdep
334#if defined key_ligand
335            zwssfep = zwsfep(ji,jj) * zdep
336#endif
337            zrivno3 = 1. - zbureff(ji,jj)
338# if ! defined key_kriest
339            tra(ji,jj,ikt,jpgoc) = tra(ji,jj,ikt,jpgoc) - trb(ji,jj,ikt,jpgoc) * zws4 
340            tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3
341            tra(ji,jj,ikt,jpbfe) = tra(ji,jj,ikt,jpbfe) - trb(ji,jj,ikt,jpbfe) * zws4
342            tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3
343            zwstpoc              = trb(ji,jj,ikt,jpgoc) * zws4 + trb(ji,jj,ikt,jppoc) * zws3
344#   if defined key_ligand
345            trn(ji,jj,ikt,jpfep) = trn(ji,jj,ikt,jpfep) - trn(ji,jj,ikt,jpfep) * zwssfep
346#   endif
347# else
348            tra(ji,jj,ikt,jpnum) = tra(ji,jj,ikt,jpnum) - trb(ji,jj,ikt,jpnum) * zws4 
349            tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3
350            tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3
351            zwstpoc = trb(ji,jj,ikt,jppoc) * zws3 
352#   if defined key_ligand
353            trn(ji,jj,ikt,jpfep) = trn(ji,jj,ikt,jpfep) - trn(ji,jj,ikt,jpfep) * zwssfep
354#   endif
355# endif
356
357#if ! defined key_sed
358            ! The 0.5 factor in zpdenit and zdenitt is to avoid negative NO3 concentration after both denitrification
359            ! in the sediments and just above the sediments. Not very clever, but simpliest option.
360            zpdenit  = MIN( 0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 )
361            z1pdenit = zwstpoc * zrivno3 - zpdenit
362            zolimit = MIN( ( trb(ji,jj,ikt,jpoxy) - rtrn ) / o2ut, z1pdenit * ( 1.- nitrfac(ji,jj,ikt) ) )
363            zdenitt = MIN(  0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, z1pdenit * nitrfac(ji,jj,ikt) )
364            tra(ji,jj,ikt,jpdoc) = tra(ji,jj,ikt,jpdoc) + z1pdenit - zolimit - zdenitt
365            tra(ji,jj,ikt,jppo4) = tra(ji,jj,ikt,jppo4) + zpdenit + zolimit + zdenitt
366            tra(ji,jj,ikt,jpnh4) = tra(ji,jj,ikt,jpnh4) + zpdenit + zolimit + zdenitt
367            tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) - rdenit * (zpdenit + zdenitt)
368            tra(ji,jj,ikt,jpoxy) = tra(ji,jj,ikt,jpoxy) - zolimit * o2ut
369            tra(ji,jj,ikt,jptal) = tra(ji,jj,ikt,jptal) + rno3 * (zolimit + (1.+rdenit) * (zpdenit + zdenitt) )
370            tra(ji,jj,ikt,jpdic) = tra(ji,jj,ikt,jpdic) + zpdenit + zolimit + zdenitt
371            sdenit(ji,jj) = rdenit * zpdenit / zdep
372            zsedc(ji,jj)   = (1. - zrivno3) * zwstpoc / zdep
373#endif
374         END DO
375      END DO
376
377      ! Nitrogen fixation process
378      ! Small source iron from particulate inorganic iron
379      !-----------------------------------
380      DO jk = 1, jpkm1
381         DO jj = 1, jpj
382            DO ji = 1, jpi
383               !                      ! Potential nitrogen fixation dependant on temperature and iron
384               zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
385               IF( zlim <= 0.2 )   zlim = 0.01
386#if defined key_degrad
387               zfact = zlim * rfact2 * facvol(ji,jj,jk)
388#else
389               zfact = zlim * rfact2
390#endif
391               ztrfer = biron(ji,jj,jk)       / ( concfediaz + biron(ji,jj,jk)       )
392               ztrpo4 = trb  (ji,jj,jk,jppo4) / ( concnnh4   + trb  (ji,jj,jk,jppo4) ) 
393               zlight =  ( 1.- EXP( -etot_ndcy(ji,jj,jk) / diazolight ) ) 
394               nitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   &
395                 &         *  zfact * MIN( ztrfer, ztrpo4 ) * zlight * (1. - fr_i(ji,jj))
396               zsoufer(ji,jj,jk) = zlight * 2E-11 / (2E-11 + biron(ji,jj,jk))
397            END DO
398         END DO
399      END DO
400
401      ! Nitrogen change due to nitrogen fixation
402      ! ----------------------------------------
403      DO jk = 1, jpkm1
404         DO jj = 1, jpj
405            DO ji = 1, jpi
406               zfact = nitrpot(ji,jj,jk) * nitrfix
407               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) +             zfact
408               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3      * zfact
409               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2nit     * zfact 
410               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + concdnh4 / ( concdnh4 + trb(ji,jj,jk,jppo4) ) &
411               &                     * 0.002 * trb(ji,jj,jk,jpdoc) * xstep
412               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * xstep
413           END DO
414         END DO
415      END DO
416
417      IF( lk_iomput ) THEN
418         IF( knt == nrdttrc ) THEN
419            zfact = 1.e+3 * rfact2r * rno3  !  conversion from molC/l/kt  to molN/m3/s
420            IF( iom_use("Nfix"   ) ) CALL iom_put( "Nfix", nitrpot(:,:,:) * nitrfix * zfact * tmask(:,:,:) )  ! nitrogen fixation
421            IF( iom_use("INTNFIX") ) THEN   ! nitrogen fixation rate in ocean ( vertically integrated )
422               zwork1(:,:) = 0.
423               DO jk = 1, jpkm1
424                 zwork1(:,:) = zwork1(:,:) + nitrpot(:,:,jk) * nitrfix * zfact * fse3t(:,:,jk) * tmask(:,:,jk)
425               ENDDO
426               CALL iom_put( "INTNFIX" , zwork1 ) 
427            ENDIF
428            IF( iom_use("SedCal" ) ) CALL iom_put( "SedCal", zsedcal(:,:) * 1.e+3 )
429            IF( iom_use("SedSi" ) )  CALL iom_put( "SedSi",  zsedsi (:,:) * 1.e+3 )
430            IF( iom_use("SedC" ) )   CALL iom_put( "SedC",   zsedc  (:,:) * 1.e+3 )
431            IF( iom_use("Sdenit" ) ) CALL iom_put( "Sdenit", sdenit (:,:) * 1.e+3 * rno3 )
432         ENDIF
433      ELSE
434         IF( ln_diatrc )  &
435            &  trc2d(:,:,jp_pcs0_2d + 12) = nitrpot(:,:,1) * nitrfix * rno3 * 1.e+3 * rfact2r * fse3t(:,:,1) * tmask(:,:,1)
436      ENDIF
437      !
438      IF(ln_ctl) THEN  ! print mean trends (USEd for debugging)
439         WRITE(charout, fmt="('sed ')")
440         CALL prt_ctl_trc_info(charout)
441         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
442      ENDIF
443      !
444      CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
445      CALL wrk_dealloc( jpi, jpj, zsedcal , zsedsi, zsedc )
446      CALL wrk_dealloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
447      CALL wrk_dealloc( jpi, jpj, jpk, zsoufer )
448#if defined key_ligand
449      CALL wrk_dealloc( jpi, jpj, zwsfep )
450#endif
451      !
452      IF( nn_timing == 1 )  CALL timing_stop('p4z_sed')
453      !
454 9100  FORMAT(i8,3f10.5)
455      !
456   END SUBROUTINE p4z_sed
457
458
459   INTEGER FUNCTION p4z_sed_alloc()
460      !!----------------------------------------------------------------------
461      !!                     ***  ROUTINE p4z_sed_alloc  ***
462      !!----------------------------------------------------------------------
463      ALLOCATE( nitrpot(jpi,jpj,jpk), sdenit(jpi,jpj), STAT=p4z_sed_alloc )
464      !
465      IF( p4z_sed_alloc /= 0 )   CALL ctl_warn('p4z_sed_alloc: failed to allocate arrays')
466      !
467   END FUNCTION p4z_sed_alloc
468
469
470#else
471   !!======================================================================
472   !!  Dummy module :                                   No PISCES bio-model
473   !!======================================================================
474CONTAINS
475   SUBROUTINE p4z_sed                         ! Empty routine
476   END SUBROUTINE p4z_sed
477#endif 
478
479   !!======================================================================
480END MODULE p4zsed
Note: See TracBrowser for help on using the repository browser.