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 sbctide ! Tidal forcing or not |
---|
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, ALLOCATABLE, DIMENSION(:) :: nb_bdy_fld ! Number of fields to update for each boundary set. |
---|
46 | INTEGER :: nb_bdy_fld_sum ! Total number of fields to update for all boundary sets. |
---|
47 | LOGICAL, DIMENSION(jp_bdy) :: ln_full_vel_array ! =T => full velocities in 3D boundary conditions |
---|
48 | ! =F => baroclinic velocities in 3D boundary conditions |
---|
49 | !$AGRIF_DO_NOT_TREAT |
---|
50 | TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET :: bf ! structure of input fields (file informations, fields read) |
---|
51 | !$AGRIF_END_DO_NOT_TREAT |
---|
52 | TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr ! array of pointers to nbmap |
---|
53 | |
---|
54 | #if defined key_si3 |
---|
55 | INTEGER :: nice_cat ! number of categories in the input file |
---|
56 | INTEGER :: jfld_hti, jfld_hts, jfld_ai ! indices of ice thickness, snow thickness and concentration in bf structure |
---|
57 | INTEGER, DIMENSION(jp_bdy) :: jfld_htit, jfld_htst, jfld_ait |
---|
58 | #endif |
---|
59 | |
---|
60 | !!---------------------------------------------------------------------- |
---|
61 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
62 | !! $Id$ |
---|
63 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
64 | !!---------------------------------------------------------------------- |
---|
65 | CONTAINS |
---|
66 | |
---|
67 | SUBROUTINE bdy_dta( kt, jit, time_offset ) |
---|
68 | !!---------------------------------------------------------------------- |
---|
69 | !! *** SUBROUTINE bdy_dta *** |
---|
70 | !! |
---|
71 | !! ** Purpose : Update external data for open boundary conditions |
---|
72 | !! |
---|
73 | !! ** Method : Use fldread.F90 |
---|
74 | !! |
---|
75 | !!---------------------------------------------------------------------- |
---|
76 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
77 | INTEGER, INTENT(in), OPTIONAL :: jit ! subcycle time-step index (for timesplitting option) |
---|
78 | INTEGER, INTENT(in), OPTIONAL :: time_offset ! time offset in units of timesteps. NB. if jit |
---|
79 | ! ! is present then units = subcycle timesteps. |
---|
80 | ! ! time_offset = 0 => get data at "now" time level |
---|
81 | ! ! time_offset = -1 => get data at "before" time level |
---|
82 | ! ! time_offset = +1 => get data at "after" time level |
---|
83 | ! ! etc. |
---|
84 | ! |
---|
85 | INTEGER :: jbdy, jfld, jstart, jend, ib, jl ! dummy loop indices |
---|
86 | INTEGER :: ii, ij, ik, igrd ! local integers |
---|
87 | INTEGER, DIMENSION(jpbgrd) :: ilen1 |
---|
88 | INTEGER, POINTER, DIMENSION(:) :: nblen, nblenrim ! short cuts |
---|
89 | TYPE(OBC_DATA), POINTER :: dta ! short cut |
---|
90 | !!--------------------------------------------------------------------------- |
---|
91 | ! |
---|
92 | IF( ln_timing ) CALL timing_start('bdy_dta') |
---|
93 | ! |
---|
94 | ! Initialise data arrays once for all from initial conditions where required |
---|
95 | !--------------------------------------------------------------------------- |
---|
96 | IF( kt == nit000 .AND. .NOT.PRESENT(jit) ) THEN |
---|
97 | |
---|
98 | ! Calculate depth-mean currents |
---|
99 | !----------------------------- |
---|
100 | |
---|
101 | DO jbdy = 1, nb_bdy |
---|
102 | ! |
---|
103 | nblen => idx_bdy(jbdy)%nblen |
---|
104 | nblenrim => idx_bdy(jbdy)%nblenrim |
---|
105 | dta => dta_bdy(jbdy) |
---|
106 | ! |
---|
107 | IF( nn_dyn2d_dta(jbdy) == 0 ) THEN |
---|
108 | ilen1(:) = nblen(:) |
---|
109 | IF( dta%ll_ssh ) THEN |
---|
110 | igrd = 1 |
---|
111 | DO ib = 1, ilen1(igrd) |
---|
112 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
113 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
114 | dta_bdy(jbdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1) |
---|
115 | END DO |
---|
116 | ENDIF |
---|
117 | IF( dta%ll_u2d ) THEN |
---|
118 | igrd = 2 |
---|
119 | DO ib = 1, ilen1(igrd) |
---|
120 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
121 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
122 | dta_bdy(jbdy)%u2d(ib) = un_b(ii,ij) * umask(ii,ij,1) |
---|
123 | END DO |
---|
124 | ENDIF |
---|
125 | IF( dta%ll_v2d ) THEN |
---|
126 | igrd = 3 |
---|
127 | DO ib = 1, ilen1(igrd) |
---|
128 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
129 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
130 | dta_bdy(jbdy)%v2d(ib) = vn_b(ii,ij) * vmask(ii,ij,1) |
---|
131 | END DO |
---|
132 | ENDIF |
---|
133 | ENDIF |
---|
134 | ! |
---|
135 | IF( nn_dyn3d_dta(jbdy) == 0 ) THEN |
---|
136 | ilen1(:) = nblen(:) |
---|
137 | IF( dta%ll_u3d ) THEN |
---|
138 | igrd = 2 |
---|
139 | DO ib = 1, ilen1(igrd) |
---|
140 | DO ik = 1, jpkm1 |
---|
141 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
142 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
143 | dta_bdy(jbdy)%u3d(ib,ik) = ( un(ii,ij,ik) - un_b(ii,ij) ) * umask(ii,ij,ik) |
---|
144 | END DO |
---|
145 | END DO |
---|
146 | ENDIF |
---|
147 | IF( dta%ll_v3d ) THEN |
---|
148 | igrd = 3 |
---|
149 | DO ib = 1, ilen1(igrd) |
---|
150 | DO ik = 1, jpkm1 |
---|
151 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
152 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
153 | dta_bdy(jbdy)%v3d(ib,ik) = ( vn(ii,ij,ik) - vn_b(ii,ij) ) * vmask(ii,ij,ik) |
---|
154 | END DO |
---|
155 | END DO |
---|
156 | ENDIF |
---|
157 | ENDIF |
---|
158 | |
---|
159 | IF( nn_tra_dta(jbdy) == 0 ) THEN |
---|
160 | ilen1(:) = nblen(:) |
---|
161 | IF( dta%ll_tem ) THEN |
---|
162 | igrd = 1 |
---|
163 | DO ib = 1, ilen1(igrd) |
---|
164 | DO ik = 1, jpkm1 |
---|
165 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
166 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
167 | dta_bdy(jbdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik) |
---|
168 | END DO |
---|
169 | END DO |
---|
170 | ENDIF |
---|
171 | IF( dta%ll_sal ) THEN |
---|
172 | igrd = 1 |
---|
173 | DO ib = 1, ilen1(igrd) |
---|
174 | DO ik = 1, jpkm1 |
---|
175 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
176 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
177 | dta_bdy(jbdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik) |
---|
178 | END DO |
---|
179 | END DO |
---|
180 | ENDIF |
---|
181 | ENDIF |
---|
182 | |
---|
183 | #if defined key_si3 |
---|
184 | IF( nn_ice_dta(jbdy) == 0 ) THEN ! set ice to initial values |
---|
185 | ilen1(:) = nblen(:) |
---|
186 | IF( dta%ll_a_i ) THEN |
---|
187 | igrd = 1 |
---|
188 | DO jl = 1, jpl |
---|
189 | DO ib = 1, ilen1(igrd) |
---|
190 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
191 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
192 | dta_bdy(jbdy)%a_i (ib,jl) = a_i(ii,ij,jl) * tmask(ii,ij,1) |
---|
193 | END DO |
---|
194 | END DO |
---|
195 | ENDIF |
---|
196 | IF( dta%ll_h_i ) THEN |
---|
197 | igrd = 1 |
---|
198 | DO jl = 1, jpl |
---|
199 | DO ib = 1, ilen1(igrd) |
---|
200 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
201 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
202 | dta_bdy(jbdy)%h_i (ib,jl) = h_i(ii,ij,jl) * tmask(ii,ij,1) |
---|
203 | END DO |
---|
204 | END DO |
---|
205 | ENDIF |
---|
206 | IF( dta%ll_h_s ) THEN |
---|
207 | igrd = 1 |
---|
208 | DO jl = 1, jpl |
---|
209 | DO ib = 1, ilen1(igrd) |
---|
210 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
211 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
212 | dta_bdy(jbdy)%h_s (ib,jl) = h_s(ii,ij,jl) * tmask(ii,ij,1) |
---|
213 | END DO |
---|
214 | END DO |
---|
215 | ENDIF |
---|
216 | ENDIF |
---|
217 | #endif |
---|
218 | END DO ! jbdy |
---|
219 | ! |
---|
220 | ENDIF ! kt == nit000 |
---|
221 | |
---|
222 | ! update external data from files |
---|
223 | !-------------------------------- |
---|
224 | |
---|
225 | jstart = 1 |
---|
226 | DO jbdy = 1, nb_bdy |
---|
227 | dta => dta_bdy(jbdy) |
---|
228 | IF( nn_dta(jbdy) == 1 ) THEN ! skip this bit if no external data required |
---|
229 | |
---|
230 | IF( PRESENT(jit) ) THEN |
---|
231 | ! Update barotropic boundary conditions only |
---|
232 | ! jit is optional argument for fld_read and bdytide_update |
---|
233 | IF( cn_dyn2d(jbdy) /= 'none' ) THEN |
---|
234 | IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays |
---|
235 | IF( dta%ll_ssh ) dta%ssh(:) = 0._wp |
---|
236 | IF( dta%ll_u2d ) dta%u2d(:) = 0._wp |
---|
237 | IF( dta%ll_u3d ) dta%v2d(:) = 0._wp |
---|
238 | ENDIF |
---|
239 | IF (cn_tra(jbdy) /= 'runoff') THEN |
---|
240 | IF( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 ) THEN |
---|
241 | |
---|
242 | jend = jstart + dta%nread(2) - 1 |
---|
243 | IF( ln_full_vel_array(jbdy) ) THEN |
---|
244 | CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend), & |
---|
245 | & kit=jit, kt_offset=time_offset , jpk_bdy=nb_jpk_bdy, & |
---|
246 | & fvl=ln_full_vel_array(jbdy) ) |
---|
247 | ELSE |
---|
248 | CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend), & |
---|
249 | & kit=jit, kt_offset=time_offset ) |
---|
250 | ENDIF |
---|
251 | |
---|
252 | ! If full velocities in boundary data then extract barotropic velocities from 3D fields |
---|
253 | IF( ln_full_vel_array(jbdy) .AND. & |
---|
254 | & ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 .OR. & |
---|
255 | & nn_dyn3d_dta(jbdy) == 1 ) )THEN |
---|
256 | |
---|
257 | igrd = 2 ! zonal velocity |
---|
258 | dta%u2d(:) = 0._wp |
---|
259 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
260 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
261 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
262 | DO ik = 1, jpkm1 |
---|
263 | dta%u2d(ib) = dta%u2d(ib) & |
---|
264 | & + e3u_n(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik) |
---|
265 | END DO |
---|
266 | dta%u2d(ib) = dta%u2d(ib) * r1_hu_n(ii,ij) |
---|
267 | END DO |
---|
268 | igrd = 3 ! meridional velocity |
---|
269 | dta%v2d(:) = 0._wp |
---|
270 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
271 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
272 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
273 | DO ik = 1, jpkm1 |
---|
274 | dta%v2d(ib) = dta%v2d(ib) & |
---|
275 | & + e3v_n(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik) |
---|
276 | END DO |
---|
277 | dta%v2d(ib) = dta%v2d(ib) * r1_hv_n(ii,ij) |
---|
278 | END DO |
---|
279 | ENDIF |
---|
280 | ENDIF |
---|
281 | IF( nn_dyn2d_dta(jbdy) .ge. 2 ) THEN ! update tidal harmonic forcing |
---|
282 | CALL bdytide_update( kt=kt, idx=idx_bdy(jbdy), dta=dta, td=tides(jbdy), & |
---|
283 | & jit=jit, time_offset=time_offset ) |
---|
284 | ENDIF |
---|
285 | ENDIF |
---|
286 | ENDIF |
---|
287 | ELSE |
---|
288 | IF (cn_tra(jbdy) == 'runoff') then ! runoff condition |
---|
289 | jend = nb_bdy_fld(jbdy) |
---|
290 | CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & |
---|
291 | & map=nbmap_ptr(jstart:jend), kt_offset=time_offset ) |
---|
292 | ! |
---|
293 | igrd = 2 ! zonal velocity |
---|
294 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
295 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
296 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
297 | dta%u2d(ib) = dta%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) |
---|
298 | END DO |
---|
299 | ! |
---|
300 | igrd = 3 ! meridional velocity |
---|
301 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
302 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
303 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
304 | dta%v2d(ib) = dta%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) |
---|
305 | END DO |
---|
306 | ELSE |
---|
307 | IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays |
---|
308 | IF( dta%ll_ssh ) dta%ssh(:) = 0._wp |
---|
309 | IF( dta%ll_u2d ) dta%u2d(:) = 0._wp |
---|
310 | IF( dta%ll_v2d ) dta%v2d(:) = 0._wp |
---|
311 | ENDIF |
---|
312 | IF( dta%nread(1) .gt. 0 ) THEN ! update external data |
---|
313 | jend = jstart + dta%nread(1) - 1 |
---|
314 | CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & |
---|
315 | & map=nbmap_ptr(jstart:jend), kt_offset=time_offset, jpk_bdy=nb_jpk_bdy, & |
---|
316 | & fvl=ln_full_vel_array(jbdy) ) |
---|
317 | ENDIF |
---|
318 | ! If full velocities in boundary data then split into barotropic and baroclinic data |
---|
319 | IF( ln_full_vel_array(jbdy) .and. & |
---|
320 | & ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 .OR. & |
---|
321 | & nn_dyn3d_dta(jbdy) == 1 ) ) THEN |
---|
322 | igrd = 2 ! zonal velocity |
---|
323 | dta%u2d(:) = 0._wp |
---|
324 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
325 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
326 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
327 | DO ik = 1, jpkm1 |
---|
328 | dta%u2d(ib) = dta%u2d(ib) & |
---|
329 | & + e3u_n(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik) |
---|
330 | END DO |
---|
331 | dta%u2d(ib) = dta%u2d(ib) * r1_hu_n(ii,ij) |
---|
332 | DO ik = 1, jpkm1 |
---|
333 | dta%u3d(ib,ik) = dta%u3d(ib,ik) - dta%u2d(ib) |
---|
334 | END DO |
---|
335 | END DO |
---|
336 | igrd = 3 ! meridional velocity |
---|
337 | dta%v2d(:) = 0._wp |
---|
338 | DO ib = 1, idx_bdy(jbdy)%nblen(igrd) |
---|
339 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
340 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
341 | DO ik = 1, jpkm1 |
---|
342 | dta%v2d(ib) = dta%v2d(ib) & |
---|
343 | & + e3v_n(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik) |
---|
344 | END DO |
---|
345 | dta%v2d(ib) = dta%v2d(ib) * r1_hv_n(ii,ij) |
---|
346 | DO ik = 1, jpkm1 |
---|
347 | dta%v3d(ib,ik) = dta%v3d(ib,ik) - dta%v2d(ib) |
---|
348 | END DO |
---|
349 | END DO |
---|
350 | ENDIF |
---|
351 | |
---|
352 | ENDIF |
---|
353 | #if defined key_si3 |
---|
354 | ! convert N-cat fields (input) into jpl-cat (output) |
---|
355 | IF( cn_ice(jbdy) /= 'none' .AND. nn_ice_dta(jbdy) == 1 ) THEN |
---|
356 | jfld_hti = jfld_htit(jbdy) |
---|
357 | jfld_hts = jfld_htst(jbdy) |
---|
358 | jfld_ai = jfld_ait(jbdy) |
---|
359 | IF ( jpl /= 1 .AND. nice_cat == 1 ) THEN ! case input cat = 1 |
---|
360 | CALL ice_var_itd ( bf(jfld_hti)%fnow(:,1,1), bf(jfld_hts)%fnow(:,1,1), bf(jfld_ai)%fnow(:,1,1), & |
---|
361 | & dta_bdy(jbdy)%h_i , dta_bdy(jbdy)%h_s , dta_bdy(jbdy)%a_i ) |
---|
362 | ELSEIF( jpl /= 1 .AND. nice_cat /= 1 .AND. nice_cat /= jpl ) THEN ! case input cat /=1 and /=jpl |
---|
363 | CALL ice_var_itd2( bf(jfld_hti)%fnow(:,1,:), bf(jfld_hts)%fnow(:,1,:), bf(jfld_ai)%fnow(:,1,:), & |
---|
364 | & dta_bdy(jbdy)%h_i , dta_bdy(jbdy)%h_s , dta_bdy(jbdy)%a_i ) |
---|
365 | ENDIF |
---|
366 | ENDIF |
---|
367 | #endif |
---|
368 | ENDIF |
---|
369 | jstart = jstart + dta%nread(1) |
---|
370 | ENDIF ! nn_dta(jbdy) = 1 |
---|
371 | END DO ! jbdy |
---|
372 | |
---|
373 | IF ( ln_apr_obc ) THEN |
---|
374 | DO jbdy = 1, nb_bdy |
---|
375 | IF (cn_tra(jbdy) /= 'runoff')THEN |
---|
376 | igrd = 1 ! meridional velocity |
---|
377 | DO ib = 1, idx_bdy(jbdy)%nblenrim(igrd) |
---|
378 | ii = idx_bdy(jbdy)%nbi(ib,igrd) |
---|
379 | ij = idx_bdy(jbdy)%nbj(ib,igrd) |
---|
380 | dta_bdy(jbdy)%ssh(ib) = dta_bdy(jbdy)%ssh(ib) + ssh_ib(ii,ij) |
---|
381 | END DO |
---|
382 | ENDIF |
---|
383 | END DO |
---|
384 | ENDIF |
---|
385 | |
---|
386 | IF ( ln_tide ) THEN |
---|
387 | IF (ln_dynspg_ts) THEN ! Fill temporary arrays with slow-varying bdy data |
---|
388 | DO jbdy = 1, nb_bdy ! Tidal component added in ts loop |
---|
389 | IF ( nn_dyn2d_dta(jbdy) .ge. 2 ) THEN |
---|
390 | nblen => idx_bdy(jbdy)%nblen |
---|
391 | nblenrim => idx_bdy(jbdy)%nblenrim |
---|
392 | IF( cn_dyn2d(jbdy) == 'frs' ) THEN; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF |
---|
393 | IF ( dta_bdy(jbdy)%ll_ssh ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) |
---|
394 | IF ( dta_bdy(jbdy)%ll_u2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) |
---|
395 | IF ( dta_bdy(jbdy)%ll_v2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) |
---|
396 | ENDIF |
---|
397 | END DO |
---|
398 | ELSE ! Add tides if not split-explicit free surface else this is done in ts loop |
---|
399 | ! |
---|
400 | CALL bdy_dta_tides( kt=kt, time_offset=time_offset ) |
---|
401 | ENDIF |
---|
402 | ENDIF |
---|
403 | |
---|
404 | ! |
---|
405 | IF( ln_timing ) CALL timing_stop('bdy_dta') |
---|
406 | ! |
---|
407 | END SUBROUTINE bdy_dta |
---|
408 | |
---|
409 | |
---|
410 | SUBROUTINE bdy_dta_init |
---|
411 | !!---------------------------------------------------------------------- |
---|
412 | !! *** SUBROUTINE bdy_dta_init *** |
---|
413 | !! |
---|
414 | !! ** Purpose : Initialise arrays for reading of external data |
---|
415 | !! for open boundary conditions |
---|
416 | !! |
---|
417 | !! ** Method : |
---|
418 | !! |
---|
419 | !!---------------------------------------------------------------------- |
---|
420 | INTEGER :: jbdy, jfld, jstart, jend, ierror, ios ! Local integers |
---|
421 | ! |
---|
422 | CHARACTER(len=100) :: cn_dir ! Root directory for location of data files |
---|
423 | CHARACTER(len=100), DIMENSION(nb_bdy) :: cn_dir_array ! Root directory for location of data files |
---|
424 | CHARACTER(len = 256):: clname ! temporary file name |
---|
425 | LOGICAL :: ln_full_vel ! =T => full velocities in 3D boundary data |
---|
426 | ! ! =F => baroclinic velocities in 3D boundary data |
---|
427 | INTEGER :: ilen_global ! Max length required for global bdy dta arrays |
---|
428 | INTEGER, ALLOCATABLE, DIMENSION(:) :: ilen1, ilen3 ! size of 1st and 3rd dimensions of local arrays |
---|
429 | INTEGER, ALLOCATABLE, DIMENSION(:) :: ibdy ! bdy set for a particular jfld |
---|
430 | INTEGER, ALLOCATABLE, DIMENSION(:) :: igrid ! index for grid type (1,2,3 = T,U,V) |
---|
431 | INTEGER, POINTER, DIMENSION(:) :: nblen, nblenrim ! short cuts |
---|
432 | TYPE(OBC_DATA), POINTER :: dta ! short cut |
---|
433 | #if defined key_si3 |
---|
434 | INTEGER :: kndims ! number of dimensions in an array (i.e. 3 = wo ice cat; 4 = w ice cat) |
---|
435 | INTEGER, DIMENSION(4) :: kdimsz ! size of dimensions |
---|
436 | INTEGER :: inum,id1 ! local integer |
---|
437 | #endif |
---|
438 | TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: blf_i ! array of namelist information structures |
---|
439 | TYPE(FLD_N) :: bn_tem, bn_sal, bn_u3d, bn_v3d ! |
---|
440 | TYPE(FLD_N) :: bn_ssh, bn_u2d, bn_v2d ! informations about the fields to be read |
---|
441 | #if defined key_si3 |
---|
442 | TYPE(FLD_N) :: bn_a_i, bn_h_i, bn_h_s |
---|
443 | #endif |
---|
444 | NAMELIST/nambdy_dta/ cn_dir, bn_tem, bn_sal, bn_u3d, bn_v3d, bn_ssh, bn_u2d, bn_v2d |
---|
445 | #if defined key_si3 |
---|
446 | NAMELIST/nambdy_dta/ bn_a_i, bn_h_i, bn_h_s |
---|
447 | #endif |
---|
448 | NAMELIST/nambdy_dta/ ln_full_vel, nb_jpk_bdy |
---|
449 | !!--------------------------------------------------------------------------- |
---|
450 | ! |
---|
451 | IF(lwp) WRITE(numout,*) |
---|
452 | IF(lwp) WRITE(numout,*) 'bdy_dta_ini : initialization of data at the open boundaries' |
---|
453 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~' |
---|
454 | IF(lwp) WRITE(numout,*) '' |
---|
455 | |
---|
456 | ! Set nn_dta |
---|
457 | DO jbdy = 1, nb_bdy |
---|
458 | nn_dta(jbdy) = MAX( nn_dyn2d_dta (jbdy) & |
---|
459 | & , nn_dyn3d_dta (jbdy) & |
---|
460 | & , nn_tra_dta (jbdy) & |
---|
461 | #if defined key_si3 |
---|
462 | & , nn_ice_dta (jbdy) & |
---|
463 | #endif |
---|
464 | ) |
---|
465 | IF(nn_dta(jbdy) > 1) nn_dta(jbdy) = 1 |
---|
466 | END DO |
---|
467 | |
---|
468 | ! Work out upper bound of how many fields there are to read in and allocate arrays |
---|
469 | ! --------------------------------------------------------------------------- |
---|
470 | ALLOCATE( nb_bdy_fld(nb_bdy) ) |
---|
471 | nb_bdy_fld(:) = 0 |
---|
472 | DO jbdy = 1, nb_bdy |
---|
473 | IF( cn_dyn2d(jbdy) /= 'none' .AND. ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) ) THEN |
---|
474 | nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 3 |
---|
475 | ENDIF |
---|
476 | IF( cn_dyn3d(jbdy) /= 'none' .AND. nn_dyn3d_dta(jbdy) == 1 ) THEN |
---|
477 | nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 2 |
---|
478 | ENDIF |
---|
479 | IF( cn_tra(jbdy) /= 'none' .AND. nn_tra_dta(jbdy) == 1 ) THEN |
---|
480 | nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 2 |
---|
481 | ENDIF |
---|
482 | #if defined key_si3 |
---|
483 | IF( cn_ice(jbdy) /= 'none' .AND. nn_ice_dta(jbdy) == 1 ) THEN |
---|
484 | nb_bdy_fld(jbdy) = nb_bdy_fld(jbdy) + 3 |
---|
485 | ENDIF |
---|
486 | #endif |
---|
487 | IF(lwp) WRITE(numout,*) 'Maximum number of files to open =', nb_bdy_fld(jbdy) |
---|
488 | END DO |
---|
489 | |
---|
490 | nb_bdy_fld_sum = SUM( nb_bdy_fld ) |
---|
491 | |
---|
492 | ALLOCATE( bf(nb_bdy_fld_sum), STAT=ierror ) |
---|
493 | IF( ierror > 0 ) THEN |
---|
494 | CALL ctl_stop( 'bdy_dta: unable to allocate bf structure' ) ; RETURN |
---|
495 | ENDIF |
---|
496 | ALLOCATE( blf_i(nb_bdy_fld_sum), STAT=ierror ) |
---|
497 | IF( ierror > 0 ) THEN |
---|
498 | CALL ctl_stop( 'bdy_dta: unable to allocate blf_i structure' ) ; RETURN |
---|
499 | ENDIF |
---|
500 | ALLOCATE( nbmap_ptr(nb_bdy_fld_sum), STAT=ierror ) |
---|
501 | IF( ierror > 0 ) THEN |
---|
502 | CALL ctl_stop( 'bdy_dta: unable to allocate nbmap_ptr structure' ) ; RETURN |
---|
503 | ENDIF |
---|
504 | ALLOCATE( ilen1(nb_bdy_fld_sum), ilen3(nb_bdy_fld_sum) ) |
---|
505 | ALLOCATE( ibdy(nb_bdy_fld_sum) ) |
---|
506 | ALLOCATE( igrid(nb_bdy_fld_sum) ) |
---|
507 | |
---|
508 | ! Read namelists |
---|
509 | ! -------------- |
---|
510 | REWIND(numnam_ref) |
---|
511 | REWIND(numnam_cfg) |
---|
512 | jfld = 0 |
---|
513 | DO jbdy = 1, nb_bdy |
---|
514 | IF( nn_dta(jbdy) == 1 ) THEN |
---|
515 | READ ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) |
---|
516 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp ) |
---|
517 | READ ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 ) |
---|
518 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist', lwp ) |
---|
519 | IF(lwm) WRITE( numond, nambdy_dta ) |
---|
520 | |
---|
521 | cn_dir_array(jbdy) = cn_dir |
---|
522 | ln_full_vel_array(jbdy) = ln_full_vel |
---|
523 | |
---|
524 | nblen => idx_bdy(jbdy)%nblen |
---|
525 | nblenrim => idx_bdy(jbdy)%nblenrim |
---|
526 | dta => dta_bdy(jbdy) |
---|
527 | dta%nread(2) = 0 |
---|
528 | |
---|
529 | ! Only read in necessary fields for this set. |
---|
530 | ! Important that barotropic variables come first. |
---|
531 | IF( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) THEN |
---|
532 | |
---|
533 | IF( dta%ll_ssh ) THEN |
---|
534 | if(lwp) write(numout,*) '++++++ reading in ssh field' |
---|
535 | jfld = jfld + 1 |
---|
536 | blf_i(jfld) = bn_ssh |
---|
537 | ibdy(jfld) = jbdy |
---|
538 | igrid(jfld) = 1 |
---|
539 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
540 | ilen3(jfld) = 1 |
---|
541 | dta%nread(2) = dta%nread(2) + 1 |
---|
542 | ENDIF |
---|
543 | |
---|
544 | IF( dta%ll_u2d .and. .not. ln_full_vel_array(jbdy) ) THEN |
---|
545 | if(lwp) write(numout,*) '++++++ reading in u2d field' |
---|
546 | jfld = jfld + 1 |
---|
547 | blf_i(jfld) = bn_u2d |
---|
548 | ibdy(jfld) = jbdy |
---|
549 | igrid(jfld) = 2 |
---|
550 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
551 | ilen3(jfld) = 1 |
---|
552 | dta%nread(2) = dta%nread(2) + 1 |
---|
553 | ENDIF |
---|
554 | |
---|
555 | IF( dta%ll_v2d .and. .not. ln_full_vel_array(jbdy) ) THEN |
---|
556 | if(lwp) write(numout,*) '++++++ reading in v2d field' |
---|
557 | jfld = jfld + 1 |
---|
558 | blf_i(jfld) = bn_v2d |
---|
559 | ibdy(jfld) = jbdy |
---|
560 | igrid(jfld) = 3 |
---|
561 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
562 | ilen3(jfld) = 1 |
---|
563 | dta%nread(2) = dta%nread(2) + 1 |
---|
564 | ENDIF |
---|
565 | |
---|
566 | ENDIF |
---|
567 | |
---|
568 | ! read 3D velocities if baroclinic velocities require OR if |
---|
569 | ! barotropic velocities required and ln_full_vel set to .true. |
---|
570 | IF( nn_dyn3d_dta(jbdy) == 1 .OR. & |
---|
571 | & ( ln_full_vel_array(jbdy) .AND. ( nn_dyn2d_dta(jbdy) == 1 .OR. nn_dyn2d_dta(jbdy) == 3 ) ) ) THEN |
---|
572 | |
---|
573 | IF( dta%ll_u3d .OR. ( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) ) THEN |
---|
574 | if(lwp) write(numout,*) '++++++ reading in u3d field' |
---|
575 | jfld = jfld + 1 |
---|
576 | blf_i(jfld) = bn_u3d |
---|
577 | ibdy(jfld) = jbdy |
---|
578 | igrid(jfld) = 2 |
---|
579 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
580 | ilen3(jfld) = jpk |
---|
581 | IF( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) dta%nread(2) = dta%nread(2) + 1 |
---|
582 | ENDIF |
---|
583 | |
---|
584 | IF( dta%ll_v3d .OR. ( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) ) THEN |
---|
585 | if(lwp) write(numout,*) '++++++ reading in v3d field' |
---|
586 | jfld = jfld + 1 |
---|
587 | blf_i(jfld) = bn_v3d |
---|
588 | ibdy(jfld) = jbdy |
---|
589 | igrid(jfld) = 3 |
---|
590 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
591 | ilen3(jfld) = jpk |
---|
592 | IF( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) dta%nread(2) = dta%nread(2) + 1 |
---|
593 | ENDIF |
---|
594 | |
---|
595 | ENDIF |
---|
596 | |
---|
597 | ! temperature and salinity |
---|
598 | IF( nn_tra_dta(jbdy) == 1 ) THEN |
---|
599 | |
---|
600 | IF( dta%ll_tem ) THEN |
---|
601 | if(lwp) write(numout,*) '++++++ reading in tem field' |
---|
602 | jfld = jfld + 1 |
---|
603 | blf_i(jfld) = bn_tem |
---|
604 | ibdy(jfld) = jbdy |
---|
605 | igrid(jfld) = 1 |
---|
606 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
607 | ilen3(jfld) = jpk |
---|
608 | ENDIF |
---|
609 | |
---|
610 | IF( dta%ll_sal ) THEN |
---|
611 | if(lwp) write(numout,*) '++++++ reading in sal field' |
---|
612 | jfld = jfld + 1 |
---|
613 | blf_i(jfld) = bn_sal |
---|
614 | ibdy(jfld) = jbdy |
---|
615 | igrid(jfld) = 1 |
---|
616 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
617 | ilen3(jfld) = jpk |
---|
618 | ENDIF |
---|
619 | |
---|
620 | ENDIF |
---|
621 | |
---|
622 | #if defined key_si3 |
---|
623 | ! sea ice |
---|
624 | IF( nn_ice_dta(jbdy) == 1 ) THEN |
---|
625 | ! Test for types of ice input (1cat or Xcat) |
---|
626 | ! Build file name to find dimensions |
---|
627 | clname=TRIM( cn_dir )//TRIM(bn_a_i%clname) |
---|
628 | IF( .NOT. bn_a_i%ln_clim ) THEN |
---|
629 | WRITE(clname, '(a,"_y",i4.4)' ) TRIM( clname ), nyear ! add year |
---|
630 | IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"m" ,i2.2)' ) TRIM( clname ), nmonth ! add month |
---|
631 | ELSE |
---|
632 | IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"_m",i2.2)' ) TRIM( clname ), nmonth ! add month |
---|
633 | ENDIF |
---|
634 | IF( bn_a_i%cltype == 'daily' .OR. bn_a_i%cltype(1:4) == 'week' ) & |
---|
635 | & WRITE(clname, '(a,"d" ,i2.2)' ) TRIM( clname ), nday ! add day |
---|
636 | ! |
---|
637 | CALL iom_open ( clname, inum ) |
---|
638 | id1 = iom_varid( inum, bn_a_i%clvar, kdimsz=kdimsz, kndims=kndims, ldstop = .FALSE. ) |
---|
639 | CALL iom_close ( inum ) |
---|
640 | |
---|
641 | IF ( kndims == 4 ) THEN |
---|
642 | nice_cat = kdimsz(4) ! Xcat input |
---|
643 | ELSE |
---|
644 | nice_cat = 1 ! 1cat input |
---|
645 | ENDIF |
---|
646 | ! End test |
---|
647 | |
---|
648 | IF( dta%ll_a_i ) THEN |
---|
649 | jfld = jfld + 1 |
---|
650 | blf_i(jfld) = bn_a_i |
---|
651 | ibdy(jfld) = jbdy |
---|
652 | igrid(jfld) = 1 |
---|
653 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
654 | ilen3(jfld) = nice_cat |
---|
655 | ENDIF |
---|
656 | |
---|
657 | IF( dta%ll_h_i ) THEN |
---|
658 | jfld = jfld + 1 |
---|
659 | blf_i(jfld) = bn_h_i |
---|
660 | ibdy(jfld) = jbdy |
---|
661 | igrid(jfld) = 1 |
---|
662 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
663 | ilen3(jfld) = nice_cat |
---|
664 | ENDIF |
---|
665 | |
---|
666 | IF( dta%ll_h_s ) THEN |
---|
667 | jfld = jfld + 1 |
---|
668 | blf_i(jfld) = bn_h_s |
---|
669 | ibdy(jfld) = jbdy |
---|
670 | igrid(jfld) = 1 |
---|
671 | ilen1(jfld) = nblen(igrid(jfld)) |
---|
672 | ilen3(jfld) = nice_cat |
---|
673 | ENDIF |
---|
674 | |
---|
675 | ENDIF |
---|
676 | #endif |
---|
677 | ! Recalculate field counts |
---|
678 | !------------------------- |
---|
679 | IF( jbdy == 1 ) THEN |
---|
680 | nb_bdy_fld_sum = 0 |
---|
681 | nb_bdy_fld(jbdy) = jfld |
---|
682 | nb_bdy_fld_sum = jfld |
---|
683 | ELSE |
---|
684 | nb_bdy_fld(jbdy) = jfld - nb_bdy_fld_sum |
---|
685 | nb_bdy_fld_sum = nb_bdy_fld_sum + nb_bdy_fld(jbdy) |
---|
686 | ENDIF |
---|
687 | |
---|
688 | dta%nread(1) = nb_bdy_fld(jbdy) |
---|
689 | |
---|
690 | ENDIF ! nn_dta == 1 |
---|
691 | ENDDO ! jbdy |
---|
692 | |
---|
693 | DO jfld = 1, nb_bdy_fld_sum |
---|
694 | ALLOCATE( bf(jfld)%fnow(ilen1(jfld),1,ilen3(jfld)) ) |
---|
695 | IF( blf_i(jfld)%ln_tint ) ALLOCATE( bf(jfld)%fdta(ilen1(jfld),1,ilen3(jfld),2) ) |
---|
696 | nbmap_ptr(jfld)%ptr => idx_bdy(ibdy(jfld))%nbmap(:,igrid(jfld)) |
---|
697 | nbmap_ptr(jfld)%ll_unstruc = ln_coords_file(ibdy(jfld)) |
---|
698 | ENDDO |
---|
699 | |
---|
700 | ! fill bf with blf_i and control print |
---|
701 | !------------------------------------- |
---|
702 | jstart = 1 |
---|
703 | DO jbdy = 1, nb_bdy |
---|
704 | jend = jstart - 1 + nb_bdy_fld(jbdy) |
---|
705 | CALL fld_fill( bf(jstart:jend), blf_i(jstart:jend), cn_dir_array(jbdy), 'bdy_dta', & |
---|
706 | & 'open boundary conditions', 'nambdy_dta' ) |
---|
707 | jstart = jend + 1 |
---|
708 | ENDDO |
---|
709 | |
---|
710 | DO jfld = 1, nb_bdy_fld_sum |
---|
711 | bf(jfld)%igrd = igrid(jfld) |
---|
712 | bf(jfld)%ibdy = ibdy(jfld) |
---|
713 | ENDDO |
---|
714 | |
---|
715 | ! Initialise local boundary data arrays |
---|
716 | ! nn_xxx_dta=0 : allocate space - will be filled from initial conditions later |
---|
717 | ! nn_xxx_dta=1 : point to "fnow" arrays |
---|
718 | !------------------------------------- |
---|
719 | |
---|
720 | jfld = 0 |
---|
721 | DO jbdy=1, nb_bdy |
---|
722 | |
---|
723 | nblen => idx_bdy(jbdy)%nblen |
---|
724 | dta => dta_bdy(jbdy) |
---|
725 | |
---|
726 | if(lwp) then |
---|
727 | write(numout,*) '++++++ dta%ll_ssh = ',dta%ll_ssh |
---|
728 | write(numout,*) '++++++ dta%ll_u2d = ',dta%ll_u2d |
---|
729 | write(numout,*) '++++++ dta%ll_v2d = ',dta%ll_v2d |
---|
730 | write(numout,*) '++++++ dta%ll_u3d = ',dta%ll_u3d |
---|
731 | write(numout,*) '++++++ dta%ll_v3d = ',dta%ll_v3d |
---|
732 | write(numout,*) '++++++ dta%ll_tem = ',dta%ll_tem |
---|
733 | write(numout,*) '++++++ dta%ll_sal = ',dta%ll_sal |
---|
734 | endif |
---|
735 | |
---|
736 | IF ( nn_dyn2d_dta(jbdy) == 0 .or. nn_dyn2d_dta(jbdy) == 2 ) THEN |
---|
737 | if(lwp) write(numout,*) '++++++ dta%ssh/u2d/u3d allocated space' |
---|
738 | IF( dta%ll_ssh ) ALLOCATE( dta%ssh(nblen(1)) ) |
---|
739 | IF( dta%ll_u2d ) ALLOCATE( dta%u2d(nblen(2)) ) |
---|
740 | IF( dta%ll_v2d ) ALLOCATE( dta%v2d(nblen(3)) ) |
---|
741 | ENDIF |
---|
742 | IF ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) THEN |
---|
743 | IF( dta%ll_ssh ) THEN |
---|
744 | if(lwp) write(numout,*) '++++++ dta%ssh pointing to fnow' |
---|
745 | jfld = jfld + 1 |
---|
746 | dta%ssh => bf(jfld)%fnow(:,1,1) |
---|
747 | ENDIF |
---|
748 | IF ( dta%ll_u2d ) THEN |
---|
749 | IF ( ln_full_vel_array(jbdy) ) THEN |
---|
750 | if(lwp) write(numout,*) '++++++ dta%u2d allocated space' |
---|
751 | ALLOCATE( dta%u2d(nblen(2)) ) |
---|
752 | ELSE |
---|
753 | if(lwp) write(numout,*) '++++++ dta%u2d pointing to fnow' |
---|
754 | jfld = jfld + 1 |
---|
755 | dta%u2d => bf(jfld)%fnow(:,1,1) |
---|
756 | ENDIF |
---|
757 | ENDIF |
---|
758 | IF ( dta%ll_v2d ) THEN |
---|
759 | IF ( ln_full_vel_array(jbdy) ) THEN |
---|
760 | if(lwp) write(numout,*) '++++++ dta%v2d allocated space' |
---|
761 | ALLOCATE( dta%v2d(nblen(3)) ) |
---|
762 | ELSE |
---|
763 | if(lwp) write(numout,*) '++++++ dta%v2d pointing to fnow' |
---|
764 | jfld = jfld + 1 |
---|
765 | dta%v2d => bf(jfld)%fnow(:,1,1) |
---|
766 | ENDIF |
---|
767 | ENDIF |
---|
768 | ENDIF |
---|
769 | |
---|
770 | IF ( nn_dyn3d_dta(jbdy) == 0 ) THEN |
---|
771 | if(lwp) write(numout,*) '++++++ dta%u3d/v3d allocated space' |
---|
772 | IF( dta%ll_u3d ) ALLOCATE( dta_bdy(jbdy)%u3d(nblen(2),jpk) ) |
---|
773 | IF( dta%ll_v3d ) ALLOCATE( dta_bdy(jbdy)%v3d(nblen(3),jpk) ) |
---|
774 | ENDIF |
---|
775 | IF ( nn_dyn3d_dta(jbdy) == 1 .or. & |
---|
776 | & ( ln_full_vel_array(jbdy) .and. ( nn_dyn2d_dta(jbdy) == 1 .or. nn_dyn2d_dta(jbdy) == 3 ) ) ) THEN |
---|
777 | IF ( dta%ll_u3d .or. ( ln_full_vel_array(jbdy) .and. dta%ll_u2d ) ) THEN |
---|
778 | if(lwp) write(numout,*) '++++++ dta%u3d pointing to fnow' |
---|
779 | jfld = jfld + 1 |
---|
780 | dta_bdy(jbdy)%u3d => bf(jfld)%fnow(:,1,:) |
---|
781 | ENDIF |
---|
782 | IF ( dta%ll_v3d .or. ( ln_full_vel_array(jbdy) .and. dta%ll_v2d ) ) THEN |
---|
783 | if(lwp) write(numout,*) '++++++ dta%v3d pointing to fnow' |
---|
784 | jfld = jfld + 1 |
---|
785 | dta_bdy(jbdy)%v3d => bf(jfld)%fnow(:,1,:) |
---|
786 | ENDIF |
---|
787 | ENDIF |
---|
788 | |
---|
789 | IF( nn_tra_dta(jbdy) == 0 ) THEN |
---|
790 | if(lwp) write(numout,*) '++++++ dta%tem/sal allocated space' |
---|
791 | IF( dta%ll_tem ) ALLOCATE( dta_bdy(jbdy)%tem(nblen(1),jpk) ) |
---|
792 | IF( dta%ll_sal ) ALLOCATE( dta_bdy(jbdy)%sal(nblen(1),jpk) ) |
---|
793 | ELSE |
---|
794 | IF( dta%ll_tem ) THEN |
---|
795 | if(lwp) write(numout,*) '++++++ dta%tem pointing to fnow' |
---|
796 | jfld = jfld + 1 |
---|
797 | dta_bdy(jbdy)%tem => bf(jfld)%fnow(:,1,:) |
---|
798 | ENDIF |
---|
799 | IF( dta%ll_sal ) THEN |
---|
800 | if(lwp) write(numout,*) '++++++ dta%sal pointing to fnow' |
---|
801 | jfld = jfld + 1 |
---|
802 | dta_bdy(jbdy)%sal => bf(jfld)%fnow(:,1,:) |
---|
803 | ENDIF |
---|
804 | ENDIF |
---|
805 | |
---|
806 | #if defined key_si3 |
---|
807 | IF (cn_ice(jbdy) /= 'none') THEN |
---|
808 | IF( nn_ice_dta(jbdy) == 0 ) THEN |
---|
809 | ALLOCATE( dta_bdy(jbdy)%a_i(nblen(1),jpl) ) |
---|
810 | ALLOCATE( dta_bdy(jbdy)%h_i(nblen(1),jpl) ) |
---|
811 | ALLOCATE( dta_bdy(jbdy)%h_s(nblen(1),jpl) ) |
---|
812 | ELSE |
---|
813 | IF ( nice_cat == jpl ) THEN ! case input cat = jpl |
---|
814 | jfld = jfld + 1 |
---|
815 | dta_bdy(jbdy)%a_i => bf(jfld)%fnow(:,1,:) |
---|
816 | jfld = jfld + 1 |
---|
817 | dta_bdy(jbdy)%h_i => bf(jfld)%fnow(:,1,:) |
---|
818 | jfld = jfld + 1 |
---|
819 | dta_bdy(jbdy)%h_s => bf(jfld)%fnow(:,1,:) |
---|
820 | ELSE ! case input cat = 1 OR (/=1 and /=jpl) |
---|
821 | jfld_ait(jbdy) = jfld + 1 |
---|
822 | jfld_htit(jbdy) = jfld + 2 |
---|
823 | jfld_htst(jbdy) = jfld + 3 |
---|
824 | jfld = jfld + 3 |
---|
825 | ALLOCATE( dta_bdy(jbdy)%a_i(nblen(1),jpl) ) |
---|
826 | ALLOCATE( dta_bdy(jbdy)%h_i(nblen(1),jpl) ) |
---|
827 | ALLOCATE( dta_bdy(jbdy)%h_s(nblen(1),jpl) ) |
---|
828 | dta_bdy(jbdy)%a_i(:,:) = 0._wp |
---|
829 | dta_bdy(jbdy)%h_i(:,:) = 0._wp |
---|
830 | dta_bdy(jbdy)%h_s(:,:) = 0._wp |
---|
831 | ENDIF |
---|
832 | |
---|
833 | ENDIF |
---|
834 | ENDIF |
---|
835 | #endif |
---|
836 | ! |
---|
837 | END DO ! jbdy |
---|
838 | ! |
---|
839 | END SUBROUTINE bdy_dta_init |
---|
840 | |
---|
841 | !!============================================================================== |
---|
842 | END MODULE bdydta |
---|