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/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

source: branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 3284

Last change on this file since 3284 was 3191, checked in by davestorkey, 13 years ago
  1. Bug fix for BDY and fldread.F90.
  2. Update history comments for BDY.
  3. Remove redundant namelist variables in BDY.
  • Property svn:keywords set to Id
File size: 5.4 KB
RevLine 
[911]1MODULE bdydyn
[1125]2   !!======================================================================
[911]3   !!                       ***  MODULE  bdydyn  ***
[3191]4   !! Unstructured Open Boundary Cond. :   Apply boundary conditions to velocities
[1125]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
[1502]9   !!            3.2  !  2008-04  (R. Benshila) consider velocity instead of transport
[2528]10   !!            3.3  !  2010-09  (E.O'Dea) modifications for Shelf configurations
11   !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions
[3191]12   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
[1125]13   !!----------------------------------------------------------------------
14#if defined key_bdy 
15   !!----------------------------------------------------------------------
16   !!   'key_bdy' :                    Unstructured Open Boundary Condition
17   !!----------------------------------------------------------------------
[3191]18   !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
19   !!                    and call bdy_dyn2d and bdy_dyn3d to apply boundary
20   !!                    conditions
[1125]21   !!----------------------------------------------------------------------
[3186]22   USE wrk_nemo        ! Memory Allocation
[3182]23   USE timing          ! Timing
[911]24   USE oce             ! ocean dynamics and tracers
25   USE dom_oce         ! ocean space and time domain
[3116]26   USE dynspg_oce     
[911]27   USE bdy_oce         ! ocean open boundary conditions
[3116]28   USE bdydyn2d        ! open boundary conditions for barotropic solution
29   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
[911]30   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
[1125]31   USE in_out_manager  !
[911]32
33   IMPLICIT NONE
34   PRIVATE
35
[3116]36   PUBLIC   bdy_dyn     ! routine called in dynspg_flt (if lk_dynspg_flt) or
37                        ! dyn_nxt (if lk_dynspg_ts or lk_dynspg_exp)
[911]38
[3116]39#  include "domzgr_substitute.h90"
[1125]40   !!----------------------------------------------------------------------
[2528]41   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
[1146]42   !! $Id$
[2528]43   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
[1125]44   !!----------------------------------------------------------------------
[911]45CONTAINS
46
[3116]47   SUBROUTINE bdy_dyn( kt, dyn3d_only )
[1125]48      !!----------------------------------------------------------------------
[3116]49      !!                  ***  SUBROUTINE bdy_dyn  ***
[1125]50      !!
[3116]51      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
[911]52      !!
[1125]53      !!----------------------------------------------------------------------
[911]54      !!
[3116]55      INTEGER, INTENT( in )           :: kt               ! Main time step counter
56      LOGICAL, INTENT( in ), OPTIONAL :: dyn3d_only       ! T => only update baroclinic velocities
57      !!
58      INTEGER               :: jk,ii,ij,ib,igrd     ! Loop counter
59      LOGICAL               :: ll_dyn2d, ll_dyn3d 
60      !!
[911]61
[3182]62      IF( nn_timing == 1 ) CALL timing_start('bdy_dyn')
[911]63
[3116]64      ll_dyn2d = .true.
65      ll_dyn3d = .true.
[2528]66
[3116]67      IF( PRESENT(dyn3d_only) ) THEN
68         IF( dyn3d_only ) ll_dyn2d = .false.
69      ENDIF
[1502]70
[3116]71      !-------------------------------------------------------
72      ! Set pointers
73      !-------------------------------------------------------
[911]74
[3116]75      pssh => sshn
76      phur => hur
77      phvr => hvr
[3182]78      CALL wrk_alloc(jpi,jpj,pu2d,pv2d) 
[1125]79
[3116]80      !-------------------------------------------------------
81      ! Split velocities into barotropic and baroclinic parts
82      !-------------------------------------------------------
[911]83
[3116]84      pu2d(:,:) = 0.e0
85      pv2d(:,:) = 0.e0
86      DO jk = 1, jpkm1   !! Vertically integrated momentum trends
87          pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
88          pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
89      END DO
90      pu2d(:,:) = pu2d(:,:) * phur(:,:)
91      pv2d(:,:) = pv2d(:,:) * phvr(:,:)
92      DO jk = 1 , jpkm1
93         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:)
94         va(:,:,jk) = va(:,:,jk) - pv2d(:,:)
95      END DO
96
97      !-------------------------------------------------------
98      ! Apply boundary conditions to barotropic and baroclinic
99      ! parts separately
100      !-------------------------------------------------------
101
102      IF( ll_dyn2d ) CALL bdy_dyn2d( kt )
103
104      IF( ll_dyn3d ) CALL bdy_dyn3d( kt )
105
106      !-------------------------------------------------------
107      ! Recombine velocities
108      !-------------------------------------------------------
109
110      DO jk = 1 , jpkm1
111         ua(:,:,jk) = ( ua(:,:,jk) + pu2d(:,:) ) * umask(:,:,jk)
112         va(:,:,jk) = ( va(:,:,jk) + pv2d(:,:) ) * vmask(:,:,jk)
113      END DO
114
[3182]115      CALL wrk_dealloc(jpi,jpj,pu2d,pv2d) 
[3116]116
[3182]117      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
118
[3116]119   END SUBROUTINE bdy_dyn
120
[911]121#else
[1125]122   !!----------------------------------------------------------------------
123   !!   Dummy module                   NO Unstruct Open Boundary Conditions
124   !!----------------------------------------------------------------------
[911]125CONTAINS
[3116]126   SUBROUTINE bdy_dyn( kt )      ! Empty routine
127      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
128   END SUBROUTINE bdy_dyn
[911]129#endif
130
[1125]131   !!======================================================================
[911]132END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.