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

source: branches/DEV_r2006_merge_TRA_TRC/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 2082

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

Improve the merge of TRA-TRC, see ticket #717

  • Property svn:executable set to *
  • 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   USE agrif_top_update
38   USE agrif_top_interp
39
40   IMPLICIT NONE
41   PRIVATE
42
43   !! * Routine accessibility
44   PUBLIC trc_nxt          ! routine called by step.F90
45
46  REAL(wp), DIMENSION(jpk) ::   r2dt
47   !!----------------------------------------------------------------------
48   !!   TOP 1.0 , LOCEAN-IPSL (2005)
49   !! $Id$
50   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
51   !!----------------------------------------------------------------------
52
53CONTAINS
54
55   SUBROUTINE trc_nxt( kt )
56      !!----------------------------------------------------------------------
57      !!                   ***  ROUTINE trcnxt  ***
58      !!
59      !! ** Purpose :   Compute the passive tracers fields at the
60      !!      next time-step from their temporal trends and swap the fields.
61      !!
62      !! ** Method  :   Apply lateral boundary conditions on (ua,va) through
63      !!      call to lbc_lnk routine
64      !!   default:
65      !!      arrays swap
66      !!         (trn) = (tra) ; (tra) = (0,0)
67      !!         (trb) = (trn)
68      !!
69      !!   For Arakawa or TVD Scheme :
70      !!      A Asselin time filter applied on now tracers (trn) to avoid
71      !!      the divergence of two consecutive time-steps and tr arrays
72      !!      to prepare the next time_step:
73      !!         (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ]
74      !!         (trn) = (tra) ; (tra) = (0,0)
75      !!
76      !!
77      !! ** Action  : - update trb, trn
78      !!----------------------------------------------------------------------
79      !! * Arguments
80      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index
81      !! * Local declarations
82      INTEGER  ::   jk, jn   ! dummy loop indices
83      REAL(wp) ::   zfact            ! temporary scalar
84      CHARACTER (len=22) :: charout
85      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  ztrdt 
86      !!----------------------------------------------------------------------
87
88      IF( kt == nittrc000 .AND. lwp ) THEN
89         WRITE(numout,*)
90         WRITE(numout,*) 'trc_nxt : time stepping on passive tracers'
91      ENDIF
92
93      ! Update after tracer on domain lateral boundaries
94      DO jn = 1, jptra
95         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )   
96      END DO
97
98
99#if defined key_obc
100!!      CALL obc_trc( kt )               ! OBC open boundaries
101#endif
102#if defined key_bdy
103!!      CALL bdy_trc( kt )               ! BDY open boundaries
104#endif
105#if defined key_agrif
106      CALL Agrif_trc                   ! AGRIF zoom boundaries
107#endif
108
109
110      ! set time step size (Euler/Leapfrog)
111      IF( neuler == 0 .AND. kt ==  nittrc000) THEN  ;  r2dt(:) =     rdttra(:) * FLOAT( nn_dttrc )  ! at nit000             (Euler)
112      ELSEIF( kt <= nittrc000 + 1 )           THEN  ;  r2dt(:) = 2.* rdttra(:) * FLOAT( nn_dttrc )  ! at nit000 or nit000+1 (Leapfrog)
113      ENDIF
114
115      ! trends computation initialisation
116      IF( l_trdtrc )  THEN
117         ALLOCATE( ztrdt(jpi,jpj,jpk,jptra) )  !* store now fields before applying the Asselin filter
118         ztrdt(:,:,:,:)  = trn(:,:,:,:)
119      ENDIF
120
121      ! Leap-Frog + Asselin filter time stepping
122      IF( lk_vvl ) THEN   ;   CALL tra_nxt_vvl( kt, nittrc000, trb, trn, tra, jptra )      ! variable volume level (vvl)
123      ELSE                ;   CALL tra_nxt_fix( kt, nittrc000, trb, trn, tra, jptra )      ! fixed    volume level
124      ENDIF
125
126#if defined key_agrif
127      ! Update tracer at AGRIF zoom boundaries
128      IF( .NOT.Agrif_Root() )    CALL Agrif_Update_Trc( kt )      ! children only
129#endif     
130
131      ! trends computation
132      IF( l_trdtrc ) THEN                                      ! trends
133         DO jn = 1, jptra
134            DO jk = 1, jpkm1
135               zfact = 1.e0 / r2dt(jk) 
136               ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact 
137               CALL trd_tra( kt, 'TRC', jn, jptra_trd_atf, ztrdt )
138            END DO
139         END DO
140         DEALLOCATE( ztrdt )
141      END IF
142      !
143      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
144         WRITE(charout, FMT="('nxt')")
145         CALL prt_ctl_trc_info(charout)
146         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
147      ENDIF
148      !
149   END SUBROUTINE trc_nxt
150
151#else
152   !!----------------------------------------------------------------------
153   !!   Default option                                         Empty module
154   !!----------------------------------------------------------------------
155CONTAINS
156   SUBROUTINE trc_nxt( kt ) 
157      INTEGER, INTENT(in) :: kt
158      WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt
159   END SUBROUTINE trc_nxt
160#endif
161   !!======================================================================
162END MODULE trcnxt
Note: See TracBrowser for help on using the repository browser.