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

source: branches/2013/dev_r3987_METO1_MERCATOR6_OBC_BDY_merge/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 3991

Last change on this file since 3991 was 3991, checked in by davestorkey, 11 years ago

New branch from later branch point on trunk so you can do a clean
diff of all the changes. Copy in changes from dev_r3891_METO1_MERCATOR6_OBC_BDY_merge.

  • Property svn:keywords set to Id
File size: 6.7 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  !
[911]32
33   IMPLICIT NONE
34   PRIVATE
35
[3294]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
[3294]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
[3294]47   SUBROUTINE bdy_dyn( kt, dyn3d_only )
[1125]48      !!----------------------------------------------------------------------
[3294]49      !!                  ***  SUBROUTINE bdy_dyn  ***
[1125]50      !!
[3294]51      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
[911]52      !!
[1125]53      !!----------------------------------------------------------------------
[911]54      !!
[3294]55      INTEGER, INTENT( in )           :: kt               ! Main time step counter
56      LOGICAL, INTENT( in ), OPTIONAL :: dyn3d_only       ! T => only update baroclinic velocities
57      !!
[3991]58      INTEGER               :: jk,ii,ij,ib_bdy,ib,igrd     ! Loop counter
59      LOGICAL               :: ll_dyn2d, ll_dyn3d, ll_orlanski
[3294]60      !!
[911]61
[3294]62      IF( nn_timing == 1 ) CALL timing_start('bdy_dyn')
[911]63
[3294]64      ll_dyn2d = .true.
65      ll_dyn3d = .true.
[2528]66
[3294]67      IF( PRESENT(dyn3d_only) ) THEN
68         IF( dyn3d_only ) ll_dyn2d = .false.
69      ENDIF
[1502]70
[3991]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
[3294]77      !-------------------------------------------------------
78      ! Set pointers
79      !-------------------------------------------------------
[911]80
[3294]81      pssh => sshn
82      phur => hur
83      phvr => hvr
[3991]84      CALL wrk_alloc(jpi,jpj,pua2d,pva2d) 
85      IF ( ll_orlanski ) CALL wrk_alloc(jpi,jpj,pub2d,pvb2d) 
[1125]86
[3294]87      !-------------------------------------------------------
88      ! Split velocities into barotropic and baroclinic parts
89      !-------------------------------------------------------
[911]90
[3991]91      ! "After" velocities:
92
93      pua2d(:,:) = 0.e0
94      pva2d(:,:) = 0.e0
95      DO jk = 1, jpkm1   !! Vertically integrated momentum trends
96          pua2d(:,:) = pua2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
97          pva2d(:,:) = pva2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
98      END DO
99      pua2d(:,:) = pua2d(:,:) * phur(:,:)
100      pva2d(:,:) = pva2d(:,:) * phvr(:,:)
101      DO jk = 1 , jpkm1
102         ua(:,:,jk) = ua(:,:,jk) - pua2d(:,:)
103         va(:,:,jk) = va(:,:,jk) - pva2d(:,:)
104      END DO
105
106      ! "Before" velocities (required for Orlanski condition):
107
108      IF ( ll_orlanski ) THEN
109         pub2d(:,:) = 0.e0
110         pvb2d(:,:) = 0.e0
[3968]111         DO jk = 1, jpkm1   !! Vertically integrated momentum trends
[3991]112             pub2d(:,:) = pub2d(:,:) + fse3u(:,:,jk) * umask(:,:,jk) * ub(:,:,jk)
113             pvb2d(:,:) = pvb2d(:,:) + fse3v(:,:,jk) * vmask(:,:,jk) * vb(:,:,jk)
[3968]114         END DO
[3991]115         pub2d(:,:) = pub2d(:,:) * phur(:,:)
116         pvb2d(:,:) = pvb2d(:,:) * phvr(:,:)
117         DO jk = 1 , jpkm1
118            ub(:,:,jk) = ub(:,:,jk) - pub2d(:,:)
119            vb(:,:,jk) = vb(:,:,jk) - pvb2d(:,:)
[3968]120         END DO
[3991]121      END IF
[3294]122
123      !-------------------------------------------------------
124      ! Apply boundary conditions to barotropic and baroclinic
125      ! parts separately
126      !-------------------------------------------------------
127
128      IF( ll_dyn2d ) CALL bdy_dyn2d( kt )
129
130      IF( ll_dyn3d ) CALL bdy_dyn3d( kt )
131
132      !-------------------------------------------------------
133      ! Recombine velocities
134      !-------------------------------------------------------
135
136      DO jk = 1 , jpkm1
[3991]137         ua(:,:,jk) = ( ua(:,:,jk) + pua2d(:,:) ) * umask(:,:,jk)
138         va(:,:,jk) = ( va(:,:,jk) + pva2d(:,:) ) * vmask(:,:,jk)
[3294]139      END DO
140
[3991]141      IF ( ll_orlanski ) THEN
142         DO jk = 1 , jpkm1
143            ub(:,:,jk) = ( ub(:,:,jk) + pub2d(:,:) ) * umask(:,:,jk)
144            vb(:,:,jk) = ( vb(:,:,jk) + pvb2d(:,:) ) * vmask(:,:,jk)
145         END DO
146      END IF
[3294]147
[3991]148      CALL wrk_dealloc(jpi,jpj,pua2d,pva2d) 
149      IF ( ll_orlanski ) CALL wrk_dealloc(jpi,jpj,pub2d,pvb2d) 
150
[3294]151      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
152
153   END SUBROUTINE bdy_dyn
154
[911]155#else
[1125]156   !!----------------------------------------------------------------------
157   !!   Dummy module                   NO Unstruct Open Boundary Conditions
158   !!----------------------------------------------------------------------
[911]159CONTAINS
[3294]160   SUBROUTINE bdy_dyn( kt )      ! Empty routine
161      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
162   END SUBROUTINE bdy_dyn
[911]163#endif
164
[1125]165   !!======================================================================
[911]166END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.