1 | MODULE bdydta |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE bdydta *** |
---|
4 | !! Open boundary data : read the data for the unstructured open boundaries. |
---|
5 | !!====================================================================== |
---|
6 | !! History : 1.0 ! 2005-01 (J. Chanut, A. Sellar) Original code |
---|
7 | !! - ! 2007-01 (D. Storkey) Update to use IOM module |
---|
8 | !! - ! 2007-07 (D. Storkey) add bdy_dta_fla |
---|
9 | !! 3.0 ! 2008-04 (NEMO team) add in the reference version |
---|
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 | !! 3.6 ! 2012-01 (C. Rousset) add ice boundary conditions for sea ice |
---|
14 | !! 4.0 ! 2018 (C. Rousset) SI3 compatibility |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | !! bdy_dta : read external data along open boundaries from file |
---|
19 | !! bdy_dta_init : initialise arrays etc for reading of external data |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | USE oce ! ocean dynamics and tracers |
---|
22 | USE dom_oce ! ocean space and time domain |
---|
23 | USE phycst ! physical constants |
---|
24 | USE sbcapr ! atmospheric pressure forcing |
---|
25 | USE tide_mod, ONLY: ln_tide ! tidal forcing |
---|
26 | USE bdy_oce ! ocean open boundary conditions |
---|
27 | USE bdytides ! tidal forcing at boundaries |
---|
28 | #if defined key_si3 |
---|
29 | USE ice ! sea-ice variables |
---|
30 | USE icevar ! redistribute ice input into categories |
---|
31 | #endif |
---|
32 | ! |
---|
33 | USE lib_mpp, ONLY: ctl_stop, ctl_nam |
---|
34 | USE fldread ! read input fields |
---|
35 | USE iom ! IOM library |
---|
36 | USE in_out_manager ! I/O logical units |
---|
37 | USE timing ! Timing |
---|
38 | |
---|
39 | IMPLICIT NONE |
---|
40 | PRIVATE |
---|
41 | |
---|
42 | PUBLIC bdy_dta ! routine called by step.F90 and dynspg_ts.F90 |
---|
43 | PUBLIC bdy_dta_init ! routine called by nemogcm.F90 |
---|
44 | |
---|
45 | INTEGER , PARAMETER :: jpbdyfld = 16 ! maximum number of files to read |
---|
46 | INTEGER , PARAMETER :: jp_bdyssh = 1 ! |
---|
47 | INTEGER , PARAMETER :: jp_bdyu2d = 2 ! |
---|
48 | INTEGER , PARAMETER :: jp_bdyv2d = 3 ! |
---|
49 | INTEGER , PARAMETER :: jp_bdyu3d = 4 ! |
---|
50 | INTEGER , PARAMETER :: jp_bdyv3d = 5 ! |
---|
51 | INTEGER , PARAMETER :: jp_bdytem = 6 ! |
---|
52 | INTEGER , PARAMETER :: jp_bdysal = 7 ! |
---|
53 | INTEGER , PARAMETER :: jp_bdya_i = 8 ! |
---|
54 | INTEGER , PARAMETER :: jp_bdyh_i = 9 ! |
---|
55 | INTEGER , PARAMETER :: jp_bdyh_s = 10 ! |
---|
56 | INTEGER , PARAMETER :: jp_bdyt_i = 11 ! |
---|
57 | INTEGER , PARAMETER :: jp_bdyt_s = 12 ! |
---|
58 | INTEGER , PARAMETER :: jp_bdytsu = 13 ! |
---|
59 | INTEGER , PARAMETER :: jp_bdys_i = 14 ! |
---|
60 | INTEGER , PARAMETER :: jp_bdyaip = 15 ! |
---|
61 | INTEGER , PARAMETER :: jp_bdyhip = 16 ! |
---|
62 | #if ! defined key_si3 |
---|
63 | INTEGER , PARAMETER :: jpl = 1 |
---|
64 | #endif |
---|
65 | |
---|
66 | !$AGRIF_DO_NOT_TREAT |
---|
67 | TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET :: bf ! structure of input fields (file informations, fields read) |
---|
68 | !$AGRIF_END_DO_NOT_TREAT |
---|
69 | |
---|
70 | !! * Substitutions |
---|
71 | # include "do_loop_substitute.h90" |
---|
72 | !!---------------------------------------------------------------------- |
---|
73 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
74 | !! $Id$ |
---|
75 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
76 | !!---------------------------------------------------------------------- |
---|
77 | CONTAINS |
---|
78 | |
---|
79 | SUBROUTINE bdy_dta( kt, Kmm ) |
---|
80 | !!---------------------------------------------------------------------- |
---|
81 | !! *** SUBROUTINE bdy_dta *** |
---|
82 | !! |
---|
83 | !! ** Purpose : Update external data for open boundary conditions |
---|
84 | !! |
---|
85 | !! ** Method : Use fldread.F90 |
---|
86 | !! |
---|
87 | !!---------------------------------------------------------------------- |
---|
88 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
89 | INTEGER, INTENT(in) :: Kmm ! ocean time level index |
---|
90 | ! |
---|
91 | INTEGER :: jbdy, jfld, jstart, jend, ib, jl ! dummy loop indices |
---|
92 | INTEGER :: ii, ij, ik, igrd, ipl ! local integers |
---|
93 | TYPE(OBC_DATA) , POINTER :: dta_alias ! short cut |
---|
94 | TYPE(FLD), DIMENSION(:), POINTER :: bf_alias |
---|
95 | !!--------------------------------------------------------------------------- |
---|
96 | ! |
---|
97 | IF( ln_timing ) CALL timing_start('bdy_dta') |
---|
98 | ! |
---|
99 | ! Initialise data arrays once for all from initial conditions where required |
---|
100 | !--------------------------------------------------------------------------- |
---|
101 | IF( kt == nit000 ) THEN |
---|
102 | |
---|
103 | ! Calculate depth-mean currents |
---|
104 | !----------------------------- |
---|
105 | |
---|
106 | DO jbdy = 1, nb_bdy |
---|
107 | ! |
---|
108 | IF( nn_dyn2d_dta(jbdy) == 0 ) THEN |
---|
109 | IF( dta_bdy(jbdy)%lneed_ssh ) THEN |
---|
110 | igrd = 1 |
---|
111 | DO ib = 1, idx_bdy(jbdy)%nblenrim(igrd) ! ssh is allocated and used only on the rim |
---|
112 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
113 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
114 | dta_bdy(jbdy)%ssh(ib) = ssh(ii,ij,Kmm) * tmask(ii,ij,1) |
---|
115 | END DO |
---|
116 | ENDIF |
---|
117 | IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain |
---|
118 | igrd = 2 |
---|
119 | DO ib = 1, SIZE(dta_bdy(jbdy)%u2d) ! u2d is used either over the whole bdy or only on the rim |
---|
120 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
121 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
122 | dta_bdy(jbdy)%u2d(ib) = uu_b(ii,ij,Kmm) * umask(ii,ij,1) |
---|
123 | END DO |
---|
124 | ENDIF |
---|
125 | IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain |
---|
126 | igrd = 3 |
---|
127 | DO ib = 1, SIZE(dta_bdy(jbdy)%v2d) ! v2d is used either over the whole bdy or only on the rim |
---|
128 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
129 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
130 | dta_bdy(jbdy)%v2d(ib) = vv_b(ii,ij,Kmm) * vmask(ii,ij,1) |
---|
131 | END DO |
---|
132 | ENDIF |
---|
133 | ENDIF |
---|
134 | ! |
---|
135 | IF( nn_dyn3d_dta(jbdy) == 0 ) THEN |
---|
136 | IF( dta_bdy(jbdy)%lneed_dyn3d ) THEN |
---|
137 | igrd = 2 |
---|
138 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
139 | DO ik = 1, jpkm1 |
---|
140 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
141 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
142 | dta_bdy(jbdy)%u3d(ib,ik) = ( uu(ii,ij,ik,Kmm) - uu_b(ii,ij,Kmm) ) * umask(ii,ij,ik) |
---|
143 | END DO |
---|
144 | END DO |
---|
145 | igrd = 3 |
---|
146 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
147 | DO ik = 1, jpkm1 |
---|
148 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
149 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
150 | dta_bdy(jbdy)%v3d(ib,ik) = ( vv(ii,ij,ik,Kmm) - vv_b(ii,ij,Kmm) ) * vmask(ii,ij,ik) |
---|
151 | END DO |
---|
152 | END DO |
---|
153 | ENDIF |
---|
154 | ENDIF |
---|
155 | |
---|
156 | IF( nn_tra_dta(jbdy) == 0 ) THEN |
---|
157 | IF( dta_bdy(jbdy)%lneed_tra ) THEN |
---|
158 | igrd = 1 |
---|
159 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
160 | DO ik = 1, jpkm1 |
---|
161 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
162 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
163 | dta_bdy(jbdy)%tem(ib,ik) = ts(ii,ij,ik,jp_tem,Kmm) * tmask(ii,ij,ik) |
---|
164 | dta_bdy(jbdy)%sal(ib,ik) = ts(ii,ij,ik,jp_sal,Kmm) * tmask(ii,ij,ik) |
---|
165 | END DO |
---|
166 | END DO |
---|
167 | ENDIF |
---|
168 | ENDIF |
---|
169 | |
---|
170 | #if defined key_si3 |
---|
171 | IF( nn_ice_dta(jbdy) == 0 ) THEN ! set ice to initial values |
---|
172 | IF( dta_bdy(jbdy)%lneed_ice ) THEN |
---|
173 | igrd = 1 |
---|
174 | DO jl = 1, jpl |
---|
175 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
176 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
177 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
178 | dta_bdy(jbdy)%a_i(ib,jl) = a_i (ii,ij,jl) * tmask(ii,ij,1) |
---|
179 | dta_bdy(jbdy)%h_i(ib,jl) = h_i (ii,ij,jl) * tmask(ii,ij,1) |
---|
180 | dta_bdy(jbdy)%h_s(ib,jl) = h_s (ii,ij,jl) * tmask(ii,ij,1) |
---|
181 | dta_bdy(jbdy)%t_i(ib,jl) = SUM(t_i (ii,ij,:,jl)) * r1_nlay_i * tmask(ii,ij,1) |
---|
182 | dta_bdy(jbdy)%t_s(ib,jl) = SUM(t_s (ii,ij,:,jl)) * r1_nlay_s * tmask(ii,ij,1) |
---|
183 | dta_bdy(jbdy)%tsu(ib,jl) = t_su(ii,ij,jl) * tmask(ii,ij,1) |
---|
184 | dta_bdy(jbdy)%s_i(ib,jl) = s_i (ii,ij,jl) * tmask(ii,ij,1) |
---|
185 | ! melt ponds |
---|
186 | dta_bdy(jbdy)%aip(ib,jl) = a_ip(ii,ij,jl) * tmask(ii,ij,1) |
---|
187 | dta_bdy(jbdy)%hip(ib,jl) = h_ip(ii,ij,jl) * tmask(ii,ij,1) |
---|
188 | END DO |
---|
189 | END DO |
---|
190 | ENDIF |
---|
191 | ENDIF |
---|
192 | #endif |
---|
193 | END DO ! jbdy |
---|
194 | ! |
---|
195 | ENDIF ! kt == nit000 |
---|
196 | |
---|
197 | ! update external data from files |
---|
198 | !-------------------------------- |
---|
199 | |
---|
200 | DO jbdy = 1, nb_bdy |
---|
201 | |
---|
202 | dta_alias => dta_bdy(jbdy) |
---|
203 | bf_alias => bf(:,jbdy) |
---|
204 | |
---|
205 | ! read/update all bdy data |
---|
206 | ! ------------------------ |
---|
207 | ! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step |
---|
208 | CALL fld_read( kt, 1, bf_alias, pt_offset = 0.5_wp, Kmm = Kmm ) |
---|
209 | ! apply some corrections in some specific cases... |
---|
210 | ! -------------------------------------------------- |
---|
211 | ! |
---|
212 | ! if runoff condition: change river flow we read (in m3/s) into barotropic velocity (m/s) |
---|
213 | IF( cn_tra(jbdy) == 'runoff' ) THEN ! runoff |
---|
214 | ! |
---|
215 | IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain |
---|
216 | igrd = 2 ! zonal flow (m3/s) to barotropic zonal velocity (m/s) |
---|
217 | DO ib = 1, SIZE(dta_alias%u2d) ! u2d is used either over the whole bdy or only on the rim |
---|
218 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
219 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
220 | dta_alias%u2d(ib) = dta_alias%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) |
---|
221 | END DO |
---|
222 | ENDIF |
---|
223 | IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain |
---|
224 | igrd = 3 ! meridional flow (m3/s) to barotropic meridional velocity (m/s) |
---|
225 | DO ib = 1, SIZE(dta_alias%v2d) ! v2d is used either over the whole bdy or only on the rim |
---|
226 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
227 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
228 | dta_alias%v2d(ib) = dta_alias%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) |
---|
229 | END DO |
---|
230 | ENDIF |
---|
231 | ENDIF |
---|
232 | |
---|
233 | ! tidal harmonic forcing ONLY: initialise arrays |
---|
234 | IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! we did not read ssh, u/v2d |
---|
235 | IF( ASSOCIATED(dta_alias%ssh) ) dta_alias%ssh(:) = 0._wp |
---|
236 | IF( ASSOCIATED(dta_alias%u2d) ) dta_alias%u2d(:) = 0._wp |
---|
237 | IF( ASSOCIATED(dta_alias%v2d) ) dta_alias%v2d(:) = 0._wp |
---|
238 | ENDIF |
---|
239 | |
---|
240 | ! If full velocities in boundary data, then split it into barotropic and baroclinic component |
---|
241 | IF( bf_alias(jp_bdyu3d)%ltotvel ) THEN ! if we read 3D total velocity (can be true only if u3d was read) |
---|
242 | ! |
---|
243 | igrd = 2 ! zonal velocity |
---|
244 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
245 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
246 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
247 | dta_alias%u2d(ib) = 0._wp ! compute barotrope zonal velocity and put it in u2d |
---|
248 | DO ik = 1, jpkm1 |
---|
249 | dta_alias%u2d(ib) = dta_alias%u2d(ib) + e3u(ii,ij,ik,Kmm) * umask(ii,ij,ik) * dta_alias%u3d(ib,ik) |
---|
250 | END DO |
---|
251 | dta_alias%u2d(ib) = dta_alias%u2d(ib) * r1_hu(ii,ij,Kmm) |
---|
252 | DO ik = 1, jpkm1 ! compute barocline zonal velocity and put it in u3d |
---|
253 | dta_alias%u3d(ib,ik) = dta_alias%u3d(ib,ik) - dta_alias%u2d(ib) |
---|
254 | END DO |
---|
255 | END DO |
---|
256 | igrd = 3 ! meridional velocity |
---|
257 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
258 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
259 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
260 | dta_alias%v2d(ib) = 0._wp ! compute barotrope meridional velocity and put it in v2d |
---|
261 | DO ik = 1, jpkm1 |
---|
262 | dta_alias%v2d(ib) = dta_alias%v2d(ib) + e3v(ii,ij,ik,Kmm) * vmask(ii,ij,ik) * dta_alias%v3d(ib,ik) |
---|
263 | END DO |
---|
264 | dta_alias%v2d(ib) = dta_alias%v2d(ib) * r1_hv(ii,ij,Kmm) |
---|
265 | DO ik = 1, jpkm1 ! compute barocline meridional velocity and put it in v3d |
---|
266 | dta_alias%v3d(ib,ik) = dta_alias%v3d(ib,ik) - dta_alias%v2d(ib) |
---|
267 | END DO |
---|
268 | END DO |
---|
269 | ENDIF ! ltotvel |
---|
270 | |
---|
271 | ! atm surface pressure : add inverted barometer effect to ssh if it was read |
---|
272 | IF ( ln_apr_obc .AND. TRIM(bf_alias(jp_bdyssh)%clrootname) /= 'NOT USED' ) THEN |
---|
273 | igrd = 1 |
---|
274 | DO ib = 1, idx_bdy(jbdy)%nblenrim(igrd) ! ssh is used only on the rim |
---|
275 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
276 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
277 | dta_alias%ssh(ib) = dta_alias%ssh(ib) + ssh_ib(ii,ij) |
---|
278 | END DO |
---|
279 | ENDIF |
---|
280 | |
---|
281 | #if defined key_si3 |
---|
282 | IF( dta_alias%lneed_ice .AND. idx_bdy(jbdy)%nblen(1) > 0 ) THEN |
---|
283 | ! fill temperature and salinity arrays |
---|
284 | IF( TRIM(bf_alias(jp_bdyt_i)%clrootname) == 'NOT USED' ) bf_alias(jp_bdyt_i)%fnow(:,1,:) = rice_tem (jbdy) |
---|
285 | IF( TRIM(bf_alias(jp_bdyt_s)%clrootname) == 'NOT USED' ) bf_alias(jp_bdyt_s)%fnow(:,1,:) = rice_tem (jbdy) |
---|
286 | IF( TRIM(bf_alias(jp_bdytsu)%clrootname) == 'NOT USED' ) bf_alias(jp_bdytsu)%fnow(:,1,:) = rice_tem (jbdy) |
---|
287 | IF( TRIM(bf_alias(jp_bdys_i)%clrootname) == 'NOT USED' ) bf_alias(jp_bdys_i)%fnow(:,1,:) = rice_sal (jbdy) |
---|
288 | IF( TRIM(bf_alias(jp_bdyaip)%clrootname) == 'NOT USED' ) bf_alias(jp_bdyaip)%fnow(:,1,:) = rice_apnd(jbdy) * & ! rice_apnd is the pond fraction |
---|
289 | & bf_alias(jp_bdya_i)%fnow(:,1,:) ! ( a_ip = rice_apnd * a_i ) |
---|
290 | IF( TRIM(bf_alias(jp_bdyhip)%clrootname) == 'NOT USED' ) bf_alias(jp_bdyhip)%fnow(:,1,:) = rice_hpnd(jbdy) |
---|
291 | |
---|
292 | ! if T_i is read and not T_su, set T_su = T_i |
---|
293 | IF( TRIM(bf_alias(jp_bdyt_i)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdytsu)%clrootname) == 'NOT USED' ) & |
---|
294 | & bf_alias(jp_bdytsu)%fnow(:,1,:) = bf_alias(jp_bdyt_i)%fnow(:,1,:) |
---|
295 | ! if T_s is read and not T_su, set T_su = T_s |
---|
296 | IF( TRIM(bf_alias(jp_bdyt_s)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdytsu)%clrootname) == 'NOT USED' ) & |
---|
297 | & bf_alias(jp_bdytsu)%fnow(:,1,:) = bf_alias(jp_bdyt_s)%fnow(:,1,:) |
---|
298 | ! if T_i is read and not T_s, set T_s = T_i |
---|
299 | IF( TRIM(bf_alias(jp_bdyt_i)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdyt_s)%clrootname) == 'NOT USED' ) & |
---|
300 | & bf_alias(jp_bdyt_s)%fnow(:,1,:) = bf_alias(jp_bdyt_i)%fnow(:,1,:) |
---|
301 | ! if T_su is read and not T_s, set T_s = T_su |
---|
302 | IF( TRIM(bf_alias(jp_bdytsu)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdyt_s)%clrootname) == 'NOT USED' ) & |
---|
303 | & bf_alias(jp_bdyt_s)%fnow(:,1,:) = bf_alias(jp_bdytsu)%fnow(:,1,:) |
---|
304 | ! if T_su is read and not T_i, set T_i = (T_su + T_freeze)/2 |
---|
305 | IF( TRIM(bf_alias(jp_bdytsu)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdyt_i)%clrootname) == 'NOT USED' ) & |
---|
306 | & bf_alias(jp_bdyt_i)%fnow(:,1,:) = 0.5_wp * ( bf_alias(jp_bdytsu)%fnow(:,1,:) + 271.15 ) |
---|
307 | ! if T_s is read and not T_i, set T_i = (T_s + T_freeze)/2 |
---|
308 | IF( TRIM(bf_alias(jp_bdyt_s)%clrootname) /= 'NOT USED' .AND. TRIM(bf_alias(jp_bdyt_i)%clrootname) == 'NOT USED' ) & |
---|
309 | & bf_alias(jp_bdyt_i)%fnow(:,1,:) = 0.5_wp * ( bf_alias(jp_bdyt_s)%fnow(:,1,:) + 271.15 ) |
---|
310 | |
---|
311 | ! make sure ponds = 0 if no ponds scheme |
---|
312 | IF ( .NOT.ln_pnd ) THEN |
---|
313 | bf_alias(jp_bdyaip)%fnow(:,1,:) = 0._wp |
---|
314 | bf_alias(jp_bdyhip)%fnow(:,1,:) = 0._wp |
---|
315 | ENDIF |
---|
316 | |
---|
317 | ! convert N-cat fields (input) into jpl-cat (output) |
---|
318 | ipl = SIZE(bf_alias(jp_bdya_i)%fnow, 3) |
---|
319 | IF( ipl /= jpl ) THEN ! ice: convert N-cat fields (input) into jpl-cat (output) |
---|
320 | CALL ice_var_itd( bf_alias(jp_bdyh_i)%fnow(:,1,:), bf_alias(jp_bdyh_s)%fnow(:,1,:), bf_alias(jp_bdya_i)%fnow(:,1,:), & |
---|
321 | & dta_alias%h_i , dta_alias%h_s , dta_alias%a_i , & |
---|
322 | & bf_alias(jp_bdyt_i)%fnow(:,1,:), bf_alias(jp_bdyt_s)%fnow(:,1,:), & |
---|
323 | & bf_alias(jp_bdytsu)%fnow(:,1,:), bf_alias(jp_bdys_i)%fnow(:,1,:), & |
---|
324 | & bf_alias(jp_bdyaip)%fnow(:,1,:), bf_alias(jp_bdyhip)%fnow(:,1,:), & |
---|
325 | & dta_alias%t_i , dta_alias%t_s , & |
---|
326 | & dta_alias%tsu , dta_alias%s_i , & |
---|
327 | & dta_alias%aip , dta_alias%hip ) |
---|
328 | ENDIF |
---|
329 | ENDIF |
---|
330 | #endif |
---|
331 | END DO ! jbdy |
---|
332 | |
---|
333 | IF ( ln_tide ) THEN |
---|
334 | IF (ln_dynspg_ts) THEN ! Fill temporary arrays with slow-varying bdy data |
---|
335 | DO jbdy = 1, nb_bdy ! Tidal component added in ts loop |
---|
336 | IF ( nn_dyn2d_dta(jbdy) .GE. 2 ) THEN |
---|
337 | IF( ASSOCIATED(dta_bdy(jbdy)%ssh) ) dta_bdy_s(jbdy)%ssh(:) = dta_bdy(jbdy)%ssh(:) |
---|
338 | IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) dta_bdy_s(jbdy)%u2d(:) = dta_bdy(jbdy)%u2d(:) |
---|
339 | IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) dta_bdy_s(jbdy)%v2d(:) = dta_bdy(jbdy)%v2d(:) |
---|
340 | ENDIF |
---|
341 | END DO |
---|
342 | ELSE ! Add tides if not split-explicit free surface else this is done in ts loop |
---|
343 | ! |
---|
344 | CALL bdy_dta_tides( kt=kt, pt_offset = 1._wp ) |
---|
345 | ENDIF |
---|
346 | ENDIF |
---|
347 | ! |
---|
348 | IF( ln_timing ) CALL timing_stop('bdy_dta') |
---|
349 | ! |
---|
350 | END SUBROUTINE bdy_dta |
---|
351 | |
---|
352 | |
---|
353 | SUBROUTINE bdy_dta_init |
---|
354 | !!---------------------------------------------------------------------- |
---|
355 | !! *** SUBROUTINE bdy_dta_init *** |
---|
356 | !! |
---|
357 | !! ** Purpose : Initialise arrays for reading of external data |
---|
358 | !! for open boundary conditions |
---|
359 | !! |
---|
360 | !! ** Method : |
---|
361 | !! |
---|
362 | !!---------------------------------------------------------------------- |
---|
363 | INTEGER :: jbdy, jfld ! Local integers |
---|
364 | INTEGER :: ierror, ios ! |
---|
365 | ! |
---|
366 | INTEGER :: nbdy_rdstart, nbdy_loc |
---|
367 | CHARACTER(LEN=50) :: cerrmsg ! error string |
---|
368 | CHARACTER(len=3) :: cl3 ! |
---|
369 | CHARACTER(len=100) :: cn_dir ! Root directory for location of data files |
---|
370 | LOGICAL :: ln_full_vel ! =T => full velocities in 3D boundary data |
---|
371 | ! ! =F => baroclinic velocities in 3D boundary data |
---|
372 | LOGICAL :: ln_zinterp ! =T => requires a vertical interpolation of the bdydta |
---|
373 | REAL(wp) :: rn_ice_tem, rn_ice_sal, rn_ice_age, rn_ice_apnd, rn_ice_hpnd |
---|
374 | INTEGER :: ipk,ipl ! |
---|
375 | INTEGER :: idvar ! variable ID |
---|
376 | INTEGER :: indims ! number of dimensions of the variable |
---|
377 | INTEGER :: iszdim ! number of dimensions of the variable |
---|
378 | INTEGER, DIMENSION(4) :: i4dimsz ! size of variable dimensions |
---|
379 | INTEGER :: igrd ! index for grid type (1,2,3 = T,U,V) |
---|
380 | LOGICAL :: lluld ! is the variable using the unlimited dimension |
---|
381 | LOGICAL :: llneed ! |
---|
382 | LOGICAL :: llread ! |
---|
383 | LOGICAL :: llfullbdy ! |
---|
384 | TYPE(FLD_N), DIMENSION(1), TARGET :: bn_tem, bn_sal, bn_u3d, bn_v3d ! must be an array to be used with fld_fill |
---|
385 | TYPE(FLD_N), DIMENSION(1), TARGET :: bn_ssh, bn_u2d, bn_v2d ! informations about the fields to be read |
---|
386 | TYPE(FLD_N), DIMENSION(1), TARGET :: bn_a_i, bn_h_i, bn_h_s, bn_t_i, bn_t_s, bn_tsu, bn_s_i, bn_aip, bn_hip |
---|
387 | TYPE(FLD_N), DIMENSION(:), POINTER :: bn_alias ! must be an array to be used with fld_fill |
---|
388 | TYPE(FLD ), DIMENSION(:), POINTER :: bf_alias |
---|
389 | ! |
---|
390 | NAMELIST/nambdy_dta/ cn_dir, bn_tem, bn_sal, bn_u3d, bn_v3d, bn_ssh, bn_u2d, bn_v2d |
---|
391 | NAMELIST/nambdy_dta/ bn_a_i, bn_h_i, bn_h_s, bn_t_i, bn_t_s, bn_tsu, bn_s_i, bn_aip, bn_hip |
---|
392 | NAMELIST/nambdy_dta/ rn_ice_tem, rn_ice_sal, rn_ice_age, rn_ice_apnd, rn_ice_hpnd |
---|
393 | NAMELIST/nambdy_dta/ ln_full_vel, ln_zinterp |
---|
394 | !!--------------------------------------------------------------------------- |
---|
395 | ! |
---|
396 | IF(lwp) WRITE(numout,*) |
---|
397 | IF(lwp) WRITE(numout,*) 'bdy_dta_ini : initialization of data at the open boundaries' |
---|
398 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~' |
---|
399 | IF(lwp) WRITE(numout,*) '' |
---|
400 | |
---|
401 | ALLOCATE( bf(jpbdyfld,nb_bdy), STAT=ierror ) |
---|
402 | IF( ierror > 0 ) THEN |
---|
403 | CALL ctl_stop( 'bdy_dta: unable to allocate bf structure' ) ; RETURN |
---|
404 | ENDIF |
---|
405 | bf(:,:)%clrootname = 'NOT USED' ! default definition used as a flag in fld_read to do nothing. |
---|
406 | bf(:,:)%lzint = .FALSE. ! default definition |
---|
407 | bf(:,:)%ltotvel = .FALSE. ! default definition |
---|
408 | |
---|
409 | ! Read namelists |
---|
410 | ! -------------- |
---|
411 | nbdy_rdstart = 1 |
---|
412 | DO jbdy = 1, nb_bdy |
---|
413 | |
---|
414 | WRITE(ctmp1, '(a,i2)') 'BDY number ', jbdy |
---|
415 | WRITE(ctmp2, '(a,i2)') 'block nambdy_dta number ', jbdy |
---|
416 | |
---|
417 | ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we read from the beginning |
---|
418 | READ ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) |
---|
419 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in reference namelist' ) |
---|
420 | |
---|
421 | ! by-pass nambdy_dta reading if no input data used in this bdy |
---|
422 | IF( ( dta_bdy(jbdy)%lneed_dyn2d .AND. MOD(nn_dyn2d_dta(jbdy),2) == 1 ) & |
---|
423 | & .OR. ( dta_bdy(jbdy)%lneed_dyn3d .AND. nn_dyn3d_dta(jbdy) == 1 ) & |
---|
424 | & .OR. ( dta_bdy(jbdy)%lneed_tra .AND. nn_tra_dta(jbdy) == 1 ) & |
---|
425 | & .OR. ( dta_bdy(jbdy)%lneed_ice .AND. nn_ice_dta(jbdy) == 1 ) ) THEN |
---|
426 | ! |
---|
427 | ! Need to support possibility of reading more than one |
---|
428 | ! nambdy_dta from the namelist_cfg internal file. |
---|
429 | ! Do this by finding the jbdy'th occurence of nambdy_dta in the |
---|
430 | ! character buffer as the starting point. |
---|
431 | ! |
---|
432 | nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' ) |
---|
433 | IF( nbdy_loc .GT. 0 ) THEN |
---|
434 | nbdy_rdstart = nbdy_rdstart + nbdy_loc |
---|
435 | ELSE |
---|
436 | WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found' |
---|
437 | ios = -1 |
---|
438 | CALL ctl_nam ( ios , cerrmsg ) |
---|
439 | ENDIF |
---|
440 | READ ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_dta, IOSTAT = ios, ERR = 902) |
---|
441 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' ) |
---|
442 | IF(lwm) WRITE( numond, nambdy_dta ) |
---|
443 | ENDIF |
---|
444 | |
---|
445 | ! get the number of ice categories in bdy data file (use a_i information to do this) |
---|
446 | ipl = jpl ! default definition |
---|
447 | IF( dta_bdy(jbdy)%lneed_ice ) THEN ! if we need ice bdy data |
---|
448 | IF( nn_ice_dta(jbdy) == 1 ) THEN ! if we get ice bdy data from netcdf file |
---|
449 | CALL fld_fill( bf(jp_bdya_i,jbdy:jbdy), bn_a_i, cn_dir, 'bdy_dta', 'a_i'//' '//ctmp1, ctmp2 ) ! use namelist info |
---|
450 | CALL fld_def( bf(jp_bdya_i,jbdy) ) |
---|
451 | CALL iom_open( bf(jp_bdya_i,jbdy)%clname, bf(jp_bdya_i,jbdy)%num ) |
---|
452 | idvar = iom_varid( bf(jp_bdya_i,jbdy)%num, bf(jp_bdya_i,jbdy)%clvar, kndims=indims, kdimsz=i4dimsz, lduld=lluld ) |
---|
453 | IF( indims == 4 .OR. ( indims == 3 .AND. .NOT. lluld ) ) THEN ; ipl = i4dimsz(3) ! xylt or xyl |
---|
454 | ELSE ; ipl = 1 ! xy or xyt |
---|
455 | ENDIF |
---|
456 | CALL iom_close( bf(jp_bdya_i,jbdy)%num ) |
---|
457 | bf(jp_bdya_i,jbdy)%clrootname = 'NOT USED' ! reset to default value as this subdomain may not need to read this bdy |
---|
458 | ENDIF |
---|
459 | ENDIF |
---|
460 | |
---|
461 | #if defined key_si3 |
---|
462 | IF( .NOT.ln_pnd ) THEN |
---|
463 | rn_ice_apnd = 0. ; rn_ice_hpnd = 0. |
---|
464 | CALL ctl_warn( 'rn_ice_apnd & rn_ice_hpnd = 0 when no ponds' ) |
---|
465 | ENDIF |
---|
466 | #endif |
---|
467 | |
---|
468 | ! temp, salt, age and ponds of incoming ice |
---|
469 | rice_tem (jbdy) = rn_ice_tem |
---|
470 | rice_sal (jbdy) = rn_ice_sal |
---|
471 | rice_age (jbdy) = rn_ice_age |
---|
472 | rice_apnd(jbdy) = rn_ice_apnd |
---|
473 | rice_hpnd(jbdy) = rn_ice_hpnd |
---|
474 | |
---|
475 | |
---|
476 | DO jfld = 1, jpbdyfld |
---|
477 | |
---|
478 | ! ===================== |
---|
479 | ! ssh |
---|
480 | ! ===================== |
---|
481 | IF( jfld == jp_bdyssh ) THEN |
---|
482 | cl3 = 'ssh' |
---|
483 | igrd = 1 ! T point |
---|
484 | ipk = 1 ! surface data |
---|
485 | llneed = dta_bdy(jbdy)%lneed_ssh ! dta_bdy(jbdy)%ssh will be needed |
---|
486 | llread = MOD(nn_dyn2d_dta(jbdy),2) == 1 ! get data from NetCDF file |
---|
487 | bf_alias => bf(jp_bdyssh,jbdy:jbdy) ! alias for ssh structure of bdy number jbdy |
---|
488 | bn_alias => bn_ssh ! alias for ssh structure of nambdy_dta |
---|
489 | iszdim = idx_bdy(jbdy)%nblenrim(igrd) ! length of this bdy on this MPI processus : used only on the rim |
---|
490 | ENDIF |
---|
491 | ! ===================== |
---|
492 | ! dyn2d |
---|
493 | ! ===================== |
---|
494 | IF( jfld == jp_bdyu2d ) THEN |
---|
495 | cl3 = 'u2d' |
---|
496 | igrd = 2 ! U point |
---|
497 | ipk = 1 ! surface data |
---|
498 | llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)%u2d will be needed |
---|
499 | llread = .NOT. ln_full_vel .AND. MOD(nn_dyn2d_dta(jbdy),2) == 1 ! don't get u2d from u3d and read NetCDF file |
---|
500 | bf_alias => bf(jp_bdyu2d,jbdy:jbdy) ! alias for u2d structure of bdy number jbdy |
---|
501 | bn_alias => bn_u2d ! alias for u2d structure of nambdy_dta |
---|
502 | llfullbdy = ln_full_vel .OR. cn_dyn2d(jbdy) == 'frs' ! need u2d over the whole bdy or only over the rim? |
---|
503 | IF( llfullbdy ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) |
---|
504 | ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) |
---|
505 | ENDIF |
---|
506 | ENDIF |
---|
507 | IF( jfld == jp_bdyv2d ) THEN |
---|
508 | cl3 = 'v2d' |
---|
509 | igrd = 3 ! V point |
---|
510 | ipk = 1 ! surface data |
---|
511 | llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)%v2d will be needed |
---|
512 | llread = .NOT. ln_full_vel .AND. MOD(nn_dyn2d_dta(jbdy),2) == 1 ! don't get v2d from v3d and read NetCDF file |
---|
513 | bf_alias => bf(jp_bdyv2d,jbdy:jbdy) ! alias for v2d structure of bdy number jbdy |
---|
514 | bn_alias => bn_v2d ! alias for v2d structure of nambdy_dta |
---|
515 | llfullbdy = ln_full_vel .OR. cn_dyn2d(jbdy) == 'frs' ! need v2d over the whole bdy or only over the rim? |
---|
516 | IF( llfullbdy ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) |
---|
517 | ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) |
---|
518 | ENDIF |
---|
519 | ENDIF |
---|
520 | ! ===================== |
---|
521 | ! dyn3d |
---|
522 | ! ===================== |
---|
523 | IF( jfld == jp_bdyu3d ) THEN |
---|
524 | cl3 = 'u3d' |
---|
525 | igrd = 2 ! U point |
---|
526 | ipk = jpk ! 3d data |
---|
527 | llneed = dta_bdy(jbdy)%lneed_dyn3d .OR. & ! dta_bdy(jbdy)%u3d will be needed |
---|
528 | & ( dta_bdy(jbdy)%lneed_dyn2d .AND. ln_full_vel ) ! u3d needed to compute u2d |
---|
529 | llread = nn_dyn3d_dta(jbdy) == 1 ! get data from NetCDF file |
---|
530 | bf_alias => bf(jp_bdyu3d,jbdy:jbdy) ! alias for u3d structure of bdy number jbdy |
---|
531 | bn_alias => bn_u3d ! alias for u3d structure of nambdy_dta |
---|
532 | iszdim = idx_bdy(jbdy)%nblen(igrd) ! length of this bdy on this MPI processus |
---|
533 | ENDIF |
---|
534 | IF( jfld == jp_bdyv3d ) THEN |
---|
535 | cl3 = 'v3d' |
---|
536 | igrd = 3 ! V point |
---|
537 | ipk = jpk ! 3d data |
---|
538 | llneed = dta_bdy(jbdy)%lneed_dyn3d .OR. & ! dta_bdy(jbdy)%v3d will be needed |
---|
539 | & ( dta_bdy(jbdy)%lneed_dyn2d .AND. ln_full_vel ) ! v3d needed to compute v2d |
---|
540 | llread = nn_dyn3d_dta(jbdy) == 1 ! get data from NetCDF file |
---|
541 | bf_alias => bf(jp_bdyv3d,jbdy:jbdy) ! alias for v3d structure of bdy number jbdy |
---|
542 | bn_alias => bn_v3d ! alias for v3d structure of nambdy_dta |
---|
543 | iszdim = idx_bdy(jbdy)%nblen(igrd) ! length of this bdy on this MPI processus |
---|
544 | ENDIF |
---|
545 | |
---|
546 | ! ===================== |
---|
547 | ! tra |
---|
548 | ! ===================== |
---|
549 | IF( jfld == jp_bdytem ) THEN |
---|
550 | cl3 = 'tem' |
---|
551 | igrd = 1 ! T point |
---|
552 | ipk = jpk ! 3d data |
---|
553 | llneed = dta_bdy(jbdy)%lneed_tra ! dta_bdy(jbdy)%tem will be needed |
---|
554 | llread = nn_tra_dta(jbdy) == 1 ! get data from NetCDF file |
---|
555 | bf_alias => bf(jp_bdytem,jbdy:jbdy) ! alias for ssh structure of bdy number jbdy |
---|
556 | bn_alias => bn_tem ! alias for ssh structure of nambdy_dta |
---|
557 | iszdim = idx_bdy(jbdy)%nblen(igrd) ! length of this bdy on this MPI processus |
---|
558 | ENDIF |
---|
559 | IF( jfld == jp_bdysal ) THEN |
---|
560 | cl3 = 'sal' |
---|
561 | igrd = 1 ! T point |
---|
562 | ipk = jpk ! 3d data |
---|
563 | llneed = dta_bdy(jbdy)%lneed_tra ! dta_bdy(jbdy)%sal will be needed |
---|
564 | llread = nn_tra_dta(jbdy) == 1 ! get data from NetCDF file |
---|
565 | bf_alias => bf(jp_bdysal,jbdy:jbdy) ! alias for ssh structure of bdy number jbdy |
---|
566 | bn_alias => bn_sal ! alias for ssh structure of nambdy_dta |
---|
567 | iszdim = idx_bdy(jbdy)%nblen(igrd) ! length of this bdy on this MPI processus |
---|
568 | ENDIF |
---|
569 | |
---|
570 | ! ===================== |
---|
571 | ! ice |
---|
572 | ! ===================== |
---|
573 | IF( jfld == jp_bdya_i .OR. jfld == jp_bdyh_i .OR. jfld == jp_bdyh_s .OR. & |
---|
574 | & jfld == jp_bdyt_i .OR. jfld == jp_bdyt_s .OR. jfld == jp_bdytsu .OR. & |
---|
575 | & jfld == jp_bdys_i .OR. jfld == jp_bdyaip .OR. jfld == jp_bdyhip ) THEN |
---|
576 | igrd = 1 ! T point |
---|
577 | ipk = ipl ! jpl-cat data |
---|
578 | llneed = dta_bdy(jbdy)%lneed_ice ! ice will be needed |
---|
579 | llread = nn_ice_dta(jbdy) == 1 ! get data from NetCDF file |
---|
580 | iszdim = idx_bdy(jbdy)%nblen(igrd) ! length of this bdy on this MPI processus |
---|
581 | ENDIF |
---|
582 | IF( jfld == jp_bdya_i ) THEN |
---|
583 | cl3 = 'a_i' |
---|
584 | bf_alias => bf(jp_bdya_i,jbdy:jbdy) ! alias for a_i structure of bdy number jbdy |
---|
585 | bn_alias => bn_a_i ! alias for a_i structure of nambdy_dta |
---|
586 | ENDIF |
---|
587 | IF( jfld == jp_bdyh_i ) THEN |
---|
588 | cl3 = 'h_i' |
---|
589 | bf_alias => bf(jp_bdyh_i,jbdy:jbdy) ! alias for h_i structure of bdy number jbdy |
---|
590 | bn_alias => bn_h_i ! alias for h_i structure of nambdy_dta |
---|
591 | ENDIF |
---|
592 | IF( jfld == jp_bdyh_s ) THEN |
---|
593 | cl3 = 'h_s' |
---|
594 | bf_alias => bf(jp_bdyh_s,jbdy:jbdy) ! alias for h_s structure of bdy number jbdy |
---|
595 | bn_alias => bn_h_s ! alias for h_s structure of nambdy_dta |
---|
596 | ENDIF |
---|
597 | IF( jfld == jp_bdyt_i ) THEN |
---|
598 | cl3 = 't_i' |
---|
599 | bf_alias => bf(jp_bdyt_i,jbdy:jbdy) ! alias for t_i structure of bdy number jbdy |
---|
600 | bn_alias => bn_t_i ! alias for t_i structure of nambdy_dta |
---|
601 | ENDIF |
---|
602 | IF( jfld == jp_bdyt_s ) THEN |
---|
603 | cl3 = 't_s' |
---|
604 | bf_alias => bf(jp_bdyt_s,jbdy:jbdy) ! alias for t_s structure of bdy number jbdy |
---|
605 | bn_alias => bn_t_s ! alias for t_s structure of nambdy_dta |
---|
606 | ENDIF |
---|
607 | IF( jfld == jp_bdytsu ) THEN |
---|
608 | cl3 = 'tsu' |
---|
609 | bf_alias => bf(jp_bdytsu,jbdy:jbdy) ! alias for tsu structure of bdy number jbdy |
---|
610 | bn_alias => bn_tsu ! alias for tsu structure of nambdy_dta |
---|
611 | ENDIF |
---|
612 | IF( jfld == jp_bdys_i ) THEN |
---|
613 | cl3 = 's_i' |
---|
614 | bf_alias => bf(jp_bdys_i,jbdy:jbdy) ! alias for s_i structure of bdy number jbdy |
---|
615 | bn_alias => bn_s_i ! alias for s_i structure of nambdy_dta |
---|
616 | ENDIF |
---|
617 | IF( jfld == jp_bdyaip ) THEN |
---|
618 | cl3 = 'aip' |
---|
619 | bf_alias => bf(jp_bdyaip,jbdy:jbdy) ! alias for aip structure of bdy number jbdy |
---|
620 | bn_alias => bn_aip ! alias for aip structure of nambdy_dta |
---|
621 | ENDIF |
---|
622 | IF( jfld == jp_bdyhip ) THEN |
---|
623 | cl3 = 'hip' |
---|
624 | bf_alias => bf(jp_bdyhip,jbdy:jbdy) ! alias for hip structure of bdy number jbdy |
---|
625 | bn_alias => bn_hip ! alias for hip structure of nambdy_dta |
---|
626 | ENDIF |
---|
627 | |
---|
628 | IF( llneed .AND. iszdim > 0 ) THEN ! dta_bdy(jbdy)%xxx will be needed |
---|
629 | ! ! -> must be associated with an allocated target |
---|
630 | ALLOCATE( bf_alias(1)%fnow( iszdim, 1, ipk ) ) ! allocate the target |
---|
631 | ! |
---|
632 | IF( llread ) THEN ! get data from NetCDF file |
---|
633 | CALL fld_fill( bf_alias, bn_alias, cn_dir, 'bdy_dta', cl3//' '//ctmp1, ctmp2 ) ! use namelist info |
---|
634 | IF( bf_alias(1)%ln_tint ) ALLOCATE( bf_alias(1)%fdta( iszdim, 1, ipk, 2 ) ) |
---|
635 | bf_alias(1)%imap => idx_bdy(jbdy)%nbmap(1:iszdim,igrd) ! associate the mapping used for this bdy |
---|
636 | bf_alias(1)%igrd = igrd ! used only for vertical integration of 3D arrays |
---|
637 | bf_alias(1)%ibdy = jbdy ! " " " " " " " " |
---|
638 | bf_alias(1)%ltotvel = ln_full_vel ! T if u3d is full velocity |
---|
639 | bf_alias(1)%lzint = ln_zinterp ! T if it requires a vertical interpolation |
---|
640 | ENDIF |
---|
641 | |
---|
642 | ! associate the pointer and get rid of the dimensions with a size equal to 1 |
---|
643 | IF( jfld == jp_bdyssh ) dta_bdy(jbdy)%ssh => bf_alias(1)%fnow(:,1,1) |
---|
644 | IF( jfld == jp_bdyu2d ) dta_bdy(jbdy)%u2d => bf_alias(1)%fnow(:,1,1) |
---|
645 | IF( jfld == jp_bdyv2d ) dta_bdy(jbdy)%v2d => bf_alias(1)%fnow(:,1,1) |
---|
646 | IF( jfld == jp_bdyu3d ) dta_bdy(jbdy)%u3d => bf_alias(1)%fnow(:,1,:) |
---|
647 | IF( jfld == jp_bdyv3d ) dta_bdy(jbdy)%v3d => bf_alias(1)%fnow(:,1,:) |
---|
648 | IF( jfld == jp_bdytem ) dta_bdy(jbdy)%tem => bf_alias(1)%fnow(:,1,:) |
---|
649 | IF( jfld == jp_bdysal ) dta_bdy(jbdy)%sal => bf_alias(1)%fnow(:,1,:) |
---|
650 | IF( jfld == jp_bdya_i ) THEN |
---|
651 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%a_i => bf_alias(1)%fnow(:,1,:) |
---|
652 | ELSE ; ALLOCATE( dta_bdy(jbdy)%a_i(iszdim,jpl) ) |
---|
653 | ENDIF |
---|
654 | ENDIF |
---|
655 | IF( jfld == jp_bdyh_i ) THEN |
---|
656 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%h_i => bf_alias(1)%fnow(:,1,:) |
---|
657 | ELSE ; ALLOCATE( dta_bdy(jbdy)%h_i(iszdim,jpl) ) |
---|
658 | ENDIF |
---|
659 | ENDIF |
---|
660 | IF( jfld == jp_bdyh_s ) THEN |
---|
661 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%h_s => bf_alias(1)%fnow(:,1,:) |
---|
662 | ELSE ; ALLOCATE( dta_bdy(jbdy)%h_s(iszdim,jpl) ) |
---|
663 | ENDIF |
---|
664 | ENDIF |
---|
665 | IF( jfld == jp_bdyt_i ) THEN |
---|
666 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%t_i => bf_alias(1)%fnow(:,1,:) |
---|
667 | ELSE ; ALLOCATE( dta_bdy(jbdy)%t_i(iszdim,jpl) ) |
---|
668 | ENDIF |
---|
669 | ENDIF |
---|
670 | IF( jfld == jp_bdyt_s ) THEN |
---|
671 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%t_s => bf_alias(1)%fnow(:,1,:) |
---|
672 | ELSE ; ALLOCATE( dta_bdy(jbdy)%t_s(iszdim,jpl) ) |
---|
673 | ENDIF |
---|
674 | ENDIF |
---|
675 | IF( jfld == jp_bdytsu ) THEN |
---|
676 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%tsu => bf_alias(1)%fnow(:,1,:) |
---|
677 | ELSE ; ALLOCATE( dta_bdy(jbdy)%tsu(iszdim,jpl) ) |
---|
678 | ENDIF |
---|
679 | ENDIF |
---|
680 | IF( jfld == jp_bdys_i ) THEN |
---|
681 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%s_i => bf_alias(1)%fnow(:,1,:) |
---|
682 | ELSE ; ALLOCATE( dta_bdy(jbdy)%s_i(iszdim,jpl) ) |
---|
683 | ENDIF |
---|
684 | ENDIF |
---|
685 | IF( jfld == jp_bdyaip ) THEN |
---|
686 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%aip => bf_alias(1)%fnow(:,1,:) |
---|
687 | ELSE ; ALLOCATE( dta_bdy(jbdy)%aip(iszdim,jpl) ) |
---|
688 | ENDIF |
---|
689 | ENDIF |
---|
690 | IF( jfld == jp_bdyhip ) THEN |
---|
691 | IF( ipk == jpl ) THEN ; dta_bdy(jbdy)%hip => bf_alias(1)%fnow(:,1,:) |
---|
692 | ELSE ; ALLOCATE( dta_bdy(jbdy)%hip(iszdim,jpl) ) |
---|
693 | ENDIF |
---|
694 | ENDIF |
---|
695 | ENDIF |
---|
696 | |
---|
697 | END DO ! jpbdyfld |
---|
698 | ! |
---|
699 | END DO ! jbdy |
---|
700 | ! |
---|
701 | END SUBROUTINE bdy_dta_init |
---|
702 | |
---|
703 | !!============================================================================== |
---|
704 | END MODULE bdydta |
---|