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

source: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90 @ 7256

Last change on this file since 7256 was 7256, checked in by cbricaud, 7 years ago

phaze NEMO routines in CRS branch with nemo_v3_6_STABLE branch at rev 7213 (09-09-2016) (merge -r 5519:7213 )

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