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

source: branches/DEV_r2106_LOCEAN2010/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 2237

Last change on this file since 2237 was 2237, checked in by cetlod, 14 years ago

Update TOP routines

  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1MODULE trcnxt
2   !!======================================================================
3   !!                       ***  MODULE  trcnxt  ***
4   !! Ocean passive tracers:  time stepping on passives tracers
5   !!======================================================================
6   !!======================================================================
7   !! History :  7.0  !  1991-11  (G. Madec)  Original code
8   !!                 !  1993-03  (M. Guyon)  symetrical conditions
9   !!                 !  1995-02  (M. Levy)   passive tracers
10   !!                 !  1996-02  (G. Madec & M. Imbard)  opa release 8.0
11   !!            8.0  !  1996-04  (A. Weaver)  Euler forward step
12   !!            8.2  !  1999-02  (G. Madec, N. Grima)  semi-implicit pressure grad.
13   !!  NEMO      1.0  !  2002-08  (G. Madec)  F90: Free form and module
14   !!                 !  2002-08  (G. Madec)  F90: Free form and module
15   !!                 !  2002-11  (C. Talandier, A-M Treguier) Open boundaries
16   !!                 !  2004-03  (C. Ethe) passive tracers
17   !!                 !  2007-02  (C. Deltel) Diagnose ML trends for passive tracers
18   !!            2.0  !  2006-02  (L. Debreu, C. Mazauric) Agrif implementation
19   !!            3.0  !  2008-06  (G. Madec)  time stepping always done in trazdf
20   !!            3.1  !  2009-02  (G. Madec, R. Benshila)  re-introduce the vvl option
21   !!            3.3  !  2010-06  (C. Ethe, G. Madec) Merge TRA-TRC
22   !!----------------------------------------------------------------------
23#if defined key_top
24   !!----------------------------------------------------------------------
25   !!   'key_top'                                                TOP models
26   !!----------------------------------------------------------------------
27   !!   trc_nxt     : time stepping on passive tracers
28   !!----------------------------------------------------------------------
29   !! * Modules used
30   USE oce_trc         ! ocean dynamics and tracers variables
31   USE trc             ! ocean passive tracers variables
32   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
33   USE prtctl_trc      ! Print control for debbuging
34   USE trdmod_oce
35   USE trdtra
36   USE tranxt
37# if defined key_agrif
38   USE agrif_top_update
39   USE agrif_top_interp
40# endif
41
42   IMPLICIT NONE
43   PRIVATE
44
45   !! * Routine accessibility
46   PUBLIC trc_nxt          ! routine called by step.F90
47
48  REAL(wp), DIMENSION(jpk) ::   r2dt
49   !!----------------------------------------------------------------------
50   !!   TOP 1.0 , LOCEAN-IPSL (2005)
51   !! $Id$
52   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
53   !!----------------------------------------------------------------------
54
55CONTAINS
56
57   SUBROUTINE trc_nxt( kt )
58      !!----------------------------------------------------------------------
59      !!                   ***  ROUTINE trcnxt  ***
60      !!
61      !! ** Purpose :   Compute the passive tracers fields at the
62      !!      next time-step from their temporal trends and swap the fields.
63      !!
64      !! ** Method  :   Apply lateral boundary conditions on (ua,va) through
65      !!      call to lbc_lnk routine
66      !!   default:
67      !!      arrays swap
68      !!         (trn) = (tra) ; (tra) = (0,0)
69      !!         (trb) = (trn)
70      !!
71      !!   For Arakawa or TVD Scheme :
72      !!      A Asselin time filter applied on now tracers (trn) to avoid
73      !!      the divergence of two consecutive time-steps and tr arrays
74      !!      to prepare the next time_step:
75      !!         (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ]
76      !!         (trn) = (tra) ; (tra) = (0,0)
77      !!
78      !!
79      !! ** Action  : - update trb, trn
80      !!----------------------------------------------------------------------
81      !! * Arguments
82      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index
83      !! * Local declarations
84      INTEGER  ::   jk, jn   ! dummy loop indices
85      REAL(wp) ::   zfact            ! temporary scalar
86      CHARACTER (len=22) :: charout
87      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  ztrdt 
88      !!----------------------------------------------------------------------
89
90      IF( kt == nit000 .AND. lwp ) THEN
91         WRITE(numout,*)
92         WRITE(numout,*) 'trc_nxt : time stepping on passive tracers'
93      ENDIF
94
95      ! Update after tracer on domain lateral boundaries
96      DO jn = 1, jptra
97         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )   
98      END DO
99
100
101#if defined key_obc
102!!      CALL obc_trc( kt )               ! OBC open boundaries
103#endif
104#if defined key_bdy
105!!      CALL bdy_trc( kt )               ! BDY open boundaries
106#endif
107#if defined key_agrif
108      CALL Agrif_trc                   ! AGRIF zoom boundaries
109#endif
110
111
112      ! set time step size (Euler/Leapfrog)
113      IF( neuler == 0 .AND. kt ==  nit000) THEN  ;  r2dt(:) =     rdttra(:) * FLOAT( nn_dttrc )  ! at nit000             (Euler)
114      ELSEIF( kt <= nit000 + 1 )           THEN  ;  r2dt(:) = 2.* rdttra(:) * FLOAT( nn_dttrc )  ! at nit000 or nit000+1 (Leapfrog)
115      ENDIF
116
117      ! trends computation initialisation
118      IF( l_trdtrc )  THEN
119         ALLOCATE( ztrdt(jpi,jpj,jpk,jptra) )  !* store now fields before applying the Asselin filter
120         ztrdt(:,:,:,:)  = trn(:,:,:,:)
121      ENDIF
122
123      ! Leap-Frog + Asselin filter time stepping
124      IF( lk_vvl ) THEN   ;   CALL tra_nxt_vvl( kt, 'TRC', trb, trn, tra, jptra )      ! variable volume level (vvl)
125      ELSE                ;   CALL tra_nxt_fix( kt,        trb, trn, tra, jptra )      ! fixed    volume level
126      ENDIF
127
128#if defined key_agrif
129      ! Update tracer at AGRIF zoom boundaries
130      IF( .NOT.Agrif_Root() )    CALL Agrif_Update_Trc( kt )      ! children only
131#endif     
132
133      ! trends computation
134      IF( l_trdtrc ) THEN                                      ! trends
135         DO jn = 1, jptra
136            DO jk = 1, jpkm1
137               zfact = 1.e0 / r2dt(jk) 
138               ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact 
139               CALL trd_tra( kt, 'TRC', jn, jptra_trd_atf, ztrdt )
140            END DO
141         END DO
142         DEALLOCATE( ztrdt )
143      END IF
144      !
145      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
146         WRITE(charout, FMT="('nxt')")
147         CALL prt_ctl_trc_info(charout)
148         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
149      ENDIF
150      !
151   END SUBROUTINE trc_nxt
152
153#else
154   !!----------------------------------------------------------------------
155   !!   Default option                                         Empty module
156   !!----------------------------------------------------------------------
157CONTAINS
158   SUBROUTINE trc_nxt( kt ) 
159      INTEGER, INTENT(in) :: kt
160      WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt
161   END SUBROUTINE trc_nxt
162#endif
163   !!======================================================================
164END MODULE trcnxt
Note: See TracBrowser for help on using the repository browser.