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.
p4zsbc.F90 in branches/2013/dev_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z – NEMO

source: branches/2013/dev_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90 @ 4217

Last change on this file since 4217 was 4217, checked in by poddo, 11 years ago

Solved problems with namelist parameter land/sea mask

File size: 27.9 KB
Line 
1MODULE p4zsbc
2   !!======================================================================
3   !!                         ***  MODULE p4sbc  ***
4   !! TOP :   PISCES surface boundary conditions of external inputs of nutrients
5   !!======================================================================
6   !! History :   3.5  !  2012-07 (O. Aumont, C. Ethe) Original code
7   !!----------------------------------------------------------------------
8#if defined key_pisces
9   !!----------------------------------------------------------------------
10   !!   'key_pisces'                                       PISCES bio-model
11   !!----------------------------------------------------------------------
12   !!   p4z_sbc        :  Read and interpolate time-varying nutrients fluxes
13   !!   p4z_sbc_init   :  Initialization of p4z_sbc
14   !!----------------------------------------------------------------------
15   USE oce_trc         !  shared variables between ocean and passive tracers
16   USE trc             !  passive tracers common variables
17   USE sms_pisces      !  PISCES Source Minus Sink variables
18   USE iom             !  I/O manager
19   USE fldread         !  time interpolation
20
21   IMPLICIT NONE
22   PRIVATE
23
24   PUBLIC   p4z_sbc
25   PUBLIC   p4z_sbc_init   
26
27   !! * Shared module variables
28   LOGICAL , PUBLIC  :: ln_dust     = .FALSE.    !: boolean for dust input from the atmosphere
29   LOGICAL , PUBLIC  :: ln_solub    = .FALSE.    !: boolean for variable solubility of atmospheric iron
30   LOGICAL , PUBLIC  :: ln_river    = .FALSE.    !: boolean for river input of nutrients
31   LOGICAL , PUBLIC  :: ln_ndepo    = .FALSE.    !: boolean for atmospheric deposition of N
32   LOGICAL , PUBLIC  :: ln_ironsed  = .FALSE.    !: boolean for Fe input from sediments
33   LOGICAL , PUBLIC  :: ln_hydrofe  = .FALSE.    !: boolean for Fe input from hydrothermal vents
34   LOGICAL , PUBLIC  :: ln_ironice  = .FALSE.    !: boolean for Fe input from sea ice
35   REAL(wp), PUBLIC  :: sedfeinput  = 1.E-9_wp   !: Coastal release of Iron
36   REAL(wp), PUBLIC  :: dustsolub   = 0.014_wp   !: Solubility of the dust
37   REAL(wp), PUBLIC  :: icefeinput  = 10E-9_wp   !: Iron concentration in sea ice
38   REAL(wp), PUBLIC  :: wdust       = 2.0_wp     !: Sinking speed of the dust
39   REAL(wp), PUBLIC  :: nitrfix     = 1E-7_wp    !: Nitrogen fixation rate   
40   REAL(wp), PUBLIC  :: diazolight  = 50._wp     !: Nitrogen fixation sensitivty to light
41   REAL(wp), PUBLIC  :: concfediaz  = 1.E-10_wp  !: Fe half-saturation Cste for diazotrophs
42   REAL(wp)          :: hratio      = 9.E-5_wp   !: Fe:3He ratio assumed for vent iron supply
43
44   LOGICAL , PUBLIC  :: ll_sbc
45
46   !! * Module variables
47   LOGICAL  ::  ll_solub
48
49   INTEGER , PARAMETER  :: jpriv  = 7   !: Maximum number of river input fields
50   INTEGER , PARAMETER  :: jr_dic = 1   !: index of dissolved inorganic carbon
51   INTEGER , PARAMETER  :: jr_doc = 2   !: index of dissolved organic carbon
52   INTEGER , PARAMETER  :: jr_din = 3   !: index of dissolved inorganic nitrogen
53   INTEGER , PARAMETER  :: jr_don = 4   !: index of dissolved organic nitrogen
54   INTEGER , PARAMETER  :: jr_dip = 5   !: index of dissolved inorganic phosporus
55   INTEGER , PARAMETER  :: jr_dop = 6   !: index of dissolved organic phosphorus
56   INTEGER , PARAMETER  :: jr_dsi = 7   !: index of dissolved silicate
57
58
59   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_dust      ! structure of input dust
60   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_solub      ! structure of input dust
61   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_river  ! structure of input riverdic
62   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ndepo     ! structure of input nitrogen deposition
63   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ironsed   ! structure of input iron from sediment
64   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_hydrofe   ! structure of input iron from hydrothermal vents
65
66   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
67   INTEGER  :: ntimes_dust, ntimes_riv, ntimes_ndep       ! number of time steps in a file
68   INTEGER  :: ntimes_solub, ntimes_hydro                 ! number of time steps in a file
69
70   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: dust, solub       !: dust fields
71   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdic, rivalk    !: river input fields
72   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdin, rivdip    !: river input fields
73   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdsi    !: river input fields
74   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition
75   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ironsed   !: Coastal supply of iron
76   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: hydrofe   !: Hydrothermal vent supply of iron
77
78   REAL(wp), PUBLIC :: sumdepsi, rivalkinput, rivdicinput, nitdepinput
79   REAL(wp), PUBLIC :: rivdininput, rivdipinput, rivdsiinput
80
81   REAL(wp) :: ryyss                    !: number of seconds per year
82
83   !!* Substitution
84#  include "top_substitute.h90"
85   !!----------------------------------------------------------------------
86   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
87   !! $Header:$
88   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
89   !!----------------------------------------------------------------------
90
91CONTAINS
92
93   SUBROUTINE p4z_sbc( kt )
94      !!----------------------------------------------------------------------
95      !!                  ***  routine p4z_sbc  ***
96      !!
97      !! ** purpose :   read and interpolate the external sources of nutrients
98      !!
99      !! ** method  :   read the files and interpolate the appropriate variables
100      !!
101      !! ** input   :   external netcdf files
102      !!
103      !!----------------------------------------------------------------------
104      !! * arguments
105      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
106
107      !! * local declarations
108      INTEGER  :: ji,jj 
109      REAL(wp) :: zcoef, zyyss
110      !!---------------------------------------------------------------------
111      !
112      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc')
113
114      !
115      ! Compute dust at nit000 or only if there is more than 1 time record in dust file
116      IF( ln_dust ) THEN
117         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_dust > 1 ) ) THEN
118            CALL fld_read( kt, 1, sf_dust )
119            dust(:,:) = sf_dust(1)%fnow(:,:,1)
120         ENDIF
121      ENDIF
122
123      IF( ll_solub ) THEN
124         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_solub > 1 ) ) THEN
125            CALL fld_read( kt, 1, sf_solub )
126            solub(:,:) = sf_solub(1)%fnow(:,:,1)
127         ENDIF
128      ENDIF
129
130      ! N/P and Si releases due to coastal rivers
131      ! Compute river at nit000 or only if there is more than 1 time record in river file
132      ! -----------------------------------------
133      IF( ln_river ) THEN
134         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_riv > 1 ) ) THEN
135            CALL fld_read( kt, 1, sf_river )
136            DO jj = 1, jpj
137               DO ji = 1, jpi
138                  zcoef = ryyss * cvol(ji,jj,1) 
139                  rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    &
140                     &              * 1.E3        / ( 12. * zcoef + rtrn )
141                  rivdic(ji,jj) = ( sf_river(jr_dic)%fnow(ji,jj,1) + sf_river(jr_doc)%fnow(ji,jj,1) ) &
142                     &              * 1.E3         / ( 12. * zcoef + rtrn )
143                  rivdin(ji,jj) = ( sf_river(jr_din)%fnow(ji,jj,1) + sf_river(jr_don)%fnow(ji,jj,1) ) &
144                     &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn )
145                  rivdip(ji,jj) = ( sf_river(jr_dip)%fnow(ji,jj,1) + sf_river(jr_dop)%fnow(ji,jj,1) ) &
146                     &              * 1.E3 / po4r / ( 31. * zcoef + rtrn )
147                  rivdsi(ji,jj) =   sf_river(jr_dsi)%fnow(ji,jj,1)                                    &
148                     &              * 1.E3        / ( 28.1 * zcoef + rtrn )
149               END DO
150            END DO
151         ENDIF
152      ENDIF
153
154      ! Compute N deposition at nit000 or only if there is more than 1 time record in N deposition file
155      IF( ln_ndepo ) THEN
156         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_ndep > 1 ) ) THEN
157            CALL fld_read( kt, 1, sf_ndepo )
158            DO jj = 1, jpj
159               DO ji = 1, jpi
160                  nitdep(ji,jj) = sf_ndepo(1)%fnow(ji,jj,1) / rno3 / ( 14E6 * ryyss * fse3t(ji,jj,1) + rtrn )
161               END DO
162            END DO
163         ENDIF
164      ENDIF
165      !
166      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc')
167      !
168   END SUBROUTINE p4z_sbc
169
170   SUBROUTINE p4z_sbc_init
171
172      !!----------------------------------------------------------------------
173      !!                  ***  routine p4z_sbc_init  ***
174      !!
175      !! ** purpose :   initialization of the external sources of nutrients
176      !!
177      !! ** method  :   read the files and compute the budget
178      !!                called at the first timestep (nittrc000)
179      !!
180      !! ** input   :   external netcdf files
181      !!
182      !!----------------------------------------------------------------------
183      !
184      INTEGER  :: ji, jj, jk, jm, ifpr
185      INTEGER  :: ii0, ii1, ij0, ij1
186      INTEGER  :: numdust, numsolub, numriv, numiron, numdepo, numhydro
187      INTEGER  :: ierr, ierr1, ierr2, ierr3
188      REAL(wp) :: zexpide, zdenitide, zmaskt
189      REAL(wp) :: ztimes_dust, ztimes_riv, ztimes_ndep 
190      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
191      REAL(wp), DIMENSION(:), ALLOCATABLE :: rivinput
192      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdust, zndepo, zriver, zcmask
193      !
194      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
195      TYPE(FLD_N), DIMENSION(jpriv) ::  slf_river    ! array of namelist informations on the fields to read
196      TYPE(FLD_N) ::   sn_dust, sn_solub, sn_ndepo, sn_ironsed, sn_hydrofe   ! informations about the fields to be read
197      TYPE(FLD_N) ::   sn_riverdoc, sn_riverdic, sn_riverdsi   ! informations about the fields to be read
198      TYPE(FLD_N) ::   sn_riverdin, sn_riverdon, sn_riverdip, sn_riverdop
199      !
200      NAMELIST/nampissbc/cn_dir, sn_dust, sn_solub, sn_riverdic, sn_riverdoc, sn_riverdin, sn_riverdon,     &
201        &                sn_riverdip, sn_riverdop, sn_riverdsi, sn_ndepo, sn_ironsed, sn_hydrofe, &
202        &                ln_dust, ln_solub, ln_river, ln_ndepo, ln_ironsed, ln_ironice, ln_hydrofe,    &
203        &                sedfeinput, dustsolub, icefeinput, wdust, nitrfix, diazolight, concfediaz, hratio
204      !!----------------------------------------------------------------------
205      !
206      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc_init')
207      !
208      ryyss   = nyear_len(1) * rday    ! number of seconds per year and per month
209      !
210      !                            !* set file information
211      cn_dir  = './'            ! directory in which the model is executed
212      ! ... default values (NB: frequency positive => hours, negative => months)
213      !                  !   file       ! frequency !  variable   ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! land/sea mask !
214      !                  !   name       !  (hours)  !   name      !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! filename      !
215      sn_dust     = FLD_N( 'dust'       ,    -1     ,  'dust'     ,  .true.    , .true.  ,   'yearly'  , ''       , &
216           & ''         , ''            )
217      sn_solub    = FLD_N( 'solubility' ,    -12    ,  'solub'    ,  .true.    , .true.  ,   'yearly'  , ''       , &
218           & ''         , ''            )
219      sn_riverdic = FLD_N( 'river'      ,   -12     ,  'riverdic' ,  .false.   , .true.  ,   'yearly'  , ''       , &
220           & ''         , ''            )
221      sn_riverdoc = FLD_N( 'river'      ,   -12     ,  'riverdoc' ,  .false.   , .true.  ,   'yearly'  , ''       , &
222           & ''         , ''            )
223      sn_riverdin = FLD_N( 'river'      ,   -12     ,  'riverdin' ,  .false.   , .true.  ,   'yearly'  , ''       , &
224           & ''         , ''            )
225      sn_riverdon = FLD_N( 'river'      ,   -12     ,  'riverdon' ,  .false.   , .true.  ,   'yearly'  , ''       , &
226           & ''         , ''            )
227      sn_riverdip = FLD_N( 'river'      ,   -12     ,  'riverdip' ,  .false.   , .true.  ,   'yearly'  , ''       , &
228           & ''         , ''            )
229      sn_riverdop = FLD_N( 'river'      ,   -12     ,  'riverdop' ,  .false.   , .true.  ,   'yearly'  , ''       , &
230           & ''         , ''            )
231      sn_riverdsi = FLD_N( 'river'      ,   -12     ,  'riverdsi' ,  .false.   , .true.  ,   'yearly'  , ''       , &
232           & ''         , ''            )
233      sn_ndepo    = FLD_N( 'ndeposition',   -12     ,  'ndep'     ,  .false.   , .true.  ,   'yearly'  , ''       , &
234           & ''         , ''            )
235      sn_ironsed  = FLD_N( 'ironsed'    ,   -12     ,  'bathy'    ,  .false.   , .true.  ,   'yearly'  , ''       , &
236           & ''         , ''            )
237      sn_hydrofe  = FLD_N( 'hydrofe'    ,   -12     ,  'hydro'    ,  .false.   , .true.  ,   'yearly'  , ''       , &
238           & ''         , ''            )
239
240      REWIND( numnatp )                     ! read numnatp
241      READ  ( numnatp, nampissbc )
242
243      IF(lwp) THEN
244         WRITE(numout,*) ' '
245         WRITE(numout,*) ' namelist : nampissbc '
246         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
247         WRITE(numout,*) '    dust input from the atmosphere           ln_dust     = ', ln_dust
248         WRITE(numout,*) '    Variable solubility of iron input        ln_solub    = ', ln_solub
249         WRITE(numout,*) '    river input of nutrients                 ln_river    = ', ln_river
250         WRITE(numout,*) '    atmospheric deposition of n              ln_ndepo    = ', ln_ndepo
251         WRITE(numout,*) '    Fe input from sediments                  ln_ironsed  = ', ln_ironsed
252         WRITE(numout,*) '    Fe input from seaice                     ln_ironice  = ', ln_ironice
253         WRITE(numout,*) '    fe input from hydrothermal vents         ln_hydrofe  = ', ln_hydrofe
254         WRITE(numout,*) '    coastal release of iron                  sedfeinput  = ', sedfeinput
255         WRITE(numout,*) '    solubility of the dust                   dustsolub   = ', dustsolub
256         WRITE(numout,*) '    Iron concentration in sea ice            icefeinput  = ', icefeinput
257         WRITE(numout,*) '    sinking speed of the dust                wdust       = ', wdust
258         WRITE(numout,*) '    nitrogen fixation rate                   nitrfix     = ', nitrfix
259         WRITE(numout,*) '    nitrogen fixation sensitivty to light    diazolight  = ', diazolight
260         WRITE(numout,*) '    fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
261         WRITE(numout,*) '    Fe to 3He ratio assumed for vent iron supply hratio  = ', hratio
262      END IF
263
264      IF( ln_dust .OR. ln_river .OR. ln_ndepo ) THEN  ;  ll_sbc = .TRUE.
265      ELSE                                            ;  ll_sbc = .FALSE.
266      ENDIF
267
268      IF( ln_dust .AND. ln_solub ) THEN               ;  ll_solub = .TRUE.
269      ELSE                                            ;  ll_solub = .FALSE.
270      ENDIF
271
272      ! dust input from the atmosphere
273      ! ------------------------------
274      IF( ln_dust ) THEN 
275         !
276         IF(lwp) WRITE(numout,*) '    initialize dust input from atmosphere '
277         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
278         !
279         ALLOCATE( dust(jpi,jpj) )    ! allocation
280         !
281         ALLOCATE( sf_dust(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
282         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_dust structure' )
283         !
284         CALL fld_fill( sf_dust, (/ sn_dust /), cn_dir, 'p4z_sed_init', 'Atmospheric dust deposition', 'nampissed' )
285                                   ALLOCATE( sf_dust(1)%fnow(jpi,jpj,1)   )
286         IF( sn_dust%ln_tint )     ALLOCATE( sf_dust(1)%fdta(jpi,jpj,1,2) )
287         !
288         IF( Agrif_Root() ) THEN   !  Only on the master grid
289            ! Get total input dust ; need to compute total atmospheric supply of Si in a year
290            CALL iom_open (  TRIM( sn_dust%clname ) , numdust )
291            CALL iom_gettime( numdust, zsteps, kntime=ntimes_dust)  ! get number of record in file
292            ALLOCATE( zdust(jpi,jpj,ntimes_dust) )
293            DO jm = 1, ntimes_dust
294               CALL iom_get( numdust, jpdom_data, TRIM( sn_dust%clvar ), zdust(:,:,jm), jm )
295            END DO
296            CALL iom_close( numdust )
297            ztimes_dust = 1._wp / FLOAT( ntimes_dust ) 
298            sumdepsi = 0.e0
299            DO jm = 1, ntimes_dust
300               sumdepsi = sumdepsi + glob_sum( zdust(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_dust )
301            ENDDO
302            sumdepsi = sumdepsi / ( nyear_len(1) * rday ) * 12. * 8.8 * 0.075 / 28.1 
303            DEALLOCATE( zdust)
304         ENDIF
305      ELSE
306         sumdepsi  = 0._wp
307      END IF
308
309      ! Solubility of dust deposition of iron
310      ! Only if ln_dust and ln_solubility set to true (ll_solub = .true.)
311      ! -----------------------------------------------------------------
312      IF( ll_solub ) THEN
313         !
314         IF(lwp) WRITE(numout,*) '    initialize variable solubility of Fe '
315         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
316         !
317         ALLOCATE( solub(jpi,jpj) )    ! allocation
318         !
319         ALLOCATE( sf_solub(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
320         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_solub structure' )
321         !
322         CALL fld_fill( sf_solub, (/ sn_solub /), cn_dir, 'p4z_sed_init', 'Solubility of atm. iron ', 'nampissed' )
323                                   ALLOCATE( sf_solub(1)%fnow(jpi,jpj,1)   )
324         IF( sn_solub%ln_tint )    ALLOCATE( sf_solub(1)%fdta(jpi,jpj,1,2) )
325         ! get number of record in file
326         CALL iom_open (  TRIM( sn_solub%clname ) , numsolub )
327         CALL iom_gettime( numsolub, zsteps, kntime=ntimes_solub)  ! get number of record in file
328         CALL iom_close( numsolub )
329      ENDIF
330
331      ! nutrient input from rivers
332      ! --------------------------
333      IF( ln_river ) THEN
334         !
335         slf_river(jr_dic) = sn_riverdic  ;  slf_river(jr_doc) = sn_riverdoc  ;  slf_river(jr_din) = sn_riverdin 
336         slf_river(jr_don) = sn_riverdon  ;  slf_river(jr_dip) = sn_riverdip  ;  slf_river(jr_dop) = sn_riverdop
337         slf_river(jr_dsi) = sn_riverdsi 
338         !
339         ALLOCATE( rivdic(jpi,jpj), rivalk(jpi,jpj), rivdin(jpi,jpj), rivdip(jpi,jpj), rivdsi(jpi,jpj) ) 
340         !
341         ALLOCATE( sf_river(jpriv), rivinput(jpriv), STAT=ierr1 )           !* allocate and fill sf_river (forcing structure) with sn_river_
342         rivinput(:) = 0.0
343
344         IF( ierr1 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_irver structure' )
345         !
346         CALL fld_fill( sf_river, slf_river, cn_dir, 'p4z_sed_init', 'Input from river ', 'nampissed' )
347         DO ifpr = 1, jpriv
348                                          ALLOCATE( sf_river(ifpr)%fnow(jpi,jpj,1  ) )
349            IF( slf_river(ifpr)%ln_tint ) ALLOCATE( sf_river(ifpr)%fdta(jpi,jpj,1,2) )
350         END DO
351         IF( Agrif_Root() ) THEN   !  Only on the master grid
352            ! Get total input rivers ; need to compute total river supply in a year
353            DO ifpr = 1, jpriv
354               CALL iom_open ( TRIM( slf_river(ifpr)%clname ), numriv )
355               CALL iom_gettime( numriv, zsteps, kntime=ntimes_riv)
356               ALLOCATE( zriver(jpi,jpj,ntimes_riv) )
357               DO jm = 1, ntimes_riv
358                  CALL iom_get( numriv, jpdom_data, TRIM( slf_river(ifpr)%clvar ), zriver(:,:,jm), jm )
359               END DO
360               CALL iom_close( numriv )
361               ztimes_riv = 1._wp / FLOAT(ntimes_riv) 
362               DO jm = 1, ntimes_riv
363                  rivinput(ifpr) = rivinput(ifpr) + glob_sum( zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
364               END DO
365               DEALLOCATE( zriver)
366            END DO
367            ! N/P and Si releases due to coastal rivers
368            ! -----------------------------------------
369            rivdicinput = (rivinput(jr_dic) + rivinput(jr_doc) ) * 1E3 / 12._wp
370            rivdininput = (rivinput(jr_din) + rivinput(jr_don) ) * 1E3 / rno3 / 14._wp
371            rivdipinput = (rivinput(jr_dip) + rivinput(jr_dop) ) * 1E3 / po4r / 31._wp
372            rivdsiinput = rivinput(jr_dsi) * 1E3 / 28.1_wp
373            rivalkinput = rivinput(jr_dic) * 1E3 / 12._wp
374            !
375         ENDIF
376      ELSE
377         rivdicinput = 0._wp
378         rivdininput = 0._wp
379         rivdipinput = 0._wp
380         rivdsiinput = 0._wp
381         rivalkinput = 0._wp
382      END IF 
383
384      ! nutrient input from dust
385      ! ------------------------
386      IF( ln_ndepo ) THEN
387         !
388         IF(lwp) WRITE(numout,*) '    initialize the nutrient input by dust from ndeposition.orca.nc'
389         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
390         !
391         ALLOCATE( nitdep(jpi,jpj) )    ! allocation
392         !
393         ALLOCATE( sf_ndepo(1), STAT=ierr3 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
394         IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_ndepo structure' )
395         !
396         CALL fld_fill( sf_ndepo, (/ sn_ndepo /), cn_dir, 'p4z_sed_init', 'Nutrient atmospheric depositon ', 'nampissed' )
397                                   ALLOCATE( sf_ndepo(1)%fnow(jpi,jpj,1)   )
398         IF( sn_ndepo%ln_tint )    ALLOCATE( sf_ndepo(1)%fdta(jpi,jpj,1,2) )
399         !
400         IF( Agrif_Root() ) THEN   !  Only on the master grid
401            ! Get total input dust ; need to compute total atmospheric supply of N in a year
402            CALL iom_open ( TRIM( sn_ndepo%clname ), numdepo )
403            CALL iom_gettime( numdepo, zsteps, kntime=ntimes_ndep)
404            ALLOCATE( zndepo(jpi,jpj,ntimes_ndep) )
405            DO jm = 1, ntimes_ndep
406               CALL iom_get( numdepo, jpdom_data, TRIM( sn_ndepo%clvar ), zndepo(:,:,jm), jm )
407            END DO
408            CALL iom_close( numdepo )
409            ztimes_ndep = 1._wp / FLOAT( ntimes_ndep ) 
410            nitdepinput = 0._wp
411            DO jm = 1, ntimes_ndep
412              nitdepinput = nitdepinput + glob_sum( zndepo(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_ndep )
413            ENDDO
414            nitdepinput = nitdepinput / rno3 / 14E6 
415            DEALLOCATE( zndepo)
416         ENDIF
417      ELSE
418         nitdepinput = 0._wp
419      ENDIF
420
421      ! coastal and island masks
422      ! ------------------------
423      IF( ln_ironsed ) THEN     
424         !
425         IF(lwp) WRITE(numout,*) '    computation of an island mask to enhance coastal supply of iron'
426         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
427         !
428         ALLOCATE( ironsed(jpi,jpj,jpk) )    ! allocation
429         !
430         CALL iom_open ( TRIM( sn_ironsed%clname ), numiron )
431         ALLOCATE( zcmask(jpi,jpj,jpk) )
432         CALL iom_get  ( numiron, jpdom_data, TRIM( sn_ironsed%clvar ), zcmask(:,:,:), 1 )
433         CALL iom_close( numiron )
434         !
435         DO jk = 1, 5
436            DO jj = 2, jpjm1
437               DO ji = fs_2, fs_jpim1
438                  IF( tmask(ji,jj,jk) /= 0. ) THEN
439                     zmaskt = tmask(ji+1,jj,jk) * tmask(ji-1,jj,jk) * tmask(ji,jj+1,jk)    &
440                        &                       * tmask(ji,jj-1,jk) * tmask(ji,jj,jk+1)
441                     IF( zmaskt == 0. )   zcmask(ji,jj,jk ) = MAX( 0.1, zcmask(ji,jj,jk) ) 
442                  END IF
443               END DO
444            END DO
445         END DO
446         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 ) THEN
447            ii0 = 176   ;   ii1 =  176        ! Southern Island : Kerguelen
448            ij0 =  37   ;   ij1 =   37  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
449            !
450            ii0 = 119   ;   ii1 =  119        ! South Georgia
451            ij0 =  29   ;   ij1 =   29  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
452            !
453            ii0 = 111   ;   ii1 =  111        ! Falklands
454            ij0 =  35   ;   ij1 =   35  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
455            !
456            ii0 = 168   ;   ii1 =  168        ! Crozet
457            ij0 =  40   ;   ij1 =   40  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
458            !
459            ii0 = 119   ;   ii1 =  119        ! South Orkney
460            ij0 =  28   ;   ij1 =   28  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
461            !
462            ii0 = 140   ;   ii1 =  140        ! Bouvet Island
463            ij0 =  33   ;   ij1 =   33  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
464            !
465            ii0 = 178   ;   ii1 =  178        ! Prince edwards
466            ij0 =  34   ;   ij1 =   34  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
467            !
468            ii0 =  43   ;   ii1 =   43        ! Balleny islands
469            ij0 =  21   ;   ij1 =   21  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
470         ENDIF
471         CALL lbc_lnk( zcmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
472         DO jk = 1, jpk
473            DO jj = 1, jpj
474               DO ji = 1, jpi
475                  zexpide   = MIN( 8.,( fsdept(ji,jj,jk) / 500. )**(-1.5) )
476                  zdenitide = -0.9543 + 0.7662 * LOG( zexpide ) - 0.235 * LOG( zexpide )**2
477                  zcmask(ji,jj,jk) = zcmask(ji,jj,jk) * MIN( 1., EXP( zdenitide ) / 0.5 )
478               END DO
479            END DO
480         END DO
481         ! Coastal supply of iron
482         ! -------------------------
483         ironsed(:,:,jpk) = 0._wp
484         DO jk = 1, jpkm1
485            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( fse3t(:,:,jk) * rday )
486         END DO
487         DEALLOCATE( zcmask)
488      ENDIF
489      !
490      ! Iron from Hydrothermal vents
491      ! ------------------------
492      IF( ln_hydrofe ) THEN
493         !
494         IF(lwp) WRITE(numout,*) '    Input of iron from hydrothermal vents '
495         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
496         !
497         ALLOCATE( hydrofe(jpi,jpj,jpk) )    ! allocation
498         !
499         CALL iom_open ( TRIM( sn_hydrofe%clname ), numhydro )
500         CALL iom_get  ( numhydro, jpdom_data, TRIM( sn_hydrofe%clvar ), hydrofe(:,:,:), 1 )
501         CALL iom_close( numhydro )
502         !
503         hydrofe(:,:,:) = ( hydrofe(:,:,:) * hratio ) / ( cvol(:,:,:) * ryyss + rtrn ) / fse3t(:,:,:)
504         !
505      ENDIF
506      !
507      IF( ll_sbc ) CALL p4z_sbc( nit000 ) 
508      !
509      IF(lwp) THEN
510         WRITE(numout,*)
511         WRITE(numout,*) '    Total input of elements from river supply'
512         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
513         WRITE(numout,*) '    N Supply   : ', rivdininput*rno3*1E3/1E12*14.,' TgN/yr'
514         WRITE(numout,*) '    Si Supply  : ', rivdsiinput*1E3/1E12*28.1,' TgSi/yr'
515         WRITE(numout,*) '    P Supply   : ', rivdipinput*1E3*po4r/1E12*31.,' TgP/yr'
516         WRITE(numout,*) '    Alk Supply : ', rivalkinput*1E3/1E12,' Teq/yr'
517         WRITE(numout,*) '    DIC Supply : ', rivdicinput*1E3*12./1E12,'TgC/yr'
518         WRITE(numout,*) 
519         WRITE(numout,*) '    Total input of elements from atmospheric supply'
520         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
521         WRITE(numout,*) '    N Supply   : ', nitdepinput*rno3*1E3/1E12*14.,' TgN/yr'
522         WRITE(numout,*) 
523      ENDIF
524      !
525      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc_init')
526      !
527   END SUBROUTINE p4z_sbc_init
528
529#else
530   !!======================================================================
531   !!  Dummy module :                                   No PISCES bio-model
532   !!======================================================================
533CONTAINS
534   SUBROUTINE p4z_sbc                         ! Empty routine
535   END SUBROUTINE p4z_sbc
536#endif 
537
538   !!======================================================================
539END MODULE  p4zsbc
Note: See TracBrowser for help on using the repository browser.