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.
trcsed.F90 in branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER – NEMO

source: branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90 @ 3318

Last change on this file since 3318 was 3318, checked in by gm, 12 years ago

Ediag branche: #927 split TRA/DYN trd computation

  • Property svn:keywords set to Id
File size: 5.9 KB
Line 
1MODULE trcsed
2   !!======================================================================
3   !!                         ***  MODULE p4sed  ***
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#if defined key_lobster
11   !!----------------------------------------------------------------------
12   !!   'key_lobster'                                     LOBSTER bio-model
13   !!----------------------------------------------------------------------
14   !!   trc_sed        :  Compute loss of organic matter in the sediments
15   !!----------------------------------------------------------------------
16   USE oce_trc         !
17   USE trc
18   USE sms_lobster
19   USE lbclnk
20   USE trd_oce         ! trends: ocean variables
21   USE trdmod_trc      ! trends: passive tracer variables
22   USE iom
23   USE prtctl_trc      ! Print control for debbuging
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   trc_sed    ! called in ???
29
30   !!* Substitution
31#  include "top_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
34   !! $Id$
35   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_sed( kt )
40      !!---------------------------------------------------------------------
41      !!                     ***  ROUTINE trc_sed  ***
42      !!
43      !! ** Purpose :   compute the now trend due to the vertical sedimentation of
44      !!              detritus and add it to the general trend of detritus equations
45      !!
46      !! ** Method  :   this ROUTINE compute not exactly the advection but the
47      !!              transport term, i.e.  dz(wt) and dz(ws)., dz(wtr)
48      !!              using an upstream scheme
49      !!              the now vertical advection of tracers is given by:
50      !!                      dz(trn wn) = 1/bt dk+1( e1t e2t vsed (trn) )
51      !!              add this trend now to the general trend of tracer (ta,sa,tra):
52      !!                             tra = tra + dz(trn wn)
53      !!       
54      !!              IF 'key_diabio' is defined, the now vertical advection
55      !!              trend of passive tracers is saved for futher diagnostics.
56      !!---------------------------------------------------------------------
57      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index     
58      !
59      INTEGER  ::   ji, jj, jk, jl, ierr
60      CHARACTER (len=25) :: charout
61      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zw2d
62      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zwork, ztra, ztrbio
63      !!---------------------------------------------------------------------
64      !
65      IF( nn_timing == 1 )  CALL timing_start('trc_sed')
66      !
67      IF( kt == nittrc000 ) THEN
68         IF(lwp) WRITE(numout,*)
69         IF(lwp) WRITE(numout,*) ' trc_sed: LOBSTER sedimentation'
70         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
71      ENDIF
72
73      ! Allocate temporary workspace
74      CALL wrk_alloc( jpi, jpj, jpk, zwork, ztra )
75
76      IF( ln_diatrc )   CALL wrk_alloc( jpi, jpj, zw2d )
77
78      IF( l_trdtrc ) THEN
79         CALL wrk_alloc( jpi, jpj, jpk, ztrbio )
80         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det)
81      ENDIF
82
83      ! sedimentation of detritus  : upstream scheme
84      ! --------------------------------------------
85
86      ! for detritus sedimentation only - jp_lob_det
87      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
88      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
89
90      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
91      DO jk = 2, jpkm1
92         zwork(:,:,jk) = -vsed * trn(:,:,jk-1,jp_lob_det)
93      END DO
94
95      ! tracer flux divergence at t-point added to the general trend
96      DO jk = 1, jpkm1
97         DO jj = 1, jpj
98            DO ji = 1, jpi
99               ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
100               tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + ztra(ji,jj,jk) 
101            END DO
102         END DO
103      END DO
104
105      IF( ln_diatrc ) THEN
106         DO jk = 1, jpkm1
107            zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * fse3t(:,:,jk) * 86400._wp
108         END DO
109         IF( lk_iomput ) THEN   ;   CALL iom_put( "TDETSED", zw2d )
110         ELSE                   ;   trc2d(:,:,jp_lob0_2d + 7) = zw2d(:,:)
111         ENDIF
112         CALL wrk_dealloc( jpi, jpj, zw2d )
113      ENDIF
114      !
115      IF( ln_diabio )   trbio(:,:,:,jp_lob0_trd + 7) = ztra(:,:,:)
116      CALL wrk_dealloc( jpi, jpj, jpk, zwork, ztra )
117      !
118      IF( l_trdtrc ) THEN
119         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det) - ztrbio(:,:,:)
120         jl = jp_lob0_trd + 7
121         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
122         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )
123      ENDIF
124
125      IF(ln_ctl) THEN      ! print mean trends (used for debugging)
126         WRITE(charout, FMT="('sed')")
127         CALL prt_ctl_trc_info(charout)
128         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
129      ENDIF
130      !
131      IF( nn_timing == 1 )   CALL timing_stop('trc_sed')
132      !
133   END SUBROUTINE trc_sed
134
135#else
136   !!======================================================================
137   !!  Dummy module :                                   No PISCES bio-model
138   !!======================================================================
139CONTAINS
140   SUBROUTINE trc_sed( kt )                   ! Empty routine
141      INTEGER, INTENT( in ) ::   kt
142      WRITE(*,*) 'trc_sed: You should not have seen this print! error?', kt
143   END SUBROUTINE trc_sed
144#endif 
145
146   !!======================================================================
147END MODULE  trcsed
Note: See TracBrowser for help on using the repository browser.