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

source: trunk/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 3968

Last change on this file since 3968 was 3968, checked in by cbricaud, 11 years ago

use after vertical scale factors in vvl case, see ticket #1059

  • Property svn:keywords set to Id
File size: 5.9 KB
RevLine 
[911]1MODULE bdydyn
[1125]2   !!======================================================================
[911]3   !!                       ***  MODULE  bdydyn  ***
[3294]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
[3294]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   !!----------------------------------------------------------------------
[3294]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   !!----------------------------------------------------------------------
[3294]22   USE wrk_nemo        ! Memory Allocation
23   USE timing          ! Timing
[911]24   USE oce             ! ocean dynamics and tracers
25   USE dom_oce         ! ocean space and time domain
[3294]26   USE dynspg_oce     
[911]27   USE bdy_oce         ! ocean open boundary conditions
[3294]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  !
[3968]32   USE domvvl          ! variable volume
[911]33
34   IMPLICIT NONE
35   PRIVATE
36
[3294]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)
[911]39
[3294]40#  include "domzgr_substitute.h90"
[1125]41   !!----------------------------------------------------------------------
[2528]42   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
[1146]43   !! $Id$
[2528]44   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
[1125]45   !!----------------------------------------------------------------------
[911]46CONTAINS
47
[3294]48   SUBROUTINE bdy_dyn( kt, dyn3d_only )
[1125]49      !!----------------------------------------------------------------------
[3294]50      !!                  ***  SUBROUTINE bdy_dyn  ***
[1125]51      !!
[3294]52      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
[911]53      !!
[1125]54      !!----------------------------------------------------------------------
[911]55      !!
[3294]56      INTEGER, INTENT( in )           :: kt               ! Main time step counter
57      LOGICAL, INTENT( in ), OPTIONAL :: dyn3d_only       ! T => only update baroclinic velocities
58      !!
59      INTEGER               :: jk,ii,ij,ib,igrd     ! Loop counter
60      LOGICAL               :: ll_dyn2d, ll_dyn3d 
61      !!
[911]62
[3294]63      IF( nn_timing == 1 ) CALL timing_start('bdy_dyn')
[911]64
[3294]65      ll_dyn2d = .true.
66      ll_dyn3d = .true.
[2528]67
[3294]68      IF( PRESENT(dyn3d_only) ) THEN
69         IF( dyn3d_only ) ll_dyn2d = .false.
70      ENDIF
[1502]71
[3294]72      !-------------------------------------------------------
73      ! Set pointers
74      !-------------------------------------------------------
[911]75
[3294]76      pssh => sshn
77      phur => hur
78      phvr => hvr
79      CALL wrk_alloc(jpi,jpj,pu2d,pv2d) 
[1125]80
[3294]81      !-------------------------------------------------------
82      ! Split velocities into barotropic and baroclinic parts
83      !-------------------------------------------------------
[911]84
[3294]85      pu2d(:,:) = 0.e0
86      pv2d(:,:) = 0.e0
[3968]87      IF (lk_vvl) THEN
88         DO jk = 1, jpkm1   !! Vertically integrated momentum trends
89            pu2d(:,:) = pu2d(:,:) + fse3u_a(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
90            pv2d(:,:) = pv2d(:,:) + fse3v_a(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
91         END DO
92         pu2d(:,:) = pu2d(:,:) / ( hu_0(:,:) + sshu_a(:,:) + 1._wp - umask(:,:,1) )
93         pv2d(:,:) = pv2d(:,:) / ( hv_0(:,:) + sshv_a(:,:) + 1._wp - vmask(:,:,1) )
94      ELSE
95         DO jk = 1, jpkm1   !! Vertically integrated momentum trends
96            pu2d(:,:) = pu2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
97            pv2d(:,:) = pv2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
98         END DO
99         pu2d(:,:) = pu2d(:,:) * phur(:,:)
100         pv2d(:,:) = pv2d(:,:) * phvr(:,:)
101      ENDIF
[3294]102      DO jk = 1 , jpkm1
[3968]103         ua(:,:,jk) = ua(:,:,jk) - pu2d(:,:) * umask(:,:,jk)
104         va(:,:,jk) = va(:,:,jk) - pv2d(:,:) * vmask(:,:,jk)
[3294]105      END DO
106
107      !-------------------------------------------------------
108      ! Apply boundary conditions to barotropic and baroclinic
109      ! parts separately
110      !-------------------------------------------------------
111
112      IF( ll_dyn2d ) CALL bdy_dyn2d( kt )
113
114      IF( ll_dyn3d ) CALL bdy_dyn3d( kt )
115
116      !-------------------------------------------------------
117      ! Recombine velocities
118      !-------------------------------------------------------
119
120      DO jk = 1 , jpkm1
121         ua(:,:,jk) = ( ua(:,:,jk) + pu2d(:,:) ) * umask(:,:,jk)
122         va(:,:,jk) = ( va(:,:,jk) + pv2d(:,:) ) * vmask(:,:,jk)
123      END DO
124
125      CALL wrk_dealloc(jpi,jpj,pu2d,pv2d) 
126
127      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
128
129   END SUBROUTINE bdy_dyn
130
[911]131#else
[1125]132   !!----------------------------------------------------------------------
133   !!   Dummy module                   NO Unstruct Open Boundary Conditions
134   !!----------------------------------------------------------------------
[911]135CONTAINS
[3294]136   SUBROUTINE bdy_dyn( kt )      ! Empty routine
137      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
138   END SUBROUTINE bdy_dyn
[911]139#endif
140
[1125]141   !!======================================================================
[911]142END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.