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.
p2zsed.F90 in NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z – NEMO

source: NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zsed.F90 @ 14219

Last change on this file since 14219 was 14219, checked in by mcastril, 4 years ago

Add Mixed Precision support by Oriol Tintó

  • 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          ! 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   !! * Substitutions
34#  include "do_loop_substitute.h90"
35#  include "domzgr_substitute.h90"
36#  include "single_precision_substitute.h90"
37   !!----------------------------------------------------------------------
38   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
39   !! $Id$
40   !! Software governed by the CeCILL license (see ./LICENSE)
41   !!----------------------------------------------------------------------
42CONTAINS
43
44   SUBROUTINE p2z_sed( kt, Kmm, Krhs )
45      !!---------------------------------------------------------------------
46      !!                     ***  ROUTINE p2z_sed  ***
47      !!
48      !! ** Purpose :   compute the now trend due to the vertical sedimentation of
49      !!              detritus and add it to the general trend of detritus equations
50      !!
51      !! ** Method  :   this ROUTINE compute not exactly the advection but the
52      !!              transport term, i.e.  dz(wt) and dz(ws)., dz(wtr)
53      !!              using an upstream scheme
54      !!              the now vertical advection of tracers is given by:
55      !!                      dz(tr(:,:,:,:,Kmm) ww) = 1/bt dk+1( e1t e2t vsed (tr(:,:,:,:,Kmm)) )
56      !!              add this trend now to the general trend of tracer (ta,sa,tr(:,:,:,:,Krhs)):
57      !!                             tr(:,:,:,:,Krhs) = tr(:,:,:,:,Krhs) + dz(tr(:,:,:,:,Kmm) ww)
58      !!       
59      !!              IF 'key_diabio' is defined, the now vertical advection
60      !!              trend of passive tracers is saved for futher diagnostics.
61      !!---------------------------------------------------------------------
62      INTEGER, INTENT( in ) ::   kt         ! ocean time-step index     
63      INTEGER, INTENT( in ) ::   Kmm, Krhs  ! time level indices
64      !
65      INTEGER  ::   ji, jj, jk, jl, ierr
66      CHARACTER (len=25) :: charout
67      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zw2d
68      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zwork, ztra
69      !!---------------------------------------------------------------------
70      !
71      IF( ln_timing )   CALL timing_start('p2z_sed')
72      !
73      IF( kt == nittrc000 ) THEN
74         IF(lwp) WRITE(numout,*)
75         IF(lwp) WRITE(numout,*) ' p2z_sed: LOBSTER sedimentation'
76         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
77      ENDIF
78
79      ! sedimentation of detritus  : upstream scheme
80      ! --------------------------------------------
81
82      ! for detritus sedimentation only - jpdet
83      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
84      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
85
86      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
87      DO jk = 2, jpkm1
88         zwork(:,:,jk) = -vsed * tr(:,:,jk-1,jpdet,Kmm)
89      END DO
90
91      ! tracer flux divergence at t-point added to the general trend
92      DO_3D( 1, 1, 1, 1, 1, jpkm1 )
93         ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / e3t(ji,jj,jk,Kmm)
94         tr(ji,jj,jk,jpdet,Krhs) = tr(ji,jj,jk,jpdet,Krhs) + ztra(ji,jj,jk) 
95      END_3D
96
97      IF( lk_iomput )  THEN
98         IF( iom_use( "TDETSED" ) ) THEN
99            ALLOCATE( zw2d(jpi,jpj) )
100            zw2d(:,:) =  ztra(:,:,1) * e3t(:,:,1,Kmm) * 86400._wp
101            DO jk = 2, jpkm1
102               zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * e3t(:,:,jk,Kmm) * 86400._wp
103            END DO
104            CALL iom_put( "TDETSED", zw2d )
105            DEALLOCATE( zw2d )
106         ENDIF
107      ENDIF
108      !
109
110      IF(sn_cfctl%l_prttrc)   THEN  ! print mean trends (used for debugging)
111         WRITE(charout, FMT="('sed')")
112         CALL prt_ctl_info( charout, cdcomp = 'top' )
113         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
114      ENDIF
115      !
116      IF( ln_timing )   CALL timing_stop('p2z_sed')
117      !
118   END SUBROUTINE p2z_sed
119
120
121   SUBROUTINE p2z_sed_init
122      !!----------------------------------------------------------------------
123      !!                  ***  ROUTINE p2z_sed_init  ***
124      !!
125      !! ** Purpose :   Parameters from aphotic layers to sediment
126      !!
127      !! ** Method  :   Read the namlobsed namelist and check the parameters
128      !!
129      !!----------------------------------------------------------------------
130      INTEGER ::   ios   ! Local integer
131      !!
132      NAMELIST/namlobsed/ sedlam, sedlostpoc, vsed, xhr
133      !!----------------------------------------------------------------------
134      !
135      READ  ( numnatp_ref, namlobsed, IOSTAT = ios, ERR = 901)
136901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namlosed in reference namelist' )
137      READ  ( numnatp_cfg, namlobsed, IOSTAT = ios, ERR = 902 )
138902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namlobsed in configuration namelist' )
139      IF(lwm) WRITE ( numonp, namlobsed )
140      !
141      IF(lwp) THEN
142          WRITE(numout,*) '   Namelist namlobsed'
143          WRITE(numout,*) '      time coeff of POC in sediments                sedlam    =', sedlam
144          WRITE(numout,*) '      Sediment geol loss for POC                    sedlostpoc=', sedlostpoc
145          WRITE(numout,*) '      detritus sedimentation speed                  vsed      =', 86400 * vsed  , ' d'
146          WRITE(numout,*) '      coeff for martin''s remineralistion           xhr       =', xhr
147          WRITE(numout,*) ' '
148      ENDIF
149      !
150   END SUBROUTINE p2z_sed_init
151
152   !!======================================================================
153END MODULE p2zsed
Note: See TracBrowser for help on using the repository browser.