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 @ 6772

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

clean in coarsening branch

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