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 trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z – NEMO

source: trunk/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90 @ 6140

Last change on this file since 6140 was 6140, checked in by timgraham, 8 years ago

Merge of branches/2015/dev_merge_2015 back into trunk. Merge excludes NEMOGCM/TOOLS/OBSTOOLS/ for now due to issues with the change of file type. Will sort these manually with further commits.

Branch merged as follows:
In the working copy of branch ran:
svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk@HEAD
Small conflicts due to bug fixes applied to trunk since the dev_merge_2015 was copied. Bug fixes were applied to the branch as well so these were easy to resolve.
Branch committed at this stage

In working copy run:
svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
to switch working copy

Run:
svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2015/dev_merge_2015
to merge the branch into the trunk and then commit - no conflicts at this stage.

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