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 branches/NERC/dev_r5518_GO6_conserv_check_up/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/NERC/dev_r5518_GO6_conserv_check_up/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90 @ 9204

Last change on this file since 9204 was 7771, checked in by frrh, 7 years ago

Apply optimisations to various areas of code replacing the use of
allocated pointers with straightforward direct ALLOCATE and DEALLOCATE
operations.

These optimisations largely have an impact in models featuring MEDUSA,
i.e. those with significant numbers of tracers, although they are
expected to have a small impact in all configurations.

Code developed and tested in NEMO branch branches/UKMO/dev_r5518_optim_GO6_alloc
Tested in stand-alone GO6-GSI8, GO6-GSI8-MEDUSA and UKESM coupled models.
NEMO ticket #1821 documents this change further.

File size: 5.1 KB
Line 
1MODULE trcbbl
2  !!======================================================================
3   !!                       ***  MODULE  trcbbl  ***
4   !! Ocean passive tracers physics :  advective and/or diffusive bottom boundary
5   !!                                  layer scheme
6   !!======================================================================
7   !!==============================================================================
8   !! History :  OPA  !  1996-06  (L. Mortier)  Original code
9   !!            8.0  !  1997-11  (G. Madec)    Optimization
10   !!   NEMO     1.0  !  2002-08  (G. Madec)  free form + modules
11   !!             -   !  2004-01  (A. de Miranda, G. Madec, J.M. Molines ) add advective bbl
12   !!            3.3  !  2009-11  (G. Madec)  merge trabbl and trabbl_adv + style + optimization
13   !!             -   !  2010-04  (G. Madec)  Campin & Goosse advective bbl
14   !!             -   !  2010-06  (C. Ethe, G. Madec)  merge TRA-TRC
15   !!----------------------------------------------------------------------
16#if  defined key_top &&  defined key_trabbl 
17   !!----------------------------------------------------------------------
18   !!   'key_trabbl                      diffusive or/and adevective bottom boundary layer
19   !!----------------------------------------------------------------------
20   !!    trc_bbl       : update the tracer trends due to the bottom boundary layer (advective and/or diffusive)
21   !!----------------------------------------------------------------------
22   USE oce_trc             ! ocean dynamics and active tracers variables
23   USE trc                 ! ocean passive tracers variables
24   USE trcnam_trp      ! passive tracers transport namelist variables
25   USE trabbl              !
26   USE prtctl_trc          ! Print control for debbuging
27   USE trd_oce
28   USE trdtra
29
30   PUBLIC   trc_bbl       !  routine called by step.F90
31
32
33   !! * Substitutions
34#  include "top_substitute.h90"
35   !!----------------------------------------------------------------------
36   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
37   !! $Id$
38   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
39   !!----------------------------------------------------------------------
40
41CONTAINS
42
43
44   SUBROUTINE trc_bbl( kt )
45      !!----------------------------------------------------------------------
46      !!                  ***  ROUTINE bbl  ***
47      !!                   
48      !! ** Purpose :   Compute the before tracer (t & s) trend associated
49      !!     with the bottom boundary layer and add it to the general trend
50      !!     of tracer equations.
51      !!
52      !!---------------------------------------------------------------------- 
53      INTEGER, INTENT( in ) ::   kt   ! ocean time-step
54      CHARACTER (len=22) :: charout
55      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrtrd
56      !!----------------------------------------------------------------------
57      !
58      IF( nn_timing == 1 )  CALL timing_start('trc_bbl')
59      !
60      IF( .NOT. lk_offline .AND. nn_dttrc == 1 ) THEN
61         CALL bbl( kt, nittrc000, 'TRC' )      ! Online coupling with dynamics  : Computation of bbl coef and bbl transport
62         l_bbl = .FALSE.                       ! Offline coupling with dynamics : Read bbl coef and bbl transport from input files
63      ENDIF
64
65      IF( l_trdtrc )  THEN
66         ALLOCATE(ztrtrd( 1:jpi, 1:jpj, 1:jpk, 1:jptra )) ! temporary save of trends
67         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
68      ENDIF
69
70      !* Diffusive bbl :
71      IF( nn_bbl_ldf == 1 ) THEN
72         !
73         CALL tra_bbl_dif( trb, tra, jptra ) 
74         IF( ln_ctl )   THEN
75            WRITE(charout, FMT="(' bbl_dif')")  ;  CALL prt_ctl_trc_info(charout)
76            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
77         ENDIF
78         !
79      END IF
80
81      !* Advective bbl : bbl upstream advective trends added to the tracer trends
82      IF( nn_bbl_adv /= 0 ) THEN
83         !
84         CALL tra_bbl_adv( trb, tra, jptra ) 
85         IF( ln_ctl )   THEN
86            WRITE(charout, FMT="(' bbl_adv')")  ;  CALL prt_ctl_trc_info(charout)
87            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
88         ENDIF
89         !
90      END IF
91
92      IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics
93        DO jn = 1, jptra
94           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn)
95           CALL trd_tra( kt, 'TRC', jn, jptra_bbl, ztrtrd(:,:,:,jn) )
96        END DO
97        DEALLOCATE(ztrtrd ) ! temporary save of trends
98      ENDIF
99      !
100      IF( nn_timing == 1 ) CALL timing_stop('trc_bbl')
101      !
102   END SUBROUTINE trc_bbl
103
104#else
105   !!----------------------------------------------------------------------
106   !!   Dummy module :                      No bottom boundary layer scheme
107   !!----------------------------------------------------------------------
108CONTAINS
109   SUBROUTINE trc_bbl( kt )              ! Empty routine
110      WRITE(*,*) 'tra_bbl: You should not have seen this print! error?', kt
111   END SUBROUTINE trc_bbl
112#endif
113
114   !!======================================================================
115END MODULE trcbbl
Note: See TracBrowser for help on using the repository browser.