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.
trcbbl.F90 in NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/TOP/TRP – NEMO

source: NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/TOP/TRP/trcbbl.F90 @ 15648

Last change on this file since 15648 was 15648, checked in by sparonuz, 2 years ago

Updated name preprocessor function CASTWP to CASTDP

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1MODULE trcbbl
2  !!======================================================================
3   !!                       ***  MODULE  trcbbl  ***
4   !! Ocean passive tracers physics :  advective and/or diffusive bottom boundary
5   !!                                  layer scheme
6   !!======================================================================
7   !! History :  OPA  !  1996-06  (L. Mortier)  Original code
8   !!            8.0  !  1997-11  (G. Madec)    Optimization
9   !!   NEMO     1.0  !  2002-08  (G. Madec)  free form + modules
10   !!             -   !  2004-01  (A. de Miranda, G. Madec, J.M. Molines ) add advective bbl
11   !!            3.3  !  2009-11  (G. Madec)  merge trabbl and trabbl_adv + style + optimization
12   !!             -   !  2010-04  (G. Madec)  Campin & Goosse advective bbl
13   !!             -   !  2010-06  (C. Ethe, G. Madec)  merge TRA-TRC
14   !!            4.0  !  2017-04  (G. Madec)  ln_trabbl namelist variable instead of a CPP key
15   !!----------------------------------------------------------------------
16#if  defined key_top
17   !!----------------------------------------------------------------------
18   !!   'key_top'                                                TOP models
19   !!----------------------------------------------------------------------
20   !!    trc_bbl      : update the tracer trends due to the bottom boundary layer (advective and/or diffusive)
21   !!----------------------------------------------------------------------
22   USE par_trc        ! need jptra, number of passive tracers
23   USE oce_trc        ! ocean dynamics and passive tracers variables
24   USE trc            ! ocean passive tracers variables
25   USE trd_oce        ! trends: ocean variables
26   USE trdtra         ! tracer trends
27   USE trabbl         ! bottom boundary layer
28   USE prtctl         ! Print control for debbuging
29
30   PUBLIC   trc_bbl   !  routine called by trctrp.F90
31
32#  include "single_precision_substitute.h90"
33   !!----------------------------------------------------------------------
34   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
35   !! $Id$
36   !! Software governed by the CeCILL license (see ./LICENSE)
37   !!----------------------------------------------------------------------
38CONTAINS
39
40   SUBROUTINE trc_bbl( kt, Kbb, Kmm, ptr, Krhs )
41      !!----------------------------------------------------------------------
42      !!                  ***  ROUTINE bbl  ***
43      !!                   
44      !! ** Purpose :   Compute the before tracer (t & s) trend associated
45      !!     with the bottom boundary layer and add it to the general trend
46      !!     of tracer equations.
47      !!
48      !!---------------------------------------------------------------------- 
49      INTEGER,                                    INTENT( in  ) :: kt              ! ocean time-step
50      INTEGER,                                    INTENT( in  ) :: Kbb, Kmm, Krhs  ! time level indices
51      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
52      INTEGER :: jn                   ! loop index
53      CHARACTER (len=22) :: charout
54      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrtrd
55      !!----------------------------------------------------------------------
56      !
57      IF( ln_timing )   CALL timing_start('trc_bbl')
58      !
59      IF( .NOT. l_offline ) THEN
60         CALL bbl( kt, nittrc000, 'TRC', Kbb, Kmm )  ! Online coupling with dynamics  : Computation of bbl coef and bbl transport
61         l_bbl = .FALSE.                             ! Offline coupling with dynamics : Read bbl coef and bbl transport from input files
62      ENDIF
63
64      IF( l_trdtrc )  THEN
65         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) ) ! temporary save of trends
66         ztrtrd(:,:,:,:)  = ptr(:,:,:,:,Krhs)
67      ENDIF
68
69      !* Diffusive bbl :
70      IF( nn_bbl_ldf == 1 ) THEN
71         !
72         CALL tra_bbl_dif( CASTDP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, Kmm ) 
73         IF( sn_cfctl%l_prttrc )   THEN
74            WRITE(charout, FMT="(' bbl_dif')")  ;  CALL prt_ctl_info( charout, cdcomp = 'top' )
75            CALL prt_ctl( tab4d_1=CASTDP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
76         ENDIF
77         !
78      ENDIF
79
80      !* Advective bbl : bbl upstream advective trends added to the tracer trends
81      IF( nn_bbl_adv /= 0 ) THEN
82         !
83         CALL tra_bbl_adv( CASTDP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, Kmm ) 
84         IF( sn_cfctl%l_prttrc )   THEN
85            WRITE(charout, FMT="(' bbl_adv')")  ;  CALL prt_ctl_info( charout, cdcomp = 'top' )
86            CALL prt_ctl( tab4d_1=CASTDP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
87         ENDIF
88         !
89      ENDIF
90
91      IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics
92        DO jn = 1, jptra
93           ztrtrd(:,:,:,jn) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:,jn)
94           CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_bbl, ztrtrd(:,:,:,jn) )
95        END DO
96        DEALLOCATE( ztrtrd ) ! temporary save of trends
97      ENDIF
98      !
99      IF( ln_timing )   CALL timing_stop('trc_bbl')
100      !
101   END SUBROUTINE trc_bbl
102
103#endif
104
105   !!======================================================================
106END MODULE trcbbl
Note: See TracBrowser for help on using the repository browser.