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/2011/dev_LOCEAN_2011/NEMOGCM/NEMO/TOP_SRC/LOBSTER – NEMO

source: branches/2011/dev_LOCEAN_2011/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90 @ 3028

Last change on this file since 3028 was 3028, checked in by cetlod, 12 years ago

branch dev_LOCEAN_2011 : minor changes in TOP component relative to the management of additional diagnostics

  • Property svn:keywords set to Id
File size: 6.2 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 trdmod_oce
21   USE trdmod_trc
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   !!----------------------------------------------------------------------
37
38CONTAINS
39
40   SUBROUTINE trc_sed( kt )
41      !!---------------------------------------------------------------------
42      !!                     ***  ROUTINE trc_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      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
59      USE wrk_nemo, ONLY: zwork => wrk_3d_2, ztra => wrk_3d_3
60      USE wrk_nemo, ONLY: zw2d  => wrk_2d_1
61      !!
62      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index     
63      !!
64      INTEGER  ::   ji, jj, jk, jl, ierr
65      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrbio
66      CHARACTER (len=25) :: charout
67      !!---------------------------------------------------------------------
68
69      IF( kt == nit000 ) THEN
70         IF(lwp) WRITE(numout,*)
71         IF(lwp) WRITE(numout,*) ' trc_sed: LOBSTER sedimentation'
72         IF(lwp) WRITE(numout,*) ' ~~~~~~~'
73      ENDIF
74
75      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 2,3) ) THEN
76         CALL ctl_stop('trc_sed : requested workspace arrays unavailable.')  ;  RETURN
77      END IF
78
79      IF( l_trdtrc )  THEN
80         ALLOCATE( ztrbio(jpi,jpj,jpk) , STAT = ierr )   ! temporary save of trends
81         IF( ierr > 0 ) THEN
82            CALL ctl_stop( 'trc_sed: unable to allocate ztrbio array' )   ;   RETURN
83         ENDIF
84         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det)
85      ENDIF
86
87      IF( ln_diatrc )  zw2d(:,:) = 0.
88
89      ! sedimentation of detritus  : upstream scheme
90      ! --------------------------------------------
91
92      ! for detritus sedimentation only - jp_lob_det
93      zwork(:,:,1  ) = 0.e0      ! surface value set to zero
94      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
95
96      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
97      DO jk = 2, jpkm1
98         zwork(:,:,jk) = -vsed * trn(:,:,jk-1,jp_lob_det)
99      END DO
100
101      ! tracer flux divergence at t-point added to the general trend
102      DO jk = 1, jpkm1
103         DO jj = 1, jpj
104            DO ji = 1, jpi
105               ztra(ji,jj,jk)  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
106               tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + ztra(ji,jj,jk) 
107            END DO
108         END DO
109      END DO
110
111      IF( ln_diatrc ) THEN
112         zw2d(:,:) = 0.
113         DO jk = 1, jpkm1
114            DO jj = 1, jpj
115               DO ji = 1, jpi
116                  zw2d(ji,jj) = zw2d(ji,jj) + ztra(ji,jj,jk) * fse3t(ji,jj,jk) * 86400.
117               END DO
118            END DO
119         END DO
120         IF( lk_iomput )  THEN
121           CALL iom_put( "TDETSED", zw2d )
122         ELSE
123           trc2d(:,:,jp_lob0_2d + 7) = zw2d(:,:)
124         ENDIF
125      ENDIF
126      !
127      IF( ln_diabio )  trbio(:,:,:,jp_lob0_trd + 7) = ztra(:,:,:)
128      !
129      IF( l_trdtrc ) THEN
130         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det) - ztrbio(:,:,:)
131         jl = jp_lob0_trd + 7
132         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
133         DEALLOCATE( ztrbio ) 
134      ENDIF
135
136      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
137         WRITE(charout, FMT="('sed')")
138         CALL prt_ctl_trc_info(charout)
139         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
140      ENDIF
141
142      IF( ( wrk_not_released(2, 1) ) .OR. ( wrk_not_released(3, 2,3) ) )  &
143       &         CALL ctl_stop('trc_sed : failed to release workspace arrays.')
144
145   END SUBROUTINE trc_sed
146
147#else
148   !!======================================================================
149   !!  Dummy module :                                   No PISCES bio-model
150   !!======================================================================
151CONTAINS
152   SUBROUTINE trc_sed( kt )                   ! Empty routine
153      INTEGER, INTENT( in ) ::   kt
154      WRITE(*,*) 'trc_sed: You should not have seen this print! error?', kt
155   END SUBROUTINE trc_sed
156#endif 
157
158   !!======================================================================
159END MODULE  trcsed
Note: See TracBrowser for help on using the repository browser.