1 | MODULE bdydyn2d |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE bdydyn *** |
---|
4 | !! Unstructured Open Boundary Cond. : Flow relaxation scheme on 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 | !!---------------------------------------------------------------------- |
---|
13 | #if defined key_bdy |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! 'key_bdy' : Unstructured Open Boundary Condition |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | !! bdy_dyn2d : Apply open boundary conditions to barotropic variables. |
---|
18 | !! bdy_dyn2d_fla : Apply Flather condition |
---|
19 | !!---------------------------------------------------------------------- |
---|
20 | USE oce ! ocean dynamics and tracers |
---|
21 | USE dom_oce ! ocean space and time domain |
---|
22 | USE bdy_oce ! ocean open boundary conditions |
---|
23 | USE dynspg_oce ! for barotropic variables |
---|
24 | USE phycst ! physical constants |
---|
25 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
26 | USE in_out_manager ! |
---|
27 | |
---|
28 | IMPLICIT NONE |
---|
29 | PRIVATE |
---|
30 | |
---|
31 | PUBLIC bdy_dyn2d ! routine called in dynspg_ts and dyn_nxt and dynspg_flt |
---|
32 | |
---|
33 | !!---------------------------------------------------------------------- |
---|
34 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
35 | !! $Id: bdydyn.F90 2528 2010-12-27 17:33:53Z rblod $ |
---|
36 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
37 | !!---------------------------------------------------------------------- |
---|
38 | CONTAINS |
---|
39 | |
---|
40 | SUBROUTINE bdy_dyn2d( kt ) |
---|
41 | !!---------------------------------------------------------------------- |
---|
42 | !! *** SUBROUTINE bdy_dyn2d *** |
---|
43 | !! |
---|
44 | !! ** Purpose : - Apply open boundary conditions for barotropic variables |
---|
45 | !! |
---|
46 | !!---------------------------------------------------------------------- |
---|
47 | INTEGER, INTENT(in) :: kt ! Main time step counter |
---|
48 | !! |
---|
49 | INTEGER :: ib_bdy ! Loop counter |
---|
50 | |
---|
51 | DO ib_bdy=1, nb_bdy |
---|
52 | |
---|
53 | SELECT CASE( nn_dyn2d(ib_bdy) ) |
---|
54 | CASE(jp_none) |
---|
55 | CYCLE |
---|
56 | CASE(jp_frs) |
---|
57 | CALL bdy_dyn2d_frs( idx_bdy(ib_bdy), dta_bdy(ib_bdy) ) |
---|
58 | CASE(jp_flather) |
---|
59 | CALL bdy_dyn2d_fla( idx_bdy(ib_bdy), dta_bdy(ib_bdy) ) |
---|
60 | CASE DEFAULT |
---|
61 | CALL ctl_stop( 'bdy_dyn3d : unrecognised option for open boundaries for barotropic variables' ) |
---|
62 | END SELECT |
---|
63 | ENDDO |
---|
64 | |
---|
65 | END SUBROUTINE bdy_dyn2d |
---|
66 | |
---|
67 | SUBROUTINE bdy_dyn2d_frs( idx, dta ) |
---|
68 | !!---------------------------------------------------------------------- |
---|
69 | !! *** SUBROUTINE bdy_dyn2d_frs *** |
---|
70 | !! |
---|
71 | !! ** Purpose : - Apply the Flow Relaxation Scheme for barotropic velocities |
---|
72 | !! at open boundaries. |
---|
73 | !! |
---|
74 | !! References :- Engedahl H., 1995: Use of the flow relaxation scheme in |
---|
75 | !! a three-dimensional baroclinic ocean model with realistic |
---|
76 | !! topography. Tellus, 365-382. |
---|
77 | !!---------------------------------------------------------------------- |
---|
78 | TYPE(OBC_INDEX), INTENT(in) :: idx ! OBC indices |
---|
79 | TYPE(OBC_DATA), INTENT(in) :: dta ! OBC external data |
---|
80 | !! |
---|
81 | INTEGER :: jb, jk ! dummy loop indices |
---|
82 | INTEGER :: ii, ij, igrd ! local integers |
---|
83 | REAL(wp) :: zwgt ! boundary weight |
---|
84 | !!---------------------------------------------------------------------- |
---|
85 | ! |
---|
86 | ! |
---|
87 | igrd = 2 ! Relaxation of zonal velocity |
---|
88 | DO jb = 1, idx%nblen(igrd) |
---|
89 | ii = idx%nbi(jb,igrd) |
---|
90 | ij = idx%nbj(jb,igrd) |
---|
91 | zwgt = idx%nbw(jb,igrd) |
---|
92 | pu2d(ii,ij) = ( pu2d(ii,ij) + zwgt * ( dta%u2d(jb) - pu2d(ii,ij) ) ) * umask(ii,ij,1) |
---|
93 | END DO |
---|
94 | ! |
---|
95 | igrd = 3 ! Relaxation of meridional velocity |
---|
96 | DO jb = 1, idx%nblen(igrd) |
---|
97 | ii = idx%nbi(jb,igrd) |
---|
98 | ij = idx%nbj(jb,igrd) |
---|
99 | zwgt = idx%nbw(jb,igrd) |
---|
100 | pv2d(ii,ij) = ( pv2d(ii,ij) + zwgt * ( dta%v2d(jb) - pv2d(ii,ij) ) ) * vmask(ii,ij,1) |
---|
101 | END DO |
---|
102 | CALL lbc_lnk( pu2d, 'U', -1. ) |
---|
103 | CALL lbc_lnk( pv2d, 'V', -1. ) ! Boundary points should be updated |
---|
104 | ! |
---|
105 | |
---|
106 | END SUBROUTINE bdy_dyn2d_frs |
---|
107 | |
---|
108 | |
---|
109 | SUBROUTINE bdy_dyn2d_fla( idx, dta ) |
---|
110 | !!---------------------------------------------------------------------- |
---|
111 | !! *** SUBROUTINE bdy_dyn2d_fla *** |
---|
112 | !! |
---|
113 | !! - Apply Flather boundary conditions on normal barotropic velocities |
---|
114 | !! |
---|
115 | !! ** WARNINGS about FLATHER implementation: |
---|
116 | !!1. According to Palma and Matano, 1998 "after ssh" is used. |
---|
117 | !! In ROMS and POM implementations, it is "now ssh". In the current |
---|
118 | !! implementation (tested only in the EEL-R5 conf.), both cases were unstable. |
---|
119 | !! So I use "before ssh" in the following. |
---|
120 | !! |
---|
121 | !!2. We assume that the normal ssh gradient at the bdy is zero. As a matter of |
---|
122 | !! fact, the model ssh just inside the dynamical boundary is used (the outside |
---|
123 | !! ssh in the code is not updated). |
---|
124 | !! |
---|
125 | !! References: Flather, R. A., 1976: A tidal model of the northwest European |
---|
126 | !! continental shelf. Mem. Soc. R. Sci. Liege, Ser. 6,10, 141-164. |
---|
127 | !!---------------------------------------------------------------------- |
---|
128 | TYPE(OBC_INDEX), INTENT(in) :: idx ! OBC indices |
---|
129 | TYPE(OBC_DATA), INTENT(in) :: dta ! OBC external data |
---|
130 | |
---|
131 | INTEGER :: jb, igrd ! dummy loop indices |
---|
132 | INTEGER :: ii, ij, iim1, iip1, ijm1, ijp1 ! 2D addresses |
---|
133 | REAL(wp) :: zcorr ! Flather correction |
---|
134 | REAL(wp) :: zforc ! temporary scalar |
---|
135 | !!---------------------------------------------------------------------- |
---|
136 | |
---|
137 | ! ---------------------------------! |
---|
138 | ! Flather boundary conditions :! |
---|
139 | ! ---------------------------------! |
---|
140 | |
---|
141 | !!! REPLACE spgu with nemo_wrk work space |
---|
142 | |
---|
143 | ! Fill temporary array with ssh data (here spgu): |
---|
144 | igrd = 1 |
---|
145 | spgu(:,:) = 0.0 |
---|
146 | DO jb = 1, idx%nblenrim(igrd) |
---|
147 | ii = idx%nbi(jb,igrd) |
---|
148 | ij = idx%nbj(jb,igrd) |
---|
149 | spgu(ii, ij) = dta%ssh(jb) |
---|
150 | END DO |
---|
151 | ! |
---|
152 | igrd = 2 ! Flather bc on u-velocity; |
---|
153 | ! ! remember that flagu=-1 if normal velocity direction is outward |
---|
154 | ! ! I think we should rather use after ssh ? |
---|
155 | DO jb = 1, idx%nblenrim(igrd) |
---|
156 | ii = idx%nbi(jb,igrd) |
---|
157 | ij = idx%nbj(jb,igrd) |
---|
158 | iim1 = ii + MAX( 0, INT( idx%flagu(jb) ) ) ! T pts i-indice inside the boundary |
---|
159 | iip1 = ii - MIN( 0, INT( idx%flagu(jb) ) ) ! T pts i-indice outside the boundary |
---|
160 | ! |
---|
161 | zcorr = - idx%flagu(jb) * SQRT( grav * phur(ii, ij) ) * ( pssh(iim1, ij) - spgu(iip1,ij) ) |
---|
162 | zforc = dta%u2d(jb) |
---|
163 | pu2d(ii,ij) = zforc + zcorr * umask(ii,ij,1) |
---|
164 | END DO |
---|
165 | ! |
---|
166 | igrd = 3 ! Flather bc on v-velocity |
---|
167 | ! ! remember that flagv=-1 if normal velocity direction is outward |
---|
168 | DO jb = 1, idx%nblenrim(igrd) |
---|
169 | ii = idx%nbi(jb,igrd) |
---|
170 | ij = idx%nbj(jb,igrd) |
---|
171 | ijm1 = ij + MAX( 0, INT( idx%flagv(jb) ) ) ! T pts j-indice inside the boundary |
---|
172 | ijp1 = ij - MIN( 0, INT( idx%flagv(jb) ) ) ! T pts j-indice outside the boundary |
---|
173 | ! |
---|
174 | zcorr = - idx%flagv(jb) * SQRT( grav * phvr(ii, ij) ) * ( pssh(ii, ijm1) - spgu(ii,ijp1) ) |
---|
175 | zforc = dta%v2d(jb) |
---|
176 | pv2d(ii,ij) = zforc + zcorr * vmask(ii,ij,1) |
---|
177 | END DO |
---|
178 | CALL lbc_lnk( pu2d, 'U', -1. ) ! Boundary points should be updated |
---|
179 | CALL lbc_lnk( pv2d, 'V', -1. ) ! |
---|
180 | ! |
---|
181 | ! |
---|
182 | END SUBROUTINE bdy_dyn2d_fla |
---|
183 | #else |
---|
184 | !!---------------------------------------------------------------------- |
---|
185 | !! Dummy module NO Unstruct Open Boundary Conditions |
---|
186 | !!---------------------------------------------------------------------- |
---|
187 | CONTAINS |
---|
188 | SUBROUTINE bdy_dyn2d( kt ) ! Empty routine |
---|
189 | WRITE(*,*) 'bdy_dyn_frs: You should not have seen this print! error?', kt |
---|
190 | END SUBROUTINE bdy_dyn2d |
---|
191 | #endif |
---|
192 | |
---|
193 | !!====================================================================== |
---|
194 | END MODULE bdydyn2d |
---|