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

source: branches/2016/dev_r7012_ROBUST5_CNRS/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90 @ 7162

Last change on this file since 7162 was 7162, checked in by cetlod, 7 years ago

new top interface : Add PISCES quota model

  • Property svn:keywords set to Id
File size: 6.9 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   USE trcbdy          ! BDY open boundaries
36   USE bdy_par, only: lk_bdy
37# if defined key_agrif
38   USE agrif_top_interp
39# endif
40
41   IMPLICIT NONE
42   PRIVATE
43
44   PUBLIC   trc_nxt          ! routine called by step.F90
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   SUBROUTINE trc_nxt( kt )
54      !!----------------------------------------------------------------------
55      !!                   ***  ROUTINE trcnxt  ***
56      !!
57      !! ** Purpose :   Compute the passive tracers fields at the
58      !!      next time-step from their temporal trends and swap the fields.
59      !!
60      !! ** Method  :   Apply lateral boundary conditions on (ua,va) through
61      !!      call to lbc_lnk routine
62      !!   default:
63      !!      arrays swap
64      !!         (trn) = (tra) ; (tra) = (0,0)
65      !!         (trb) = (trn)
66      !!
67      !!   For Arakawa or TVD Scheme :
68      !!      A Asselin time filter applied on now tracers (trn) to avoid
69      !!      the divergence of two consecutive time-steps and tr arrays
70      !!      to prepare the next time_step:
71      !!         (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ]
72      !!         (trn) = (tra) ; (tra) = (0,0)
73      !!
74      !!
75      !! ** Action  : - update trb, trn
76      !!----------------------------------------------------------------------
77      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index
78      !
79      INTEGER  ::   jk, jn   ! dummy loop indices
80      REAL(wp) ::   zfact            ! temporary scalar
81      CHARACTER (len=22) :: charout
82      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrdt 
83      !!----------------------------------------------------------------------
84      !
85      IF( nn_timing == 1 )  CALL timing_start('trc_nxt')
86      !
87      IF( kt == nittrc000 .AND. lwp ) THEN
88         WRITE(numout,*)
89         WRITE(numout,*) 'trc_nxt : time stepping on passive tracers'
90      ENDIF
91      !
92#if defined key_agrif
93      CALL Agrif_trc                   ! AGRIF zoom boundaries
94#endif
95      DO jn = 1, jptra                 ! Update after tracer on domain lateral boundaries
96         CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. )   
97      END DO
98
99      IF( lk_bdy )  CALL trc_bdy( kt )
100
101      IF( l_trdtrc )  THEN             ! trends: store now fields before the Asselin filter application
102         CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt )
103         ztrdt(:,:,:,:)  = trn(:,:,:,:)
104      ENDIF
105      !                                ! Leap-Frog + Asselin filter time stepping
106      IF( neuler == 0 .AND. kt == nittrc000 ) THEN    ! Euler time-stepping at first time-step (only swap)
107         DO jn = 1, jptra
108            DO jk = 1, jpkm1
109               trn(:,:,jk,jn) = tra(:,:,jk,jn)
110            END DO
111         END DO
112      ELSE                                            ! Asselin filter + swap
113         IF( ln_linssh ) THEN   ;   CALL tra_nxt_fix( kt, nittrc000,         'TRC', trb, trn, tra, jptra )  !     linear ssh
114         ELSE                   ;   CALL tra_nxt_vvl( kt, nittrc000, rdttrc, 'TRC', trb, trn, tra,      &
115           &                                                                   sbc_trc, sbc_trc_b, jptra )  ! non-linear ssh
116         ENDIF
117         !
118         DO jn = 1, jptra
119            CALL lbc_lnk( trb(:,:,:,jn), 'T', 1._wp ) 
120            CALL lbc_lnk( trn(:,:,:,jn), 'T', 1._wp )
121            CALL lbc_lnk( tra(:,:,:,jn), 'T', 1._wp )
122         END DO
123      ENDIF
124      !
125      IF( l_trdtrc ) THEN              ! trends: send Asselin filter trends to trdtra manager for further diagnostics
126         DO jn = 1, jptra
127            DO jk = 1, jpkm1
128               zfact = 1._wp / r2dttrc 
129               ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact 
130               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt )
131            END DO
132         END DO
133         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrdt ) 
134      END IF
135      !
136      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
137         WRITE(charout, FMT="('nxt')")
138         CALL prt_ctl_trc_info(charout)
139         CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm)
140      ENDIF
141      !
142      IF( nn_timing == 1 )  CALL timing_stop('trc_nxt')
143      !
144   END SUBROUTINE trc_nxt
145
146#else
147   !!----------------------------------------------------------------------
148   !!   Default option                                         Empty module
149   !!----------------------------------------------------------------------
150CONTAINS
151   SUBROUTINE trc_nxt( kt ) 
152      INTEGER, INTENT(in) :: kt
153      WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt
154   END SUBROUTINE trc_nxt
155#endif
156   !!======================================================================
157END MODULE trcnxt
Note: See TracBrowser for help on using the repository browser.