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

source: trunk/NEMOGCM/NEMO/TOP_SRC/trcbdy.F90 @ 7646

Last change on this file since 7646 was 7646, checked in by timgraham, 7 years ago

Merge of dev_merge_2016 into trunk. UPDATE TO ARCHFILES NEEDED for XIOS2.
LIM_SRC_s/limrhg.F90 to follow in next commit due to change of kind (I'm unable to do it in this commit).
Merged using the following steps:

1) svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk .
2) Resolve minor conflicts in sette.sh and namelist_cfg for ORCA2LIM3 (due to a change in trunk after branch was created)
3) svn commit
4) svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
5) svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2016/dev_merge_2016 .
6) At this stage I checked out a clean copy of the branch to compare against what is about to be committed to the trunk.
6) svn commit #Commit code to the trunk

In this commit I have also reverted a change to Fcheck_archfile.sh which was causing problems on the Paris machine.

File size: 6.3 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/OPA 4.0 , NEMO Consortium (2016)
34   !! $Id$
35   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_bdy( kt )
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      !!
48      INTEGER                           :: ib_bdy ,jn ,igrd ! Loop indeces
49      REAL(wp), POINTER, DIMENSION(:,:) ::  ztrc
50      REAL(wp), POINTER                 ::  zfac
51      !!----------------------------------------------------------------------
52      !
53      IF( nn_timing == 1 ) CALL timing_start('trc_bdy')
54      !
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' )
71            END SELECT
72            ! Boundary points should be updated
73            CALL lbc_bdy_lnk( tra(:,:,:,jn), 'T', 1., ib_bdy )
74            !
75         END DO
76      END DO
77      !
78      IF( nn_timing == 1 ) CALL timing_stop('trc_bdy')
79
80   END SUBROUTINE trc_bdy
81
82   SUBROUTINE trc_bdy_dmp( kt )
83      !!----------------------------------------------------------------------
84      !!                 ***  SUBROUTINE trc_bdy_dmp  ***
85      !!                   
86      !! ** Purpose : Apply damping for tracers at open boundaries.
87      !!             It currently applies the damping to all tracers!!!
88      !!
89      !!----------------------------------------------------------------------
90      INTEGER,         INTENT(in) ::   kt
91      !!
92      INTEGER  ::   jn             ! Tracer index
93      REAL(wp) ::   zwgt           ! boundary weight
94      REAL(wp) ::   zta, zsa, ztime
95      INTEGER  ::   ib, ik, igrd   ! dummy loop indices
96      INTEGER  ::   ii, ij         ! 2D addresses
97      INTEGER  ::   ib_bdy         ! Loop index
98      !!----------------------------------------------------------------------
99      !
100      IF( nn_timing == 1 ) CALL timing_start('trc_bdy_dmp')
101      !
102      DO jn = 1, jptra
103         DO ib_bdy=1, nb_bdy
104            IF ( trcdta_bdy(jn, ib_bdy)%dmp ) THEN
105               igrd = 1                       ! Everything is at T-points here
106               DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
107                  ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
108                  ij = idx_bdy(ib_bdy)%nbj(ib,igrd)
109                  zwgt = idx_bdy(ib_bdy)%nbd(ib,igrd)
110                  DO ik = 1, jpkm1
111                     zta = zwgt * ( trcdta_bdy(jn, ib_bdy)%trc(ib,ik) - trb(ii,ij,ik,jn) ) * tmask(ii,ij,ik)
112                     tra(ii,ij,ik,jn) = tra(ii,ij,ik,jn) + zta
113                  END DO
114               END DO
115            ENDIF
116         ENDDO
117      ENDDO
118      !
119      IF( nn_timing == 1 ) CALL timing_stop('trc_bdy_dmp')
120      !
121   END SUBROUTINE trc_bdy_dmp
122 
123#else
124   !!----------------------------------------------------------------------
125   !!   Dummy module                   NO Unstruct Open Boundary Conditions
126   !!----------------------------------------------------------------------
127CONTAINS
128   SUBROUTINE trc_bdy(kt)      ! Empty routine
129      WRITE(*,*) 'trc_bdy: You should not have seen this print! error?', kt
130   END SUBROUTINE trc_bdy
131
132   SUBROUTINE trc_bdy_dmp(kt)      ! Empty routine
133      WRITE(*,*) 'trc_bdy_dmp: You should not have seen this print! error?', kt
134   END SUBROUTINE trc_bdy_dmp
135
136#endif
137
138   !!======================================================================
139END MODULE trcbdy
Note: See TracBrowser for help on using the repository browser.