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.
obcdyn.F90 in branches/2011/UKMO_MERCATOR_obc_bdy_merge/NEMOGCM/NEMO/OPA_SRC/OBC – NEMO

source: branches/2011/UKMO_MERCATOR_obc_bdy_merge/NEMOGCM/NEMO/OPA_SRC/OBC/obcdyn.F90 @ 2800

Last change on this file since 2800 was 2800, checked in by davestorkey, 13 years ago
  1. Application of boundary conditions to barotropic and baroclinic velocities clearly separated.
  2. Option to input full velocities in boundary data (default expects barotropic and baroclinic velocities separately).
  3. Option to use initial conditions as boundary conditions coded.
File size: 5.1 KB
Line 
1MODULE obcdyn
2   !!======================================================================
3   !!                       ***  MODULE  obcdyn  ***
4   !! Unstructured Open Boundary Cond. :   Flow relaxation scheme on 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   !!----------------------------------------------------------------------
13#if defined key_obc 
14   !!----------------------------------------------------------------------
15   !!   'key_obc' :                    Unstructured Open Boundary Condition
16   !!----------------------------------------------------------------------
17   !!   obc_dyn3d        : apply open boundary conditions to baroclinic velocities
18   !!   obc_dyn3d_frs    : apply Flow Relaxation Scheme
19   !!----------------------------------------------------------------------
20   USE oce             ! ocean dynamics and tracers
21   USE dom_oce         ! ocean space and time domain
22   USE dynspg_oce     
23   USE obc_oce         ! ocean open boundary conditions
24   USE obcdyn2d        ! open boundary conditions for barotropic solution
25   USE obcdyn3d        ! open boundary conditions for baroclinic velocities
26   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
27   USE in_out_manager  !
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   obc_dyn     ! routine called in dynspg_flt (if lk_dynspg_flt) or
33                        ! dyn_nxt (if lk_dynspg_ts or lk_dynspg_exp)
34
35#  include "domzgr_substitute.h90"
36   !!----------------------------------------------------------------------
37   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
38   !! $Id: obcdyn.F90 2528 2010-12-27 17:33:53Z rblod $
39   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
40   !!----------------------------------------------------------------------
41CONTAINS
42
43   SUBROUTINE obc_dyn( kt )
44      !!----------------------------------------------------------------------
45      !!                  ***  SUBROUTINE obc_dyn  ***
46      !!
47      !! ** Purpose : - Wrapper routine for obc_dyn2d and obc_dyn3d.
48      !!
49      !!----------------------------------------------------------------------
50      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
51      USE wrk_nemo, ONLY: wrk_2d_7, wrk_2d_8      ! 2D workspace
52      !!
53      INTEGER, INTENT( in ) :: kt     ! Main time step counter
54      !!
55      INTEGER               :: jk,ii,ij,ib,igrd     ! Loop counter
56      !!
57
58      IF(wrk_in_use(2, 7,8) ) THEN
59         CALL ctl_stop('obc_dyn: ERROR: requested workspace arrays are unavailable.')   ;   RETURN
60      END IF
61
62      !-------------------------------------------------------
63      ! Set pointers
64      !-------------------------------------------------------
65
66      pssh => sshn_b
67      phur => hur
68      phvr => hvr
69      pu2d => wrk_2d_7
70      pv2d => wrk_2d_8
71
72      !-------------------------------------------------------
73      ! Split velocities into barotropic and baroclinic parts
74      !-------------------------------------------------------
75
76      pu2d(:,:) = 0.e0
77      pv2d(:,:) = 0.e0
78      DO jk = 1, jpkm1   !! Vertically integrated momentum trends
79          pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
80          pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
81      END DO
82      pu2d(:,:) = pu2d(:,:) * phur(:,:)
83      pv2d(:,:) = pv2d(:,:) * phvr(:,:)
84      DO jk = 1 , jpkm1
85         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:)
86         va(:,:,jk) = va(:,:,jk) - pv2d(:,:)
87      END DO
88
89      !-------------------------------------------------------
90      ! Apply boundary conditions to barotropic and baroclinic
91      ! parts separately
92      !-------------------------------------------------------
93
94      CALL obc_dyn2d( kt )
95
96      CALL obc_dyn3d( kt )
97
98      !-------------------------------------------------------
99      ! Recombine velocities
100      !-------------------------------------------------------
101
102      DO jk = 1 , jpkm1
103         ua(:,:,jk) = ( ua(:,:,jk) + pu2d(:,:) ) * umask(:,:,jk)
104         va(:,:,jk) = ( va(:,:,jk) + pv2d(:,:) ) * vmask(:,:,jk)
105      END DO
106
107      IF(wrk_not_released(2, 7,8) )    CALL ctl_stop('obc_dyn: ERROR: failed to release workspace arrays.')
108
109   END SUBROUTINE obc_dyn
110
111#else
112   !!----------------------------------------------------------------------
113   !!   Dummy module                   NO Unstruct Open Boundary Conditions
114   !!----------------------------------------------------------------------
115CONTAINS
116   SUBROUTINE obc_dyn( kt )      ! Empty routine
117      WRITE(*,*) 'obc_dyn: You should not have seen this print! error?', kt
118   END SUBROUTINE obc_dyn
119#endif
120
121   !!======================================================================
122END MODULE obcdyn
Note: See TracBrowser for help on using the repository browser.