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.
trcbdy.F90 in NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP – NEMO

source: NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/TOP/trcbdy.F90 @ 10372

Last change on this file since 10372 was 10314, checked in by smasson, 5 years ago

dev_r10164_HPC09_ESIWACE_PREP_MERGE: action 2: add generic glob_min/max/sum and locmin/max, complete timing and report (including bdy and icb), see #2133

  • Property svn:keywords set to Id
File size: 6.3 KB
RevLine 
[6108]1MODULE trcbdy
2   !!======================================================================
3   !!                       ***  MODULE  bdytrc  ***
4   !! Ocean tracers:   Apply boundary conditions for tracers in TOP component
5   !!======================================================================
6   !! History :  1.0  !  2005-01  (J. Chanut, A. Sellar)  Original code
7   !!            3.0  !  2008-04  (NEMO team)  add in the reference version
8   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
9   !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
10   !!            3.6  !  2015     (T. Lovato) Adapt BDY for tracers in TOP component
[7646]11   !!            4.0  !  2016     (T. Lovato) Generalize OBC structure
[6108]12   !!----------------------------------------------------------------------
[7646]13#if defined key_top
[6108]14   !!----------------------------------------------------------------------
[7646]15   !!   trc_bdy       : Apply open boundary conditions & damping to tracers
[6108]16   !!----------------------------------------------------------------------
17   USE timing                       ! Timing
18   USE oce_trc                      ! ocean dynamics and tracers variables
19   USE par_trc
20   USE trc                          ! ocean space and time domain variables
21   USE bdylib                       ! for orlanski library routines
22   USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
23   USE in_out_manager               ! I/O manager
[7646]24   USE bdy_oce, only: idx_bdy       ! ocean open boundary conditions
[6108]25
26   IMPLICIT NONE
27   PRIVATE
28
29   PUBLIC trc_bdy      ! routine called in trcnxt.F90
30   PUBLIC trc_bdy_dmp  ! routine called in trcstp.F90
31
32   !!----------------------------------------------------------------------
[10068]33   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
[6108]34   !! $Id$
[10068]35   !! Software governed by the CeCILL license (see ./LICENSE)
[6108]36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_bdy( kt )
40      !!----------------------------------------------------------------------
41      !!                  ***  SUBROUTINE trc_bdy  ***
42      !!
[7646]43      !! ** Purpose : - Apply open boundary conditions for TOP tracers
[6108]44      !!
45      !!----------------------------------------------------------------------
46      INTEGER, INTENT( in ) :: kt     ! Main time step counter
47      !!
[7646]48      INTEGER                           :: ib_bdy ,jn ,igrd ! Loop indeces
49      REAL(wp), POINTER, DIMENSION(:,:) ::  ztrc
50      REAL(wp), POINTER                 ::  zfac
[6108]51      !!----------------------------------------------------------------------
52      !
[9124]53      IF( ln_timing )   CALL timing_start('trc_bdy')
[6108]54      !
[7646]55      igrd = 1 
56      !
57      DO ib_bdy=1, nb_bdy
58         DO jn = 1, jptra
59            !
60            ztrc => trcdta_bdy(jn,ib_bdy)%trc 
61            zfac => trcdta_bdy(jn,ib_bdy)%rn_fac
62            !
63            SELECT CASE( TRIM(trcdta_bdy(jn,ib_bdy)%cn_obc) )
64            CASE('none'        )   ;   CYCLE
65            CASE('frs'         )   ;   CALL bdy_frs( idx_bdy(ib_bdy),                tra(:,:,:,jn), ztrc*zfac )
66            CASE('specified'   )   ;   CALL bdy_spe( idx_bdy(ib_bdy),                tra(:,:,:,jn), ztrc*zfac )
67            CASE('neumann'     )   ;   CALL bdy_nmn( idx_bdy(ib_bdy), igrd         , tra(:,:,:,jn) )
68            CASE('orlanski'    )   ;   CALL bdy_orl( idx_bdy(ib_bdy), trb(:,:,:,jn), tra(:,:,:,jn), ztrc*zfac, ll_npo=.false. )
69            CASE('orlanski_npo')   ;   CALL bdy_orl( idx_bdy(ib_bdy), trb(:,:,:,jn), tra(:,:,:,jn), ztrc*zfac, ll_npo=.true. )
70            CASE DEFAULT           ;   CALL ctl_stop( 'trc_bdy : unrecognised option for open boundaries for passive tracers' )
[6108]71            END SELECT
72            ! Boundary points should be updated
[10314]73            CALL lbc_bdy_lnk( 'trcbdy', tra(:,:,:,jn), 'T', 1., ib_bdy )
[7646]74            !
75         END DO
76      END DO
[6108]77      !
[9124]78      IF( ln_timing )   CALL timing_stop('trc_bdy')
[6108]79
80   END SUBROUTINE trc_bdy
81
[9124]82
[6108]83   SUBROUTINE trc_bdy_dmp( kt )
84      !!----------------------------------------------------------------------
85      !!                 ***  SUBROUTINE trc_bdy_dmp  ***
86      !!                   
87      !! ** Purpose : Apply damping for tracers at open boundaries.
88      !!             It currently applies the damping to all tracers!!!
89      !!
90      !!----------------------------------------------------------------------
91      INTEGER,         INTENT(in) ::   kt
92      !!
93      INTEGER  ::   jn             ! Tracer index
94      REAL(wp) ::   zwgt           ! boundary weight
95      REAL(wp) ::   zta, zsa, ztime
96      INTEGER  ::   ib, ik, igrd   ! dummy loop indices
97      INTEGER  ::   ii, ij         ! 2D addresses
98      INTEGER  ::   ib_bdy         ! Loop index
99      !!----------------------------------------------------------------------
100      !
[9124]101      IF( ln_timing )   CALL timing_start('trc_bdy_dmp')
[6108]102      !
103      DO jn = 1, jptra
104         DO ib_bdy=1, nb_bdy
[9124]105            IF( trcdta_bdy(jn, ib_bdy)%dmp ) THEN
[6108]106               igrd = 1                       ! Everything is at T-points here
107               DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
108                  ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
109                  ij = idx_bdy(ib_bdy)%nbj(ib,igrd)
110                  zwgt = idx_bdy(ib_bdy)%nbd(ib,igrd)
111                  DO ik = 1, jpkm1
112                     zta = zwgt * ( trcdta_bdy(jn, ib_bdy)%trc(ib,ik) - trb(ii,ij,ik,jn) ) * tmask(ii,ij,ik)
113                     tra(ii,ij,ik,jn) = tra(ii,ij,ik,jn) + zta
114                  END DO
115               END DO
116            ENDIF
[9124]117         END DO
118      END DO
[6108]119      !
[9124]120      IF( ln_timing )   CALL timing_stop('trc_bdy_dmp')
[6108]121      !
122   END SUBROUTINE trc_bdy_dmp
123 
124#else
125   !!----------------------------------------------------------------------
126   !!   Dummy module                   NO Unstruct Open Boundary Conditions
127   !!----------------------------------------------------------------------
128CONTAINS
129   SUBROUTINE trc_bdy(kt)      ! Empty routine
130      WRITE(*,*) 'trc_bdy: You should not have seen this print! error?', kt
131   END SUBROUTINE trc_bdy
132
133   SUBROUTINE trc_bdy_dmp(kt)      ! Empty routine
134      WRITE(*,*) 'trc_bdy_dmp: You should not have seen this print! error?', kt
135   END SUBROUTINE trc_bdy_dmp
136
137#endif
138
139   !!======================================================================
140END MODULE trcbdy
Note: See TracBrowser for help on using the repository browser.