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 branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90 @ 6101

Last change on this file since 6101 was 6101, checked in by cbricaud, 8 years ago

correction of bugs from last update and improvments for CRS

  • Property svn:keywords set to Id
File size: 8.3 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 trcnam_trp      ! passive tracers transport namelist variables
18   USE trabbl          ! bottom boundary layer               (trc_bbl routine)
19   USE trabbl_crs      ! bottom boundary layer               (trc_bbl routine)
20   USE trcbbl          ! bottom boundary layer               (trc_bbl routine)
21   USE trcbbl_crs      ! bottom boundary layer               (trc_bbl routine)
22   USE zdfkpp          ! KPP non-local tracer fluxes         (trc_kpp routine)
23   USE trcdmp          ! internal damping                    (trc_dmp routine)
24   USE trcldf          ! lateral mixing                      (trc_ldf routine)
25   USE trcldf_crs      ! lateral mixing                      (trc_ldf routine)
26   USE trcadv          ! advection                           (trc_adv routine)
27   USE trcadv_crs      ! advection                           (trc_adv routine)
28   USE trczdf          ! vertical diffusion                  (trc_zdf routine)
29   USE trczdf_crs      ! vertical diffusion                  (trc_zdf routine
30   USE trcnxt          ! time-stepping                       (trc_nxt routine)
31   USE trcrad          ! positivity                          (trc_rad routine)
32   USE trcsbc          ! surface boundary condition          (trc_sbc routine)
33   USE trcsbc_crs      ! surface boundary condition          (trc_sbc routine)
34   USE zpshde          ! partial step: hor. derivative       (zps_hde routine)
35   USE zpshde_crs      ! partial step: hor. derivative       (zps_hde routine)
36   USE dom_oce , ONLY : ln_crs, ln_isfcav
37   USE crs     , ONLY : jpi_crs,jpj_crs,wn_crs,ln_crs_top !cbr
38   USE ldfslp_crs
39#if defined key_agrif
40   USE agrif_top_sponge ! tracers sponges
41   USE agrif_top_update ! tracers updates
42#endif
43
44   IMPLICIT NONE
45   PRIVATE
46
47   PUBLIC   trc_trp    ! called by trc_stp
48
49   !! * Substitutions
50#  include "top_substitute.h90"
51   !!----------------------------------------------------------------------
52   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
53   !! $Id$
54   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
55   !!----------------------------------------------------------------------
56
57CONTAINS
58
59   SUBROUTINE trc_trp( kstp )
60      !!----------------------------------------------------------------------
61      !!                     ***  ROUTINE trc_trp  ***
62      !!                     
63      !! ** Purpose :   Management of passive tracers transport
64      !!
65      !! ** Method  : - Compute the passive tracers trends
66      !!              - Update the passive tracers
67      !!----------------------------------------------------------------------
68      INTEGER, INTENT( in ) ::  kstp  ! ocean time-step index
69      REAL(wp) :: zmin,zmax
70      INTEGER :: ji,jj,jk
71      !! ---------------------------------------------------------------------
72      !
73      IF( nn_timing == 1 )   CALL timing_start('trc_trp')
74      !
75      IF( .NOT. lk_c1d ) THEN
76         !
77         IF( ln_crs_top ) THEN ;    CALL trc_sbc_crs( kstp )
78         ELSE              ;    CALL trc_sbc( kstp )
79         ENDIF
80         IF( ln_crs_top ) THEN ;    CALL trc_bbl_crs( kstp )
81         ELSE              ;    CALL trc_bbl( kstp )
82         ENDIF
83         IF( ln_trcdmp )        CALL trc_dmp( kstp )            ! internal damping trends
84
85         IF( ln_crs_top ) THEN ;    CALL trc_adv_crs( kstp )
86         ELSE              ;    CALL trc_adv( kstp )
87         ENDIF
88
89         IF( ln_trcdmp_clo )    CALL trc_dmp_clo( kstp )        ! internal damping trends on closed seas only
90         IF( ln_crs_top ) THEN ;    CALL trc_ldf_crs( kstp )
91         ELSE              ;    CALL trc_ldf( kstp )
92         ENDIF
93         IF( .NOT. lk_offline .AND. lk_zdfkpp )    &
94            &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes
95#if defined key_agrif
96         IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc           ! tracers sponge
97#endif
98         IF( ln_crs_top ) THEN ;    CALL trc_zdf_crs( kstp )
99         ELSE              ;    CALL trc_zdf( kstp )
100         ENDIF
101                                CALL trc_nxt( kstp )            ! tracer fields at next time step     
102         IF( ln_trcrad )        CALL trc_rad( kstp )            ! Correct artificial negative concentrations
103
104#if defined key_agrif
105      IF( .NOT. Agrif_Root())   CALL Agrif_Update_Trc( kstp )   ! Update tracer at AGRIF zoom boundaries : children only
106#endif
107          ! Partial steps: now horizontal gradient of passive
108         IF( ln_zps    )THEN
109            IF( ln_crs_top ) THEN 
110               CALL zps_hde_crs( kstp, jptra, trn, gtru, gtrv )
111            ELSE
112               IF( ln_isfcav )THEN
113                  CALL zps_hde_isf( kstp, jptra, trn, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )  ! Partial steps: now horizontal gradient of passive
114               ELSE
115                  CALL zps_hde    ( kstp, jptra, trn, gtru, gtrv )   ! Partial steps: now horizontal gradient of passive
116               ENDIF
117            ENDIF
118         ENDIF
119                                                                ! tracers at the bottom ocean level
120         !
121      ELSE                                               ! 1D vertical configuration
122                                CALL trc_sbc( kstp )            ! surface boundary condition
123         IF( .NOT. lk_offline .AND. lk_zdfkpp )    &
124            &                   CALL trc_kpp( kstp )            ! KPP non-local tracer fluxes
125                                CALL trc_zdf( kstp )            ! vertical mixing and after tracer fields
126                                CALL trc_nxt( kstp )            ! tracer fields at next time step     
127          IF( ln_trcrad )       CALL trc_rad( kstp )            ! Correct artificial negative concentrations
128         !
129      END IF
130      !
131      IF( nn_timing == 1 )   CALL timing_stop('trc_trp')
132      !
133   END SUBROUTINE trc_trp
134   SUBROUTINE test(kt,i)
135   INTEGER,INTENT(IN) :: kt,i
136   REAL(wp)::zmin,zmax
137   INTEGER :: ii,jj,kk
138   zmin=MINVAL( trb(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_min(zmin)
139   zmax=MAXVAL( trb(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_max(zmax)
140   IF(lwp)WRITE(numout,*)"trctrp b ",kt,i,zmin,zmax   
141   zmin=MINVAL( trn(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_min(zmin)
142   zmax=MAXVAL( trn(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_max(zmax)
143   IF(lwp)WRITE(numout,*)"trctrp n ",kt,i,zmin,zmax   
144   zmin=MINVAL( tra(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_min(zmin)
145   zmax=MAXVAL( tra(2:jpi-1,2:jpj-1,:,1),mask=(tmask(2:jpi-1,2:jpj-1,:)==1)) ; CALL mpp_max(zmax)
146   IF(lwp)WRITE(numout,*)"trctrp a ",kt,i,zmin,zmax   
147   zmin=MINVAL( tra(2:jpi-1,2:jpj-1,30,1),mask=(tmask(2:jpi-1,2:jpj-1,30)==1)) ; CALL mpp_min(zmin)
148   zmax=MAXVAL( tra(2:jpi-1,2:jpj-1,30,1),mask=(tmask(2:jpi-1,2:jpj-1,30)==1)) ; CALL mpp_max(zmax)
149
150   END SUBROUTINE test
151#else
152   !!----------------------------------------------------------------------
153   !!   Dummy module :                                        No TOP models
154   !!----------------------------------------------------------------------
155CONTAINS
156   SUBROUTINE trc_trp( kstp )              ! Empty routine
157      INTEGER, INTENT(in) ::   kstp
158      WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kstp
159   END SUBROUTINE trc_trp
160#endif
161   
162   !!======================================================================
163END MODULE trctrp
Note: See TracBrowser for help on using the repository browser.