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.
bdytra.F90 in branches/2012/dev_CMCC_INGV_2012/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

source: branches/2012/dev_CMCC_INGV_2012/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90 @ 3646

Last change on this file since 3646 was 3646, checked in by vichi, 11 years ago

Add the resulting merged branch from CMCC and INGV 2012 developments

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1MODULE bdytra
2   !!======================================================================
3   !!                       ***  MODULE  bdytra  ***
4   !! Ocean tracers:   Apply boundary conditions for tracers
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   !!----------------------------------------------------------------------
11#if defined key_bdy
12   !!----------------------------------------------------------------------
13   !!   'key_bdy'                     Unstructured Open Boundary Conditions
14   !!----------------------------------------------------------------------
15   !!   bdy_tra            : Apply open boundary conditions to T and S
16   !!   bdy_tra_frs        : Apply Flow Relaxation Scheme
17   !!----------------------------------------------------------------------
18   USE timing          ! Timing
19   USE oce             ! ocean dynamics and tracers variables
20   USE dom_oce         ! ocean space and time domain variables
21   USE bdy_oce         ! ocean open boundary conditions
22   USE bdydta, ONLY:   bf
23   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
24   USE in_out_manager  ! I/O manager
25
26   IMPLICIT NONE
27   PRIVATE
28
29   PUBLIC bdy_tra      ! routine called in tranxt.F90
30
31   !!----------------------------------------------------------------------
32   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
33   !! $Id$
34   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
35   !!----------------------------------------------------------------------
36CONTAINS
37
38   SUBROUTINE bdy_tra( kt )
39      !!----------------------------------------------------------------------
40      !!                  ***  SUBROUTINE bdy_tra  ***
41      !!
42      !! ** Purpose : - Apply open boundary conditions for temperature and salinity
43      !!
44      !!----------------------------------------------------------------------
45      INTEGER, INTENT( in ) :: kt     ! Main time step counter
46      !!
47      INTEGER               :: ib_bdy ! Loop index
48
49      DO ib_bdy=1, nb_bdy
50
51         SELECT CASE( nn_tra(ib_bdy) )
52         CASE(jp_none)
53            CYCLE
54         CASE(jp_frs)
55            CALL bdy_tra_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy), kt, ib_bdy )
56         CASE DEFAULT
57            CALL ctl_stop( 'bdy_tra : unrecognised option for open boundaries for T and S' )
58         END SELECT
59      ENDDO
60
61   END SUBROUTINE bdy_tra
62
63   SUBROUTINE bdy_tra_frs( idx, dta, kt, ib_bdy )
64      !!----------------------------------------------------------------------
65      !!                 ***  SUBROUTINE bdy_tra_frs  ***
66      !!                   
67      !! ** Purpose : Apply the Flow Relaxation Scheme for tracers at open boundaries.
68      !!
69      !! Reference : Engedahl H., 1995, Tellus, 365-382.
70      !!----------------------------------------------------------------------
71      INTEGER,         INTENT(in) ::   kt
72      TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
73      TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
74      INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
75      !!
76      REAL(wp) ::   zwgt           ! boundary weight
77      INTEGER  ::   ib, ik, igrd   ! dummy loop indices
78      INTEGER  ::   ii, ij         ! 2D addresses
79      !!----------------------------------------------------------------------
80      !
81      IF( nn_timing == 1 ) CALL timing_start('bdy_tra_frs')
82      !
83      igrd = 1                       ! Everything is at T-points here
84      DO ib = 1, idx%nblen(igrd)
85         DO ik = 1, jpkm1
86            ii = idx%nbi(ib,igrd)
87            ij = idx%nbj(ib,igrd)
88            zwgt = idx%nbw(ib,igrd)
89            tsa(ii,ij,ik,jp_tem) = ( tsa(ii,ij,ik,jp_tem) + zwgt * ( dta%tem(ib,ik) - tsa(ii,ij,ik,jp_tem) ) ) * tmask(ii,ij,ik)         
90            tsa(ii,ij,ik,jp_sal) = ( tsa(ii,ij,ik,jp_sal) + zwgt * ( dta%sal(ib,ik) - tsa(ii,ij,ik,jp_sal) ) ) * tmask(ii,ij,ik)
91         END DO
92      END DO
93      CALL lbc_bdy_lnk( tsa(:,:,:,jp_tem), 'T', 1., ib_bdy )   ; CALL lbc_bdy_lnk( tsa(:,:,:,jp_sal), 'T', 1., ib_bdy )    ! Boundary points should be updated
94      !
95      IF( kt .eq. nit000 ) CLOSE( unit = 102 )
96      !
97      IF( nn_timing == 1 ) CALL timing_stop('bdy_tra_frs')
98      !
99   END SUBROUTINE bdy_tra_frs
100   
101#else
102   !!----------------------------------------------------------------------
103   !!   Dummy module                   NO Unstruct Open Boundary Conditions
104   !!----------------------------------------------------------------------
105CONTAINS
106   SUBROUTINE bdy_tra(kt)      ! Empty routine
107      WRITE(*,*) 'bdy_tra: You should not have seen this print! error?', kt
108   END SUBROUTINE bdy_tra
109#endif
110
111   !!======================================================================
112END MODULE bdytra
Note: See TracBrowser for help on using the repository browser.