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.
trctrp.F90 in NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/TOP/TRP – NEMO

source: NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/TOP/TRP/trctrp.F90 @ 11427

Last change on this file since 11427 was 11427, checked in by davestorkey, 5 years ago

dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap :
Restore independent time level indices for TOP in order to enable the option for
TOP to have a different timestep to OCE (nn_dttrc > 1). But note that this version of
the code only works for nn_dttrc=1. Also sort out the time-level swapping for OFF.
This commit passes the GYRE_PISCES and ORCA2_OFF_PISCES tests but fails restartability
and bit-comparison with the control for ORCA2_ICE_PISCES.

  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1MODULE trctrp
2   !!======================================================================
3   !!                       ***  MODULE trctrp  ***
4   !! Ocean Physics    : manage the passive tracer transport
5   !!======================================================================
6   !! History :   1.0  !  2004-03 (C. Ethe) Original code
7   !!             3.3  !  2010-07 (C. Ethe) Merge TRA-TRC
8   !!----------------------------------------------------------------------
9#if defined key_top
10   !!----------------------------------------------------------------------
11   !!   'key_top'                                                TOP models
12   !!----------------------------------------------------------------------
13   !!   trc_trp        : passive tracer transport
14   !!----------------------------------------------------------------------
15   USE oce_trc         ! ocean dynamics and active tracers variables
16   USE trc             ! ocean passive tracers variables
17   USE trcbbl          ! bottom boundary layer               (trc_bbl routine)
18   USE trcdmp          ! internal damping                    (trc_dmp routine)
19   USE trcldf          ! lateral mixing                      (trc_ldf routine)
20   USE trcadv          ! advection                           (trc_adv routine)
21   USE trczdf          ! vertical diffusion                  (trc_zdf routine)
22   USE trcatf          ! time filtering                      (trc_atf routine)
23   USE trcrad          ! positivity                          (trc_rad routine)
24   USE trcsbc          ! surface boundary condition          (trc_sbc routine)
25   USE zpshde          ! partial step: hor. derivative       (zps_hde routine)
26   USE bdy_oce   , ONLY: ln_bdy
27   USE trcbdy          ! BDY open boundaries
28
29#if defined key_agrif
30   USE agrif_top_sponge ! tracers sponges
31#endif
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   trc_trp    ! called by trc_stp
37
38   INTEGER, SAVE :: N_save  !  Save value of time index for time swapping for ln_top_euler=.true.
39
40   !!----------------------------------------------------------------------
41   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
42   !! $Id$
43   !! Software governed by the CeCILL license (see ./LICENSE)
44   !!----------------------------------------------------------------------
45
46CONTAINS
47
48   SUBROUTINE trc_trp( kt, Kbb, Kmm, Krhs, Kaa )
49      !!----------------------------------------------------------------------
50      !!                     ***  ROUTINE trc_trp  ***
51      !!                     
52      !! ** Purpose :   Management of passive tracers transport
53      !!
54      !! ** Method  : - Compute the passive tracers trends
55      !!              - Update the passive tracers
56      !!----------------------------------------------------------------------
57      INTEGER, INTENT( in    ) :: kt                  ! ocean time-step index
58      INTEGER, INTENT( inout ) :: Kbb, Kmm, Krhs, Kaa ! TOP time level indices (swapped in this routine)
59      !! ---------------------------------------------------------------------
60      !
61      IF( ln_timing )   CALL timing_start('trc_trp')
62      !
63      IF ( kt == nit000 ) N_save = Kbb
64      !
65      IF( .NOT. lk_c1d ) THEN
66         !
67                                CALL trc_sbc    ( kt,      Kmm, tr, Krhs )  ! surface boundary condition
68         IF( ln_trabbl )        CALL trc_bbl    ( kt, Kbb, Kmm, tr, Krhs )  ! advective (and/or diffusive) bottom boundary layer scheme
69         IF( ln_trcdmp )        CALL trc_dmp    ( kt, Kbb, Kmm, tr, Krhs )  ! internal damping trends
70         IF( ln_bdy )           CALL trc_bdy_dmp( kt, Kbb,      Krhs )      ! BDY damping trends
71                                CALL trc_adv    ( kt, Kbb, Kmm, tr, Krhs )  ! horizontal & vertical advection
72         !                                                             ! Partial top/bottom cell: GRADh( tr(Kbb) ) 
73         IF( ln_zps ) THEN
74           IF( ln_isfcav ) THEN ; CALL zps_hde_isf( kt, Kmm, jptra, tr(:,:,:,:,Kbb), pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )  ! both top & bottom
75           ELSE                 ; CALL zps_hde    ( kt, Kmm, jptra, tr(:,:,:,:,Kbb), gtru, gtrv )                                      !  only bottom
76           ENDIF
77         ENDIF
78         !                                                     
79                                CALL trc_ldf    ( kt, Kbb, Kmm,       tr, Krhs )  ! lateral mixing
80#if defined key_agrif
81         IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc       ! tracers sponge
82#endif
83                                CALL trc_zdf    ( kt, Kbb, Kmm, Krhs, tr, Kaa  )  ! vert. mixing & after tracer   ==> after
84                                CALL trc_atf    ( kt, Kbb, Kmm, Kaa , tr )        ! time filtering of "now" tracer fields   
85         !
86         ! Swap TOP time levels (= Nrhs_trc, Nbb_trc etc)
87         IF( ln_top_euler ) THEN
88            ! For Euler timestepping we need the "before" and "now" fields to be the same.
89            ! Use N_save to ensure that the indices stay in sync with the (leapfrogging) OCE time indices for nn_dttrc=1.
90            Krhs = N_save
91            N_save = Kmm
92            Kbb = Kaa
93         ELSE
94            Krhs = Kbb
95            Kbb = Kmm
96         ENDIF
97         Kmm = Kaa
98         Kaa = Krhs
99         !
100         IF( ln_trcrad )        CALL trc_rad    ( kt, Kbb, Kmm, Krhs, tr   )    ! Correct artificial negative concentrations
101         IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kt, Kbb, Kmm )                ! internal damping trends on closed seas only
102
103         !
104      ELSE                                               ! 1D vertical configuration
105                                CALL trc_sbc( kt,      Kmm,       tr, Krhs )  ! surface boundary condition
106         IF( ln_trcdmp )        CALL trc_dmp( kt, Kbb, Kmm,       tr, Krhs )  ! internal damping trends
107                                CALL trc_zdf( kt, Kbb, Kmm, Krhs, tr, Kaa  )  ! vert. mixing & after tracer ==> after
108                                CALL trc_atf( kt, Kbb, Kmm, Kaa , tr )        ! time filtering of "now" tracer fields
109         !
110         ! Swap TOP time levels (= Nrhs_trc, Nbb_trc etc)
111         Krhs = Kbb
112         Kbb = Kmm
113         Kmm = Kaa
114         Kaa = Krhs
115         !
116         IF( ln_trcrad )       CALL trc_rad( kt, Kbb, Kmm, Krhs, tr       )  ! Correct artificial negative concentrations
117         !
118      END IF
119      !
120      IF( ln_timing )   CALL timing_stop('trc_trp')
121      !
122   END SUBROUTINE trc_trp
123
124#else
125   !!----------------------------------------------------------------------
126   !!   Dummy module :                                        No TOP models
127   !!----------------------------------------------------------------------
128CONTAINS
129   SUBROUTINE trc_trp( kt )              ! Empty routine
130      INTEGER, INTENT(in) ::   kt
131      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kt
132   END SUBROUTINE trc_trp
133#endif
134   
135   !!======================================================================
136END MODULE trctrp
Note: See TracBrowser for help on using the repository browser.