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 trunk/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90 @ 7698

Last change on this file since 7698 was 7698, checked in by mocavero, 7 years ago

update trunk with OpenMP parallelization

  • Property svn:keywords set to Id
File size: 5.5 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 trabbl              !
25   USE prtctl_trc          ! Print control for debbuging
26   USE trd_oce
27   USE trdtra
28
29   PUBLIC   trc_bbl       !  routine called by step.F90
30
31   !!----------------------------------------------------------------------
32   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
33   !! $Id$
34   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
35   !!----------------------------------------------------------------------
36
37CONTAINS
38
39
40   SUBROUTINE trc_bbl( kt )
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      CHARACTER (len=22) :: charout
51      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   ztrtrd
52      !!----------------------------------------------------------------------
53      !
54      IF( nn_timing == 1 )  CALL timing_start('trc_bbl')
55      !
56      IF( .NOT. l_offline .AND. nn_dttrc == 1 ) THEN
57         CALL bbl( kt, nittrc000, 'TRC' )      ! Online coupling with dynamics  : Computation of bbl coef and bbl transport
58         l_bbl = .FALSE.                       ! Offline coupling with dynamics : Read bbl coef and bbl transport from input files
59      ENDIF
60
61      IF( l_trdtrc )  THEN
62         CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) ! temporary save of trends
63!$OMP PARALLEL DO schedule(static) private(jn,jk,jj,ji)
64         DO jn = 1, jptra
65            DO jk = 1, jpk
66               DO jj = 1, jpj
67                  DO ji = 1, jpi
68                     ztrtrd(ji,jj,jk,jn)  = tra(ji,jj,jk,jn)
69                  END DO
70               END DO
71            END DO
72         END DO
73      ENDIF
74
75      !* Diffusive bbl :
76      IF( nn_bbl_ldf == 1 ) THEN
77         !
78         CALL tra_bbl_dif( trb, tra, jptra ) 
79         IF( ln_ctl )   THEN
80            WRITE(charout, FMT="(' bbl_dif')")  ;  CALL prt_ctl_trc_info(charout)
81            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
82         ENDIF
83         !
84      END IF
85
86      !* Advective bbl : bbl upstream advective trends added to the tracer trends
87      IF( nn_bbl_adv /= 0 ) THEN
88         !
89         CALL tra_bbl_adv( trb, tra, jptra ) 
90         IF( ln_ctl )   THEN
91            WRITE(charout, FMT="(' bbl_adv')")  ;  CALL prt_ctl_trc_info(charout)
92            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
93         ENDIF
94         !
95      END IF
96
97      IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics
98        DO jn = 1, jptra
99!$OMP PARALLEL DO schedule(static) private(jk,jj,ji)
100            DO jk = 1, jpk
101               DO jj = 1, jpj
102                  DO ji = 1, jpi
103                     ztrtrd(ji,jj,jk,jn) = tra(ji,jj,jk,jn) - ztrtrd(ji,jj,jk,jn)
104                  END DO
105               END DO
106            END DO
107           CALL trd_tra( kt, 'TRC', jn, jptra_bbl, ztrtrd(:,:,:,jn) )
108        END DO
109        CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) ! temporary save of trends
110      ENDIF
111      !
112      IF( nn_timing == 1 ) CALL timing_stop('trc_bbl')
113      !
114   END SUBROUTINE trc_bbl
115
116#else
117   !!----------------------------------------------------------------------
118   !!   Dummy module :                      No bottom boundary layer scheme
119   !!----------------------------------------------------------------------
120CONTAINS
121   SUBROUTINE trc_bbl( kt )              ! Empty routine
122      WRITE(*,*) 'tra_bbl: You should not have seen this print! error?', kt
123   END SUBROUTINE trc_bbl
124#endif
125
126   !!======================================================================
127END MODULE trcbbl
Note: See TracBrowser for help on using the repository browser.