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 branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

source: branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 5845

Last change on this file since 5845 was 5845, checked in by gm, 8 years ago

#1613: vvl by default: suppression of domzgr_substitute.h90

  • Property svn:keywords set to Id
File size: 6.4 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#if defined key_bdy 
15   !!----------------------------------------------------------------------
16   !!   'key_bdy' :                    Unstructured Open Boundary Condition
17   !!----------------------------------------------------------------------
18   !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
19   !!                    and call bdy_dyn2d and bdy_dyn3d to apply boundary
20   !!                    conditions
21   !!----------------------------------------------------------------------
22   USE wrk_nemo        ! Memory Allocation
23   USE timing          ! Timing
24   USE oce             ! ocean dynamics and tracers
25   USE dom_oce         ! ocean space and time domain
26   USE dynspg_oce     
27   USE bdy_oce         ! ocean open boundary conditions
28   USE bdydyn2d        ! open boundary conditions for barotropic solution
29   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
30   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
31   USE in_out_manager  !
32   USE domvvl          ! variable volume
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   bdy_dyn     ! routine called in dynspg_flt (if lk_dynspg_flt) or
38                        ! dyn_nxt (if lk_dynspg_ts or lk_dynspg_exp)
39
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
42   !! $Id$
43   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE bdy_dyn( kt, dyn3d_only )
48      !!----------------------------------------------------------------------
49      !!                  ***  SUBROUTINE bdy_dyn  ***
50      !!
51      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
52      !!
53      !!----------------------------------------------------------------------
54      INTEGER, INTENT( in )           :: kt               ! Main time step counter
55      LOGICAL, INTENT( in ), OPTIONAL :: dyn3d_only       ! T => only update baroclinic velocities
56      !
57      INTEGER :: jk,ii,ij,ib_bdy,ib,igrd     ! Loop counter
58      LOGICAL :: ll_dyn2d, ll_dyn3d, ll_orlanski
59      REAL(wp), POINTER, DIMENSION(:,:) :: pua2d, pva2d     ! after barotropic velocities
60      !!----------------------------------------------------------------------
61      !
62      IF( nn_timing == 1 )   CALL timing_start('bdy_dyn')
63      !
64      ll_dyn2d = .true.
65      ll_dyn3d = .true.
66      !
67      IF( PRESENT(dyn3d_only) ) THEN
68         IF( dyn3d_only )   ll_dyn2d = .false.
69      ENDIF
70
71      ll_orlanski = .false.
72      DO ib_bdy = 1, nb_bdy
73         IF ( cn_dyn2d(ib_bdy) == 'orlanski' .or. cn_dyn2d(ib_bdy) == 'orlanski_npo' &
74     &   .or. cn_dyn3d(ib_bdy) == 'orlanski' .or. cn_dyn3d(ib_bdy) == 'orlanski_npo')   ll_orlanski = .true.
75      END DO
76
77      !-------------------------------------------------------
78      ! Set pointers
79      !-------------------------------------------------------
80
81      CALL wrk_alloc( jpi,jpj,   pua2d, pva2d ) 
82
83      !-------------------------------------------------------
84      ! Split velocities into barotropic and baroclinic parts
85      !-------------------------------------------------------
86
87      !                          ! "After" velocities:
88      pua2d(:,:) = 0._wp
89      pva2d(:,:) = 0._wp     
90      DO jk = 1, jpkm1
91         pua2d(:,:) = pua2d(:,:) + e3u_a(:,:,jk) * ua(:,:,jk) * umask(:,:,jk)
92         pva2d(:,:) = pva2d(:,:) + e3v_a(:,:,jk) * va(:,:,jk) * vmask(:,:,jk)
93      END DO
94      pua2d(:,:) = pua2d(:,:) * r1_hu_a(:,:)
95      pva2d(:,:) = pva2d(:,:) * r1_hv_a(:,:)
96
97      DO jk = 1 , jpkm1
98         ua(:,:,jk) = ( ua(:,:,jk) - pua2d(:,:) ) * umask(:,:,jk)
99         va(:,:,jk) = ( va(:,:,jk) - pva2d(:,:) ) * vmask(:,:,jk)
100      END DO
101
102
103      IF( ll_orlanski ) THEN     ! "Before" velocities (Orlanski condition only)
104         DO jk = 1 , jpkm1
105            ub(:,:,jk) = ( ub(:,:,jk) - ub_b(:,:) ) * umask(:,:,jk)
106            vb(:,:,jk) = ( vb(:,:,jk) - vb_b(:,:) ) * vmask(:,:,jk)
107         END DO
108      ENDIF
109
110      !-------------------------------------------------------
111      ! Apply boundary conditions to barotropic and baroclinic
112      ! parts separately
113      !-------------------------------------------------------
114
115      IF( ll_dyn2d )   CALL bdy_dyn2d( kt, pua2d, pva2d, ub_b, vb_b, r1_hu_a(:,:), r1_hv_a(:,:), ssha )
116
117      IF( ll_dyn3d )   CALL bdy_dyn3d( kt )
118
119      !-------------------------------------------------------
120      ! Recombine velocities
121      !-------------------------------------------------------
122      !
123      DO jk = 1 , jpkm1
124         ua(:,:,jk) = ( ua(:,:,jk) + pua2d(:,:) ) * umask(:,:,jk)
125         va(:,:,jk) = ( va(:,:,jk) + pva2d(:,:) ) * vmask(:,:,jk)
126      END DO
127      !
128      IF ( ll_orlanski ) THEN
129         DO jk = 1 , jpkm1
130            ub(:,:,jk) = ( ub(:,:,jk) + ub_b(:,:) ) * umask(:,:,jk)
131            vb(:,:,jk) = ( vb(:,:,jk) + vb_b(:,:) ) * vmask(:,:,jk)
132         END DO
133      END IF
134      !
135      CALL wrk_dealloc( jpi,jpj,  pua2d, pva2d ) 
136      !
137      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
138      !
139   END SUBROUTINE bdy_dyn
140
141#else
142   !!----------------------------------------------------------------------
143   !!   Dummy module                   NO Unstruct Open Boundary Conditions
144   !!----------------------------------------------------------------------
145CONTAINS
146   SUBROUTINE bdy_dyn( kt )      ! Empty routine
147      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
148   END SUBROUTINE bdy_dyn
149#endif
150
151   !!======================================================================
152END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.