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.
trcnxt.F90 in branches/DEV_r2191_3partymerge2010/NEMO/TOP_SRC/TRP – NEMO

source: branches/DEV_r2191_3partymerge2010/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 2208

Last change on this file since 2208 was 2208, checked in by rblod, 14 years ago

Put FCM NEMO code changes in DEV_r2191_3partymerge2010 branch

  • Property svn:keywords set to Id
File size: 9.0 KB
Line 
1MODULE trcnxt
2   !!======================================================================
3   !!                       ***  MODULE  trcnxt  ***
4   !! Ocean passive tracers:  time stepping on passives tracers
5   !!======================================================================
6   !!======================================================================
7   !! History :  7.0  !  91-11  (G. Madec)  Original code
8   !!                 !  93-03  (M. Guyon)  symetrical conditions
9   !!                 !  95-02  (M. Levy)   passive tracers
10   !!                 !  96-02  (G. Madec & M. Imbard)  opa release 8.0
11   !!            8.0  !  96-04  (A. Weaver)  Euler forward step
12   !!            8.2  !  99-02  (G. Madec, N. Grima)  semi-implicit pressure grad.
13   !!            8.5  !  02-08  (G. Madec)  F90: Free form and module
14   !!                 !  02-11  (C. Talandier, A-M Treguier) Open boundaries
15   !!            9.0  !  04-03  (C. Ethe) passive tracers
16   !!                 !  07-02  (C. Deltel) Diagnose ML trends for passive tracers
17   !!----------------------------------------------------------------------
18#if defined key_top
19   !!----------------------------------------------------------------------
20   !!   'key_top'                                                TOP models
21   !!----------------------------------------------------------------------
22   !!   trc_nxt     : time stepping on passive tracers
23   !!----------------------------------------------------------------------
24   !! * Modules used
25   USE oce_trc         ! ocean dynamics and tracers variables
26   USE trp_trc             ! ocean passive tracers variables
27   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
28   USE trctrp_lec      ! pasive tracers transport
29   USE prtctl_trc      ! Print control for debbuging
30   USE trdmld_trc
31   USE trdmld_trc_oce
32# if defined key_agrif
33   USE agrif_top_update
34   USE agrif_top_interp
35# endif
36
37   IMPLICIT NONE
38   PRIVATE
39
40   !! * Routine accessibility
41   PUBLIC trc_nxt          ! routine called by step.F90
42   !!----------------------------------------------------------------------
43   !!   TOP 1.0 , LOCEAN-IPSL (2005)
44   !! $Id$
45   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
46   !!----------------------------------------------------------------------
47
48CONTAINS
49
50   SUBROUTINE trc_nxt( kt )
51      !!----------------------------------------------------------------------
52      !!                   ***  ROUTINE trcnxt  ***
53      !!
54      !! ** Purpose :   Compute the passive tracers fields at the
55      !!      next time-step from their temporal trends and swap the fields.
56      !!
57      !! ** Method  :   Apply lateral boundary conditions on (ua,va) through
58      !!      call to lbc_lnk routine
59      !!   default:
60      !!      arrays swap
61      !!         (trn) = (tra) ; (tra) = (0,0)
62      !!         (trb) = (trn)
63      !!
64      !!   For Arakawa or TVD Scheme :
65      !!      A Asselin time filter applied on now tracers (trn) to avoid
66      !!      the divergence of two consecutive time-steps and tr arrays
67      !!      to prepare the next time_step:
68      !!         (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ]
69      !!         (trn) = (tra) ; (tra) = (0,0)
70      !!
71      !!
72      !! ** Action  : - update trb, trn
73      !!----------------------------------------------------------------------
74      USE oce, ONLY :   ztrtrd => ua    ! use ua as 3D workspace
75      !! * Arguments
76      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index
77      !! * Local declarations
78      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
79      REAL(wp) ::   zfact            ! temporary scalar
80      CHARACTER (len=22) :: charout
81      !!----------------------------------------------------------------------
82
83      IF( kt == nittrc000 .AND. lwp ) THEN
84         WRITE(numout,*)
85         WRITE(numout,*) 'trc_nxt : time stepping on passive tracers'
86      ENDIF
87
88      DO jn = 1, jptra
89
90         ! 0. Lateral boundary conditions on tra (T-point, unchanged sign)
91         ! ---------------------------------============
92         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )   
93         
94         !                                                ! ===============
95         DO jk = 1, jpk                                   ! Horizontal slab
96            !                                             ! ===============
97            ! 1. Leap-frog scheme (only in explicit case, otherwise the
98            ! -------------------  time stepping is already done in trczdf)
99            IF( l_trczdf_exp .AND. ( ln_trcadv_cen2 .OR. ln_trcadv_tvd) ) THEN
100               zfact = 2. * rdttra(jk) * FLOAT(ndttrc) 
101               IF( neuler == 0 .AND. kt == nittrc000 ) zfact = rdttra(jk) * FLOAT(ndttrc) 
102               tra(:,:,jk,jn) = ( trb(:,:,jk,jn) + zfact * tra(:,:,jk,jn) ) * tmask(:,:,jk)
103            ENDIF
104
105         END DO
106
107#if defined key_obc
108        CALL ctl_stop( '          Passive tracers and Open Boundary condition can not be used together ' &
109           &           '          Check in trc_nxt routine' )
110#endif
111
112#if defined key_agrif
113         !                                             ! ===============
114      END DO                                           !   End of slab
115      !                                                ! ===============
116      ! Interp tracers on boundaries (coarse => fine)
117      CALL Agrif_trc
118      !                                                ! ===============
119      DO jn = 1, jptra                                 ! Horizontal slab
120         !                                             ! ===============
121#endif
122
123         DO jk = 1, jpk 
124
125            ! 2. Time filter and swap of arrays
126            ! ---------------------------------
127            IF ( ln_trcadv_cen2 .OR. ln_trcadv_tvd  ) THEN
128
129               IF( neuler == 0 .AND. kt == nittrc000 ) THEN
130                  DO jj = 1, jpj
131                     DO ji = 1, jpi
132                        trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
133                        trn(ji,jj,jk,jn) = tra(ji,jj,jk,jn)
134                        tra(ji,jj,jk,jn) = 0.
135                     END DO
136                  END DO
137                  IF( l_trdtrc )   ztrtrd(:,:,:) = 0.e0           !    no trend
138               ELSE
139                  IF( l_trdtrc ) THEN                             !    Asselin trend
140                     DO jj = 1, jpj
141                        DO ji = 1, jpi
142                           ztrtrd(ji,jj,jk) = atfp * ( trb(ji,jj,jk,jn) - 2*trn(ji,jj,jk,jn) + tra(ji,jj,jk,jn) )
143                        END DO
144                     END DO
145                  ENDIF
146
147                  DO jj = 1, jpj
148                     DO ji = 1, jpi
149                        trb(ji,jj,jk,jn) = atfp  * ( trb(ji,jj,jk,jn) + tra(ji,jj,jk,jn) ) + atfp1 * trn(ji,jj,jk,jn)
150                        trn(ji,jj,jk,jn) = tra(ji,jj,jk,jn)
151                        tra(ji,jj,jk,jn) = 0.
152                     END DO
153                  END DO
154               ENDIF
155            ELSE                                                  ! >> EULER-FORWARD schemes (SMOLAR, MUSCL)
156               IF( l_trdtrc ) ztrtrd(:,:,:) = 0.e0                !    no trend
157
158               DO jj = 1, jpj
159                  DO ji = 1, jpi
160                     trb(ji,jj,jk,jn) = tra(ji,jj,jk,jn)
161                     trn(ji,jj,jk,jn) = tra(ji,jj,jk,jn)
162                     tra(ji,jj,jk,jn) = 0.
163                  END DO
164               END DO
165
166            ENDIF
167            !                                             ! ===============
168         END DO                                           !   End of slab
169         !                                                ! ===============
170
171         IF( l_trdtrc ) THEN                                      ! trends
172            DO jk = 1, jpk
173               zfact = 2. * rdttra(jk) * FLOAT(ndttrc)
174               ztrtrd(:,:,jk) = ztrtrd(:,:,jk) / zfact            ! n.b. ztrtrd=0 in Euler-forward case
175            END DO
176            IF (luttrd(jn)) CALL trd_mod_trc( ztrtrd, jn, jptrc_trd_atf, kt )
177         ENDIF
178         !                                                        ! ===========
179      END DO                                                      ! tracer loop
180      !                                                           ! ===========
181
182      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
183         WRITE(charout, FMT="('nxt')")
184         CALL prt_ctl_trc_info(charout)
185         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
186      ENDIF
187
188#if defined key_agrif
189      IF (.NOT.Agrif_Root())    CALL Agrif_Update_Trc( kt )
190#endif     
191
192
193   END SUBROUTINE trc_nxt
194
195#else
196   !!----------------------------------------------------------------------
197   !!   Default option                                         Empty module
198   !!----------------------------------------------------------------------
199CONTAINS
200   SUBROUTINE trc_nxt( kt ) 
201      INTEGER, INTENT(in) :: kt
202      WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt
203   END SUBROUTINE trc_nxt
204#endif
205   !!======================================================================
206END MODULE trcnxt
Note: See TracBrowser for help on using the repository browser.