 Timestamp:
 20131120T17:28:04+01:00 (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
r4230 r4292 11 11 !! 3.3 ! 201009 (D.Storkey) add ice boundary conditions 12 12 !! 3.4 ! 2011 (D. Storkey) rewrite in preparation for OBCBDY merge 13 !! 3.6 ! 201201 (C. Rousset) add ice boundary conditions for lim3 13 14 !! 14 15 #if defined key_bdy … … 29 30 USE iom ! IOM library 30 31 USE in_out_manager ! I/O logical units 32 USE dynspg_oce, ONLY: lk_dynspg_ts ! Splitexplicit free surface flag 31 33 #if defined key_lim2 32 34 USE ice_2 35 #elif defined key_lim3 36 USE par_ice 37 USE ice 38 USE limcat_1D ! redistribute ice input into categories 33 39 #endif 34 40 USE sbcapr … … 49 55 50 56 TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr ! array of pointers to nbmap 57 58 #if defined key_lim3 59 LOGICAL :: ll_bdylim3 ! determine whether ice input is lim2 (F) or lim3 (T) type 60 INTEGER :: jfld_hti, jfld_hts, jfld_ai ! indices of ice thickness, snow thickness and concentration in bf structure 61 #endif 51 62 52 63 # include "domzgr_substitute.h90" … … 77 88 ! etc. 78 89 !! 79 INTEGER :: ib_bdy, jfld, jstart, jend, ib, ii, ij, ik, igrd ! local indices90 INTEGER :: ib_bdy, jfld, jstart, jend, ib, ii, ij, ik, igrd, jl ! local indices 80 91 INTEGER, DIMENSION(jpbgrd) :: ilen1 81 92 INTEGER, POINTER, DIMENSION(:) :: nblen, nblenrim ! short cuts 93 TYPE(OBC_DATA), POINTER :: dta ! short cut 82 94 !! 83 95 !! … … 91 103 ! Calculate depthmean currents 92 104 ! 93 CALL wrk_alloc(jpi,jpj,pu2d,pv2d) 94 95 pu2d(:,:) = 0.e0 96 pv2d(:,:) = 0.e0 97 105 CALL wrk_alloc(jpi,jpj,pun2d,pvn2d) 106 107 pun2d(:,:) = 0.e0 108 pvn2d(:,:) = 0.e0 98 109 DO ik = 1, jpkm1 !! Vertically integrated momentum trends 99 pu 2d(:,:) = pu2d(:,:) + fse3u(:,:,ik) * umask(:,:,ik) * un(:,:,ik)100 pv 2d(:,:) = pv2d(:,:) + fse3v(:,:,ik) * vmask(:,:,ik) * vn(:,:,ik)110 pun2d(:,:) = pun2d(:,:) + fse3u(:,:,ik) * umask(:,:,ik) * un(:,:,ik) 111 pvn2d(:,:) = pvn2d(:,:) + fse3v(:,:,ik) * vmask(:,:,ik) * vn(:,:,ik) 101 112 END DO 102 pu 2d(:,:) = pu2d(:,:) * hur(:,:)103 pv 2d(:,:) = pv2d(:,:) * hvr(:,:)113 pun2d(:,:) = pun2d(:,:) * hur(:,:) 114 pvn2d(:,:) = pvn2d(:,:) * hvr(:,:) 104 115 105 116 DO ib_bdy = 1, nb_bdy … … 107 118 nblen => idx_bdy(ib_bdy)%nblen 108 119 nblenrim => idx_bdy(ib_bdy)%nblenrim 109 110 IF( nn_dyn2d(ib_bdy) .gt. 0 .and. nn_dyn2d_dta(ib_bdy) .eq. 0 ) THEN 120 dta => dta_bdy(ib_bdy) 121 122 IF( nn_dyn2d_dta(ib_bdy) .eq. 0 ) THEN 111 123 ilen1(:) = nblen(:) 112 igrd = 1 113 DO ib = 1, ilen1(igrd) 114 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 115 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 116 dta_bdy(ib_bdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1) 117 END DO 118 igrd = 2 119 DO ib = 1, ilen1(igrd) 120 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 121 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 122 dta_bdy(ib_bdy)%u2d(ib) = pu2d(ii,ij) * umask(ii,ij,1) 123 END DO 124 igrd = 3 125 DO ib = 1, ilen1(igrd) 126 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 127 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 128 dta_bdy(ib_bdy)%v2d(ib) = pv2d(ii,ij) * vmask(ii,ij,1) 129 END DO 130 ENDIF 131 132 IF( nn_dyn3d(ib_bdy) .gt. 0 .and. nn_dyn3d_dta(ib_bdy) .eq. 0 ) THEN 133 ilen1(:) = nblen(:) 134 igrd = 2 135 DO ib = 1, ilen1(igrd) 136 DO ik = 1, jpkm1 124 IF( dta%ll_ssh ) THEN 125 igrd = 1 126 DO ib = 1, ilen1(igrd) 137 127 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 138 128 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 139 dta_bdy(ib_bdy)% u3d(ib,ik) = ( un(ii,ij,ik)  pu2d(ii,ij) ) * umask(ii,ij,ik)140 END DO 141 END DO142 igrd = 3143 DO ib = 1, ilen1(igrd)144 DO i k = 1, jpkm1129 dta_bdy(ib_bdy)%ssh(ib) = sshn(ii,ij) * tmask(ii,ij,1) 130 END DO 131 END IF 132 IF( dta%ll_u2d ) THEN 133 igrd = 2 134 DO ib = 1, ilen1(igrd) 145 135 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 146 136 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 147 dta_bdy(ib_bdy)%v3d(ib,ik) = ( vn(ii,ij,ik)  pv2d(ii,ij) ) * vmask(ii,ij,ik) 148 END DO 149 END DO 150 ENDIF 151 152 IF( nn_tra(ib_bdy) .gt. 0 .and. nn_tra_dta(ib_bdy) .eq. 0 ) THEN 153 ilen1(:) = nblen(:) 154 igrd = 1 ! Everything is at Tpoints here 155 DO ib = 1, ilen1(igrd) 156 DO ik = 1, jpkm1 137 dta_bdy(ib_bdy)%u2d(ib) = pun2d(ii,ij) * umask(ii,ij,1) 138 END DO 139 END IF 140 IF( dta%ll_v2d ) THEN 141 igrd = 3 142 DO ib = 1, ilen1(igrd) 157 143 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 158 144 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 159 dta_bdy(ib_bdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik) 160 dta_bdy(ib_bdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik) 145 dta_bdy(ib_bdy)%v2d(ib) = pvn2d(ii,ij) * vmask(ii,ij,1) 146 END DO 147 END IF 148 ENDIF 149 150 IF( nn_dyn3d_dta(ib_bdy) .eq. 0 ) THEN 151 ilen1(:) = nblen(:) 152 IF( dta%ll_u3d ) THEN 153 igrd = 2 154 DO ib = 1, ilen1(igrd) 155 DO ik = 1, jpkm1 156 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 157 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 158 dta_bdy(ib_bdy)%u3d(ib,ik) = ( un(ii,ij,ik)  pun2d(ii,ij) ) * umask(ii,ij,ik) 159 END DO 160 END DO 161 END IF 162 IF( dta%ll_v3d ) THEN 163 igrd = 3 164 DO ib = 1, ilen1(igrd) 165 DO ik = 1, jpkm1 166 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 167 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 168 dta_bdy(ib_bdy)%v3d(ib,ik) = ( vn(ii,ij,ik)  pvn2d(ii,ij) ) * vmask(ii,ij,ik) 169 END DO 170 END DO 171 END IF 172 ENDIF 173 174 IF( nn_tra_dta(ib_bdy) .eq. 0 ) THEN 175 ilen1(:) = nblen(:) 176 IF( dta%ll_tem ) THEN 177 igrd = 1 178 DO ib = 1, ilen1(igrd) 179 DO ik = 1, jpkm1 180 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 181 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 182 dta_bdy(ib_bdy)%tem(ib,ik) = tsn(ii,ij,ik,jp_tem) * tmask(ii,ij,ik) 183 END DO 184 END DO 185 END IF 186 IF( dta%ll_sal ) THEN 187 igrd = 1 188 DO ib = 1, ilen1(igrd) 189 DO ik = 1, jpkm1 190 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 191 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 192 dta_bdy(ib_bdy)%sal(ib,ik) = tsn(ii,ij,ik,jp_sal) * tmask(ii,ij,ik) 193 END DO 194 END DO 195 END IF 196 ENDIF 197 198 #if defined key_lim2 199 IF( nn_ice_lim2_dta(ib_bdy) .eq. 0 ) THEN 200 ilen1(:) = nblen(:) 201 IF( dta%ll_frld ) THEN 202 igrd = 1 203 DO ib = 1, ilen1(igrd) 204 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 205 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 206 dta_bdy(ib_bdy)%frld(ib) = frld(ii,ij) * tmask(ii,ij,1) 207 END DO 208 END IF 209 IF( dta%ll_hicif ) THEN 210 igrd = 1 211 DO ib = 1, ilen1(igrd) 212 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 213 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 214 dta_bdy(ib_bdy)%hicif(ib) = hicif(ii,ij) * tmask(ii,ij,1) 215 END DO 216 END IF 217 IF( dta%ll_hsnif ) THEN 218 igrd = 1 219 DO ib = 1, ilen1(igrd) 220 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 221 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 222 dta_bdy(ib_bdy)%hsnif(ib) = hsnif(ii,ij) * tmask(ii,ij,1) 223 END DO 224 END IF 225 ENDIF 226 #elif defined key_lim3 227 IF( nn_ice_lim_dta(ib_bdy) .eq. 0 ) THEN 228 ilen1(:) = nblen(:) 229 IF( dta%ll_a_i ) THEN 230 igrd = 1 231 DO jl = 1, jpl 232 DO ib = 1, ilen1(igrd) 233 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 234 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 235 dta_bdy(ib_bdy)%a_i (ib,jl) = a_i(ii,ij,jl) * tmask(ii,ij,1) 236 END DO 161 237 END DO 162 END DO 163 ENDIF 164 165 #if defined key_lim2 166 IF( nn_ice_lim2(ib_bdy) .gt. 0 .and. nn_ice_lim2_dta(ib_bdy) .eq. 0 ) THEN 167 ilen1(:) = nblen(:) 168 igrd = 1 ! Everything is at Tpoints here 169 DO ib = 1, ilen1(igrd) 170 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 171 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 172 dta_bdy(ib_bdy)%frld(ib) = frld(ii,ij) * tmask(ii,ij,1) 173 dta_bdy(ib_bdy)%hicif(ib) = hicif(ii,ij) * tmask(ii,ij,1) 174 dta_bdy(ib_bdy)%hsnif(ib) = hsnif(ii,ij) * tmask(ii,ij,1) 175 END DO 238 ENDIF 239 IF( dta%ll_ht_i ) THEN 240 igrd = 1 241 DO jl = 1, jpl 242 DO ib = 1, ilen1(igrd) 243 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 244 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 245 dta_bdy(ib_bdy)%ht_i (ib,jl) = ht_i(ii,ij,jl) * tmask(ii,ij,1) 246 END DO 247 END DO 248 ENDIF 249 IF( dta%ll_ht_s ) THEN 250 igrd = 1 251 DO jl = 1, jpl 252 DO ib = 1, ilen1(igrd) 253 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 254 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 255 dta_bdy(ib_bdy)%ht_s (ib,jl) = ht_s(ii,ij,jl) * tmask(ii,ij,1) 256 END DO 257 END DO 258 ENDIF 176 259 ENDIF 177 260 #endif … … 179 262 ENDDO ! ib_bdy 180 263 181 CALL wrk_dealloc(jpi,jpj,pu 2d,pv2d)264 CALL wrk_dealloc(jpi,jpj,pun2d,pvn2d) 182 265 183 266 ENDIF ! kt .eq. nit000 … … 188 271 jstart = 1 189 272 DO ib_bdy = 1, nb_bdy 273 dta => dta_bdy(ib_bdy) 190 274 IF( nn_dta(ib_bdy) .eq. 1 ) THEN ! skip this bit if no external data required 191 275 … … 193 277 ! Update barotropic boundary conditions only 194 278 ! jit is optional argument for fld_read and bdytide_update 195 IF( nn_dyn2d(ib_bdy) .gt. 0) THEN279 IF( cn_dyn2d(ib_bdy) /= 'none' ) THEN 196 280 IF( nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays 197 dta_bdy(ib_bdy)%ssh(:) = 0.0198 dta_bdy(ib_bdy)%u2d(:) = 0.0199 dta_bdy(ib_bdy)%v2d(:) = 0.0281 IF( dta%ll_ssh ) dta%ssh(:) = 0.0 282 IF( dta%ll_u2d ) dta%u2d(:) = 0.0 283 IF( dta%ll_u3d ) dta%v2d(:) = 0.0 200 284 ENDIF 201 IF (nn_tra(ib_bdy).ne.4) THEN 202 IF( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 .OR. & 203 & (ln_full_vel_array(ib_bdy) .AND. nn_dyn3d_dta(ib_bdy).eq.1) )THEN 204 205 ! For the runoff case, no need to update the forcing (already done in the baroclinic part) 206 jend = nb_bdy_fld(ib_bdy) 207 IF ( nn_tra(ib_bdy) .GT. 0 .AND. nn_tra_dta(ib_bdy) .GE. 1 ) jend = jend  2 285 IF (cn_tra(ib_bdy) /= 'runoff') THEN 286 IF( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 ) THEN 287 288 jend = jstart + dta%nread(2)  1 208 289 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend), & 209 290 & kit=jit, kt_offset=time_offset ) 210 IF ( nn_tra(ib_bdy) .GT. 0 .AND. nn_tra_dta(ib_bdy) .GE. 1 ) jend = jend + 2 211 212 ! If full velocities in boundary data then split into barotropic and baroclinic data 291 292 ! If full velocities in boundary data then extract barotropic velocities from 3D fields 213 293 IF( ln_full_vel_array(ib_bdy) .AND. & 214 294 & ( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 .OR. & … … 216 296 217 297 igrd = 2 ! zonal velocity 218 dta _bdy(ib_bdy)%u2d(:) = 0.0298 dta%u2d(:) = 0.0 219 299 DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd) 220 300 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 221 301 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 222 302 DO ik = 1, jpkm1 223 dta _bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) &224 & + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta _bdy(ib_bdy)%u3d(ib,ik)303 dta%u2d(ib) = dta%u2d(ib) & 304 & + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik) 225 305 END DO 226 dta_bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) * hur(ii,ij) 227 DO ik = 1, jpkm1 228 dta_bdy(ib_bdy)%u3d(ib,ik) = dta_bdy(ib_bdy)%u3d(ib,ik)  dta_bdy(ib_bdy)%u2d(ib) 229 END DO 306 dta%u2d(ib) = dta%u2d(ib) * hur(ii,ij) 230 307 END DO 231 308 igrd = 3 ! meridional velocity 232 dta _bdy(ib_bdy)%v2d(:) = 0.0309 dta%v2d(:) = 0.0 233 310 DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd) 234 311 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 235 312 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 236 313 DO ik = 1, jpkm1 237 dta _bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) &238 & + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta _bdy(ib_bdy)%v3d(ib,ik)314 dta%v2d(ib) = dta%v2d(ib) & 315 & + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik) 239 316 END DO 240 dta_bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) * hvr(ii,ij) 241 DO ik = 1, jpkm1 242 dta_bdy(ib_bdy)%v3d(ib,ik) = dta_bdy(ib_bdy)%v3d(ib,ik)  dta_bdy(ib_bdy)%v2d(ib) 243 END DO 317 dta%v2d(ib) = dta%v2d(ib) * hvr(ii,ij) 244 318 END DO 245 319 ENDIF 246 320 ENDIF 247 321 IF( nn_dyn2d_dta(ib_bdy) .ge. 2 ) THEN ! update tidal harmonic forcing 248 CALL bdytide_update( kt=kt, idx=idx_bdy(ib_bdy), dta=dta _bdy(ib_bdy), td=tides(ib_bdy), &322 CALL bdytide_update( kt=kt, idx=idx_bdy(ib_bdy), dta=dta, td=tides(ib_bdy), & 249 323 & jit=jit, time_offset=time_offset ) 250 324 ENDIF … … 252 326 ENDIF 253 327 ELSE 254 IF ( nn_tra(ib_bdy).eq.4) then ! runoff condition328 IF (cn_tra(ib_bdy) == 'runoff') then ! runoff condition 255 329 jend = nb_bdy_fld(ib_bdy) 256 330 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & … … 261 335 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 262 336 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 263 dta _bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) )337 dta%u2d(ib) = dta%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) 264 338 END DO 265 339 ! … … 268 342 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 269 343 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 270 dta _bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) )344 dta%v2d(ib) = dta%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) 271 345 END DO 272 346 ELSE 273 IF( nn_dyn2d (ib_bdy) .gt. 0 .and. nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays274 dta_bdy(ib_bdy)%ssh(:) = 0.0275 dta_bdy(ib_bdy)%u2d(:) = 0.0276 dta_bdy(ib_bdy)%v2d(:) = 0.0347 IF( nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays 348 IF( dta%ll_ssh ) dta%ssh(:) = 0.0 349 IF( dta%ll_u2d ) dta%u2d(:) = 0.0 350 IF( dta%ll_v2d ) dta%v2d(:) = 0.0 277 351 ENDIF 278 IF( nb_bdy_fld(ib_bdy) .gt. 0 ) THEN ! update external data279 jend = nb_bdy_fld(ib_bdy)352 IF( dta%nread(1) .gt. 0 ) THEN ! update external data 353 jend = jstart + dta%nread(1)  1 280 354 CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), & 281 355 & map=nbmap_ptr(jstart:jend), kt_offset=time_offset ) … … 286 360 & nn_dyn3d_dta(ib_bdy) .EQ. 1 ) ) THEN 287 361 igrd = 2 ! zonal velocity 288 dta _bdy(ib_bdy)%u2d(:) = 0.0362 dta%u2d(:) = 0.0 289 363 DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd) 290 364 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 291 365 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 292 366 DO ik = 1, jpkm1 293 dta _bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) &294 & + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta _bdy(ib_bdy)%u3d(ib,ik)367 dta%u2d(ib) = dta%u2d(ib) & 368 & + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik) 295 369 END DO 296 dta _bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) * hur(ii,ij)370 dta%u2d(ib) = dta%u2d(ib) * hur(ii,ij) 297 371 DO ik = 1, jpkm1 298 dta _bdy(ib_bdy)%u3d(ib,ik) = dta_bdy(ib_bdy)%u3d(ib,ik)  dta_bdy(ib_bdy)%u2d(ib)372 dta%u3d(ib,ik) = dta%u3d(ib,ik)  dta%u2d(ib) 299 373 END DO 300 374 END DO 301 375 igrd = 3 ! meridional velocity 302 dta _bdy(ib_bdy)%v2d(:) = 0.0376 dta%v2d(:) = 0.0 303 377 DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd) 304 378 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 305 379 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 306 380 DO ik = 1, jpkm1 307 dta _bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) &308 & + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta _bdy(ib_bdy)%v3d(ib,ik)381 dta%v2d(ib) = dta%v2d(ib) & 382 & + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik) 309 383 END DO 310 dta _bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) * hvr(ii,ij)384 dta%v2d(ib) = dta%v2d(ib) * hvr(ii,ij) 311 385 DO ik = 1, jpkm1 312 dta _bdy(ib_bdy)%v3d(ib,ik) = dta_bdy(ib_bdy)%v3d(ib,ik)  dta_bdy(ib_bdy)%v2d(ib)386 dta%v3d(ib,ik) = dta%v3d(ib,ik)  dta%v2d(ib) 313 387 END DO 314 388 END DO 315 389 ENDIF 316 IF( nn_dyn2d(ib_bdy) .gt. 0 .and. nn_dyn2d_dta(ib_bdy) .ge. 2 ) THEN ! update tidal harmonic forcing 317 CALL bdytide_update( kt=kt, idx=idx_bdy(ib_bdy), dta=dta_bdy(ib_bdy), & 318 & td=tides(ib_bdy), time_offset=time_offset ) 319 ENDIF 320 ENDIF 321 ENDIF 322 jstart = jend+1 390 391 ENDIF 392 #if defined key_lim3 393 IF( .NOT. ll_bdylim3 .AND. nn_ice_lim(ib_bdy) > 0 .AND. nn_ice_lim_dta(ib_bdy) == 1 ) THEN ! bdy ice input (case input is lim2 type) 394 CALL lim_cat_1D ( bf(jfld_hti)%fnow(:,1,1), bf(jfld_hts)%fnow(:,1,1), bf(jfld_ai)%fnow(:,1,1), & 395 & dta_bdy(ib_bdy)%ht_i, dta_bdy(ib_bdy)%ht_s, dta_bdy(ib_bdy)%a_i ) 396 ENDIF 397 #endif 398 ENDIF 399 jstart = jstart + dta%nread(1) 323 400 END IF ! nn_dta(ib_bdy) = 1 324 401 END DO ! ib_bdy 325 402 403 ! bg jchanut tschanges 404 #if defined key_tide 405 ! Add tides if not splitexplicit free surface else this is done in ts loop 406 IF (.NOT.lk_dynspg_ts) CALL bdy_dta_tides( kt=kt, time_offset=time_offset ) 407 #endif 408 ! end jchanut tschanges 409 326 410 IF ( ln_apr_obc ) THEN 327 411 DO ib_bdy = 1, nb_bdy 328 IF ( nn_tra(ib_bdy).NE.4)THEN412 IF (cn_tra(ib_bdy) /= 'runoff')THEN 329 413 igrd = 1 ! meridional velocity 330 414 DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd) … … 349 433 !! for open boundary conditions 350 434 !! 351 !! ** Method : Use fldread.F90435 !! ** Method : 352 436 !! 353 437 !! … … 362 446 ! =F => baroclinic velocities in 3D boundary data 363 447 INTEGER :: ilen_global ! Max length required for global bdy dta arrays 364 INTEGER, DIMENSION(jpbgrd) :: ilen0 ! size of local arrays365 448 INTEGER, ALLOCATABLE, DIMENSION(:) :: ilen1, ilen3 ! size of 1st and 3rd dimensions of local arrays 366 449 INTEGER, ALLOCATABLE, DIMENSION(:) :: ibdy ! bdy set for a particular jfld 367 450 INTEGER, ALLOCATABLE, DIMENSION(:) :: igrid ! index for grid type (1,2,3 = T,U,V) 368 451 INTEGER, POINTER, DIMENSION(:) :: nblen, nblenrim ! short cuts 452 TYPE(OBC_DATA), POINTER :: dta ! short cut 453 #if defined key_lim3 454 INTEGER, DIMENSION(3) :: zdimsz ! number of elements in each of the 4 dimensions (i.e. i,j,t,icecat) for an array 455 INTEGER :: zndims ! number of dimensions in an array (i.e. 3 = wo ice cat; 4 = w ice cat) 456 INTEGER :: inum,id1 ! local integer 457 #endif 369 458 TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: blf_i ! array of namelist information structures 370 459 TYPE(FLD_N) :: bn_tem, bn_sal, bn_u3d, bn_v3d ! … … 372 461 #if defined key_lim2 373 462 TYPE(FLD_N) :: bn_frld, bn_hicif, bn_hsnif ! 463 #elif defined key_lim3 464 TYPE(FLD_N) :: bn_a_i, bn_ht_i, bn_ht_s 374 465 #endif 375 466 NAMELIST/nambdy_dta/ cn_dir, bn_tem, bn_sal, bn_u3d, bn_v3d, bn_ssh, bn_u2d, bn_v2d 376 467 #if defined key_lim2 377 468 NAMELIST/nambdy_dta/ bn_frld, bn_hicif, bn_hsnif 469 #elif defined key_lim3 470 NAMELIST/nambdy_dta/ bn_a_i, bn_ht_i, bn_ht_s 378 471 #endif 379 472 NAMELIST/nambdy_dta/ ln_full_vel … … 392 485 ,nn_dyn3d_dta(ib_bdy) & 393 486 ,nn_tra_dta(ib_bdy) & 394 #if defined key_lim2395 ,nn_ice_lim2_dta(ib_bdy) &487 #if ( defined key_lim2  defined key_lim3 ) 488 ,nn_ice_lim_dta(ib_bdy) & 396 489 #endif 397 490 ) … … 404 497 nb_bdy_fld(:) = 0 405 498 DO ib_bdy = 1, nb_bdy 406 IF( nn_dyn2d(ib_bdy) .gt. 0.and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) THEN499 IF( cn_dyn2d(ib_bdy) /= 'none' .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) THEN 407 500 nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 3 408 501 ENDIF 409 IF( nn_dyn3d(ib_bdy) .gt. 0.and. nn_dyn3d_dta(ib_bdy) .eq. 1 ) THEN502 IF( cn_dyn3d(ib_bdy) /= 'none' .and. nn_dyn3d_dta(ib_bdy) .eq. 1 ) THEN 410 503 nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 2 411 504 ENDIF 412 IF( nn_tra(ib_bdy) .gt. 0.and. nn_tra_dta(ib_bdy) .eq. 1 ) THEN505 IF( cn_tra(ib_bdy) /= 'none' .and. nn_tra_dta(ib_bdy) .eq. 1 ) THEN 413 506 nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 2 414 507 ENDIF 415 #if defined key_lim2416 IF( nn_ice_lim2(ib_bdy) .gt. 0 .and. nn_ice_lim2_dta(ib_bdy) .eq. 1 ) THEN508 #if ( defined key_lim2  defined key_lim3 ) 509 IF( cn_ice_lim(ib_bdy) /= 'none' .and. nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN 417 510 nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 3 418 511 ENDIF … … 458 551 nblen => idx_bdy(ib_bdy)%nblen 459 552 nblenrim => idx_bdy(ib_bdy)%nblenrim 553 dta => dta_bdy(ib_bdy) 554 dta%nread(2) = 0 460 555 461 556 ! Only read in necessary fields for this set. 462 557 ! Important that barotropic variables come first. 463 IF( nn_dyn2d(ib_bdy) .gt. 0 .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) THEN 464 465 IF( nn_dyn2d(ib_bdy) .ne. jp_frs .and. nn_tra(ib_bdy) .ne. 4 ) THEN ! runoff condition : no ssh reading 558 IF( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) THEN 559 560 IF( dta%ll_ssh ) THEN 561 if(lwp) write(numout,*) '++++++ reading in ssh field' 466 562 jfld = jfld + 1 467 563 blf_i(jfld) = bn_ssh … … 470 566 ilen1(jfld) = nblen(igrid(jfld)) 471 567 ilen3(jfld) = 1 472 ENDIF 473 474 IF( .not. ln_full_vel_array(ib_bdy) ) THEN 568 dta%nread(2) = dta%nread(2) + 1 569 ENDIF 570 571 IF( dta%ll_u2d .and. .not. ln_full_vel_array(ib_bdy) ) THEN 572 if(lwp) write(numout,*) '++++++ reading in u2d field' 475 573 jfld = jfld + 1 476 574 blf_i(jfld) = bn_u2d … … 479 577 ilen1(jfld) = nblen(igrid(jfld)) 480 578 ilen3(jfld) = 1 481 579 dta%nread(2) = dta%nread(2) + 1 580 ENDIF 581 582 IF( dta%ll_v2d .and. .not. ln_full_vel_array(ib_bdy) ) THEN 583 if(lwp) write(numout,*) '++++++ reading in v2d field' 482 584 jfld = jfld + 1 483 585 blf_i(jfld) = bn_v2d … … 486 588 ilen1(jfld) = nblen(igrid(jfld)) 487 589 ilen3(jfld) = 1 488 ENDIF 489 490 ENDIF 491 492 ! baroclinic velocities 493 IF( ( nn_dyn3d(ib_bdy) .gt. 0 .and. nn_dyn3d_dta(ib_bdy) .eq. 1 ) .or. & 494 & ( ln_full_vel_array(ib_bdy) .and. nn_dyn2d(ib_bdy) .gt. 0 .and. & 495 & ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) ) THEN 496 497 jfld = jfld + 1 498 blf_i(jfld) = bn_u3d 499 ibdy(jfld) = ib_bdy 500 igrid(jfld) = 2 501 ilen1(jfld) = nblen(igrid(jfld)) 502 ilen3(jfld) = jpk 503 504 jfld = jfld + 1 505 blf_i(jfld) = bn_v3d 506 ibdy(jfld) = ib_bdy 507 igrid(jfld) = 3 508 ilen1(jfld) = nblen(igrid(jfld)) 509 ilen3(jfld) = jpk 590 dta%nread(2) = dta%nread(2) + 1 591 ENDIF 592 593 ENDIF 594 595 ! read 3D velocities if baroclinic velocities require OR if 596 ! barotropic velocities required and ln_full_vel set to .true. 597 IF( nn_dyn3d_dta(ib_bdy) .eq. 1 .or. & 598 & ( ln_full_vel_array(ib_bdy) .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) ) THEN 599 600 IF( dta%ll_u3d .or. ( ln_full_vel_array(ib_bdy) .and. dta%ll_u2d ) ) THEN 601 if(lwp) write(numout,*) '++++++ reading in u3d field' 602 jfld = jfld + 1 603 blf_i(jfld) = bn_u3d 604 ibdy(jfld) = ib_bdy 605 igrid(jfld) = 2 606 ilen1(jfld) = nblen(igrid(jfld)) 607 ilen3(jfld) = jpk 608 IF( ln_full_vel_array(ib_bdy) .and. dta%ll_u2d ) dta%nread(2) = dta%nread(2) + 1 609 ENDIF 610 611 IF( dta%ll_v3d .or. ( ln_full_vel_array(ib_bdy) .and. dta%ll_v2d ) ) THEN 612 if(lwp) write(numout,*) '++++++ reading in v3d field' 613 jfld = jfld + 1 614 blf_i(jfld) = bn_v3d 615 ibdy(jfld) = ib_bdy 616 igrid(jfld) = 3 617 ilen1(jfld) = nblen(igrid(jfld)) 618 ilen3(jfld) = jpk 619 IF( ln_full_vel_array(ib_bdy) .and. dta%ll_v2d ) dta%nread(2) = dta%nread(2) + 1 620 ENDIF 510 621 511 622 ENDIF 512 623 513 624 ! temperature and salinity 514 IF( nn_tra(ib_bdy) .gt. 0 .and. nn_tra_dta(ib_bdy) .eq. 1 ) THEN 515 516 jfld = jfld + 1 517 blf_i(jfld) = bn_tem 518 ibdy(jfld) = ib_bdy 519 igrid(jfld) = 1 520 ilen1(jfld) = nblen(igrid(jfld)) 521 ilen3(jfld) = jpk 522 523 jfld = jfld + 1 524 blf_i(jfld) = bn_sal 525 ibdy(jfld) = ib_bdy 526 igrid(jfld) = 1 527 ilen1(jfld) = nblen(igrid(jfld)) 528 ilen3(jfld) = jpk 625 IF( nn_tra_dta(ib_bdy) .eq. 1 ) THEN 626 627 IF( dta%ll_tem ) THEN 628 if(lwp) write(numout,*) '++++++ reading in tem field' 629 jfld = jfld + 1 630 blf_i(jfld) = bn_tem 631 ibdy(jfld) = ib_bdy 632 igrid(jfld) = 1 633 ilen1(jfld) = nblen(igrid(jfld)) 634 ilen3(jfld) = jpk 635 ENDIF 636 637 IF( dta%ll_sal ) THEN 638 if(lwp) write(numout,*) '++++++ reading in sal field' 639 jfld = jfld + 1 640 blf_i(jfld) = bn_sal 641 ibdy(jfld) = ib_bdy 642 igrid(jfld) = 1 643 ilen1(jfld) = nblen(igrid(jfld)) 644 ilen3(jfld) = jpk 645 ENDIF 529 646 530 647 ENDIF … … 532 649 #if defined key_lim2 533 650 ! sea ice 534 IF( nn_ice_lim2(ib_bdy) .gt. 0 .and. nn_ice_lim2_dta(ib_bdy) .eq. 1 ) THEN 535 536 jfld = jfld + 1 537 blf_i(jfld) = bn_frld 538 ibdy(jfld) = ib_bdy 539 igrid(jfld) = 1 540 ilen1(jfld) = nblen(igrid(jfld)) 541 ilen3(jfld) = 1 542 543 jfld = jfld + 1 544 blf_i(jfld) = bn_hicif 545 ibdy(jfld) = ib_bdy 546 igrid(jfld) = 1 547 ilen1(jfld) = nblen(igrid(jfld)) 548 ilen3(jfld) = 1 549 550 jfld = jfld + 1 551 blf_i(jfld) = bn_hsnif 552 ibdy(jfld) = ib_bdy 553 igrid(jfld) = 1 554 ilen1(jfld) = nblen(igrid(jfld)) 555 ilen3(jfld) = 1 556 557 ENDIF 651 IF( nn_ice_lim2_dta(ib_bdy) .eq. 1 ) THEN 652 653 IF( dta%ll_frld ) THEN 654 jfld = jfld + 1 655 blf_i(jfld) = bn_frld 656 ibdy(jfld) = ib_bdy 657 igrid(jfld) = 1 658 ilen1(jfld) = nblen(igrid(jfld)) 659 ilen3(jfld) = 1 660 ENDIF 661 662 IF( dta%ll_hicif ) THEN 663 jfld = jfld + 1 664 blf_i(jfld) = bn_hicif 665 ibdy(jfld) = ib_bdy 666 igrid(jfld) = 1 667 ilen1(jfld) = nblen(igrid(jfld)) 668 ilen3(jfld) = 1 669 ENDIF 670 671 IF( dta%ll_hsnif ) THEN 672 jfld = jfld + 1 673 blf_i(jfld) = bn_hsnif 674 ibdy(jfld) = ib_bdy 675 igrid(jfld) = 1 676 ilen1(jfld) = nblen(igrid(jfld)) 677 ilen3(jfld) = 1 678 ENDIF 679 680 ENDIF 681 #elif defined key_lim3 682 ! sea ice 683 IF( nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN 684 685 ! Test for types of ice input (lim2 or lim3) 686 CALL iom_open ( bn_a_i%clname, inum ) 687 id1 = iom_varid ( inum, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. ) 688 CALL iom_close ( inum ) 689 !CALL fld_clopn ( bn_a_i, nyear, nmonth, nday, ldstop=.TRUE. ) 690 !CALL iom_open ( bn_a_i %clname, inum ) 691 !id1 = iom_varid ( bn_a_i%num, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. ) 692 IF ( zndims == 4 ) THEN 693 ll_bdylim3 = .TRUE. ! lim3 input 694 ELSE 695 ll_bdylim3 = .FALSE. ! lim2 input 696 ENDIF 697 ! End test 698 699 IF( dta%ll_a_i ) THEN 700 jfld = jfld + 1 701 blf_i(jfld) = bn_a_i 702 ibdy(jfld) = ib_bdy 703 igrid(jfld) = 1 704 ilen1(jfld) = nblen(igrid(jfld)) 705 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF 706 ENDIF 707 708 IF( dta%ll_ht_i ) THEN 709 jfld = jfld + 1 710 blf_i(jfld) = bn_ht_i 711 ibdy(jfld) = ib_bdy 712 igrid(jfld) = 1 713 ilen1(jfld) = nblen(igrid(jfld)) 714 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF 715 ENDIF 716 717 IF( dta%ll_ht_s ) THEN 718 jfld = jfld + 1 719 blf_i(jfld) = bn_ht_s 720 ibdy(jfld) = ib_bdy 721 igrid(jfld) = 1 722 ilen1(jfld) = nblen(igrid(jfld)) 723 IF ( ll_bdylim3 ) THEN ; ilen3(jfld)=jpl ; ELSE ; ilen3(jfld)=1 ; ENDIF 724 ENDIF 725 558 726 #endif 559 727 ! Recalculate field counts … … 568 736 ENDIF 569 737 738 dta%nread(1) = nb_bdy_fld(ib_bdy) 739 570 740 ENDIF ! nn_dta .eq. 1 571 741 ENDDO ! ib_bdy … … 596 766 597 767 nblen => idx_bdy(ib_bdy)%nblen 598 nblenrim => idx_bdy(ib_bdy)%nblenrim 599 600 IF (nn_dyn2d(ib_bdy) .gt. 0) THEN 601 IF( nn_dyn2d_dta(ib_bdy) .eq. 0 .or. nn_dyn2d_dta(ib_bdy) .eq. 2 .or. ln_full_vel_array(ib_bdy) ) THEN 602 ilen0(1:3) = nblen(1:3) 603 ALLOCATE( dta_bdy(ib_bdy)%u2d(ilen0(2)) ) 604 ALLOCATE( dta_bdy(ib_bdy)%v2d(ilen0(3)) ) 605 IF ( nn_dyn2d(ib_bdy) .ne. jp_frs .and. (nn_dyn2d_dta(ib_bdy).eq.1.or.nn_dyn2d_dta(ib_bdy).eq.3) ) THEN 606 jfld = jfld + 1 607 dta_bdy(ib_bdy)%ssh => bf(jfld)%fnow(:,1,1) 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)) ) 608 796 ELSE 609 ALLOCATE( dta_bdy(ib_bdy)%ssh(nblen(1)) ) 610 ENDIF 611 ELSE 612 IF( nn_dyn2d(ib_bdy) .ne. jp_frs ) THEN 613 jfld = jfld + 1 614 dta_bdy(ib_bdy)%ssh => bf(jfld)%fnow(:,1,1) 615 ENDIF 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' 616 823 jfld = jfld + 1 617 dta_bdy(ib_bdy)%u2d => bf(jfld)%fnow(:,1,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' 618 828 jfld = jfld + 1 619 dta_bdy(ib_bdy)%v2d => bf(jfld)%fnow(:,1,1) 620 ENDIF 621 ENDIF 622 623 IF ( nn_dyn3d(ib_bdy) .gt. 0 .and. nn_dyn3d_dta(ib_bdy) .eq. 0 ) THEN 624 ilen0(1:3) = nblen(1:3) 625 ALLOCATE( dta_bdy(ib_bdy)%u3d(ilen0(2),jpk) ) 626 ALLOCATE( dta_bdy(ib_bdy)%v3d(ilen0(3),jpk) ) 627 ENDIF 628 IF ( ( nn_dyn3d(ib_bdy) .gt. 0 .and. nn_dyn3d_dta(ib_bdy) .eq. 1 ).or. & 629 & ( ln_full_vel_array(ib_bdy) .and. nn_dyn2d(ib_bdy) .gt. 0 .and. & 630 & ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) ) THEN 631 jfld = jfld + 1 632 dta_bdy(ib_bdy)%u3d => bf(jfld)%fnow(:,1,:) 633 jfld = jfld + 1 634 dta_bdy(ib_bdy)%v3d => bf(jfld)%fnow(:,1,:) 635 ENDIF 636 637 IF (nn_tra(ib_bdy) .gt. 0) THEN 638 IF( nn_tra_dta(ib_bdy) .eq. 0 ) THEN 639 ilen0(1:3) = nblen(1:3) 640 ALLOCATE( dta_bdy(ib_bdy)%tem(ilen0(1),jpk) ) 641 ALLOCATE( dta_bdy(ib_bdy)%sal(ilen0(1),jpk) ) 642 ELSE 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' 643 840 jfld = jfld + 1 644 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' 645 845 jfld = jfld + 1 646 846 dta_bdy(ib_bdy)%sal => bf(jfld)%fnow(:,1,:) … … 649 849 650 850 #if defined key_lim2 651 IF (nn_ice_lim 2(ib_bdy) .gt. 0) THEN851 IF (nn_ice_lim(ib_bdy) .gt. 0) THEN 652 852 IF( nn_ice_lim2_dta(ib_bdy) .eq. 0 ) THEN 653 ilen0(1:3) = nblen(1:3) 654 ALLOCATE( dta_bdy(ib_bdy)%frld(ilen0(1)) ) 655 ALLOCATE( dta_bdy(ib_bdy)%hicif(ilen0(1)) ) 656 ALLOCATE( dta_bdy(ib_bdy)%hsnif(ilen0(1)) ) 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)) ) 657 856 ELSE 658 857 jfld = jfld + 1 … … 662 861 jfld = jfld + 1 663 862 dta_bdy(ib_bdy)%hsnif => bf(jfld)%fnow(:,1,1) 863 ENDIF 864 ENDIF 865 #elif defined key_lim3 866 IF (nn_ice_lim(ib_bdy) .gt. 0) 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 664 892 ENDIF 665 893 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.