source: NEMO/branches/2019/fix_sn_cfctl_ticket2328/src/TOP/PISCES/P2Z/p2zsed.F90 @ 11872

Last change on this file since 11872 was 11872, checked in by acc, 11 months ago

Branch 2019/fix_sn_cfctl_ticket2328. See #2328. Replacement of ln_ctl and activation of full functionality with
sn_cfctl structure. These changes rename structure components l_mppout and l_mpptop as l_prtctl and l_prttrc
and introduce l_glochk to activate former ln_ctl code in stpctl.F90 to perform global location of min and max
checks. Also added is l_allon which can be used to activate all output (much like the former ln_ctl). If l_allon
is .false. then l_config decides whether or not the suboptions are used.

   sn_cfctl%l_glochk = .FALSE.    ! Range sanity checks are local (F) or global (T). Set T for debugging only
   sn_cfctl%l_allon  = .FALSE.    ! IF T activate all options. If F deactivate all unless l_config is T
   sn_cfctl%l_config = .TRUE.     ! IF .true. then control which reports are written with the remaining options

Note, these changes pass SETTE tests but all references to ln_ctl need to be removed from the sette scripts.

  • Property svn:keywords set to Id
File size: 6.6 KB
Line 
1MODULE p2zsed
2   !!======================================================================
3   !!                         ***  MODULE p2zsed  ***
4   !! TOP :   PISCES Compute loss of organic matter in the sediments
5   !!======================================================================
6   !! History :    -   !  1995-06 (M. Levy)  original code
7   !!              -   !  2000-12 (E. Kestenare)  clean up
8   !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 + simplifications
9   !!----------------------------------------------------------------------
10   !!   p2z_sed        :  Compute loss of organic matter in the sediments
11   !!----------------------------------------------------------------------
12   USE oce_trc         !
13   USE trd_oce         !
14   USE trdtrc          !
15   USE trc             !
16   USE sms_pisces      !
17   !
18   USE lbclnk          !
19   USE iom             !
20   USE prtctl_trc      ! Print control for debbuging
21
22   IMPLICIT NONE
23   PRIVATE
24
25   PUBLIC   p2z_sed         ! called in ???
26   PUBLIC   p2z_sed_init    ! called in ???
27
28   REAL(wp), PUBLIC ::   sedlam      !: time coefficient of POC remineralization in sediments
29   REAL(wp), PUBLIC ::   sedlostpoc  !: mass of POC lost in sediments
30   REAL(wp), PUBLIC ::   vsed        !: detritus sedimentation speed [m/s]
31   REAL(wp), PUBLIC ::   xhr         !: coeff for martin''s remineralisation profile
32
33   !!----------------------------------------------------------------------
34   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
35   !! $Id$
36   !! Software governed by the CeCILL license (see ./LICENSE)
37   !!----------------------------------------------------------------------
38CONTAINS
39
40   SUBROUTINE p2z_sed( kt )
41      !!---------------------------------------------------------------------
42      !!                     ***  ROUTINE p2z_sed  ***
43      !!
44      !! ** Purpose :   compute the now trend due to the vertical sedimentation of
45      !!              detritus and add it to the general trend of detritus equations
46      !!
47      !! ** Method  :   this ROUTINE compute not exactly the advection but the
48      !!              transport term, i.e.  dz(wt) and dz(ws)., dz(wtr)
49      !!              using an upstream scheme
50      !!              the now vertical advection of tracers is given by:
51      !!                      dz(trn wn) = 1/bt dk+1( e1t e2t vsed (trn) )
52      !!              add this trend now to the general trend of tracer (ta,sa,tra):
53      !!                             tra = tra + dz(trn wn)
54      !!       
55      !!              IF 'key_diabio' is defined, the now vertical advection
56      !!              trend of passive tracers is saved for futher diagnostics.
57      !!---------------------------------------------------------------------
58      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index     
59      !
60      INTEGER  ::   ji, jj, jk, jl, ierr
61      CHARACTER (len=25) :: charout
62      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zw2d
63      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zwork, ztra
64      !!---------------------------------------------------------------------
65      !
66      IF( ln_timing )   CALL timing_start('p2z_sed')
67      !
68      IF( kt == nittrc000 ) THEN
69         IF(lwp) WRITE(numout,*)
70         IF(lwp) WRITE(numout,*) ' p2z_sed: LOBSTER sedimentation'
71         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
72      ENDIF
73
74      ! sedimentation of detritus  : upstream scheme
75      ! --------------------------------------------
76
77      ! for detritus sedimentation only - jpdet
78      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
79      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
80
81      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
82      DO jk = 2, jpkm1
83         zwork(:,:,jk) = -vsed * trn(:,:,jk-1,jpdet)
84      END DO
85
86      ! tracer flux divergence at t-point added to the general trend
87      DO jk = 1, jpkm1
88         DO jj = 1, jpj
89            DO ji = 1, jpi
90               ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / e3t_n(ji,jj,jk)
91               tra(ji,jj,jk,jpdet) = tra(ji,jj,jk,jpdet) + ztra(ji,jj,jk) 
92            END DO
93         END DO
94      END DO
95
96      IF( lk_iomput )  THEN
97         IF( iom_use( "TDETSED" ) ) THEN
98            ALLOCATE( zw2d(jpi,jpj) )
99            zw2d(:,:) =  ztra(:,:,1) * e3t_n(:,:,1) * 86400._wp
100            DO jk = 2, jpkm1
101               zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * e3t_n(:,:,jk) * 86400._wp
102            END DO
103            CALL iom_put( "TDETSED", zw2d )
104            DEALLOCATE( zw2d )
105         ENDIF
106      ENDIF
107      !
108
109      IF(sn_cfctl%l_prttrc)   THEN  ! print mean trends (used for debugging)
110         WRITE(charout, FMT="('sed')")
111         CALL prt_ctl_trc_info(charout)
112         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
113      ENDIF
114      !
115      IF( ln_timing )   CALL timing_stop('p2z_sed')
116      !
117   END SUBROUTINE p2z_sed
118
119
120   SUBROUTINE p2z_sed_init
121      !!----------------------------------------------------------------------
122      !!                  ***  ROUTINE p2z_sed_init  ***
123      !!
124      !! ** Purpose :   Parameters from aphotic layers to sediment
125      !!
126      !! ** Method  :   Read the namlobsed namelist and check the parameters
127      !!
128      !!----------------------------------------------------------------------
129      INTEGER ::   ios   ! Local integer
130      !!
131      NAMELIST/namlobsed/ sedlam, sedlostpoc, vsed, xhr
132      !!----------------------------------------------------------------------
133      !
134      REWIND( numnatp_ref )              ! Namelist namlobsed in reference namelist : Lobster sediments
135      READ  ( numnatp_ref, namlobsed, IOSTAT = ios, ERR = 901)
136901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlosed in reference namelist' )
137      REWIND( numnatp_cfg )              ! Namelist namlobsed in configuration namelist : Lobster sediments
138      READ  ( numnatp_cfg, namlobsed, IOSTAT = ios, ERR = 902 )
139902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobsed in configuration namelist' )
140      IF(lwm) WRITE ( numonp, namlobsed )
141      !
142      IF(lwp) THEN
143          WRITE(numout,*) '   Namelist namlobsed'
144          WRITE(numout,*) '      time coeff of POC in sediments                sedlam    =', sedlam
145          WRITE(numout,*) '      Sediment geol loss for POC                    sedlostpoc=', sedlostpoc
146          WRITE(numout,*) '      detritus sedimentation speed                  vsed      =', 86400 * vsed  , ' d'
147          WRITE(numout,*) '      coeff for martin''s remineralistion           xhr       =', xhr
148          WRITE(numout,*) ' '
149      ENDIF
150      !
151   END SUBROUTINE p2z_sed_init
152
153   !!======================================================================
154END MODULE p2zsed
Note: See TracBrowser for help on using the repository browser.