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

source: branches/2015/dev_r5204_CNRS_PISCES_dcy/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90 @ 5315

Last change on this file since 5315 was 5315, checked in by cetlod, 9 years ago

dev_r5204_CNRS_PISCES_dcy : An adjustment (isrow) is made to the hard-wired

File size: 29.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     !: boolean for dust input from the atmosphere
29   LOGICAL , PUBLIC  :: ln_solub    !: boolean for variable solubility of atmospheric iron
30   LOGICAL , PUBLIC  :: ln_river    !: boolean for river input of nutrients
31   LOGICAL , PUBLIC  :: ln_ndepo    !: boolean for atmospheric deposition of N
32   LOGICAL , PUBLIC  :: ln_ironsed  !: boolean for Fe input from sediments
33   LOGICAL , PUBLIC  :: ln_hydrofe  !: boolean for Fe input from hydrothermal vents
34   LOGICAL , PUBLIC  :: ln_ironice  !: boolean for Fe input from sea ice
35   REAL(wp), PUBLIC  :: sedfeinput  !: Coastal release of Iron
36   REAL(wp), PUBLIC  :: dustsolub   !: Solubility of the dust
37   REAL(wp), PUBLIC  :: mfrac       !: Mineral Content of the dust
38   REAL(wp), PUBLIC  :: icefeinput  !: Iron concentration in sea ice
39   REAL(wp), PUBLIC  :: wdust       !: Sinking speed of the dust
40   REAL(wp), PUBLIC  :: nitrfix     !: Nitrogen fixation rate   
41   REAL(wp), PUBLIC  :: diazolight  !: Nitrogen fixation sensitivty to light
42   REAL(wp), PUBLIC  :: concfediaz  !: Fe half-saturation Cste for diazotrophs
43   REAL(wp)          :: hratio      !: Fe:3He ratio assumed for vent iron supply
44
45   LOGICAL , PUBLIC  :: ll_sbc
46
47   !! * Module variables
48   LOGICAL  ::  ll_solub
49
50   INTEGER , PARAMETER  :: jpriv  = 7   !: Maximum number of river input fields
51   INTEGER , PARAMETER  :: jr_dic = 1   !: index of dissolved inorganic carbon
52   INTEGER , PARAMETER  :: jr_doc = 2   !: index of dissolved organic carbon
53   INTEGER , PARAMETER  :: jr_din = 3   !: index of dissolved inorganic nitrogen
54   INTEGER , PARAMETER  :: jr_don = 4   !: index of dissolved organic nitrogen
55   INTEGER , PARAMETER  :: jr_dip = 5   !: index of dissolved inorganic phosporus
56   INTEGER , PARAMETER  :: jr_dop = 6   !: index of dissolved organic phosphorus
57   INTEGER , PARAMETER  :: jr_dsi = 7   !: index of dissolved silicate
58
59
60   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_dust      ! structure of input dust
61   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_solub      ! structure of input dust
62   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_river  ! structure of input riverdic
63   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ndepo     ! structure of input nitrogen deposition
64   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ironsed   ! structure of input iron from sediment
65   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_hydrofe   ! structure of input iron from hydrothermal vents
66
67   INTEGER , PARAMETER :: nbtimes = 365  !: maximum number of times record in a file
68   INTEGER  :: ntimes_dust, ntimes_riv, ntimes_ndep       ! number of time steps in a file
69   INTEGER  :: ntimes_solub, ntimes_hydro                 ! number of time steps in a file
70
71   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: dust, solub       !: dust fields
72   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdic, rivalk    !: river input fields
73   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdin, rivdip    !: river input fields
74   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdsi    !: river input fields
75   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition
76   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ironsed   !: Coastal supply of iron
77   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: hydrofe   !: Hydrothermal vent supply of iron
78
79   REAL(wp), PUBLIC :: sumdepsi, rivalkinput, rivdicinput, nitdepinput
80   REAL(wp), PUBLIC :: rivdininput, rivdipinput, rivdsiinput
81
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 * e1e2t(ji,jj) * h_rnf(ji,jj) 
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      INTEGER  :: ios                 ! Local integer output status for namelist read
189      INTEGER  :: ik50                !  last level where depth less than 50 m
190      INTEGER  ::   isrow             ! index for ORCA1 starting row
191      REAL(wp) :: zexpide, zdenitide, zmaskt
192      REAL(wp) :: ztimes_dust, ztimes_riv, ztimes_ndep 
193      REAL(wp), DIMENSION(nbtimes) :: zsteps                 ! times records
194      REAL(wp), DIMENSION(:), ALLOCATABLE :: rivinput
195      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdust, zndepo, zriver, zcmask
196      !
197      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
198      TYPE(FLD_N), DIMENSION(jpriv) ::  slf_river    ! array of namelist informations on the fields to read
199      TYPE(FLD_N) ::   sn_dust, sn_solub, sn_ndepo, sn_ironsed, sn_hydrofe   ! informations about the fields to be read
200      TYPE(FLD_N) ::   sn_riverdoc, sn_riverdic, sn_riverdsi   ! informations about the fields to be read
201      TYPE(FLD_N) ::   sn_riverdin, sn_riverdon, sn_riverdip, sn_riverdop
202      !
203      NAMELIST/nampissbc/cn_dir, sn_dust, sn_solub, sn_riverdic, sn_riverdoc, sn_riverdin, sn_riverdon,     &
204        &                sn_riverdip, sn_riverdop, sn_riverdsi, sn_ndepo, sn_ironsed, sn_hydrofe, &
205        &                ln_dust, ln_solub, ln_river, ln_ndepo, ln_ironsed, ln_ironice, ln_hydrofe,    &
206        &                sedfeinput, dustsolub, icefeinput, wdust, mfrac, nitrfix, diazolight, concfediaz, hratio
207      !!----------------------------------------------------------------------
208      !
209      IF( nn_timing == 1 )  CALL timing_start('p4z_sbc_init')
210      !
211      !                            !* set file information
212      REWIND( numnatp_ref )              ! Namelist nampissbc in reference namelist : Pisces external sources of nutrients
213      READ  ( numnatp_ref, nampissbc, IOSTAT = ios, ERR = 901)
214901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampissbc in reference namelist', lwp )
215
216      REWIND( numnatp_cfg )              ! Namelist nampissbc in configuration namelist : Pisces external sources of nutrients
217      READ  ( numnatp_cfg, nampissbc, IOSTAT = ios, ERR = 902 )
218902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampissbc in configuration namelist', lwp )
219      IF(lwm) WRITE ( numonp, nampissbc )
220
221      IF(lwp) THEN
222         WRITE(numout,*) ' '
223         WRITE(numout,*) ' namelist : nampissbc '
224         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~ '
225         WRITE(numout,*) '    dust input from the atmosphere           ln_dust     = ', ln_dust
226         WRITE(numout,*) '    Variable solubility of iron input        ln_solub    = ', ln_solub
227         WRITE(numout,*) '    river input of nutrients                 ln_river    = ', ln_river
228         WRITE(numout,*) '    atmospheric deposition of n              ln_ndepo    = ', ln_ndepo
229         WRITE(numout,*) '    Fe input from sediments                  ln_ironsed  = ', ln_ironsed
230         WRITE(numout,*) '    Fe input from seaice                     ln_ironice  = ', ln_ironice
231         WRITE(numout,*) '    fe input from hydrothermal vents         ln_hydrofe  = ', ln_hydrofe
232         WRITE(numout,*) '    coastal release of iron                  sedfeinput  = ', sedfeinput
233         WRITE(numout,*) '    solubility of the dust                   dustsolub   = ', dustsolub
234         WRITE(numout,*) '    Mineral Fe content of the dust           mfrac       = ', mfrac
235         WRITE(numout,*) '    Iron concentration in sea ice            icefeinput  = ', icefeinput
236         WRITE(numout,*) '    sinking speed of the dust                wdust       = ', wdust
237         WRITE(numout,*) '    nitrogen fixation rate                   nitrfix     = ', nitrfix
238         WRITE(numout,*) '    nitrogen fixation sensitivty to light    diazolight  = ', diazolight
239         WRITE(numout,*) '    fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
240         WRITE(numout,*) '    Fe to 3He ratio assumed for vent iron supply hratio  = ', hratio
241      END IF
242
243      IF( ln_dust .OR. ln_river .OR. ln_ndepo ) THEN  ;  ll_sbc = .TRUE.
244      ELSE                                            ;  ll_sbc = .FALSE.
245      ENDIF
246
247      IF( ln_dust .AND. ln_solub ) THEN               ;  ll_solub = .TRUE.
248      ELSE                                            ;  ll_solub = .FALSE.
249      ENDIF
250
251      ! set the number of level over which river runoffs are applied
252      ! online configuration : computed in sbcrnf
253      IF( lk_offline ) THEN
254        nk_rnf(:,:) = 1
255        h_rnf (:,:) = fsdept(:,:,1)
256      ENDIF
257
258      ! dust input from the atmosphere
259      ! ------------------------------
260      IF( ln_dust ) THEN 
261         !
262         IF(lwp) WRITE(numout,*) '    initialize dust input from atmosphere '
263         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
264         !
265         ALLOCATE( dust(jpi,jpj) )    ! allocation
266         !
267         ALLOCATE( sf_dust(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
268         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_dust structure' )
269         !
270         CALL fld_fill( sf_dust, (/ sn_dust /), cn_dir, 'p4z_sed_init', 'Atmospheric dust deposition', 'nampissed' )
271                                   ALLOCATE( sf_dust(1)%fnow(jpi,jpj,1)   )
272         IF( sn_dust%ln_tint )     ALLOCATE( sf_dust(1)%fdta(jpi,jpj,1,2) )
273         !
274         IF( Agrif_Root() ) THEN   !  Only on the master grid
275            ! Get total input dust ; need to compute total atmospheric supply of Si in a year
276            CALL iom_open (  TRIM( sn_dust%clname ) , numdust )
277            CALL iom_gettime( numdust, zsteps, kntime=ntimes_dust)  ! get number of record in file
278            ALLOCATE( zdust(jpi,jpj,ntimes_dust) )
279            DO jm = 1, ntimes_dust
280               CALL iom_get( numdust, jpdom_data, TRIM( sn_dust%clvar ), zdust(:,:,jm), jm )
281            END DO
282            CALL iom_close( numdust )
283            ztimes_dust = 1._wp / FLOAT( ntimes_dust ) 
284            sumdepsi = 0.e0
285            DO jm = 1, ntimes_dust
286               sumdepsi = sumdepsi + glob_sum( zdust(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_dust )
287            ENDDO
288            sumdepsi = sumdepsi / ( nyear_len(1) * rday ) * 12. * 8.8 * 0.075 * mfrac / 28.1 
289            DEALLOCATE( zdust)
290         ENDIF
291      ELSE
292         sumdepsi  = 0._wp
293      END IF
294
295      ! Solubility of dust deposition of iron
296      ! Only if ln_dust and ln_solubility set to true (ll_solub = .true.)
297      ! -----------------------------------------------------------------
298      IF( ll_solub ) THEN
299         !
300         IF(lwp) WRITE(numout,*) '    initialize variable solubility of Fe '
301         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
302         !
303         ALLOCATE( solub(jpi,jpj) )    ! allocation
304         !
305         ALLOCATE( sf_solub(1), STAT=ierr )           !* allocate and fill sf_sst (forcing structure) with sn_sst
306         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_solub structure' )
307         !
308         CALL fld_fill( sf_solub, (/ sn_solub /), cn_dir, 'p4z_sed_init', 'Solubility of atm. iron ', 'nampissed' )
309                                   ALLOCATE( sf_solub(1)%fnow(jpi,jpj,1)   )
310         IF( sn_solub%ln_tint )    ALLOCATE( sf_solub(1)%fdta(jpi,jpj,1,2) )
311         ! get number of record in file
312         CALL iom_open (  TRIM( sn_solub%clname ) , numsolub )
313         CALL iom_gettime( numsolub, zsteps, kntime=ntimes_solub)  ! get number of record in file
314         CALL iom_close( numsolub )
315      ENDIF
316
317      ! nutrient input from rivers
318      ! --------------------------
319      IF( ln_river ) THEN
320         !
321         slf_river(jr_dic) = sn_riverdic  ;  slf_river(jr_doc) = sn_riverdoc  ;  slf_river(jr_din) = sn_riverdin 
322         slf_river(jr_don) = sn_riverdon  ;  slf_river(jr_dip) = sn_riverdip  ;  slf_river(jr_dop) = sn_riverdop
323         slf_river(jr_dsi) = sn_riverdsi 
324         !
325         ALLOCATE( rivdic(jpi,jpj), rivalk(jpi,jpj), rivdin(jpi,jpj), rivdip(jpi,jpj), rivdsi(jpi,jpj) ) 
326         !
327         ALLOCATE( sf_river(jpriv), rivinput(jpriv), STAT=ierr1 )           !* allocate and fill sf_river (forcing structure) with sn_river_
328         rivinput(:) = 0.0
329
330         IF( ierr1 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_irver structure' )
331         !
332         CALL fld_fill( sf_river, slf_river, cn_dir, 'p4z_sed_init', 'Input from river ', 'nampissed' )
333         DO ifpr = 1, jpriv
334                                          ALLOCATE( sf_river(ifpr)%fnow(jpi,jpj,1  ) )
335            IF( slf_river(ifpr)%ln_tint ) ALLOCATE( sf_river(ifpr)%fdta(jpi,jpj,1,2) )
336         END DO
337         IF( Agrif_Root() ) THEN   !  Only on the master grid
338            ! Get total input rivers ; need to compute total river supply in a year
339            DO ifpr = 1, jpriv
340               CALL iom_open ( TRIM( slf_river(ifpr)%clname ), numriv )
341               CALL iom_gettime( numriv, zsteps, kntime=ntimes_riv)
342               ALLOCATE( zriver(jpi,jpj,ntimes_riv) )
343               DO jm = 1, ntimes_riv
344                  CALL iom_get( numriv, jpdom_data, TRIM( slf_river(ifpr)%clvar ), zriver(:,:,jm), jm )
345               END DO
346               CALL iom_close( numriv )
347               ztimes_riv = 1._wp / FLOAT(ntimes_riv) 
348               DO jm = 1, ntimes_riv
349                  rivinput(ifpr) = rivinput(ifpr) + glob_sum( zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
350               END DO
351               DEALLOCATE( zriver)
352            END DO
353            ! N/P and Si releases due to coastal rivers
354            ! -----------------------------------------
355            rivdicinput = (rivinput(jr_dic) + rivinput(jr_doc) ) * 1E3 / 12._wp
356            rivdininput = (rivinput(jr_din) + rivinput(jr_don) ) * 1E3 / rno3 / 14._wp
357            rivdipinput = (rivinput(jr_dip) + rivinput(jr_dop) ) * 1E3 / po4r / 31._wp
358            rivdsiinput = rivinput(jr_dsi) * 1E3 / 28.1_wp
359            rivalkinput = rivinput(jr_dic) * 1E3 / 12._wp
360            !
361         ENDIF
362      ELSE
363         rivdicinput = 0._wp
364         rivdininput = 0._wp
365         rivdipinput = 0._wp
366         rivdsiinput = 0._wp
367         rivalkinput = 0._wp
368      END IF 
369      ! nutrient input from dust
370      ! ------------------------
371      IF( ln_ndepo ) THEN
372         !
373         IF(lwp) WRITE(numout,*) '    initialize the nutrient input by dust from ndeposition.orca.nc'
374         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
375         !
376         ALLOCATE( nitdep(jpi,jpj) )    ! allocation
377         !
378         ALLOCATE( sf_ndepo(1), STAT=ierr3 )           !* allocate and fill sf_sst (forcing structure) with sn_sst
379         IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'p4z_sed_init: unable to allocate sf_ndepo structure' )
380         !
381         CALL fld_fill( sf_ndepo, (/ sn_ndepo /), cn_dir, 'p4z_sed_init', 'Nutrient atmospheric depositon ', 'nampissed' )
382                                   ALLOCATE( sf_ndepo(1)%fnow(jpi,jpj,1)   )
383         IF( sn_ndepo%ln_tint )    ALLOCATE( sf_ndepo(1)%fdta(jpi,jpj,1,2) )
384         !
385         IF( Agrif_Root() ) THEN   !  Only on the master grid
386            ! Get total input dust ; need to compute total atmospheric supply of N in a year
387            CALL iom_open ( TRIM( sn_ndepo%clname ), numdepo )
388            CALL iom_gettime( numdepo, zsteps, kntime=ntimes_ndep)
389            ALLOCATE( zndepo(jpi,jpj,ntimes_ndep) )
390            DO jm = 1, ntimes_ndep
391               CALL iom_get( numdepo, jpdom_data, TRIM( sn_ndepo%clvar ), zndepo(:,:,jm), jm )
392            END DO
393            CALL iom_close( numdepo )
394            ztimes_ndep = 1._wp / FLOAT( ntimes_ndep ) 
395            nitdepinput = 0._wp
396            DO jm = 1, ntimes_ndep
397              nitdepinput = nitdepinput + glob_sum( zndepo(:,:,jm) * e1e2t(:,:) * tmask(:,:,1) * ztimes_ndep )
398            ENDDO
399            nitdepinput = nitdepinput / rno3 / 14E6 
400            DEALLOCATE( zndepo)
401         ENDIF
402      ELSE
403         nitdepinput = 0._wp
404      ENDIF
405
406      ! coastal and island masks
407      ! ------------------------
408      IF( ln_ironsed ) THEN     
409         !
410         IF(lwp) WRITE(numout,*) '    computation of an island mask to enhance coastal supply of iron'
411         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
412         !
413         ALLOCATE( ironsed(jpi,jpj,jpk) )    ! allocation
414         !
415         CALL iom_open ( TRIM( sn_ironsed%clname ), numiron )
416         ALLOCATE( zcmask(jpi,jpj,jpk) )
417         CALL iom_get  ( numiron, jpdom_data, TRIM( sn_ironsed%clvar ), zcmask(:,:,:), 1 )
418         CALL iom_close( numiron )
419         !
420         ik50 = 5        !  last level where depth less than 50 m
421         DO jk = jpkm1, 1, -1
422            IF( gdept_1d(jk) > 50. )  ik50 = jk - 1
423         END DO
424         IF (lwp) WRITE(numout,*)
425         IF (lwp) WRITE(numout,*) ' Level corresponding to 50m depth ',  ik50,' ', gdept_1d(ik50+1)
426         IF (lwp) WRITE(numout,*)
427         DO jk = 1, ik50
428            DO jj = 2, jpjm1
429               DO ji = fs_2, fs_jpim1
430                  IF( tmask(ji,jj,jk) /= 0. ) THEN
431                     zmaskt = tmask(ji+1,jj,jk) * tmask(ji-1,jj,jk) * tmask(ji,jj+1,jk)    &
432                        &                       * tmask(ji,jj-1,jk) * tmask(ji,jj,jk+1)
433                     IF( zmaskt == 0. )   zcmask(ji,jj,jk ) = MAX( 0.1, zcmask(ji,jj,jk) ) 
434                  END IF
435               END DO
436            END DO
437         END DO
438         IF( cp_cfg == 'orca' ) THEN
439            IF( jp_cfg == 2 ) THEN
440               ii0 = 176   ;   ii1 =  176        ! Southern Island : Kerguelen
441               ij0 =  37   ;   ij1 =   37  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
442               !
443               ii0 = 119   ;   ii1 =  119        ! South Georgia
444               ij0 =  29   ;   ij1 =   29  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
445               !
446               ii0 = 111   ;   ii1 =  111        ! Falklands
447               ij0 =  35   ;   ij1 =   35  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
448               !
449               ii0 = 168   ;   ii1 =  168        ! Crozet
450               ij0 =  40   ;   ij1 =   40  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
451               !
452               ii0 = 119   ;   ii1 =  119        ! South Orkney
453               ij0 =  28   ;   ij1 =   28  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
454               !
455               ii0 = 140   ;   ii1 =  140        ! Bouvet Island
456               ij0 =  33   ;   ij1 =   33  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
457               !
458               ii0 = 178   ;   ii1 =  178        ! Prince edwards
459               ij0 =  34   ;   ij1 =   34  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
460               !
461               ii0 =  43   ;   ii1 =   43        ! Balleny islands
462               ij0 =  21   ;   ij1 =   21  ;   zcmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  0.3_wp 
463               !
464            ELSE IF( jp_cfg == 1 ) THEN
465               !
466               ! This dirty section will be suppressed by simplification process: all this will come back in input files
467               ! Currently these hard-wired indices relate to the original (pre-v3.6) configuration
468               ! which had a grid-size of 362x292.
469               ! This grid has been extended southwards for use with the under ice-shelf options (isf) introduced in v3.6.
470               ! The original domain can still be used optionally if the isf code is not activated.
471               ! An adjustment (isrow) is made to the hard-wired indices if the extended domain (362x332) is being used.
472               !
473               IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  ! Using pre-v3.6 files or adjusted start row from isf-extended grid
474               ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 40 ! Using full isf­extended domain.
475               ENDIF     
476
477               ii0 = 357             ;   ii1 =  357        ! Southern Island : Kerguelen
478               ij0 =  75  + iswrow   ;   ij1 =  76   + iswrow 
479               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
480               !
481               ii0 = 243             ;   ii1 =  243        ! South Georgia
482               ij0 =  57  + iswrow   ;   ij1 =   59  + iswrow 
483               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
484               !
485               ii0 = 227             ;   ii1 =  227        ! Falklands
486               ij0 =  71  + iswrow   ;   ij1 =   73  + iswrow 
487               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
488               !
489               ii0 = 326             ;   ii1 =  327        ! Crozet
490               ij0 =  79  + iswrow   ;   ij1 =   79  + iswrow 
491               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
492               !
493               ii0 = 243             ;   ii1 =  243        ! South Orkney
494               ij0 =  56  + iswrow   ;   ij1 =   56  + iswrow 
495               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
496               !
497               ii0 = 283             ;   ii1 =  286        ! Bouvet Island
498               ij0 =  66  + iswrow   ;   ij1 =   66  + iswrow 
499               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
500               !
501               ii0 = 361             ;   ii1 =  361        ! Prince edwards
502               ij0 =  67  + iswrow   ;   ij1 =   68  + iswrow 
503               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
504               !
505               ii0 =  91             ;   ii1 =   92        ! Balleny islands
506               ij0 =  42  + iswrow   ;   ij1 =   43  + iswrow 
507               zcmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1), 1:jpk ) = 0.3_wp
508               !
509            ELSE IF( jp_cfg == 05 ) THEN
510               !
511               CALL ctl_warn( ' Coastal supply of iron modifications for southern Islands in ORCA_R05' )
512               !
513            ELSE IF( jp_cfg == 025 ) THEN
514               !
515               CALL ctl_warn( ' Coastal supply of iron modifications for southern Islands in ORCA_R025' )
516               !
517            ENDIF
518            !
519         ENDIF
520         CALL lbc_lnk( zcmask , 'T', 1. )      ! lateral boundary conditions on cmask   (sign unchanged)
521         DO jk = 1, jpk
522            DO jj = 1, jpj
523               DO ji = 1, jpi
524                  zexpide   = MIN( 8.,( fsdept(ji,jj,jk) / 500. )**(-1.5) )
525                  zdenitide = -0.9543 + 0.7662 * LOG( zexpide ) - 0.235 * LOG( zexpide )**2
526                  zcmask(ji,jj,jk) = zcmask(ji,jj,jk) * MIN( 1., EXP( zdenitide ) / 0.5 )
527               END DO
528            END DO
529         END DO
530         ! Coastal supply of iron
531         ! -------------------------
532         ironsed(:,:,jpk) = 0._wp
533         DO jk = 1, jpkm1
534            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( fse3t(:,:,jk) * rday )
535         END DO
536         DEALLOCATE( zcmask)
537      ENDIF
538      !
539      ! Iron from Hydrothermal vents
540      ! ------------------------
541      IF( ln_hydrofe ) THEN
542         !
543         IF(lwp) WRITE(numout,*) '    Input of iron from hydrothermal vents '
544         IF(lwp) WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
545         !
546         ALLOCATE( hydrofe(jpi,jpj,jpk) )    ! allocation
547         !
548         CALL iom_open ( TRIM( sn_hydrofe%clname ), numhydro )
549         CALL iom_get  ( numhydro, jpdom_data, TRIM( sn_hydrofe%clvar ), hydrofe(:,:,:), 1 )
550         CALL iom_close( numhydro )
551         !
552         hydrofe(:,:,:) = ( hydrofe(:,:,:) * hratio ) / ( cvol(:,:,:) * ryyss + rtrn ) / 1000._wp
553         !
554      ENDIF
555      !
556      IF( ll_sbc ) CALL p4z_sbc( nit000 ) 
557      !
558      IF(lwp) THEN
559         WRITE(numout,*)
560         WRITE(numout,*) '    Total input of elements from river supply'
561         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
562         WRITE(numout,*) '    N Supply   : ', rivdininput*rno3*1E3/1E12*14.,' TgN/yr'
563         WRITE(numout,*) '    Si Supply  : ', rivdsiinput*1E3/1E12*28.1,' TgSi/yr'
564         WRITE(numout,*) '    P Supply   : ', rivdipinput*1E3*po4r/1E12*31.,' TgP/yr'
565         WRITE(numout,*) '    Alk Supply : ', rivalkinput*1E3/1E12,' Teq/yr'
566         WRITE(numout,*) '    DIC Supply : ', rivdicinput*1E3*12./1E12,'TgC/yr'
567         WRITE(numout,*) 
568         WRITE(numout,*) '    Total input of elements from atmospheric supply'
569         WRITE(numout,*) '    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
570         WRITE(numout,*) '    N Supply   : ', nitdepinput*rno3*1E3/1E12*14.,' TgN/yr'
571         WRITE(numout,*) 
572      ENDIF
573      !
574      IF( nn_timing == 1 )  CALL timing_stop('p4z_sbc_init')
575      !
576   END SUBROUTINE p4z_sbc_init
577
578#else
579   !!======================================================================
580   !!  Dummy module :                                   No PISCES bio-model
581   !!======================================================================
582CONTAINS
583   SUBROUTINE p4z_sbc                         ! Empty routine
584   END SUBROUTINE p4z_sbc
585#endif 
586
587   !!======================================================================
588END MODULE  p4zsbc
Note: See TracBrowser for help on using the repository browser.