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 @ 2865

Last change on this file since 2865 was 2865, checked in by davestorkey, 13 years ago
  1. Updates for dynspg_exp option.
  2. Implement time_offset functionality in obc_dta.
  3. Add option to specify boundaries in the namelist.
  4. Re-activate obc_vol option.
  5. Update to namelist control of tidal harmonics.
File size: 5.4 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, dyn3d_only )
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      LOGICAL, INTENT( in ), OPTIONAL :: dyn3d_only       ! T => only update baroclinic velocities
55      !!
56      INTEGER               :: jk,ii,ij,ib,igrd     ! Loop counter
57      LOGICAL               :: ll_dyn2d, ll_dyn3d 
58      !!
59
60      IF(wrk_in_use(2, 7,8) ) THEN
61         CALL ctl_stop('obc_dyn: ERROR: requested workspace arrays are unavailable.')   ;   RETURN
62      END IF
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      !-------------------------------------------------------
72      ! Set pointers
73      !-------------------------------------------------------
74
75      pssh => sshn
76      phur => hur
77      phvr => hvr
78      pu2d => wrk_2d_7
79      pv2d => wrk_2d_8
80
81      !-------------------------------------------------------
82      ! Split velocities into barotropic and baroclinic parts
83      !-------------------------------------------------------
84
85      pu2d(:,:) = 0.e0
86      pv2d(:,:) = 0.e0
87      DO jk = 1, jpkm1   !! Vertically integrated momentum trends
88          pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
89          pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
90      END DO
91      pu2d(:,:) = pu2d(:,:) * phur(:,:)
92      pv2d(:,:) = pv2d(:,:) * phvr(:,:)
93      DO jk = 1 , jpkm1
94         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:)
95         va(:,:,jk) = va(:,:,jk) - pv2d(:,:)
96      END DO
97
98      !-------------------------------------------------------
99      ! Apply boundary conditions to barotropic and baroclinic
100      ! parts separately
101      !-------------------------------------------------------
102
103      IF( ll_dyn2d ) CALL obc_dyn2d( kt )
104
105      IF( ll_dyn3d ) CALL obc_dyn3d( kt )
106
107      !-------------------------------------------------------
108      ! Recombine velocities
109      !-------------------------------------------------------
110
111      DO jk = 1 , jpkm1
112         ua(:,:,jk) = ( ua(:,:,jk) + pu2d(:,:) ) * umask(:,:,jk)
113         va(:,:,jk) = ( va(:,:,jk) + pv2d(:,:) ) * vmask(:,:,jk)
114      END DO
115
116      IF(wrk_not_released(2, 7,8) )    CALL ctl_stop('obc_dyn: ERROR: failed to release workspace arrays.')
117
118   END SUBROUTINE obc_dyn
119
120#else
121   !!----------------------------------------------------------------------
122   !!   Dummy module                   NO Unstruct Open Boundary Conditions
123   !!----------------------------------------------------------------------
124CONTAINS
125   SUBROUTINE obc_dyn( kt )      ! Empty routine
126      WRITE(*,*) 'obc_dyn: You should not have seen this print! error?', kt
127   END SUBROUTINE obc_dyn
128#endif
129
130   !!======================================================================
131END MODULE obcdyn
Note: See TracBrowser for help on using the repository browser.