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/2014/dev_r4650_UKMO14.12_STAND_ALONE_OBSOPER/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

source: branches/2014/dev_r4650_UKMO14.12_STAND_ALONE_OBSOPER/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 6043

Last change on this file since 6043 was 6043, checked in by timgraham, 8 years ago

Merged head of trunk into branch

  • Property svn:keywords set to Id
File size: 6.2 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 bdy_oce         ! ocean open boundary conditions
27   USE bdydyn2d        ! open boundary conditions for barotropic solution
28   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
30   USE in_out_manager  !
31   USE domvvl          ! variable volume
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   bdy_dyn    ! routine called in dyn_nxt
37
38#  include "domzgr_substitute.h90"
39   !!----------------------------------------------------------------------
40   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
41   !! $Id$
42   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44CONTAINS
45
46   SUBROUTINE bdy_dyn( kt, dyn3d_only )
47      !!----------------------------------------------------------------------
48      !!                  ***  SUBROUTINE bdy_dyn  ***
49      !!
50      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
51      !!
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      !!
60      REAL(wp), POINTER, DIMENSION(:,:) :: pua2d, pva2d     ! after barotropic velocities
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      ENDDO
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
89      pua2d(:,:) = 0.e0
90      pva2d(:,:) = 0.e0     
91      DO jk = 1, jpkm1
92         pua2d(:,:) = pua2d(:,:) + fse3u_a(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
93         pva2d(:,:) = pva2d(:,:) + fse3v_a(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
94      END DO
95
96      pua2d(:,:) = pua2d(:,:) * hur_a(:,:)
97      pva2d(:,:) = pva2d(:,:) * hvr_a(:,:)
98
99      DO jk = 1 , jpkm1
100         ua(:,:,jk) = (ua(:,:,jk) - pua2d(:,:)) * umask(:,:,jk)
101         va(:,:,jk) = (va(:,:,jk) - pva2d(:,:)) * vmask(:,:,jk)
102      END DO
103
104      ! "Before" velocities (required for Orlanski condition):
105
106      IF ( ll_orlanski ) THEN         
107         DO jk = 1 , jpkm1
108            ub(:,:,jk) = (ub(:,:,jk) - ub_b(:,:)) * umask(:,:,jk)
109            vb(:,:,jk) = (vb(:,:,jk) - vb_b(:,:)) * vmask(:,:,jk)
110         END DO
111      END IF
112
113      !-------------------------------------------------------
114      ! Apply boundary conditions to barotropic and baroclinic
115      ! parts separately
116      !-------------------------------------------------------
117
118      IF( ll_dyn2d ) CALL bdy_dyn2d( kt, pua2d, pva2d, ub_b, vb_b, hur_a(:,:), hvr_a(:,:), ssha )
119
120      IF( ll_dyn3d ) CALL bdy_dyn3d( kt )
121
122      !-------------------------------------------------------
123      ! Recombine velocities
124      !-------------------------------------------------------
125
126      DO jk = 1 , jpkm1
127         ua(:,:,jk) = ( ua(:,:,jk) + pua2d(:,:) ) * umask(:,:,jk)
128         va(:,:,jk) = ( va(:,:,jk) + pva2d(:,:) ) * vmask(:,:,jk)
129      END DO
130
131      IF ( ll_orlanski ) THEN
132         DO jk = 1 , jpkm1
133            ub(:,:,jk) = ( ub(:,:,jk) + ub_b(:,:) ) * umask(:,:,jk)
134            vb(:,:,jk) = ( vb(:,:,jk) + vb_b(:,:) ) * vmask(:,:,jk)
135         END DO
136      END IF
137
138      CALL wrk_dealloc(jpi,jpj,pua2d,pva2d) 
139
140      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
141
142   END SUBROUTINE bdy_dyn
143
144#else
145   !!----------------------------------------------------------------------
146   !!   Dummy module                   NO Unstruct Open Boundary Conditions
147   !!----------------------------------------------------------------------
148CONTAINS
149   SUBROUTINE bdy_dyn( kt )      ! Empty routine
150      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
151   END SUBROUTINE bdy_dyn
152#endif
153
154   !!======================================================================
155END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.