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

source: branches/2015/dev_r5847_MERCATOR9_solveur_simplification/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90 @ 5868

Last change on this file since 5868 was 5868, checked in by jchanut, 8 years ago

Free surface simplification #1620. Step 1: suppress filtered free surface

  • Property svn:keywords set to Id
File size: 6.3 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#if defined key_bdy 
15   !!----------------------------------------------------------------------
16   !!   'key_bdy' :                    Unstructured Open Boundary Condition
17   !!----------------------------------------------------------------------
18   !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
19   !!                    and call bdy_dyn2d and bdy_dyn3d to apply boundary
20   !!                    conditions
21   !!----------------------------------------------------------------------
22   USE wrk_nemo        ! Memory Allocation
23   USE timing          ! Timing
24   USE oce             ! ocean dynamics and tracers
25   USE dom_oce         ! ocean space and time domain
26   USE dynspg_oce     
27   USE bdy_oce         ! ocean open boundary conditions
28   USE bdydyn2d        ! open boundary conditions for barotropic solution
29   USE bdydyn3d        ! open boundary conditions for baroclinic velocities
30   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
31   USE in_out_manager  !
32   USE domvvl          ! variable volume
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   bdy_dyn    ! routine called in dyn_nxt
38
39#  include "domzgr_substitute.h90"
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
42   !! $Id$
43   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE bdy_dyn( kt, dyn3d_only )
48      !!----------------------------------------------------------------------
49      !!                  ***  SUBROUTINE bdy_dyn  ***
50      !!
51      !! ** Purpose : - Wrapper routine for bdy_dyn2d and bdy_dyn3d.
52      !!
53      !!----------------------------------------------------------------------
54      !!
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_bdy,ib,igrd     ! Loop counter
59      LOGICAL               :: ll_dyn2d, ll_dyn3d, ll_orlanski
60      !!
61      REAL(wp), POINTER, DIMENSION(:,:) :: pua2d, pva2d     ! after barotropic velocities
62
63      IF( nn_timing == 1 ) CALL timing_start('bdy_dyn')
64
65      ll_dyn2d = .true.
66      ll_dyn3d = .true.
67
68      IF( PRESENT(dyn3d_only) ) THEN
69         IF( dyn3d_only ) ll_dyn2d = .false.
70      ENDIF
71
72      ll_orlanski = .false.
73      DO ib_bdy = 1, nb_bdy
74         IF ( cn_dyn2d(ib_bdy) == 'orlanski' .or. cn_dyn2d(ib_bdy) == 'orlanski_npo' &
75     &   .or. cn_dyn3d(ib_bdy) == 'orlanski' .or. cn_dyn3d(ib_bdy) == 'orlanski_npo') ll_orlanski = .true.
76      ENDDO
77
78      !-------------------------------------------------------
79      ! Set pointers
80      !-------------------------------------------------------
81
82      CALL wrk_alloc(jpi,jpj,pua2d,pva2d) 
83
84      !-------------------------------------------------------
85      ! Split velocities into barotropic and baroclinic parts
86      !-------------------------------------------------------
87
88      ! "After" velocities:
89
90      pua2d(:,:) = 0.e0
91      pva2d(:,:) = 0.e0     
92      DO jk = 1, jpkm1
93         pua2d(:,:) = pua2d(:,:) + fse3u_a(:,:,jk) * umask(:,:,jk) * ua(:,:,jk)
94         pva2d(:,:) = pva2d(:,:) + fse3v_a(:,:,jk) * vmask(:,:,jk) * va(:,:,jk)
95      END DO
96
97      pua2d(:,:) = pua2d(:,:) * hur_a(:,:)
98      pva2d(:,:) = pva2d(:,:) * hvr_a(:,:)
99
100      DO jk = 1 , jpkm1
101         ua(:,:,jk) = (ua(:,:,jk) - pua2d(:,:)) * umask(:,:,jk)
102         va(:,:,jk) = (va(:,:,jk) - pva2d(:,:)) * vmask(:,:,jk)
103      END DO
104
105      ! "Before" velocities (required for Orlanski condition):
106
107      IF ( ll_orlanski ) THEN         
108         DO jk = 1 , jpkm1
109            ub(:,:,jk) = (ub(:,:,jk) - ub_b(:,:)) * umask(:,:,jk)
110            vb(:,:,jk) = (vb(:,:,jk) - vb_b(:,:)) * vmask(:,:,jk)
111         END DO
112      END IF
113
114      !-------------------------------------------------------
115      ! Apply boundary conditions to barotropic and baroclinic
116      ! parts separately
117      !-------------------------------------------------------
118
119      IF( ll_dyn2d ) CALL bdy_dyn2d( kt, pua2d, pva2d, ub_b, vb_b, hur_a(:,:), hvr_a(:,:), ssha )
120
121      IF( ll_dyn3d ) CALL bdy_dyn3d( kt )
122
123      !-------------------------------------------------------
124      ! Recombine velocities
125      !-------------------------------------------------------
126
127      DO jk = 1 , jpkm1
128         ua(:,:,jk) = ( ua(:,:,jk) + pua2d(:,:) ) * umask(:,:,jk)
129         va(:,:,jk) = ( va(:,:,jk) + pva2d(:,:) ) * vmask(:,:,jk)
130      END DO
131
132      IF ( ll_orlanski ) THEN
133         DO jk = 1 , jpkm1
134            ub(:,:,jk) = ( ub(:,:,jk) + ub_b(:,:) ) * umask(:,:,jk)
135            vb(:,:,jk) = ( vb(:,:,jk) + vb_b(:,:) ) * vmask(:,:,jk)
136         END DO
137      END IF
138
139      CALL wrk_dealloc(jpi,jpj,pua2d,pva2d) 
140
141      IF( nn_timing == 1 ) CALL timing_stop('bdy_dyn')
142
143   END SUBROUTINE bdy_dyn
144
145#else
146   !!----------------------------------------------------------------------
147   !!   Dummy module                   NO Unstruct Open Boundary Conditions
148   !!----------------------------------------------------------------------
149CONTAINS
150   SUBROUTINE bdy_dyn( kt )      ! Empty routine
151      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
152   END SUBROUTINE bdy_dyn
153#endif
154
155   !!======================================================================
156END MODULE bdydyn
Note: See TracBrowser for help on using the repository browser.