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

source: branches/2016/dev_r6859_LIM3_meltponds/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 8061

Last change on this file since 8061 was 7158, checked in by clem, 8 years ago

debug branch

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