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