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.
bdydyn.F90 in NEMO/trunk/src/OCE/BDY – NEMO

source: NEMO/trunk/src/OCE/BDY/bdydyn.F90 @ 14401

Last change on this file since 14401 was 13237, checked in by smasson, 4 years ago

trunk: Mid-year merge, merge back KERNEL-06_techene_e3

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1MODULE bdydyn
2   !!======================================================================
3   !!                       ***  MODULE  bdydyn  ***
4   !! Unstructured Open Boundary Cond. :   Apply boundary conditions to velocities
5   !!======================================================================
6   !! History :  1.0  !  2005-02  (J. Chanut, A. Sellar)  Original code
7   !!             -   !  2007-07  (D. Storkey) Move Flather implementation to separate routine.
8   !!            3.0  !  2008-04  (NEMO team)  add in the reference version
9   !!            3.2  !  2008-04  (R. Benshila) consider velocity instead of transport
10   !!            3.3  !  2010-09  (E.O'Dea) modifications for Shelf configurations
11   !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions
12   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
13   !!----------------------------------------------------------------------
14   !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
15   !!                    and call bdy_dyn2d and bdy_dyn3d to apply boundary
16   !!                    conditions
17   !!----------------------------------------------------------------------
18   USE oce             ! ocean dynamics and tracers
19   USE dom_oce         ! ocean space and time domain
20   USE bdy_oce         ! ocean open boundary conditions
21   USE bdydyn2d        ! open boundary conditions for barotropic solution
22   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
23   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
24   USE in_out_manager  !
25   USE domvvl          ! variable volume
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   bdy_dyn    ! routine called in dyn_nxt
31
32   !! * Substitutions
33#  include "domzgr_substitute.h90"
34   !!----------------------------------------------------------------------
35   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
36   !! $Id$
37   !! Software governed by the CeCILL license (see ./LICENSE)
38   !!----------------------------------------------------------------------
39CONTAINS
40
41   SUBROUTINE bdy_dyn( kt, Kbb, puu, pvv, Kaa, dyn3d_only )
42      !!----------------------------------------------------------------------
43      !!                  ***  SUBROUTINE bdy_dyn  ***
44      !!
45      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
46      !!
47      !!----------------------------------------------------------------------
48      INTEGER                             , INTENT(in)    ::   kt           ! Main time step counter
49      INTEGER                             , INTENT(in)    ::   Kbb, Kaa     ! Ocean time level indices
50      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv     ! Ocean velocities (to be updated at open boundaries)
51      LOGICAL, OPTIONAL                   , INTENT(in)    ::   dyn3d_only   ! T => only update baroclinic velocities
52      !
53      INTEGER ::   jk, ii, ij, ib_bdy, ib, igrd     ! Loop counter
54      LOGICAL ::   ll_dyn2d, ll_dyn3d, ll_orlanski
55      REAL(wp), DIMENSION(jpi,jpj) :: zua2d, zva2d     ! after barotropic velocities
56      !!----------------------------------------------------------------------
57      !
58      ll_dyn2d = .true.
59      ll_dyn3d = .true.
60      !
61      IF( PRESENT(dyn3d_only) ) THEN
62         IF( dyn3d_only )   ll_dyn2d = .false.
63      ENDIF
64      !
65      ll_orlanski = .false.
66      DO ib_bdy = 1, nb_bdy
67         IF ( cn_dyn2d(ib_bdy) == 'orlanski' .OR. cn_dyn2d(ib_bdy) == 'orlanski_npo' &
68     &   .OR. cn_dyn3d(ib_bdy) == 'orlanski' .OR. cn_dyn3d(ib_bdy) == 'orlanski_npo')   ll_orlanski = .true.
69      END DO
70
71      !-------------------------------------------------------
72      ! Split velocities into barotropic and baroclinic parts
73      !-------------------------------------------------------
74
75      !                          ! "After" velocities:
76      zua2d(:,:) = 0._wp
77      zva2d(:,:) = 0._wp     
78      DO jk = 1, jpkm1
79         zua2d(:,:) = zua2d(:,:) + e3u(:,:,jk,Kaa) * puu(:,:,jk,Kaa) * umask(:,:,jk)
80         zva2d(:,:) = zva2d(:,:) + e3v(:,:,jk,Kaa) * pvv(:,:,jk,Kaa) * vmask(:,:,jk)
81      END DO
82      zua2d(:,:) = zua2d(:,:) * r1_hu(:,:,Kaa)
83      zva2d(:,:) = zva2d(:,:) * r1_hv(:,:,Kaa)
84
85      DO jk = 1 , jpkm1
86         puu(:,:,jk,Kaa) = ( puu(:,:,jk,Kaa) - zua2d(:,:) ) * umask(:,:,jk)
87         pvv(:,:,jk,Kaa) = ( pvv(:,:,jk,Kaa) - zva2d(:,:) ) * vmask(:,:,jk)
88      END DO
89
90
91      IF( ll_orlanski ) THEN     ! "Before" velocities (Orlanski condition only)
92         DO jk = 1 , jpkm1
93            puu(:,:,jk,Kbb) = ( puu(:,:,jk,Kbb) - uu_b(:,:,Kbb) ) * umask(:,:,jk)
94            pvv(:,:,jk,Kbb) = ( pvv(:,:,jk,Kbb) - vv_b(:,:,Kbb) ) * vmask(:,:,jk)
95         END DO
96      ENDIF
97
98      !-------------------------------------------------------
99      ! Apply boundary conditions to barotropic and baroclinic
100      ! parts separately
101      !-------------------------------------------------------
102
103      IF( ll_dyn2d )   CALL bdy_dyn2d( kt, zua2d, zva2d, uu_b(:,:,Kbb), vv_b(:,:,Kbb), r1_hu(:,:,Kaa), r1_hv(:,:,Kaa), ssh(:,:,Kaa) )
104
105      IF( ll_dyn3d )   CALL bdy_dyn3d( kt, Kbb, puu, pvv, Kaa )
106
107      !-------------------------------------------------------
108      ! Recombine velocities
109      !-------------------------------------------------------
110      !
111      DO jk = 1 , jpkm1
112         puu(:,:,jk,Kaa) = ( puu(:,:,jk,Kaa) + zua2d(:,:) ) * umask(:,:,jk)
113         pvv(:,:,jk,Kaa) = ( pvv(:,:,jk,Kaa) + zva2d(:,:) ) * vmask(:,:,jk)
114      END DO
115      !
116      IF ( ll_orlanski ) THEN
117         DO jk = 1 , jpkm1
118            puu(:,:,jk,Kbb) = ( puu(:,:,jk,Kbb) + uu_b(:,:,Kbb) ) * umask(:,:,jk)
119            pvv(:,:,jk,Kbb) = ( pvv(:,:,jk,Kbb) + vv_b(:,:,Kbb) ) * vmask(:,:,jk)
120         END DO
121      END IF
122      !
123   END SUBROUTINE bdy_dyn
124
125   !!======================================================================
126END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.