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_r1879_FCM/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/DEV_r1879_FCM/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 2013

Last change on this file since 2013 was 2013, checked in by smasson, 14 years ago

remove propertie svn:executabe of fortran files in DEV_r1879_FCM

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