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

source: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 9124

Last change on this file since 9124 was 9124, checked in by gm, 6 years ago

dev_merge_2017: ln_timing instead of nn_timing + restricted timing to nemo_init and routine called by step in OPA_SRC

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1MODULE bdydyn
2   !!======================================================================
3   !!                       ***  MODULE  bdydyn  ***
4   !! Unstructured Open Boundary Cond. :   Apply boundary conditions to 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   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
13   !!----------------------------------------------------------------------
14   !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
15   !!                    and call bdy_dyn2d and bdy_dyn3d to apply boundary
16   !!                    conditions
17   !!----------------------------------------------------------------------
18   USE wrk_nemo        ! Memory Allocation
19   USE oce             ! ocean dynamics and tracers
20   USE dom_oce         ! ocean space and time domain
21   USE bdy_oce         ! ocean open boundary conditions
22   USE bdydyn2d        ! open boundary conditions for barotropic solution
23   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
24   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
25   USE in_out_manager  !
26   USE domvvl          ! variable volume
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   bdy_dyn    ! routine called in dyn_nxt
32
33   !!----------------------------------------------------------------------
34   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
35   !! $Id$
36   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
37   !!----------------------------------------------------------------------
38CONTAINS
39
40   SUBROUTINE bdy_dyn( kt, dyn3d_only )
41      !!----------------------------------------------------------------------
42      !!                  ***  SUBROUTINE bdy_dyn  ***
43      !!
44      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
45      !!
46      !!----------------------------------------------------------------------
47      INTEGER, INTENT(in)           ::   kt           ! Main time step counter
48      LOGICAL, INTENT(in), OPTIONAL ::   dyn3d_only   ! T => only update baroclinic velocities
49      !
50      INTEGER ::   jk, ii, ij, ib_bdy, ib, igrd     ! Loop counter
51      LOGICAL ::   ll_dyn2d, ll_dyn3d, ll_orlanski
52      REAL(wp), POINTER, DIMENSION(:,:) :: pua2d, pva2d     ! after barotropic velocities
53      !!----------------------------------------------------------------------
54      !
55      ll_dyn2d = .true.
56      ll_dyn3d = .true.
57      !
58      IF( PRESENT(dyn3d_only) ) THEN
59         IF( dyn3d_only )   ll_dyn2d = .false.
60      ENDIF
61      !
62      ll_orlanski = .false.
63      DO ib_bdy = 1, nb_bdy
64         IF ( cn_dyn2d(ib_bdy) == 'orlanski' .OR. cn_dyn2d(ib_bdy) == 'orlanski_npo' &
65     &   .OR. cn_dyn3d(ib_bdy) == 'orlanski' .OR. cn_dyn3d(ib_bdy) == 'orlanski_npo')   ll_orlanski = .true.
66      END DO
67
68      !-------------------------------------------------------
69      ! Set pointers
70      !-------------------------------------------------------
71
72      CALL wrk_alloc( jpi,jpj,   pua2d, pva2d ) 
73
74      !-------------------------------------------------------
75      ! Split velocities into barotropic and baroclinic parts
76      !-------------------------------------------------------
77
78      !                          ! "After" velocities:
79      pua2d(:,:) = 0._wp
80      pva2d(:,:) = 0._wp     
81      DO jk = 1, jpkm1
82         pua2d(:,:) = pua2d(:,:) + e3u_a(:,:,jk) * ua(:,:,jk) * umask(:,:,jk)
83         pva2d(:,:) = pva2d(:,:) + e3v_a(:,:,jk) * va(:,:,jk) * vmask(:,:,jk)
84      END DO
85      pua2d(:,:) = pua2d(:,:) * r1_hu_a(:,:)
86      pva2d(:,:) = pva2d(:,:) * r1_hv_a(:,:)
87
88      DO jk = 1 , jpkm1
89         ua(:,:,jk) = ( ua(:,:,jk) - pua2d(:,:) ) * umask(:,:,jk)
90         va(:,:,jk) = ( va(:,:,jk) - pva2d(:,:) ) * vmask(:,:,jk)
91      END DO
92
93
94      IF( ll_orlanski ) THEN     ! "Before" velocities (Orlanski condition only)
95         DO jk = 1 , jpkm1
96            ub(:,:,jk) = ( ub(:,:,jk) - ub_b(:,:) ) * umask(:,:,jk)
97            vb(:,:,jk) = ( vb(:,:,jk) - vb_b(:,:) ) * vmask(:,:,jk)
98         END DO
99      ENDIF
100
101      !-------------------------------------------------------
102      ! Apply boundary conditions to barotropic and baroclinic
103      ! parts separately
104      !-------------------------------------------------------
105
106      IF( ll_dyn2d )   CALL bdy_dyn2d( kt, pua2d, pva2d, ub_b, vb_b, r1_hu_a(:,:), r1_hv_a(:,:), ssha )
107
108      IF( ll_dyn3d )   CALL bdy_dyn3d( kt )
109
110      !-------------------------------------------------------
111      ! Recombine velocities
112      !-------------------------------------------------------
113      !
114      DO jk = 1 , jpkm1
115         ua(:,:,jk) = ( ua(:,:,jk) + pua2d(:,:) ) * umask(:,:,jk)
116         va(:,:,jk) = ( va(:,:,jk) + pva2d(:,:) ) * vmask(:,:,jk)
117      END DO
118      !
119      IF ( ll_orlanski ) THEN
120         DO jk = 1 , jpkm1
121            ub(:,:,jk) = ( ub(:,:,jk) + ub_b(:,:) ) * umask(:,:,jk)
122            vb(:,:,jk) = ( vb(:,:,jk) + vb_b(:,:) ) * vmask(:,:,jk)
123         END DO
124      END IF
125      !
126      CALL wrk_dealloc( jpi,jpj,  pua2d, pva2d ) 
127      !
128   END SUBROUTINE bdy_dyn
129
130   !!======================================================================
131END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.