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/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/TOP – NEMO

source: NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps_rewrite_time_filterswap/src/TOP/trcbdy.F90 @ 11463

Last change on this file since 11463 was 10963, checked in by acc, 5 years ago

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps : Convert TOP routines in top-level TOP directory and all knock on effects of these conversions. SETTE tested.

  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
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
11   !!            4.0  !  2016     (T. Lovato) Generalize OBC structure
12   !!----------------------------------------------------------------------
13#if defined key_top
14   !!----------------------------------------------------------------------
15   !!   trc_bdy       : Apply open boundary conditions & damping to tracers
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
24   USE bdy_oce, only: idx_bdy       ! ocean open boundary conditions
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   !!----------------------------------------------------------------------
33   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
34   !! $Id$
35   !! Software governed by the CeCILL license (see ./LICENSE)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_bdy( kt, Kbb, Kmm, Krhs )
40      !!----------------------------------------------------------------------
41      !!                  ***  SUBROUTINE trc_bdy  ***
42      !!
43      !! ** Purpose : - Apply open boundary conditions for TOP tracers
44      !!
45      !!----------------------------------------------------------------------
46      INTEGER, INTENT( in ) :: kt              ! Main time step counter
47      INTEGER, INTENT( in ) :: Kbb, Kmm, Krhs  ! time level indices
48      !!
49      INTEGER                           :: ib_bdy ,jn ,igrd ! Loop indeces
50      REAL(wp), POINTER, DIMENSION(:,:) ::  ztrc
51      REAL(wp), POINTER                 ::  zfac
52      !!----------------------------------------------------------------------
53      !
54      IF( ln_timing )   CALL timing_start('trc_bdy')
55      !
56      igrd = 1 
57      !
58      DO ib_bdy=1, nb_bdy
59         DO jn = 1, jptra
60            !
61            ztrc => trcdta_bdy(jn,ib_bdy)%trc 
62            zfac => trcdta_bdy(jn,ib_bdy)%rn_fac
63            !
64            SELECT CASE( TRIM(trcdta_bdy(jn,ib_bdy)%cn_obc) )
65            CASE('none'        )   ;   CYCLE
66            CASE('frs'         )   ;   CALL bdy_frs( idx_bdy(ib_bdy), tr(:,:,:,jn,Krhs), ztrc*zfac )
67            CASE('specified'   )   ;   CALL bdy_spe( idx_bdy(ib_bdy), tr(:,:,:,jn,Krhs), ztrc*zfac )
68            CASE('neumann'     )   ;   CALL bdy_nmn( idx_bdy(ib_bdy), igrd            , tr(:,:,:,jn,Krhs) )
69            CASE('orlanski'    )   ;   CALL bdy_orl( idx_bdy(ib_bdy), tr(:,:,:,jn,Kbb), tr(:,:,:,jn,Krhs), ztrc*zfac, ll_npo=.false. )
70            CASE('orlanski_npo')   ;   CALL bdy_orl( idx_bdy(ib_bdy), tr(:,:,:,jn,Kbb), tr(:,:,:,jn,Krhs), ztrc*zfac, ll_npo=.true. )
71            CASE DEFAULT           ;   CALL ctl_stop( 'trc_bdy : unrecognised option for open boundaries for passive tracers' )
72            END SELECT
73            ! Boundary points should be updated
74            CALL lbc_bdy_lnk( 'trcbdy', tr(:,:,:,jn,Krhs), 'T', 1., ib_bdy )
75            !
76         END DO
77      END DO
78      !
79      IF( ln_timing )   CALL timing_stop('trc_bdy')
80
81   END SUBROUTINE trc_bdy
82
83
84   SUBROUTINE trc_bdy_dmp( kt, Kbb, Krhs )
85      !!----------------------------------------------------------------------
86      !!                 ***  SUBROUTINE trc_bdy_dmp  ***
87      !!                   
88      !! ** Purpose : Apply damping for tracers at open boundaries.
89      !!             It currently applies the damping to all tracers!!!
90      !!
91      !!----------------------------------------------------------------------
92      INTEGER,         INTENT(in) ::   kt
93      INTEGER,         INTENT(in) ::   Kbb, Krhs  ! time level indices
94      !!
95      INTEGER  ::   jn             ! Tracer index
96      REAL(wp) ::   zwgt           ! boundary weight
97      REAL(wp) ::   zta, zsa, ztime
98      INTEGER  ::   ib, ik, igrd   ! dummy loop indices
99      INTEGER  ::   ii, ij         ! 2D addresses
100      INTEGER  ::   ib_bdy         ! Loop index
101      !!----------------------------------------------------------------------
102      !
103      IF( ln_timing )   CALL timing_start('trc_bdy_dmp')
104      !
105      DO jn = 1, jptra
106         DO ib_bdy=1, nb_bdy
107            IF( trcdta_bdy(jn, ib_bdy)%dmp ) THEN
108               igrd = 1                       ! Everything is at T-points here
109               DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
110                  ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
111                  ij = idx_bdy(ib_bdy)%nbj(ib,igrd)
112                  zwgt = idx_bdy(ib_bdy)%nbd(ib,igrd)
113                  DO ik = 1, jpkm1
114                     zta = zwgt * ( trcdta_bdy(jn, ib_bdy)%trc(ib,ik) - tr(ii,ij,ik,jn,Kbb) ) * tmask(ii,ij,ik)
115                     tr(ii,ij,ik,jn,Krhs) = tr(ii,ij,ik,jn,Krhs) + zta
116                  END DO
117               END DO
118            ENDIF
119         END DO
120      END DO
121      !
122      IF( ln_timing )   CALL timing_stop('trc_bdy_dmp')
123      !
124   END SUBROUTINE trc_bdy_dmp
125 
126#else
127   !!----------------------------------------------------------------------
128   !!   Dummy module                   NO Unstruct Open Boundary Conditions
129   !!----------------------------------------------------------------------
130CONTAINS
131   SUBROUTINE trc_bdy(kt)      ! Empty routine
132      WRITE(*,*) 'trc_bdy: You should not have seen this print! error?', kt
133   END SUBROUTINE trc_bdy
134
135   SUBROUTINE trc_bdy_dmp(kt)      ! Empty routine
136      WRITE(*,*) 'trc_bdy_dmp: You should not have seen this print! error?', kt
137   END SUBROUTINE trc_bdy_dmp
138
139#endif
140
141   !!======================================================================
142END MODULE trcbdy
Note: See TracBrowser for help on using the repository browser.