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

source: branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90 @ 4147

Last change on this file since 4147 was 4147, checked in by cetlod, 10 years ago

merge in dev_LOCEAN_2013, the 1st development branch dev_r3853_CNRS9_Confsetting, from its starting point ( r3853 ) on the trunk: see ticket #1169

File size: 25.6 KB
Line 
1MODULE p4zsms
2   !!======================================================================
3   !!                         ***  MODULE p4zsms  ***
4   !! TOP :   PISCES Source Minus Sink manager
5   !!======================================================================
6   !! History :   1.0  !  2004-03 (O. Aumont) Original code
7   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
8   !!----------------------------------------------------------------------
9#if defined key_pisces
10   !!----------------------------------------------------------------------
11   !!   'key_pisces'                                       PISCES bio-model
12   !!----------------------------------------------------------------------
13   !!   p4zsms        :  Time loop of passive tracers sms
14   !!----------------------------------------------------------------------
15   USE oce_trc         !  shared variables between ocean and passive tracers
16   USE trc             !  passive tracers common variables
17   USE trcdta
18   USE sms_pisces      !  PISCES Source Minus Sink variables
19   USE p4zbio          !  Biological model
20   USE p4zche          !  Chemical model
21   USE p4zlys          !  Calcite saturation
22   USE p4zflx          !  Gas exchange
23   USE p4zsbc          !  External source of nutrients
24   USE p4zsed          !  Sedimentation
25   USE p4zint          !  time interpolation
26   USE iom             !  I/O manager
27   USE trdmod_oce      !  Ocean trends variables
28   USE trdmod_trc      !  TOP trends variables
29   USE sedmodel        !  Sediment model
30   USE prtctl_trc      !  print control for debugging
31
32   IMPLICIT NONE
33   PRIVATE
34
35   PUBLIC   p4z_sms_init    ! called in p4zsms.F90
36   PUBLIC   p4z_sms    ! called in p4zsms.F90
37
38   REAL(wp) :: alkbudget, no3budget, silbudget, ferbudget
39   INTEGER ::  numco2, numnut  !: logical unit for co2 budget
40
41   !!----------------------------------------------------------------------
42   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
43   !! $Id: p4zsms.F90 3320 2012-03-05 16:37:52Z cetlod $
44   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46
47CONTAINS
48
49   SUBROUTINE p4z_sms( kt )
50      !!---------------------------------------------------------------------
51      !!                     ***  ROUTINE p4z_sms  ***
52      !!
53      !! ** Purpose :   Managment of the call to Biological sources and sinks
54      !!              routines of PISCES bio-model
55      !!
56      !! ** Method  : - at each new day ...
57      !!              - several calls of bio and sed ???
58      !!              - ...
59      !!---------------------------------------------------------------------
60      !
61      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index     
62      !!
63      INTEGER ::   jnt, jn, jl
64      CHARACTER (len=25) :: charout
65      REAL(wp), POINTER, DIMENSION(:,:,:,:)  :: ztrdpis
66      !!---------------------------------------------------------------------
67      !
68      IF( nn_timing == 1 )  CALL timing_start('p4z_sms')
69      !
70      IF( l_trdtrc )  THEN
71         CALL wrk_alloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
72         DO jn = 1, jp_pisces
73            jl = jn + jp_pcs0 - 1
74            ztrdpis(:,:,:,jn) = trn(:,:,:,jl)
75         ENDDO
76      ENDIF
77      !
78      IF( ln_rsttr .AND. kt == nittrc000 )                         CALL p4z_rst( nittrc000, 'READ' )  !* read or initialize all required fields
79      IF( ln_rsttr  .AND. ln_pisclo )                              CALL p4z_clo            ! damping on closed seas
80      IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL p4z_dmp( kt )      ! Relaxation of some tracers
81      !
82      IF( ndayflxtr /= nday_year ) THEN      ! New days
83         !
84         ndayflxtr = nday_year
85
86         IF(lwp) write(numout,*)
87         IF(lwp) write(numout,*) ' New chemical constants and various rates for biogeochemistry at new day : ', nday_year
88         IF(lwp) write(numout,*) '~~~~~~'
89
90         CALL p4z_che              ! computation of chemical constants
91         CALL p4z_int( kt )        ! computation of various rates for biogeochemistry
92         !
93      ENDIF
94
95      IF( ll_sbc ) CALL p4z_sbc( kt )   ! external sources of nutrients
96
97      DO jnt = 1, nrdttrc          ! Potential time splitting if requested
98         !
99         CALL p4z_bio (kt, jnt)    ! Biology
100         CALL p4z_sed (kt, jnt)    ! Sedimentation
101         !
102         DO jn = jp_pcs0, jp_pcs1
103            trb(:,:,:,jn) = trn(:,:,:,jn)
104         ENDDO
105         !
106      END DO
107
108      IF( l_trdtrc )  THEN
109         DO jn = 1, jp_pisces
110            jl = jn + jp_pcs0 - 1
111            ztrdpis(:,:,:,jn) = ( ztrdpis(:,:,:,jn) - trn(:,:,:,jl) ) * rfact2r
112         ENDDO
113      ENDIF
114
115      CALL p4z_lys( kt )             ! Compute CaCO3 saturation
116      CALL p4z_flx( kt )             ! Compute surface fluxes
117
118      DO jn = jp_pcs0, jp_pcs1
119        CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
120        CALL lbc_lnk( trb(:,:,:,jn), 'T', 1. )
121        CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )
122      END DO
123      !
124      IF( lk_sed ) THEN 
125         !
126         CALL sed_model( kt )     !  Main program of Sediment model
127         !
128         DO jn = jp_pcs0, jp_pcs1
129           CALL lbc_lnk( trn(:,:,:,jn), 'T', 1. )
130         END DO
131         !
132      ENDIF
133      !
134      IF( lrst_trc )  CALL p4z_rst( kt, 'WRITE' )  !* Write PISCES informations in restart file
135      !
136      IF( l_trdtrc ) THEN
137         DO jn = 1, jp_pisces
138            jl = jn + jp_pcs0 - 1
139             ztrdpis(:,:,:,jn) = ztrdpis(:,:,:,jn) + tra(:,:,:,jl)
140             CALL trd_mod_trc( ztrdpis(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
141          END DO
142          CALL wrk_dealloc( jpi, jpj, jpk, jp_pisces, ztrdpis ) 
143      END IF
144      !
145      CALL p4z_chk_mass( kt ) ! Mass conservation checking
146
147      IF ( kt == nittrc000 ) CALL FLUSH    ( numonp )     ! flush output namelist PISCES
148      IF( nn_timing == 1 )  CALL timing_stop('p4z_sms')
149      !
150      !
151   END SUBROUTINE p4z_sms
152
153   SUBROUTINE p4z_sms_init
154      !!----------------------------------------------------------------------
155      !!                     ***  p4z_sms_init  *** 
156      !!
157      !! ** Purpose :   read PISCES namelist
158      !!
159      !! ** input   :   file 'namelist.trc.s' containing the following
160      !!             namelist: natext, natbio, natsms
161      !!                       natkriest ("key_kriest")
162      !!----------------------------------------------------------------------
163      NAMELIST/nampisbio/ nrdttrc, wsbio, xkmort, ferat3, wsbio2, niter1max, niter2max
164#if defined key_kriest
165      NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_ncontent, xkr_mass_min, xkr_mass_max
166#endif
167      NAMELIST/nampisdmp/ ln_pisdmp, nn_pisdmp, ln_pisclo
168      NAMELIST/nampismass/ ln_check_mass
169      INTEGER :: ios                 ! Local integer output status for namelist read
170      !!----------------------------------------------------------------------
171
172      REWIND( numnatp_ref )              ! Namelist nampisbio in reference namelist : Pisces variables
173      READ  ( numnatp_ref, nampisbio, IOSTAT = ios, ERR = 901)
174901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisbio in reference namelist', lwp )
175
176      REWIND( numnatp_cfg )              ! Namelist nampisbio in configuration namelist : Pisces variables
177      READ  ( numnatp_cfg, nampisbio, IOSTAT = ios, ERR = 902 )
178902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisbio in configuration namelist', lwp )
179      WRITE ( numonp, nampisbio )
180
181      IF(lwp) THEN                         ! control print
182         WRITE(numout,*) ' Namelist : nampisbio'
183         WRITE(numout,*) '    frequence pour la biologie                nrdttrc   =', nrdttrc
184         WRITE(numout,*) '    POC sinking speed                         wsbio     =', wsbio
185         WRITE(numout,*) '    half saturation constant for mortality    xkmort    =', xkmort
186         WRITE(numout,*) '    Fe/C in zooplankton                       ferat3    =', ferat3
187         WRITE(numout,*) '    Big particles sinking speed               wsbio2    =', wsbio2
188         WRITE(numout,*) '    Maximum number of iterations for POC      niter1max =', niter1max
189         WRITE(numout,*) '    Maximum number of iterations for GOC      niter2max =', niter2max
190      ENDIF
191
192#if defined key_kriest
193
194      !                               ! nampiskrp : kriest parameters
195      !                               ! -----------------------------
196      REWIND( numnatp_ref )              ! Namelist nampiskrp in reference namelist : Pisces Kriest
197      READ  ( numnatp_ref, nampiskrp, IOSTAT = ios, ERR = 903)
198903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrp in reference namelist', lwp )
199
200      REWIND( numnatp_cfg )              ! Namelist nampiskrp in configuration namelist : Pisces Kriest
201      READ  ( numnatp_cfg, nampiskrp, IOSTAT = ios, ERR = 904 )
202904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrp in configuration namelist', lwp )
203      WRITE ( numonp, nampiskrp )
204
205      IF(lwp) THEN
206         WRITE(numout,*)
207         WRITE(numout,*) ' Namelist : nampiskrp'
208         WRITE(numout,*) '    Sinking  exponent                        xkr_eta      = ', xkr_eta
209         WRITE(numout,*) '    N content exponent                       xkr_zeta     = ', xkr_zeta
210         WRITE(numout,*) '    N content factor                         xkr_ncontent = ', xkr_ncontent
211         WRITE(numout,*) '    Minimum mass for Aggregates              xkr_mass_min = ', xkr_mass_min
212         WRITE(numout,*) '    Maximum mass for Aggregates              xkr_mass_max = ', xkr_mass_max
213         WRITE(numout,*)
214     ENDIF
215
216
217     ! Computation of some variables
218     xkr_massp = xkr_ncontent * 7.625 * xkr_mass_min**xkr_zeta
219
220#endif
221
222      REWIND( numnatp_ref )              ! Namelist nampisdmp in reference namelist : Pisces damping
223      READ  ( numnatp_ref, nampisdmp, IOSTAT = ios, ERR = 905)
224905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdmp in reference namelist', lwp )
225
226      REWIND( numnatp_cfg )              ! Namelist nampisdmp in configuration namelist : Pisces damping
227      READ  ( numnatp_cfg, nampisdmp, IOSTAT = ios, ERR = 906 )
228906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdmp in configuration namelist', lwp )
229      WRITE ( numonp, nampisdmp )
230
231      IF(lwp) THEN                         ! control print
232         WRITE(numout,*)
233         WRITE(numout,*) ' Namelist : nampisdmp'
234         WRITE(numout,*) '    Relaxation of tracer to glodap mean value             ln_pisdmp      =', ln_pisdmp
235         WRITE(numout,*) '    Frequency of Relaxation                               nn_pisdmp      =', nn_pisdmp
236         WRITE(numout,*) '    Restoring of tracer to initial value  on closed seas  ln_pisclo      =', ln_pisclo
237         WRITE(numout,*) ' '
238      ENDIF
239
240      REWIND( numnatp_ref )              ! Namelist nampismass in reference namelist : Pisces mass conservation check
241      READ  ( numnatp_ref, nampismass, IOSTAT = ios, ERR = 907)
242907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismass in reference namelist', lwp )
243
244      REWIND( numnatp_cfg )              ! Namelist nampismass in configuration namelist : Pisces mass conservation check
245      READ  ( numnatp_cfg, nampismass, IOSTAT = ios, ERR = 908 )
246908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismass in configuration namelist', lwp )
247      WRITE ( numonp, nampismass )
248
249      IF(lwp) THEN                         ! control print
250         WRITE(numout,*) ' '
251         WRITE(numout,*) ' Namelist parameter for mass conservation checking'
252         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
253         WRITE(numout,*) '    Flag to check mass conservation of NO3/Si/TALK ln_check_mass = ', ln_check_mass
254      ENDIF
255
256   END SUBROUTINE p4z_sms_init
257
258   SUBROUTINE p4z_rst( kt, cdrw )
259      !!---------------------------------------------------------------------
260      !!                   ***  ROUTINE p4z_rst  ***
261      !!
262      !!  ** Purpose : Read or write variables in restart file:
263      !!
264      !!  WRITE(READ) mode:
265      !!       kt        : number of time step since the begining of the experiment at the
266      !!                   end of the current(previous) run
267      !!---------------------------------------------------------------------
268      INTEGER         , INTENT(in) ::   kt         ! ocean time-step
269      CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag
270      !
271      INTEGER  ::  ji, jj, jk
272      REAL(wp) ::  zcaralk, zbicarb, zco3
273      REAL(wp) ::  ztmas, ztmas1
274      !!---------------------------------------------------------------------
275
276      IF( TRIM(cdrw) == 'READ' ) THEN
277         !
278         IF(lwp) WRITE(numout,*)
279         IF(lwp) WRITE(numout,*) ' p4z_rst : Read specific variables from pisces model '
280         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
281         !
282         IF( iom_varid( numrtr, 'PH', ldstop = .FALSE. ) > 0 ) THEN
283            CALL iom_get( numrtr, jpdom_autoglo, 'PH' , hi(:,:,:)  )
284         ELSE
285!            hi(:,:,:) = 1.e-9
286            ! Set PH from  total alkalinity, borat (???), akb3 (???) and ak23 (???)
287            ! --------------------------------------------------------
288            DO jk = 1, jpk
289               DO jj = 1, jpj
290                  DO ji = 1, jpi
291                     ztmas   = tmask(ji,jj,jk)
292                     ztmas1  = 1. - tmask(ji,jj,jk)
293                     zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
294                     zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
295                     zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk )
296                     hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1
297                  END DO
298               END DO
299            END DO
300         ENDIF
301         CALL iom_get( numrtr, jpdom_autoglo, 'Silicalim', xksi(:,:) )
302         IF( iom_varid( numrtr, 'Silicamax', ldstop = .FALSE. ) > 0 ) THEN
303            CALL iom_get( numrtr, jpdom_autoglo, 'Silicamax' , xksimax(:,:)  )
304         ELSE
305            xksimax(:,:) = xksi(:,:)
306         ENDIF
307         !
308      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
309         IF( kt == nitrst ) THEN
310            IF(lwp) WRITE(numout,*)
311            IF(lwp) WRITE(numout,*) 'p4z_rst : write pisces restart file  kt =', kt
312            IF(lwp) WRITE(numout,*) '~~~~~~~'
313         ENDIF
314         CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:) )
315         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) )
316         CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) )
317      ENDIF
318      !
319   END SUBROUTINE p4z_rst
320
321   SUBROUTINE p4z_dmp( kt )
322      !!----------------------------------------------------------------------
323      !!                    ***  p4z_dmp  ***
324      !!
325      !! ** purpose  : Relaxation of some tracers
326      !!----------------------------------------------------------------------
327      !
328      INTEGER, INTENT( in )  ::     kt ! time step
329      !
330      REAL(wp) ::  alkmean = 2426.     ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
331      REAL(wp) ::  po4mean = 2.165     ! mean value of phosphates
332      REAL(wp) ::  no3mean = 30.90     ! mean value of nitrate
333      REAL(wp) ::  silmean = 91.51     ! mean value of silicate
334      !
335      REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum
336      !!---------------------------------------------------------------------
337
338
339      IF(lwp)  WRITE(numout,*)
340      IF(lwp)  WRITE(numout,*) ' p4z_dmp : Restoring of nutrients at time-step kt = ', kt
341      IF(lwp)  WRITE(numout,*)
342
343      IF( cp_cfg == "orca" .AND. .NOT. lk_c1d ) THEN      ! ORCA configuration (not 1D) !
344         !                                                    ! --------------------------- !
345         ! set total alkalinity, phosphate, nitrate & silicate
346         zarea          = 1._wp / glob_sum( cvol(:,:,:) ) * 1e6             
347
348         zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
349         zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea * po4r
350         zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea * rno3
351         zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
352 
353         IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum
354         trn(:,:,:,jptal) = trn(:,:,:,jptal) * alkmean / zalksum
355
356         IF(lwp) WRITE(numout,*) '       PO4  mean : ', zpo4sum
357         trn(:,:,:,jppo4) = trn(:,:,:,jppo4) * po4mean / zpo4sum
358
359         IF(lwp) WRITE(numout,*) '       NO3  mean : ', zno3sum
360         trn(:,:,:,jpno3) = trn(:,:,:,jpno3) * no3mean / zno3sum
361
362         IF(lwp) WRITE(numout,*) '       SiO3 mean : ', zsilsum
363         trn(:,:,:,jpsil) = MIN( 400.e-6,trn(:,:,:,jpsil) * silmean / zsilsum )
364         !
365      ENDIF
366
367   END SUBROUTINE p4z_dmp
368
369
370   SUBROUTINE p4z_chk_mass( kt )
371      !!----------------------------------------------------------------------
372      !!                  ***  ROUTINE p4z_chk_mass  ***
373      !!
374      !! ** Purpose :  Mass conservation check
375      !!
376      !!---------------------------------------------------------------------
377      !
378      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index     
379      !!
380      !!---------------------------------------------------------------------
381
382      IF( kt == nittrc000 ) THEN
383         IF( ln_check_mass .AND. lwp) THEN      !   Open budget file of NO3, ALK, Si, Fer
384            CALL ctl_opn( numco2, 'carbon.budget'  , 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
385            CALL ctl_opn( numnut, 'nutrient.budget', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
386         ENDIF
387      ENDIF
388
389      IF( ln_check_mass .AND. kt == nitend ) THEN      !   Compute the budget of NO3, ALK, Si, Fer
390         no3budget = glob_sum( (   trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  &
391            &                    + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  &
392            &                    + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  &
393            &                    + trn(:,:,:,jppoc)                     &
394#if ! defined key_kriest
395            &                    + trn(:,:,:,jpgoc)                     &
396#endif
397            &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  ) 
398         !
399         silbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  &
400            &                    + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  )
401         !
402         alkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              &
403            &                    + trn(:,:,:,jptal)                     &
404            &                    + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  )
405         !
406         ferbudget = glob_sum( (   trn(:,:,:,jpfer) + trn(:,:,:,jpnfe)  &
407            &                    + trn(:,:,:,jpdfe)                     &
408#if ! defined key_kriest
409            &                    + trn(:,:,:,jpbfe)                     &
410#endif
411            &                    + trn(:,:,:,jpsfe)                     &
412            &                    + trn(:,:,:,jpzoo)                     &
413            &                    + trn(:,:,:,jpmes) * ferat3            ) * cvol(:,:,:)  )
414
415         !
416         t_atm_co2_flx  = t_atm_co2_flx / glob_sum( e1e2t(:,:) )
417         t_oce_co2_flx  = t_oce_co2_flx         * 12. / 1.e15 * (-1 )
418         tpp            = tpp           * 1000. * 12. / 1.E15
419         t_oce_co2_exp  = t_oce_co2_exp * 1000. * 12. / 1.E15
420         !
421         no3budget = no3budget / areatot
422         silbudget = silbudget / areatot
423         alkbudget = alkbudget / areatot
424         ferbudget = ferbudget / areatot
425         !
426         IF(lwp) THEN
427            WRITE(numco2,9000) ndastp, t_atm_co2_flx, t_oce_co2_flx, tpp, t_oce_co2_exp
428            WRITE(numnut,9500) ndastp, alkbudget, no3budget, silbudget, ferbudget
429         ENDIF
430         !
431      ENDIF
432       !
433 9000  FORMAT(i8,f10.5,e18.10,f10.5,f10.5)
434 9500  FORMAT(i8,4e18.10)     
435       !
436   END SUBROUTINE p4z_chk_mass
437
438   SUBROUTINE p4z_clo   
439      !!---------------------------------------------------------------------
440      !!                  ***  ROUTINE p4z_clo  ***
441      !!
442      !! ** Purpose :   Closed sea domain initialization
443      !!
444      !! ** Method  :   if a closed sea is located only in a model grid point
445      !!                we restore to initial data
446      !!
447      !! ** Action  :   ictsi1(), ictsj1() : south-west closed sea limits (i,j)
448      !!                ictsi2(), ictsj2() : north-east Closed sea limits (i,j)
449      !!----------------------------------------------------------------------
450      INTEGER, PARAMETER           ::   npicts   = 4        ! number of closed sea
451      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1      ! south-west closed sea limits (i,j)
452      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2      ! north-east closed sea limits (i,j)
453      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indices
454      INTEGER :: ierr                                       ! local integer
455      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta     ! 4D  workspace
456      !!----------------------------------------------------------------------
457
458      IF(lwp) WRITE(numout,*)
459      IF(lwp) WRITE(numout,*)' p4z_clo : closed seas '
460      IF(lwp) WRITE(numout,*)'~~~~~~~'
461
462      ! initial values
463      ictsi1(:) = 1  ;  ictsi2(:) = 1 
464      ictsj1(:) = 1  ;  ictsj2(:) = 1 
465
466      ! set the closed seas (in data domain indices)
467      ! -------------------
468
469      IF( cp_cfg == "orca" ) THEN
470         !
471         SELECT CASE ( jp_cfg )
472         !                                           ! =======================
473         CASE ( 2 )                                  !  ORCA_R2 configuration
474            !                                        ! =======================
475            !                                            ! Caspian Sea
476            ictsi1(1)   =  11  ;  ictsj1(1)   = 103
477            ictsi2(1)   =  17  ;  ictsj2(1)   = 112
478            !                                            ! Great North American Lakes
479            ictsi1(2)   =  97  ;  ictsj1(2)   = 107
480            ictsi2(2)   = 103  ;  ictsj2(2)   = 111
481            !                                            ! Black Sea 1 : west part of the Black Sea
482            ictsi1(3)   = 174  ; ictsj1(3)   = 107
483            ictsi2(3)   = 181  ; ictsj2(3)   = 112
484            !                                            ! Black Sea 2 : est part of the Black Sea
485            ictsi1(4)   =   2  ;  ictsj1(4)   = 107
486            ictsi2(4)   =   6  ;  ictsj2(4)   = 112
487            !                                        ! =======================
488         CASE ( 4 )                                  !  ORCA_R4 configuration
489            !                                        ! =======================
490            !                                            ! Caspian Sea
491            ictsi1(1)   =  4  ;  ictsj1(1)   = 53
492            ictsi2(1)   =  4  ;  ictsj2(1)   = 56
493            !                                            ! Great North American Lakes
494            ictsi1(2)   = 49  ;  ictsj1(2)   = 55
495            ictsi2(2)   = 51  ;  ictsj2(2)   = 56
496            !                                            ! Black Sea
497            ictsi1(3)   = 88  ;  ictsj1(3)   = 55
498            ictsi2(3)   = 91  ;  ictsj2(3)   = 56
499            !                                            ! Baltic Sea
500            ictsi1(4)   = 75  ;  ictsj1(4)   = 59
501            ictsi2(4)   = 76  ;  ictsj2(4)   = 61
502            !                                        ! =======================
503            !                                        ! =======================
504         CASE ( 025 )                                ! ORCA_R025 configuration
505            !                                        ! =======================
506                                                     ! Caspian + Aral sea
507            ictsi1(1)   = 1330 ; ictsj1(1)   = 645
508            ictsi2(1)   = 1400 ; ictsj2(1)   = 795
509            !                                        ! Azov Sea
510            ictsi1(2)   = 1284 ; ictsj1(2)   = 722
511            ictsi2(2)   = 1304 ; ictsj2(2)   = 747
512            !
513         END SELECT
514         !
515      ENDIF
516
517      ! convert the position in local domain indices
518      ! --------------------------------------------
519      DO jc = 1, npicts 
520         ictsi1(jc)   = mi0( ictsi1(jc) )
521         ictsj1(jc)   = mj0( ictsj1(jc) )
522
523         ictsi2(jc)   = mi1( ictsi2(jc) )
524         ictsj2(jc)   = mj1( ictsj2(jc) )
525      END DO
526
527      ! Restore close seas values to initial data
528      IF( ln_trcdta .AND. nb_trcdta > 0 )  THEN   ! Initialisation of tracer from a file that may also be used for damping
529         !
530         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )   ! Memory allocation
531         !
532         CALL trc_dta( nittrc000, ztrcdta )   ! read tracer data at nittrc000
533         !
534         DO jn = 1, jptra
535            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
536                jl = n_trc_index(jn)
537                DO jc = 1, npicts
538                   DO jk = 1, jpkm1
539                      DO jj = ictsj1(jc), ictsj2(jc)
540                         DO ji = ictsi1(jc), ictsi2(jc)
541                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk)
542                            trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
543                         ENDDO
544                      ENDDO
545                   ENDDO
546                ENDDO
547             ENDIF
548          ENDDO
549          CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
550      ENDIF
551      !
552   END SUBROUTINE p4z_clo
553#else
554   !!======================================================================
555   !!  Dummy module :                                   No PISCES bio-model
556   !!======================================================================
557CONTAINS
558   SUBROUTINE p4z_sms( kt )                   ! Empty routine
559      INTEGER, INTENT( in ) ::   kt
560      WRITE(*,*) 'p4z_sms: You should not have seen this print! error?', kt
561   END SUBROUTINE p4z_sms
562#endif 
563
564   !!======================================================================
565END MODULE p4zsms 
Note: See TracBrowser for help on using the repository browser.