Changeset 13026
- Timestamp:
- 2020-06-03T16:30:02+02:00 (4 years ago)
- Location:
- NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/ICE/iceistate.F90
r12736 r13026 32 32 USE lib_fortran ! fortran utilities (glob_sum + no signed zero) 33 33 USE fldread ! read input fields 34 35 # if defined key_agrif 36 USE agrif_oce 37 USE agrif_ice 38 USE agrif_ice_interp 39 # endif 34 40 35 41 IMPLICIT NONE … … 168 174 ! 2) overwrite some of the fields with namelist parameters or netcdf file 169 175 !------------------------------------------------------------------------ 176 177 170 178 IF( ln_iceini ) THEN 171 179 ! !---------------! 172 IF( ln_iceini_file )THEN ! Read a file ! 173 ! !---------------! 174 WHERE( ff_t(:,:) >= 0._wp ) ; zswitch(:,:) = 1._wp 175 ELSEWHERE ; zswitch(:,:) = 0._wp 180 181 IF( Agrif_Root() ) THEN 182 183 IF( ln_iceini_file )THEN ! Read a file ! 184 ! !---------------! 185 WHERE( ff_t(:,:) >= 0._wp ) ; zswitch(:,:) = 1._wp 186 ELSEWHERE ; zswitch(:,:) = 0._wp 187 END WHERE 188 ! 189 CALL fld_read( kt, 1, si ) ! input fields provided at the current time-step 190 ! 191 ! -- mandatory fields -- ! 192 zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1) * tmask(:,:,1) 193 zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1) * tmask(:,:,1) 194 zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1) * tmask(:,:,1) 195 196 ! -- optional fields -- ! 197 ! if fields do not exist then set them to the values present in the namelist (except for snow and surface temperature) 198 ! 199 ! ice salinity 200 IF( TRIM(si(jp_smi)%clrootname) == 'NOT USED' ) & 201 & si(jp_smi)%fnow(:,:,1) = ( rn_smi_ini_n * zswitch + rn_smi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 202 ! 203 ! temperatures 204 IF ( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. & 205 & TRIM(si(jp_tms)%clrootname) == 'NOT USED' ) THEN 206 si(jp_tmi)%fnow(:,:,1) = ( rn_tmi_ini_n * zswitch + rn_tmi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 207 si(jp_tsu)%fnow(:,:,1) = ( rn_tsu_ini_n * zswitch + rn_tsu_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 208 si(jp_tms)%fnow(:,:,1) = ( rn_tms_ini_n * zswitch + rn_tms_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 209 ELSEIF( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tms)%clrootname) /= 'NOT USED' ) THEN ! if T_s is read and not T_i, set T_i = (T_s + T_freeze)/2 210 si(jp_tmi)%fnow(:,:,1) = 0.5_wp * ( si(jp_tms)%fnow(:,:,1) + 271.15 ) 211 ELSEIF( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) /= 'NOT USED' ) THEN ! if T_su is read and not T_i, set T_i = (T_su + T_freeze)/2 212 si(jp_tmi)%fnow(:,:,1) = 0.5_wp * ( si(jp_tsu)%fnow(:,:,1) + 271.15 ) 213 ELSEIF( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tms)%clrootname) /= 'NOT USED' ) THEN ! if T_s is read and not T_su, set T_su = T_s 214 si(jp_tsu)%fnow(:,:,1) = si(jp_tms)%fnow(:,:,1) 215 ELSEIF( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN ! if T_i is read and not T_su, set T_su = T_i 216 si(jp_tsu)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 217 ELSEIF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) /= 'NOT USED' ) THEN ! if T_su is read and not T_s, set T_s = T_su 218 si(jp_tms)%fnow(:,:,1) = si(jp_tsu)%fnow(:,:,1) 219 ELSEIF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN ! if T_i is read and not T_s, set T_s = T_i 220 si(jp_tms)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 221 ENDIF 222 ! 223 ! pond concentration 224 IF( TRIM(si(jp_apd)%clrootname) == 'NOT USED' ) & 225 & si(jp_apd)%fnow(:,:,1) = ( rn_apd_ini_n * zswitch + rn_apd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) & ! rn_apd = pond fraction => rn_apnd * a_i = pond conc. 226 & * si(jp_ati)%fnow(:,:,1) 227 ! 228 ! pond depth 229 IF( TRIM(si(jp_hpd)%clrootname) == 'NOT USED' ) & 230 & si(jp_hpd)%fnow(:,:,1) = ( rn_hpd_ini_n * zswitch + rn_hpd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 231 ! 232 zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) * tmask(:,:,1) 233 ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) * tmask(:,:,1) 234 zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1) * tmask(:,:,1) 235 ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1) * tmask(:,:,1) 236 zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1) * tmask(:,:,1) 237 zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1) * tmask(:,:,1) 238 ! 239 ! change the switch for the following 240 WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1) 241 ELSEWHERE ; zswitch(:,:) = 0._wp 242 END WHERE 243 244 ! !---------------! 245 ELSE ! Read namelist ! 246 ! !---------------! 247 ! no ice if (sst - Tfreez) >= thresold 248 WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst ) ; zswitch(:,:) = 0._wp 249 ELSEWHERE ; zswitch(:,:) = tmask(:,:,1) 250 END WHERE 251 ! 252 ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array 253 WHERE( ff_t(:,:) >= 0._wp ) 254 zht_i_ini(:,:) = rn_hti_ini_n * zswitch(:,:) 255 zht_s_ini(:,:) = rn_hts_ini_n * zswitch(:,:) 256 zat_i_ini(:,:) = rn_ati_ini_n * zswitch(:,:) 257 zsm_i_ini(:,:) = rn_smi_ini_n * zswitch(:,:) 258 ztm_i_ini(:,:) = rn_tmi_ini_n * zswitch(:,:) 259 zt_su_ini(:,:) = rn_tsu_ini_n * zswitch(:,:) 260 ztm_s_ini(:,:) = rn_tms_ini_n * zswitch(:,:) 261 zapnd_ini(:,:) = rn_apd_ini_n * zswitch(:,:) * zat_i_ini(:,:) ! rn_apd = pond fraction => rn_apd * a_i = pond conc. 262 zhpnd_ini(:,:) = rn_hpd_ini_n * zswitch(:,:) 263 ELSEWHERE 264 zht_i_ini(:,:) = rn_hti_ini_s * zswitch(:,:) 265 zht_s_ini(:,:) = rn_hts_ini_s * zswitch(:,:) 266 zat_i_ini(:,:) = rn_ati_ini_s * zswitch(:,:) 267 zsm_i_ini(:,:) = rn_smi_ini_s * zswitch(:,:) 268 ztm_i_ini(:,:) = rn_tmi_ini_s * zswitch(:,:) 269 zt_su_ini(:,:) = rn_tsu_ini_s * zswitch(:,:) 270 ztm_s_ini(:,:) = rn_tms_ini_s * zswitch(:,:) 271 zapnd_ini(:,:) = rn_apd_ini_s * zswitch(:,:) * zat_i_ini(:,:) ! rn_apd = pond fraction => rn_apd * a_i = pond conc. 272 zhpnd_ini(:,:) = rn_hpd_ini_s * zswitch(:,:) 273 END WHERE 274 ! 275 ENDIF 276 277 278 279 ! make sure ponds = 0 if no ponds scheme 280 IF ( .NOT.ln_pnd ) THEN 281 zapnd_ini(:,:) = 0._wp 282 zhpnd_ini(:,:) = 0._wp 283 ENDIF 284 285 !-------------! 286 ! fill fields ! 287 !-------------! 288 ! select ice covered grid points 289 npti = 0 ; nptidx(:) = 0 290 DO_2D_11_11 291 IF ( zht_i_ini(ji,jj) > 0._wp ) THEN 292 npti = npti + 1 293 nptidx(npti) = (jj - 1) * jpi + ji 294 ENDIF 295 END_2D 296 297 ! move to 1D arrays: (jpi,jpj) -> (jpi*jpj) 298 CALL tab_2d_1d( npti, nptidx(1:npti), h_i_1d (1:npti) , zht_i_ini ) 299 CALL tab_2d_1d( npti, nptidx(1:npti), h_s_1d (1:npti) , zht_s_ini ) 300 CALL tab_2d_1d( npti, nptidx(1:npti), at_i_1d(1:npti) , zat_i_ini ) 301 CALL tab_2d_1d( npti, nptidx(1:npti), t_i_1d (1:npti,1), ztm_i_ini ) 302 CALL tab_2d_1d( npti, nptidx(1:npti), t_s_1d (1:npti,1), ztm_s_ini ) 303 CALL tab_2d_1d( npti, nptidx(1:npti), t_su_1d(1:npti) , zt_su_ini ) 304 CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d (1:npti) , zsm_i_ini ) 305 CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_1d(1:npti) , zapnd_ini ) 306 CALL tab_2d_1d( npti, nptidx(1:npti), h_ip_1d(1:npti) , zhpnd_ini ) 307 308 ! allocate temporary arrays 309 ALLOCATE( zhi_2d(npti,jpl), zhs_2d(npti,jpl), zai_2d (npti,jpl), & 310 & zti_2d(npti,jpl), zts_2d(npti,jpl), ztsu_2d(npti,jpl), zsi_2d(npti,jpl), zaip_2d(npti,jpl), zhip_2d(npti,jpl) ) 311 312 ! distribute 1-cat into jpl-cat: (jpi*jpj) -> (jpi*jpj,jpl) 313 CALL ice_var_itd( h_i_1d(1:npti) , h_s_1d(1:npti) , at_i_1d(1:npti), & 314 & zhi_2d , zhs_2d , zai_2d , & 315 & t_i_1d(1:npti,1), t_s_1d(1:npti,1), t_su_1d(1:npti), s_i_1d(1:npti), a_ip_1d(1:npti), h_ip_1d(1:npti), & 316 & zti_2d , zts_2d , ztsu_2d , zsi_2d , zaip_2d , zhip_2d ) 317 318 ! move to 3D arrays: (jpi*jpj,jpl) -> (jpi,jpj,jpl) 319 DO jl = 1, jpl 320 zti_3d(:,:,jl) = rt0 * tmask(:,:,1) 321 zts_3d(:,:,jl) = rt0 * tmask(:,:,1) 322 END DO 323 CALL tab_2d_3d( npti, nptidx(1:npti), zhi_2d , h_i ) 324 CALL tab_2d_3d( npti, nptidx(1:npti), zhs_2d , h_s ) 325 CALL tab_2d_3d( npti, nptidx(1:npti), zai_2d , a_i ) 326 CALL tab_2d_3d( npti, nptidx(1:npti), zti_2d , zti_3d ) 327 CALL tab_2d_3d( npti, nptidx(1:npti), zts_2d , zts_3d ) 328 CALL tab_2d_3d( npti, nptidx(1:npti), ztsu_2d , t_su ) 329 CALL tab_2d_3d( npti, nptidx(1:npti), zsi_2d , s_i ) 330 CALL tab_2d_3d( npti, nptidx(1:npti), zaip_2d , a_ip ) 331 CALL tab_2d_3d( npti, nptidx(1:npti), zhip_2d , h_ip ) 332 333 ! deallocate temporary arrays 334 DEALLOCATE( zhi_2d, zhs_2d, zai_2d , & 335 & zti_2d, zts_2d, ztsu_2d, zsi_2d, zaip_2d, zhip_2d ) 336 337 ! calculate extensive and intensive variables 338 CALL ice_var_salprof ! for sz_i 339 DO jl = 1, jpl 340 DO_2D_11_11 341 v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl) 342 v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl) 343 sv_i(ji,jj,jl) = MIN( MAX( rn_simin , s_i(ji,jj,jl) ) , rn_simax ) * v_i(ji,jj,jl) 344 END_2D 345 END DO 346 ! 347 DO jl = 1, jpl 348 DO_3D_11_11( 1, nlay_s ) 349 t_s(ji,jj,jk,jl) = zts_3d(ji,jj,jl) 350 e_s(ji,jj,jk,jl) = zswitch(ji,jj) * v_s(ji,jj,jl) * r1_nlay_s * & 351 & rhos * ( rcpi * ( rt0 - t_s(ji,jj,jk,jl) ) + rLfus ) 352 END_3D 353 END DO 354 ! 355 DO jl = 1, jpl 356 DO_3D_11_11( 1, nlay_i ) 357 t_i (ji,jj,jk,jl) = zti_3d(ji,jj,jl) 358 ztmelts = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 ! melting temperature in K 359 e_i(ji,jj,jk,jl) = zswitch(ji,jj) * v_i(ji,jj,jl) * r1_nlay_i * & 360 & rhoi * ( rcpi * ( ztmelts - t_i(ji,jj,jk,jl) ) + & 361 & rLfus * ( 1._wp - (ztmelts-rt0) / MIN( (t_i(ji,jj,jk,jl)-rt0), -epsi20 ) ) & 362 & - rcp * ( ztmelts - rt0 ) ) 363 END_3D 364 END DO 365 366 ! Melt ponds 367 WHERE( a_i > epsi10 ) 368 a_ip_frac(:,:,:) = a_ip(:,:,:) / a_i(:,:,:) 369 ELSEWHERE 370 a_ip_frac(:,:,:) = 0._wp 176 371 END WHERE 372 v_ip(:,:,:) = h_ip(:,:,:) * a_ip(:,:,:) 373 374 ! specific temperatures for coupled runs 375 tn_ice(:,:,:) = t_su(:,:,:) 376 t1_ice(:,:,:) = t_i (:,:,1,:) 177 377 ! 178 CALL fld_read( kt, 1, si ) ! input fields provided at the current time-step 179 ! 180 ! -- mandatory fields -- ! 181 zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1) * tmask(:,:,1) 182 zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1) * tmask(:,:,1) 183 zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1) * tmask(:,:,1) 184 185 ! -- optional fields -- ! 186 ! if fields do not exist then set them to the values present in the namelist (except for snow and surface temperature) 187 ! 188 ! ice salinity 189 IF( TRIM(si(jp_smi)%clrootname) == 'NOT USED' ) & 190 & si(jp_smi)%fnow(:,:,1) = ( rn_smi_ini_n * zswitch + rn_smi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 191 ! 192 ! temperatures 193 IF ( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. & 194 & TRIM(si(jp_tms)%clrootname) == 'NOT USED' ) THEN 195 si(jp_tmi)%fnow(:,:,1) = ( rn_tmi_ini_n * zswitch + rn_tmi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 196 si(jp_tsu)%fnow(:,:,1) = ( rn_tsu_ini_n * zswitch + rn_tsu_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 197 si(jp_tms)%fnow(:,:,1) = ( rn_tms_ini_n * zswitch + rn_tms_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 198 ELSEIF( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tms)%clrootname) /= 'NOT USED' ) THEN ! if T_s is read and not T_i, set T_i = (T_s + T_freeze)/2 199 si(jp_tmi)%fnow(:,:,1) = 0.5_wp * ( si(jp_tms)%fnow(:,:,1) + 271.15 ) 200 ELSEIF( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) /= 'NOT USED' ) THEN ! if T_su is read and not T_i, set T_i = (T_su + T_freeze)/2 201 si(jp_tmi)%fnow(:,:,1) = 0.5_wp * ( si(jp_tsu)%fnow(:,:,1) + 271.15 ) 202 ELSEIF( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tms)%clrootname) /= 'NOT USED' ) THEN ! if T_s is read and not T_su, set T_su = T_s 203 si(jp_tsu)%fnow(:,:,1) = si(jp_tms)%fnow(:,:,1) 204 ELSEIF( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN ! if T_i is read and not T_su, set T_su = T_i 205 si(jp_tsu)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 206 ELSEIF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tsu)%clrootname) /= 'NOT USED' ) THEN ! if T_su is read and not T_s, set T_s = T_su 207 si(jp_tms)%fnow(:,:,1) = si(jp_tsu)%fnow(:,:,1) 208 ELSEIF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN ! if T_i is read and not T_s, set T_s = T_i 209 si(jp_tms)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 210 ENDIF 211 ! 212 ! pond concentration 213 IF( TRIM(si(jp_apd)%clrootname) == 'NOT USED' ) & 214 & si(jp_apd)%fnow(:,:,1) = ( rn_apd_ini_n * zswitch + rn_apd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) & ! rn_apd = pond fraction => rn_apnd * a_i = pond conc. 215 & * si(jp_ati)%fnow(:,:,1) 216 ! 217 ! pond depth 218 IF( TRIM(si(jp_hpd)%clrootname) == 'NOT USED' ) & 219 & si(jp_hpd)%fnow(:,:,1) = ( rn_hpd_ini_n * zswitch + rn_hpd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 220 ! 221 zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) * tmask(:,:,1) 222 ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) * tmask(:,:,1) 223 zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1) * tmask(:,:,1) 224 ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1) * tmask(:,:,1) 225 zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1) * tmask(:,:,1) 226 zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1) * tmask(:,:,1) 227 ! 228 ! change the switch for the following 229 WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1) 230 ELSEWHERE ; zswitch(:,:) = 0._wp 378 379 #if defined key_agrif 380 ELSE 381 382 Agrif_SpecialValue = -9999. 383 Agrif_UseSpecialValue = .TRUE. 384 CALL Agrif_init_variable(tra_iceini_id,procname=interp_tra_ice) 385 use_sign_north = .TRUE. 386 sign_north = -1. 387 CALL Agrif_init_variable(u_iceini_id ,procname=interp_u_ice) 388 CALL Agrif_init_variable(v_iceini_id ,procname=interp_v_ice) 389 Agrif_SpecialValue = 0._wp 390 use_sign_north = .FALSE. 391 Agrif_UseSpecialValue = .FALSE. 392 ! lbc ???? 393 ! Here we know : a_i, v_i, v_s, sv_i, oa_i, a_ip, v_ip, t_su, e_s, e_i 394 CALL ice_var_glo2eqv 395 CALL ice_var_zapsmall 396 CALL ice_var_agg(2) 397 398 ! Melt ponds 399 WHERE( a_i > epsi10 ) 400 a_ip_frac(:,:,:) = a_ip(:,:,:) / a_i(:,:,:) 401 ELSEWHERE 402 a_ip_frac(:,:,:) = 0._wp 231 403 END WHERE 232 ! !---------------! 233 ELSE ! Read namelist ! 234 ! !---------------! 235 ! no ice if (sst - Tfreez) >= thresold 236 WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst ) ; zswitch(:,:) = 0._wp 237 ELSEWHERE ; zswitch(:,:) = tmask(:,:,1) 238 END WHERE 239 ! 240 ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array 241 WHERE( ff_t(:,:) >= 0._wp ) 242 zht_i_ini(:,:) = rn_hti_ini_n * zswitch(:,:) 243 zht_s_ini(:,:) = rn_hts_ini_n * zswitch(:,:) 244 zat_i_ini(:,:) = rn_ati_ini_n * zswitch(:,:) 245 zsm_i_ini(:,:) = rn_smi_ini_n * zswitch(:,:) 246 ztm_i_ini(:,:) = rn_tmi_ini_n * zswitch(:,:) 247 zt_su_ini(:,:) = rn_tsu_ini_n * zswitch(:,:) 248 ztm_s_ini(:,:) = rn_tms_ini_n * zswitch(:,:) 249 zapnd_ini(:,:) = rn_apd_ini_n * zswitch(:,:) * zat_i_ini(:,:) ! rn_apd = pond fraction => rn_apd * a_i = pond conc. 250 zhpnd_ini(:,:) = rn_hpd_ini_n * zswitch(:,:) 404 WHERE( a_ip > 0._wp ) ! ??????? 405 h_ip(:,:,:) = v_ip(:,:,:) / a_ip(:,:,:) 251 406 ELSEWHERE 252 zht_i_ini(:,:) = rn_hti_ini_s * zswitch(:,:) 253 zht_s_ini(:,:) = rn_hts_ini_s * zswitch(:,:) 254 zat_i_ini(:,:) = rn_ati_ini_s * zswitch(:,:) 255 zsm_i_ini(:,:) = rn_smi_ini_s * zswitch(:,:) 256 ztm_i_ini(:,:) = rn_tmi_ini_s * zswitch(:,:) 257 zt_su_ini(:,:) = rn_tsu_ini_s * zswitch(:,:) 258 ztm_s_ini(:,:) = rn_tms_ini_s * zswitch(:,:) 259 zapnd_ini(:,:) = rn_apd_ini_s * zswitch(:,:) * zat_i_ini(:,:) ! rn_apd = pond fraction => rn_apd * a_i = pond conc. 260 zhpnd_ini(:,:) = rn_hpd_ini_s * zswitch(:,:) 261 END WHERE 262 ! 263 ENDIF 264 265 ! make sure ponds = 0 if no ponds scheme 266 IF ( .NOT.ln_pnd ) THEN 267 zapnd_ini(:,:) = 0._wp 268 zhpnd_ini(:,:) = 0._wp 269 ENDIF 270 271 !-------------! 272 ! fill fields ! 273 !-------------! 274 ! select ice covered grid points 275 npti = 0 ; nptidx(:) = 0 276 DO_2D_11_11 277 IF ( zht_i_ini(ji,jj) > 0._wp ) THEN 278 npti = npti + 1 279 nptidx(npti) = (jj - 1) * jpi + ji 280 ENDIF 281 END_2D 282 283 ! move to 1D arrays: (jpi,jpj) -> (jpi*jpj) 284 CALL tab_2d_1d( npti, nptidx(1:npti), h_i_1d (1:npti) , zht_i_ini ) 285 CALL tab_2d_1d( npti, nptidx(1:npti), h_s_1d (1:npti) , zht_s_ini ) 286 CALL tab_2d_1d( npti, nptidx(1:npti), at_i_1d(1:npti) , zat_i_ini ) 287 CALL tab_2d_1d( npti, nptidx(1:npti), t_i_1d (1:npti,1), ztm_i_ini ) 288 CALL tab_2d_1d( npti, nptidx(1:npti), t_s_1d (1:npti,1), ztm_s_ini ) 289 CALL tab_2d_1d( npti, nptidx(1:npti), t_su_1d(1:npti) , zt_su_ini ) 290 CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d (1:npti) , zsm_i_ini ) 291 CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_1d(1:npti) , zapnd_ini ) 292 CALL tab_2d_1d( npti, nptidx(1:npti), h_ip_1d(1:npti) , zhpnd_ini ) 293 294 ! allocate temporary arrays 295 ALLOCATE( zhi_2d(npti,jpl), zhs_2d(npti,jpl), zai_2d (npti,jpl), & 296 & zti_2d(npti,jpl), zts_2d(npti,jpl), ztsu_2d(npti,jpl), zsi_2d(npti,jpl), zaip_2d(npti,jpl), zhip_2d(npti,jpl) ) 297 298 ! distribute 1-cat into jpl-cat: (jpi*jpj) -> (jpi*jpj,jpl) 299 CALL ice_var_itd( h_i_1d(1:npti) , h_s_1d(1:npti) , at_i_1d(1:npti), & 300 & zhi_2d , zhs_2d , zai_2d , & 301 & t_i_1d(1:npti,1), t_s_1d(1:npti,1), t_su_1d(1:npti), s_i_1d(1:npti), a_ip_1d(1:npti), h_ip_1d(1:npti), & 302 & zti_2d , zts_2d , ztsu_2d , zsi_2d , zaip_2d , zhip_2d ) 303 304 ! move to 3D arrays: (jpi*jpj,jpl) -> (jpi,jpj,jpl) 305 DO jl = 1, jpl 306 zti_3d(:,:,jl) = rt0 * tmask(:,:,1) 307 zts_3d(:,:,jl) = rt0 * tmask(:,:,1) 308 END DO 309 CALL tab_2d_3d( npti, nptidx(1:npti), zhi_2d , h_i ) 310 CALL tab_2d_3d( npti, nptidx(1:npti), zhs_2d , h_s ) 311 CALL tab_2d_3d( npti, nptidx(1:npti), zai_2d , a_i ) 312 CALL tab_2d_3d( npti, nptidx(1:npti), zti_2d , zti_3d ) 313 CALL tab_2d_3d( npti, nptidx(1:npti), zts_2d , zts_3d ) 314 CALL tab_2d_3d( npti, nptidx(1:npti), ztsu_2d , t_su ) 315 CALL tab_2d_3d( npti, nptidx(1:npti), zsi_2d , s_i ) 316 CALL tab_2d_3d( npti, nptidx(1:npti), zaip_2d , a_ip ) 317 CALL tab_2d_3d( npti, nptidx(1:npti), zhip_2d , h_ip ) 318 319 ! deallocate temporary arrays 320 DEALLOCATE( zhi_2d, zhs_2d, zai_2d , & 321 & zti_2d, zts_2d, ztsu_2d, zsi_2d, zaip_2d, zhip_2d ) 322 323 ! calculate extensive and intensive variables 324 CALL ice_var_salprof ! for sz_i 325 DO jl = 1, jpl 326 DO_2D_11_11 327 v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl) 328 v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl) 329 sv_i(ji,jj,jl) = MIN( MAX( rn_simin , s_i(ji,jj,jl) ) , rn_simax ) * v_i(ji,jj,jl) 330 END_2D 331 END DO 332 ! 333 DO jl = 1, jpl 334 DO_3D_11_11( 1, nlay_s ) 335 t_s(ji,jj,jk,jl) = zts_3d(ji,jj,jl) 336 e_s(ji,jj,jk,jl) = zswitch(ji,jj) * v_s(ji,jj,jl) * r1_nlay_s * & 337 & rhos * ( rcpi * ( rt0 - t_s(ji,jj,jk,jl) ) + rLfus ) 338 END_3D 339 END DO 340 ! 341 DO jl = 1, jpl 342 DO_3D_11_11( 1, nlay_i ) 343 t_i (ji,jj,jk,jl) = zti_3d(ji,jj,jl) 344 ztmelts = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 ! melting temperature in K 345 e_i(ji,jj,jk,jl) = zswitch(ji,jj) * v_i(ji,jj,jl) * r1_nlay_i * & 346 & rhoi * ( rcpi * ( ztmelts - t_i(ji,jj,jk,jl) ) + & 347 & rLfus * ( 1._wp - (ztmelts-rt0) / MIN( (t_i(ji,jj,jk,jl)-rt0), -epsi20 ) ) & 348 & - rcp * ( ztmelts - rt0 ) ) 349 END_3D 350 END DO 351 352 ! Melt ponds 353 WHERE( a_i > epsi10 ) 354 a_ip_frac(:,:,:) = a_ip(:,:,:) / a_i(:,:,:) 355 ELSEWHERE 356 a_ip_frac(:,:,:) = 0._wp 357 END WHERE 358 v_ip(:,:,:) = h_ip(:,:,:) * a_ip(:,:,:) 359 360 ! specific temperatures for coupled runs 361 tn_ice(:,:,:) = t_su(:,:,:) 362 t1_ice(:,:,:) = t_i (:,:,1,:) 363 ! 407 h_ip(:,:,:) = 0._wp 408 END WHERE 409 410 tn_ice(:,:,:) = t_su(:,:,:) 411 t1_ice(:,:,:) = t_i (:,:,1,:) 412 #endif 413 ENDIF ! Agrif_Root 364 414 ENDIF ! ln_iceini 365 415 ! -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/ICE/icestp.F90
r12489 r13026 240 240 CALL par_init ! set some ice run parameters 241 241 ! 242 #if defined key_agrif 243 CALL Agrif_Declare_Var_ice ! " " " " " Sea ice 244 #endif 245 ! 242 246 ! ! Allocate the ice arrays (sbc_ice already allocated in sbc_init) 243 247 ierr = ice_alloc () ! ice variables -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_ice.F90
r10068 r13026 16 16 17 17 INTEGER, PUBLIC :: u_ice_id, v_ice_id, tra_ice_id 18 INTEGER, PUBLIC :: u_iceini_id, v_iceini_id, tra_iceini_id 18 19 INTEGER, PUBLIC :: nbstep_ice = 0 ! child time position in sea-ice model 19 20 -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_ice_interp.F90
r10069 r13026 14 14 !!---------------------------------------------------------------------- 15 15 !! agrif_interp_ice : interpolation of ice at "after" sea-ice time step 16 !! agrif_interp_u_ice : atomic routine to interpolate u_ice17 !! agrif_interp_v_ice : atomic routine to interpolate v_ice18 !! agrif_interp_tra_ice : atomic routine to interpolate ice properties16 !! interp_u_ice : atomic routine to interpolate u_ice 17 !! interp_v_ice : atomic routine to interpolate v_ice 18 !! interp_tra_ice : atomic routine to interpolate ice properties 19 19 !!---------------------------------------------------------------------- 20 20 USE par_oce … … 23 23 USE ice 24 24 USE agrif_ice 25 USE agrif_oce 25 26 USE phycst , ONLY: rt0 26 27 … … 29 30 30 31 PUBLIC agrif_interp_ice ! called by agrif_user.F90 32 PUBLIC interp_tra_ice, interp_u_ice, interp_v_ice ! called by iceistate.F90 31 33 32 34 !!---------------------------------------------------------------------- … … 68 70 Agrif_SpecialValue = -9999. 69 71 Agrif_UseSpecialValue = .TRUE. 72 73 use_sign_north = .TRUE. 74 sign_north = -1. 75 if (cd_type == 'T') use_sign_north = .FALSE. 76 70 77 SELECT CASE( cd_type ) 71 78 CASE('U') ; CALL Agrif_Bc_variable( u_ice_id , procname=interp_u_ice , calledweight=zbeta ) … … 75 82 Agrif_SpecialValue = 0._wp 76 83 Agrif_UseSpecialValue = .FALSE. 84 85 use_sign_north = .FALSE. 77 86 ! 78 87 END SUBROUTINE agrif_interp_ice … … 156 165 ! and it is ok since we conserve tracers (same as in the ocean). 157 166 ALLOCATE( ztab(SIZE(a_i,1),SIZE(a_i,2),SIZE(ptab,3)) ) 158 167 159 168 IF( before ) THEN ! parent grid 160 169 jm = 1 -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_ice_update.F90
r12377 r13026 1 #define TWO_WAY 1 2 #undef DECAL_FEEDBACK /* SEPARATION of INTERFACES*/ 2 3 … … 66 67 CALL Agrif_Update_Variable( tra_ice_id , locupdate=(/1,0/), procname = update_tra_ice ) 67 68 #endif 69 use_sign_north = .TRUE. 70 sign_north = -1. 71 68 72 # if ! defined DECAL_FEEDBACK 69 73 CALL Agrif_Update_Variable( u_ice_id , procname = update_u_ice ) … … 73 77 CALL Agrif_Update_Variable( v_ice_id , locupdate1=(/1,-2/),locupdate2=(/0,-1/),procname=update_v_ice) 74 78 #endif 79 use_sign_north = .FALSE. 75 80 ! CALL Agrif_Update_Variable( tra_ice_id , locupdate=(/0,2/), procname = update_tra_ice ) 76 81 ! CALL Agrif_Update_Variable( u_ice_id , locupdate=(/0,1/), procname = update_u_ice ) -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce.F90
r12377 r13026 29 29 ! 30 30 INTEGER , PUBLIC, PARAMETER :: nn_sponge_len = 2 !: Sponge width (in number of parent grid points) 31 LOGICAL , PUBLIC :: ln_bry_south = .TRUE. !: Is the South boundary open ? 32 31 33 LOGICAL , PUBLIC :: spongedoneT = .FALSE. !: tracer sponge layer indicator 32 34 LOGICAL , PUBLIC :: spongedoneU = .FALSE. !: dynamics sponge layer indicator … … 49 51 INTEGER , PUBLIC, SAVE :: Kbb_a, Kmm_a, Krhs_a !: AGRIF module-specific copies of time-level indices 50 52 51 # if defined key_vertical52 53 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ht0_parent, hu0_parent, hv0_parent 53 54 INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: mbkt_parent, mbku_parent, mbkv_parent 54 # endif55 55 56 56 INTEGER, PUBLIC :: tsn_id ! AGRIF profile for tracers interpolation and update … … 58 58 INTEGER, PUBLIC :: un_update_id, vn_update_id ! AGRIF profiles for udpates 59 59 INTEGER, PUBLIC :: tsn_sponge_id, un_sponge_id, vn_sponge_id ! AGRIF profiles for sponge layers 60 INTEGER, PUBLIC :: tsini_id, uini_id, vini_id, sshini_id ! AGRIF profile for initialization 60 61 # if defined key_top 61 62 INTEGER, PUBLIC :: trn_id, trn_sponge_id … … 68 69 INTEGER, PUBLIC :: mbkt_id, ht0_id 69 70 INTEGER, PUBLIC :: kindic_agr 71 72 ! North fold 73 !$AGRIF_DO_NOT_TREAT 74 LOGICAL, PUBLIC :: use_sign_north 75 REAL, PUBLIC :: sign_north 76 LOGICAL, PUBLIC :: l_ini_child = .FALSE. 77 # if defined key_vertical 78 LOGICAL, PUBLIC :: l_vremap = .TRUE. 79 # else 80 LOGICAL, PUBLIC :: l_vremap = .FALSE. 81 # endif 82 !$AGRIF_END_DO_NOT_TREAT 70 83 71 84 !!---------------------------------------------------------------------- … … 91 104 & tabspongedone_trn(jpi,jpj), & 92 105 # endif 93 # if defined key_vertical94 106 & ht0_parent(jpi,jpj), mbkt_parent(jpi,jpj), & 95 107 & hu0_parent(jpi,jpj), mbku_parent(jpi,jpj), & 96 108 & hv0_parent(jpi,jpj), mbkv_parent(jpi,jpj), & 97 # endif98 109 & tabspongedone_u (jpi,jpj), & 99 110 & tabspongedone_v (jpi,jpj), STAT = ierr(1) ) -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce_interp.F90
r12377 r13026 34 34 USE lib_mpp 35 35 USE vremap 36 USE lbclnk 36 37 37 38 IMPLICIT NONE … … 44 45 PUBLIC interpunb, interpvnb , interpub2b, interpvb2b 45 46 PUBLIC interpe3t 46 #if defined key_vertical47 47 PUBLIC interpht0, interpmbkt 48 # endif 48 PUBLIC agrif_initts, agrif_initssh 49 49 50 INTEGER :: bdy_tinterp = 0 50 51 … … 89 90 Agrif_UseSpecialValue = ln_spc_dyn 90 91 ! 92 use_sign_north = .TRUE. 93 sign_north = -1. 91 94 CALL Agrif_Bc_variable( un_interp_id, procname=interpun ) 92 95 CALL Agrif_Bc_variable( vn_interp_id, procname=interpvn ) 96 use_sign_north = .FALSE. 93 97 ! 94 98 Agrif_UseSpecialValue = .FALSE. 95 99 ! 96 100 ! --- West --- ! 97 ibdy1 = 2 98 ibdy2 = 1+nbghostcells 99 ! 100 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 101 IF( lk_west ) THEN 102 ibdy1 = 2 103 ibdy2 = 1+nbghostcells 104 ! 105 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 106 DO ji = mi0(ibdy1), mi1(ibdy2) 107 uu_b(ji,:,Krhs_a) = 0._wp 108 109 DO jk = 1, jpkm1 110 DO jj = 1, jpj 111 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 112 END DO 113 END DO 114 115 DO jj = 1, jpj 116 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) * r1_hu(ji,jj,Krhs_a) 117 END DO 118 END DO 119 ENDIF 120 ! 101 121 DO ji = mi0(ibdy1), mi1(ibdy2) 102 uu_b(ji,:,Krhs_a) = 0._wp 103 122 zub(ji,:) = 0._wp ! Correct transport 104 123 DO jk = 1, jpkm1 105 124 DO jj = 1, jpj 106 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 107 END DO 108 END DO 109 110 DO jj = 1, jpj 111 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) * r1_hu(ji,jj,Krhs_a) 112 END DO 113 END DO 114 ENDIF 115 ! 116 DO ji = mi0(ibdy1), mi1(ibdy2) 117 zub(ji,:) = 0._wp ! Correct transport 118 DO jk = 1, jpkm1 119 DO jj = 1, jpj 120 zub(ji,jj) = zub(ji,jj) & 121 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a)*umask(ji,jj,jk) 122 END DO 123 END DO 124 DO jj=1,jpj 125 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 126 END DO 127 128 DO jk = 1, jpkm1 129 DO jj = 1, jpj 130 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) + uu_b(ji,jj,Krhs_a)-zub(ji,jj)) * umask(ji,jj,jk) 131 END DO 132 END DO 133 END DO 134 135 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 136 DO ji = mi0(ibdy1), mi1(ibdy2) 137 zvb(ji,:) = 0._wp 125 zub(ji,jj) = zub(ji,jj) & 126 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a)*umask(ji,jj,jk) 127 END DO 128 END DO 129 DO jj=1,jpj 130 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 131 END DO 132 138 133 DO jk = 1, jpkm1 139 134 DO jj = 1, jpj 140 zvb(ji,jj) = zvb(ji,jj) + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 141 END DO 142 END DO 143 DO jj = 1, jpj 144 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 145 END DO 135 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) + uu_b(ji,jj,Krhs_a)-zub(ji,jj)) * umask(ji,jj,jk) 136 END DO 137 END DO 138 END DO 139 140 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 141 DO ji = mi0(ibdy1), mi1(ibdy2) 142 zvb(ji,:) = 0._wp 143 DO jk = 1, jpkm1 144 DO jj = 1, jpj 145 zvb(ji,jj) = zvb(ji,jj) + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 146 END DO 147 END DO 148 DO jj = 1, jpj 149 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 150 END DO 151 DO jk = 1, jpkm1 152 DO jj = 1, jpj 153 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) + vv_b(ji,jj,Krhs_a)-zvb(ji,jj))*vmask(ji,jj,jk) 154 END DO 155 END DO 156 END DO 157 ENDIF 158 ENDIF 159 160 ! --- East --- ! 161 IF( lk_east) THEN 162 ibdy1 = jpiglo-1-nbghostcells 163 ibdy2 = jpiglo-2 164 ! 165 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 166 DO ji = mi0(ibdy1), mi1(ibdy2) 167 uu_b(ji,:,Krhs_a) = 0._wp 168 DO jk = 1, jpkm1 169 DO jj = 1, jpj 170 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) & 171 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 172 END DO 173 END DO 174 DO jj = 1, jpj 175 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) * r1_hu(ji,jj,Krhs_a) 176 END DO 177 END DO 178 ENDIF 179 ! 180 DO ji = mi0(ibdy1), mi1(ibdy2) 181 zub(ji,:) = 0._wp ! Correct transport 146 182 DO jk = 1, jpkm1 147 183 DO jj = 1, jpj 148 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) + vv_b(ji,jj,Krhs_a)-zvb(ji,jj))*vmask(ji,jj,jk) 149 END DO 150 END DO 151 END DO 152 ENDIF 153 154 ! --- East --- ! 155 ibdy1 = jpiglo-1-nbghostcells 156 ibdy2 = jpiglo-2 157 ! 158 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 159 DO ji = mi0(ibdy1), mi1(ibdy2) 160 uu_b(ji,:,Krhs_a) = 0._wp 184 zub(ji,jj) = zub(ji,jj) & 185 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 186 END DO 187 END DO 188 DO jj=1,jpj 189 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 190 END DO 191 161 192 DO jk = 1, jpkm1 162 193 DO jj = 1, jpj 163 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) & 164 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 165 END DO 166 END DO 167 DO jj = 1, jpj 168 uu_b(ji,jj,Krhs_a) = uu_b(ji,jj,Krhs_a) * r1_hu(ji,jj,Krhs_a) 169 END DO 170 END DO 171 ENDIF 172 ! 173 DO ji = mi0(ibdy1), mi1(ibdy2) 174 zub(ji,:) = 0._wp ! Correct transport 175 DO jk = 1, jpkm1 176 DO jj = 1, jpj 177 zub(ji,jj) = zub(ji,jj) & 178 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 179 END DO 180 END DO 181 DO jj=1,jpj 182 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 183 END DO 184 185 DO jk = 1, jpkm1 186 DO jj = 1, jpj 187 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 188 & + uu_b(ji,jj,Krhs_a)-zub(ji,jj))*umask(ji,jj,jk) 189 END DO 190 END DO 191 END DO 192 193 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 194 ibdy1 = jpiglo-nbghostcells 195 ibdy2 = jpiglo-1 196 DO ji = mi0(ibdy1), mi1(ibdy2) 197 zvb(ji,:) = 0._wp 198 DO jk = 1, jpkm1 194 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 195 & + uu_b(ji,jj,Krhs_a)-zub(ji,jj))*umask(ji,jj,jk) 196 END DO 197 END DO 198 END DO 199 200 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 201 ibdy1 = jpiglo-nbghostcells 202 ibdy2 = jpiglo-1 203 DO ji = mi0(ibdy1), mi1(ibdy2) 204 zvb(ji,:) = 0._wp 205 DO jk = 1, jpkm1 206 DO jj = 1, jpj 207 zvb(ji,jj) = zvb(ji,jj) & 208 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 209 END DO 210 END DO 199 211 DO jj = 1, jpj 200 zvb(ji,jj) = zvb(ji,jj) & 212 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 213 END DO 214 DO jk = 1, jpkm1 215 DO jj = 1, jpj 216 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 217 & + vv_b(ji,jj,Krhs_a)-zvb(ji,jj)) * vmask(ji,jj,jk) 218 END DO 219 END DO 220 END DO 221 ENDIF 222 ENDIF 223 224 ! --- South --- ! 225 IF( lk_south ) THEN 226 jbdy1 = 2 227 jbdy2 = 1+nbghostcells 228 ! 229 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 230 DO jj = mj0(jbdy1), mj1(jbdy2) 231 vv_b(:,jj,Krhs_a) = 0._wp 232 DO jk = 1, jpkm1 233 DO ji = 1, jpi 234 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) & 235 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 236 END DO 237 END DO 238 DO ji=1,jpi 239 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) * r1_hv(ji,jj,Krhs_a) 240 END DO 241 END DO 242 ENDIF 243 ! 244 DO jj = mj0(jbdy1), mj1(jbdy2) 245 zvb(:,jj) = 0._wp ! Correct transport 246 DO jk=1,jpkm1 247 DO ji=1,jpi 248 zvb(ji,jj) = zvb(ji,jj) & 201 249 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 202 250 END DO 203 251 END DO 204 DO j j = 1, jpj252 DO ji = 1, jpi 205 253 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 206 254 END DO 207 DO jk = 1, jpkm1 208 DO jj = 1, jpj 209 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 210 & + vv_b(ji,jj,Krhs_a)-zvb(ji,jj)) * vmask(ji,jj,jk) 211 END DO 212 END DO 213 END DO 214 ENDIF 215 216 ! --- South --- ! 217 jbdy1 = 2 218 jbdy2 = 1+nbghostcells 219 ! 220 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 221 DO jj = mj0(jbdy1), mj1(jbdy2) 222 vv_b(:,jj,Krhs_a) = 0._wp 255 223 256 DO jk = 1, jpkm1 224 257 DO ji = 1, jpi 225 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) & 226 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 227 END DO 228 END DO 229 DO ji=1,jpi 230 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) * r1_hv(ji,jj,Krhs_a) 231 END DO 232 END DO 233 ENDIF 234 ! 235 DO jj = mj0(jbdy1), mj1(jbdy2) 236 zvb(:,jj) = 0._wp ! Correct transport 237 DO jk=1,jpkm1 238 DO ji=1,jpi 239 zvb(ji,jj) = zvb(ji,jj) & 240 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 241 END DO 242 END DO 243 DO ji = 1, jpi 244 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 245 END DO 246 247 DO jk = 1, jpkm1 258 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 259 & + vv_b(ji,jj,Krhs_a) - zvb(ji,jj) ) * vmask(ji,jj,jk) 260 END DO 261 END DO 262 END DO 263 264 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 265 DO jj = mj0(jbdy1), mj1(jbdy2) 266 zub(:,jj) = 0._wp 267 DO jk = 1, jpkm1 268 DO ji = 1, jpi 269 zub(ji,jj) = zub(ji,jj) & 270 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 271 END DO 272 END DO 273 DO ji = 1, jpi 274 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 275 END DO 276 277 DO jk = 1, jpkm1 278 DO ji = 1, jpi 279 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 280 & + uu_b(ji,jj,Krhs_a) - zub(ji,jj) ) * umask(ji,jj,jk) 281 END DO 282 END DO 283 END DO 284 ENDIF 285 ENDIF 286 287 ! --- North --- ! 288 IF( lk_north ) THEN 289 jbdy1 = jpjglo-1-nbghostcells 290 jbdy2 = jpjglo-2 291 ! 292 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 293 DO jj = mj0(jbdy1), mj1(jbdy2) 294 vv_b(:,jj,Krhs_a) = 0._wp 295 DO jk = 1, jpkm1 296 DO ji = 1, jpi 297 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) & 298 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 299 END DO 300 END DO 301 DO ji=1,jpi 302 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) * r1_hv(ji,jj,Krhs_a) 303 END DO 304 END DO 305 ENDIF 306 ! 307 DO jj = mj0(jbdy1), mj1(jbdy2) 308 zvb(:,jj) = 0._wp ! Correct transport 309 DO jk=1,jpkm1 310 DO ji=1,jpi 311 zvb(ji,jj) = zvb(ji,jj) & 312 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 313 END DO 314 END DO 248 315 DO ji = 1, jpi 249 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 250 & + vv_b(ji,jj,Krhs_a) - zvb(ji,jj) ) * vmask(ji,jj,jk) 251 END DO 252 END DO 253 END DO 254 255 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 256 DO jj = mj0(jbdy1), mj1(jbdy2) 257 zub(:,jj) = 0._wp 316 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 317 END DO 318 258 319 DO jk = 1, jpkm1 259 320 DO ji = 1, jpi 260 zub(ji,jj) = zub(ji,jj) & 261 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 262 END DO 263 END DO 264 DO ji = 1, jpi 265 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 266 END DO 321 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 322 & + vv_b(ji,jj,Krhs_a) - zvb(ji,jj) ) * vmask(ji,jj,jk) 323 END DO 324 END DO 325 END DO 267 326 268 DO jk = 1, jpkm1 327 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 328 jbdy1 = jpjglo-nbghostcells 329 jbdy2 = jpjglo-1 330 DO jj = mj0(jbdy1), mj1(jbdy2) 331 zub(:,jj) = 0._wp 332 DO jk = 1, jpkm1 333 DO ji = 1, jpi 334 zub(ji,jj) = zub(ji,jj) & 335 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 336 END DO 337 END DO 269 338 DO ji = 1, jpi 270 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 271 & + uu_b(ji,jj,Krhs_a) - zub(ji,jj) ) * umask(ji,jj,jk) 272 END DO 273 END DO 274 END DO 275 ENDIF 276 277 ! --- North --- ! 278 jbdy1 = jpjglo-1-nbghostcells 279 jbdy2 = jpjglo-2 280 ! 281 IF( .NOT.ln_dynspg_ts ) THEN ! Store transport 282 DO jj = mj0(jbdy1), mj1(jbdy2) 283 vv_b(:,jj,Krhs_a) = 0._wp 284 DO jk = 1, jpkm1 285 DO ji = 1, jpi 286 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) & 287 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 288 END DO 289 END DO 290 DO ji=1,jpi 291 vv_b(ji,jj,Krhs_a) = vv_b(ji,jj,Krhs_a) * r1_hv(ji,jj,Krhs_a) 292 END DO 293 END DO 294 ENDIF 295 ! 296 DO jj = mj0(jbdy1), mj1(jbdy2) 297 zvb(:,jj) = 0._wp ! Correct transport 298 DO jk=1,jpkm1 299 DO ji=1,jpi 300 zvb(ji,jj) = zvb(ji,jj) & 301 & + e3v(ji,jj,jk,Krhs_a) * vv(ji,jj,jk,Krhs_a) * vmask(ji,jj,jk) 302 END DO 303 END DO 304 DO ji = 1, jpi 305 zvb(ji,jj) = zvb(ji,jj) * r1_hv(ji,jj,Krhs_a) 306 END DO 307 308 DO jk = 1, jpkm1 309 DO ji = 1, jpi 310 vv(ji,jj,jk,Krhs_a) = ( vv(ji,jj,jk,Krhs_a) & 311 & + vv_b(ji,jj,Krhs_a) - zvb(ji,jj) ) * vmask(ji,jj,jk) 312 END DO 313 END DO 314 END DO 315 316 IF( ln_dynspg_ts ) THEN ! Set tangential velocities to time splitting estimate 317 jbdy1 = jpjglo-nbghostcells 318 jbdy2 = jpjglo-1 319 DO jj = mj0(jbdy1), mj1(jbdy2) 320 zub(:,jj) = 0._wp 321 DO jk = 1, jpkm1 322 DO ji = 1, jpi 323 zub(ji,jj) = zub(ji,jj) & 324 & + e3u(ji,jj,jk,Krhs_a) * uu(ji,jj,jk,Krhs_a) * umask(ji,jj,jk) 325 END DO 326 END DO 327 DO ji = 1, jpi 328 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 329 END DO 330 331 DO jk = 1, jpkm1 332 DO ji = 1, jpi 333 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 334 & + uu_b(ji,jj,Krhs_a) - zub(ji,jj) ) * umask(ji,jj,jk) 335 END DO 336 END DO 337 END DO 339 zub(ji,jj) = zub(ji,jj) * r1_hu(ji,jj,Krhs_a) 340 END DO 341 342 DO jk = 1, jpkm1 343 DO ji = 1, jpi 344 uu(ji,jj,jk,Krhs_a) = ( uu(ji,jj,jk,Krhs_a) & 345 & + uu_b(ji,jj,Krhs_a) - zub(ji,jj) ) * umask(ji,jj,jk) 346 END DO 347 END DO 348 END DO 349 ENDIF 338 350 ENDIF 339 351 ! … … 354 366 ! 355 367 !--- West ---! 356 istart = 2 357 iend = nbghostcells+1 358 DO ji = mi0(istart), mi1(iend) 359 DO jj=1,jpj 360 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 361 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 362 END DO 363 END DO 368 IF( lk_west ) THEN 369 istart = 2 370 iend = nbghostcells+1 371 DO ji = mi0(istart), mi1(iend) 372 DO jj=1,jpj 373 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 374 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 375 END DO 376 END DO 377 ENDIF 364 378 ! 365 379 !--- East ---! 366 istart = jpiglo-nbghostcells 367 iend = jpiglo-1 368 DO ji = mi0(istart), mi1(iend) 369 DO jj=1,jpj 370 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 371 END DO 372 END DO 373 istart = jpiglo-nbghostcells-1 374 iend = jpiglo-2 375 DO ji = mi0(istart), mi1(iend) 376 DO jj=1,jpj 377 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 378 END DO 379 END DO 380 IF( lk_east ) THEN 381 istart = jpiglo-nbghostcells 382 iend = jpiglo-1 383 DO ji = mi0(istart), mi1(iend) 384 385 DO jj=1,jpj 386 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 387 END DO 388 END DO 389 istart = jpiglo-nbghostcells-1 390 iend = jpiglo-2 391 DO ji = mi0(istart), mi1(iend) 392 DO jj=1,jpj 393 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 394 END DO 395 END DO 396 ENDIF 380 397 ! 381 398 !--- South ---! 382 jstart = 2 383 jend = nbghostcells+1 384 DO jj = mj0(jstart), mj1(jend) 385 DO ji=1,jpi 386 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 387 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 388 END DO 389 END DO 399 IF( lk_south ) THEN 400 jstart = 2 401 jend = nbghostcells+1 402 DO jj = mj0(jstart), mj1(jend) 403 404 DO ji=1,jpi 405 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 406 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 407 END DO 408 END DO 409 ENDIF 390 410 ! 391 411 !--- North ---! 392 jstart = jpjglo-nbghostcells 393 jend = jpjglo-1 394 DO jj = mj0(jstart), mj1(jend) 395 DO ji=1,jpi 396 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 397 END DO 398 END DO 399 jstart = jpjglo-nbghostcells-1 400 jend = jpjglo-2 401 DO jj = mj0(jstart), mj1(jend) 402 DO ji=1,jpi 403 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 404 END DO 405 END DO 412 IF( lk_north ) THEN 413 jstart = jpjglo-nbghostcells 414 jend = jpjglo-1 415 DO jj = mj0(jstart), mj1(jend) 416 DO ji=1,jpi 417 ua_e(ji,jj) = ubdy(ji,jj) * hur_e(ji,jj) 418 END DO 419 END DO 420 jstart = jpjglo-nbghostcells-1 421 jend = jpjglo-2 422 DO jj = mj0(jstart), mj1(jend) 423 DO ji=1,jpi 424 va_e(ji,jj) = vbdy(ji,jj) * hvr_e(ji,jj) 425 END DO 426 END DO 427 ENDIF 406 428 ! 407 429 END SUBROUTINE Agrif_dyn_ts … … 421 443 ! 422 444 !--- West ---! 423 istart = 2 424 iend = nbghostcells+1 425 DO ji = mi0(istart), mi1(iend) 426 DO jj=1,jpj 427 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 428 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 429 END DO 430 END DO 445 IF( lk_west ) THEN 446 istart = 2 447 iend = nbghostcells+1 448 DO ji = mi0(istart), mi1(iend) 449 DO jj=1,jpj 450 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 451 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 452 END DO 453 END DO 454 ENDIF 431 455 ! 432 456 !--- East ---! 433 istart = jpiglo-nbghostcells 434 iend = jpiglo-1 435 DO ji = mi0(istart), mi1(iend) 436 DO jj=1,jpj 437 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 438 END DO 439 END DO 440 istart = jpiglo-nbghostcells-1 441 iend = jpiglo-2 442 DO ji = mi0(istart), mi1(iend) 443 DO jj=1,jpj 444 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 445 END DO 446 END DO 457 IF( lk_east ) THEN 458 istart = jpiglo-nbghostcells 459 iend = jpiglo-1 460 DO ji = mi0(istart), mi1(iend) 461 DO jj=1,jpj 462 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 463 END DO 464 END DO 465 istart = jpiglo-nbghostcells-1 466 iend = jpiglo-2 467 DO ji = mi0(istart), mi1(iend) 468 DO jj=1,jpj 469 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 470 END DO 471 END DO 472 ENDIF 447 473 ! 448 474 !--- South ---! 449 jstart = 2 450 jend = nbghostcells+1 451 DO jj = mj0(jstart), mj1(jend) 452 DO ji=1,jpi 453 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 454 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 455 END DO 456 END DO 475 IF( lk_south ) THEN 476 jstart = 2 477 jend = nbghostcells+1 478 DO jj = mj0(jstart), mj1(jend) 479 DO ji=1,jpi 480 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 481 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 482 END DO 483 END DO 484 ENDIF 457 485 ! 458 486 !--- North ---! 459 jstart = jpjglo-nbghostcells 460 jend = jpjglo-1 461 DO jj = mj0(jstart), mj1(jend) 462 DO ji=1,jpi 463 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 464 END DO 465 END DO 466 jstart = jpjglo-nbghostcells-1 467 jend = jpjglo-2 468 DO jj = mj0(jstart), mj1(jend) 469 DO ji=1,jpi 470 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 471 END DO 472 END DO 487 IF( lk_north ) THEN 488 jstart = jpjglo-nbghostcells 489 jend = jpjglo-1 490 DO jj = mj0(jstart), mj1(jend) 491 DO ji=1,jpi 492 zu(ji,jj) = ubdy(ji,jj) * e2u(ji,jj) 493 END DO 494 END DO 495 jstart = jpjglo-nbghostcells-1 496 jend = jpjglo-2 497 DO jj = mj0(jstart), mj1(jend) 498 DO ji=1,jpi 499 zv(ji,jj) = vbdy(ji,jj) * e1v(ji,jj) 500 END DO 501 END DO 502 ENDIF 473 503 ! 474 504 END SUBROUTINE Agrif_dyn_ts_flux … … 494 524 Agrif_SpecialValue = 0._wp 495 525 Agrif_UseSpecialValue = ln_spc_dyn 526 527 use_sign_north = .TRUE. 528 sign_north = -1. 529 496 530 ! 497 531 ! Set bdy time interpolation stage to 0 (latter incremented locally do deal with corners) … … 518 552 ENDIF 519 553 Agrif_UseSpecialValue = .FALSE. 554 use_sign_north = .FALSE. 520 555 ! 521 556 END SUBROUTINE Agrif_dta_ts … … 542 577 ! 543 578 ! --- West --- ! 544 istart = 2 545 iend = 1 + nbghostcells 546 DO ji = mi0(istart), mi1(iend) 547 DO jj = 1, jpj 548 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 579 IF(lk_west) THEN 580 istart = 2 581 iend = 1 + nbghostcells 582 DO ji = mi0(istart), mi1(iend) 583 DO jj = 1, jpj 584 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 585 ENDDO 549 586 ENDDO 550 END DO587 ENDIF 551 588 ! 552 589 ! --- East --- ! 553 istart = jpiglo - nbghostcells 554 iend = jpiglo - 1 555 DO ji = mi0(istart), mi1(iend) 556 DO jj = 1, jpj 557 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 590 IF(lk_east) THEN 591 istart = jpiglo - nbghostcells 592 iend = jpiglo - 1 593 DO ji = mi0(istart), mi1(iend) 594 DO jj = 1, jpj 595 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 596 ENDDO 558 597 ENDDO 559 END DO598 ENDIF 560 599 ! 561 600 ! --- South --- ! 562 jstart = 2 563 jend = 1 + nbghostcells 564 DO jj = mj0(jstart), mj1(jend) 565 DO ji = 1, jpi 566 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 601 IF(lk_south) THEN 602 jstart = 2 603 jend = 1 + nbghostcells 604 DO jj = mj0(jstart), mj1(jend) 605 DO ji = 1, jpi 606 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 607 ENDDO 567 608 ENDDO 568 END DO609 ENDIF 569 610 ! 570 611 ! --- North --- ! 571 jstart = jpjglo - nbghostcells 572 jend = jpjglo - 1 573 DO jj = mj0(jstart), mj1(jend) 574 DO ji = 1, jpi 575 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 612 IF(lk_north) THEN 613 jstart = jpjglo - nbghostcells 614 jend = jpjglo - 1 615 DO jj = mj0(jstart), mj1(jend) 616 DO ji = 1, jpi 617 ssh(ji,jj,Krhs_a) = hbdy(ji,jj) 618 ENDDO 576 619 ENDDO 577 END DO620 ENDIF 578 621 ! 579 622 END SUBROUTINE Agrif_ssh … … 593 636 ! 594 637 ! --- West --- ! 595 istart = 2 596 iend = 1+nbghostcells 597 DO ji = mi0(istart), mi1(iend) 598 DO jj = 1, jpj 599 ssha_e(ji,jj) = hbdy(ji,jj) 638 IF(lk_west) THEN 639 istart = 2 640 iend = 1+nbghostcells 641 DO ji = mi0(istart), mi1(iend) 642 DO jj = 1, jpj 643 ssha_e(ji,jj) = hbdy(ji,jj) 644 ENDDO 600 645 ENDDO 601 END DO646 ENDIF 602 647 ! 603 648 ! --- East --- ! 604 istart = jpiglo - nbghostcells 605 iend = jpiglo - 1 606 DO ji = mi0(istart), mi1(iend) 607 DO jj = 1, jpj 608 ssha_e(ji,jj) = hbdy(ji,jj) 649 IF(lk_east) THEN 650 istart = jpiglo - nbghostcells 651 iend = jpiglo - 1 652 DO ji = mi0(istart), mi1(iend) 653 DO jj = 1, jpj 654 ssha_e(ji,jj) = hbdy(ji,jj) 655 ENDDO 609 656 ENDDO 610 END DO657 ENDIF 611 658 ! 612 659 ! --- South --- ! 613 jstart = 2 614 jend = 1+nbghostcells 615 DO jj = mj0(jstart), mj1(jend) 616 DO ji = 1, jpi 617 ssha_e(ji,jj) = hbdy(ji,jj) 660 IF(lk_south) THEN 661 jstart = 2 662 jend = 1+nbghostcells 663 DO jj = mj0(jstart), mj1(jend) 664 DO ji = 1, jpi 665 ssha_e(ji,jj) = hbdy(ji,jj) 666 ENDDO 618 667 ENDDO 619 END DO668 ENDIF 620 669 ! 621 670 ! --- North --- ! 622 jstart = jpjglo - nbghostcells 623 jend = jpjglo - 1 624 DO jj = mj0(jstart), mj1(jend) 625 DO ji = 1, jpi 626 ssha_e(ji,jj) = hbdy(ji,jj) 671 IF(lk_north) THEN 672 jstart = jpjglo - nbghostcells 673 jend = jpjglo - 1 674 DO jj = mj0(jstart), mj1(jend) 675 DO ji = 1, jpi 676 ssha_e(ji,jj) = hbdy(ji,jj) 677 ENDDO 627 678 ENDDO 628 END DO679 ENDIF 629 680 ! 630 681 END SUBROUTINE Agrif_ssh_ts … … 662 713 INTEGER :: ji, jj, jk, jn ! dummy loop indices 663 714 INTEGER :: N_in, N_out 715 INTEGER :: item 664 716 ! vertical interpolation: 665 717 REAL(wp) :: zhtot … … 669 721 !!---------------------------------------------------------------------- 670 722 671 IF( before ) THEN 723 IF( before ) THEN 724 725 item = Kmm_a 726 IF( l_ini_child ) Kmm_a = Kbb_a 727 672 728 DO jn = 1,jpts 673 729 DO jk=k1,k2 … … 678 734 END DO 679 735 END DO 680 END DO 681 682 # if defined key_vertical 683 ! Interpolate thicknesses 684 ! Warning: these are masked, hence extrapolated prior interpolation. 685 DO jk=k1,k2 686 DO jj=j1,j2 687 DO ji=i1,i2 688 ptab(ji,jj,jk,jpts+1) = tmask(ji,jj,jk) * e3t(ji,jj,jk,Kmm_a) 689 END DO 690 END DO 691 END DO 692 693 ! Extrapolate thicknesses in partial bottom cells: 694 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 695 IF (ln_zps) THEN 696 DO jj=j1,j2 697 DO ji=i1,i2 698 jk = mbkt(ji,jj) 699 ptab(ji,jj,jk,jpts+1) = 0._wp 700 END DO 701 END DO 702 END IF 703 704 ! Save ssh at last level: 705 IF (.NOT.ln_linssh) THEN 706 ptab(i1:i2,j1:j2,k2,jpts+1) = ssh(i1:i2,j1:j2,Kmm_a)*tmask(i1:i2,j1:j2,1) 707 ELSE 708 ptab(i1:i2,j1:j2,k2,jpts+1) = 0._wp 709 END IF 710 # endif 736 END DO 737 738 IF( l_vremap .OR. l_ini_child) THEN 739 ! Interpolate thicknesses 740 ! Warning: these are masked, hence extrapolated prior interpolation. 741 DO jk=k1,k2 742 DO jj=j1,j2 743 DO ji=i1,i2 744 ptab(ji,jj,jk,jpts+1) = tmask(ji,jj,jk) * e3t(ji,jj,jk,Kmm_a) 745 746 END DO 747 END DO 748 END DO 749 750 ! Extrapolate thicknesses in partial bottom cells: 751 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 752 IF (ln_zps) THEN 753 DO jj=j1,j2 754 DO ji=i1,i2 755 jk = mbkt(ji,jj) 756 ptab(ji,jj,jk,jpts+1) = 0._wp 757 END DO 758 END DO 759 END IF 760 761 ! Save ssh at last level: 762 IF (.NOT.ln_linssh) THEN 763 ptab(i1:i2,j1:j2,k2,jpts+1) = ssh(i1:i2,j1:j2,Kmm_a)*tmask(i1:i2,j1:j2,1) 764 ELSE 765 ptab(i1:i2,j1:j2,k2,jpts+1) = 0._wp 766 END IF 767 ENDIF 768 Kmm_a = item 769 711 770 ELSE 712 713 # if defined key_vertical 714 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,n2) = 0._wp 715 716 DO jj=j1,j2 717 DO ji=i1,i2 718 ts(ji,jj,:,:,Krhs_a) = 0._wp 719 N_in = mbkt_parent(ji,jj) 720 zhtot = 0._wp 721 DO jk=1,N_in !k2 = jpk of parent grid 722 IF (jk==N_in) THEN 723 h_in(jk) = ht0_parent(ji,jj) + ptab(ji,jj,k2,n2) - zhtot 724 ELSE 725 h_in(jk) = ptab(ji,jj,jk,n2) 771 item = Krhs_a 772 IF( l_ini_child ) Krhs_a = Kbb_a 773 774 IF( l_vremap .OR. l_ini_child ) THEN 775 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,n2) = 0._wp 776 777 DO jj=j1,j2 778 DO ji=i1,i2 779 ts(ji,jj,:,:,Krhs_a) = 0. 780 ! IF( l_ini_child) ts(ji,jj,:,:,Krhs_a) = ptab(ji,jj,:,1:jpts) 781 N_in = mbkt_parent(ji,jj) 782 zhtot = 0._wp 783 DO jk=1,N_in !k2 = jpk of parent grid 784 IF (jk==N_in) THEN 785 h_in(jk) = ht0_parent(ji,jj) + ptab(ji,jj,k2,n2) - zhtot 786 ELSE 787 h_in(jk) = ptab(ji,jj,jk,n2) 788 ENDIF 789 zhtot = zhtot + h_in(jk) 790 tabin(jk,:) = ptab(ji,jj,jk,n1:n2-1) 791 END DO 792 N_out = 0 793 DO jk=1,jpk ! jpk of child grid 794 IF (tmask(ji,jj,jk) == 0._wp) EXIT 795 N_out = N_out + 1 796 h_out(jk) = e3t(ji,jj,jk,Krhs_a) 797 ENDDO 798 IF (N_in*N_out > 0) THEN 799 IF( l_ini_child ) THEN 800 CALL remap_linear(tabin(1:N_in,1:jpts),h_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a), & 801 & h_out(1:N_out),N_in,N_out,jpts) 802 ELSE 803 CALL reconstructandremap(tabin(1:N_in,1:jpts),h_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a), & 804 & h_out(1:N_out),N_in,N_out,jpts) 805 ENDIF 726 806 ENDIF 727 zhtot = zhtot + h_in(jk)728 tabin(jk,:) = ptab(ji,jj,jk,n1:n2-1)729 END DO730 N_out = 0731 DO jk=1,jpk ! jpk of child grid732 IF (tmask(ji,jj,jk) == 0._wp) EXIT733 N_out = N_out + 1734 h_out(jk) = e3t(ji,jj,jk,Krhs_a)735 807 ENDDO 736 IF (N_in*N_out > 0) THEN737 CALL reconstructandremap(tabin(1:N_in,1:jpts),h_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a),h_out(1:N_out),N_in,N_out,jpts)738 ENDIF739 808 ENDDO 740 ENDDO 741 # else 742 ! 743 DO jn=1, jpts 744 ts(i1:i2,j1:j2,1:jpk,jn,Krhs_a)=ptab(i1:i2,j1:j2,1:jpk,jn)*tmask(i1:i2,j1:j2,1:jpk) 745 END DO 746 # endif 809 Krhs_a = item 810 811 ELSE 812 813 DO jn=1, jpts 814 ts(i1:i2,j1:j2,1:jpk,jn,Krhs_a)=ptab(i1:i2,j1:j2,1:jpk,jn)*tmask(i1:i2,j1:j2,1:jpk) 815 END DO 816 ENDIF 747 817 748 818 ENDIF … … 782 852 REAL(wp), DIMENSION(k1:k2) :: tabin, h_in 783 853 REAL(wp), DIMENSION(1:jpk) :: h_out 784 INTEGER :: N_in, N_out 854 INTEGER :: N_in, N_out,item 785 855 REAL(wp) :: h_diff 786 856 !!--------------------------------------------- 787 857 ! 788 858 IF (before) THEN 859 860 item = Kmm_a 861 IF( l_ini_child ) Kmm_a = Kbb_a 862 789 863 DO jk=1,jpk 790 864 DO jj=j1,j2 791 865 DO ji=i1,i2 792 866 ptab(ji,jj,jk,1) = (e2u(ji,jj) * e3u(ji,jj,jk,Kmm_a) * uu(ji,jj,jk,Kmm_a)*umask(ji,jj,jk)) 793 # if defined key_vertical 794 ! Interpolate thicknesses (masked for subsequent extrapolation) 795 ptab(ji,jj,jk,2) = umask(ji,jj,jk) * e2u(ji,jj) * e3u(ji,jj,jk,Kmm_a) 796 # endif 797 END DO 798 END DO 799 END DO 800 # if defined key_vertical 867 IF( l_vremap .OR. l_ini_child) THEN 868 ! Interpolate thicknesses (masked for subsequent extrapolation) 869 ptab(ji,jj,jk,2) = umask(ji,jj,jk) * e2u(ji,jj) * e3u(ji,jj,jk,Kmm_a) 870 ENDIF 871 END DO 872 END DO 873 END DO 874 875 IF( l_vremap .OR. l_ini_child) THEN 801 876 ! Extrapolate thicknesses in partial bottom cells: 802 877 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 803 IF (ln_zps) THEN 804 DO jj=j1,j2 805 DO ji=i1,i2 806 jk = mbku(ji,jj) 807 ptab(ji,jj,jk,2) = 0._wp 808 END DO 809 END DO 810 END IF 811 ! Save ssh at last level: 812 ptab(i1:i2,j1:j2,k2,2) = 0._wp 813 IF (.NOT.ln_linssh) THEN 814 ! This vertical sum below should be replaced by the sea-level at U-points (optimization): 815 DO jk=1,jpk 816 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) + e3u(i1:i2,j1:j2,jk,Kmm_a) * umask(i1:i2,j1:j2,jk) 817 END DO 818 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) - hu_0(i1:i2,j1:j2) 819 END IF 820 # endif 878 IF (ln_zps) THEN 879 DO jj=j1,j2 880 DO ji=i1,i2 881 jk = mbku(ji,jj) 882 ptab(ji,jj,jk,2) = 0._wp 883 END DO 884 END DO 885 END IF 886 887 ! Save ssh at last level: 888 ptab(i1:i2,j1:j2,k2,2) = 0._wp 889 IF (.NOT.ln_linssh) THEN 890 ! This vertical sum below should be replaced by the sea-level at U-points (optimization): 891 DO jk=1,jpk 892 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) + e3u(i1:i2,j1:j2,jk,Kmm_a) * umask(i1:i2,j1:j2,jk) 893 END DO 894 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) - hu_0(i1:i2,j1:j2) 895 END IF 896 ENDIF 897 898 Kmm_a = item 821 899 ! 822 900 ELSE 823 901 zrhoy = Agrif_rhoy() 824 # if defined key_vertical 902 903 IF( l_vremap .OR. l_ini_child) THEN 825 904 ! VERTICAL REFINEMENT BEGIN 826 905 827 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 828 829 DO ji=i1,i2 830 DO jj=j1,j2 831 uu(ji,jj,:,Krhs_a) = 0._wp 832 N_in = mbku_parent(ji,jj) 833 zhtot = 0._wp 834 DO jk=1,N_in 835 IF (jk==N_in) THEN 836 h_in(jk) = hu0_parent(ji,jj) + ptab(ji,jj,k2,2) - zhtot 837 ELSE 838 h_in(jk) = ptab(ji,jj,jk,2)/(e2u(ji,jj)*zrhoy) 839 ENDIF 840 zhtot = zhtot + h_in(jk) 841 tabin(jk) = ptab(ji,jj,jk,1)/(e2u(ji,jj)*zrhoy*h_in(jk)) 842 ENDDO 843 844 N_out = 0 845 DO jk=1,jpk 846 if (umask(ji,jj,jk) == 0) EXIT 847 N_out = N_out + 1 848 h_out(N_out) = e3u(ji,jj,jk,Krhs_a) 849 ENDDO 850 IF (N_in*N_out > 0) THEN 851 CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 852 ENDIF 906 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 907 908 DO ji=i1,i2 909 DO jj=j1,j2 910 uu(ji,jj,:,Krhs_a) = 0._wp 911 N_in = mbku_parent(ji,jj) 912 zhtot = 0._wp 913 DO jk=1,N_in 914 IF (jk==N_in) THEN 915 h_in(jk) = hu0_parent(ji,jj) + ptab(ji,jj,k2,2) - zhtot 916 ELSE 917 h_in(jk) = ptab(ji,jj,jk,2)/(e2u(ji,jj)*zrhoy) 918 ENDIF 919 zhtot = zhtot + h_in(jk) 920 IF( h_in(jk) .GT. 0. ) THEN 921 tabin(jk) = ptab(ji,jj,jk,1)/(e2u(ji,jj)*zrhoy*h_in(jk)) 922 ELSE 923 tabin(jk) = 0. 924 ENDIF 925 ENDDO 926 927 N_out = 0 928 DO jk=1,jpk 929 IF (umask(ji,jj,jk) == 0) EXIT 930 N_out = N_out + 1 931 h_out(N_out) = e3u(ji,jj,jk,Krhs_a) 932 ENDDO 933 IF (N_in*N_out > 0) THEN 934 IF( l_ini_child ) THEN 935 CALL remap_linear (tabin(1:N_in),h_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 936 ELSE 937 CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 938 ENDIF 939 ENDIF 940 ENDDO 853 941 ENDDO 854 ENDDO 855 856 # else 857 DO jk = 1, jpkm1 858 DO jj=j1,j2 859 uu(i1:i2,jj,jk,Krhs_a) = ptab(i1:i2,jj,jk,1) / ( zrhoy * e2u(i1:i2,jj) * e3u(i1:i2,jj,jk,Krhs_a) ) 860 END DO 861 END DO 862 # endif 942 ELSE 943 DO jk = 1, jpkm1 944 DO jj=j1,j2 945 uu(i1:i2,jj,jk,Krhs_a) = ptab(i1:i2,jj,jk,1) / ( zrhoy * e2u(i1:i2,jj) * e3u(i1:i2,jj,jk,Krhs_a) ) 946 END DO 947 END DO 948 ENDIF 863 949 864 950 ENDIF … … 880 966 REAL(wp), DIMENSION(k1:k2) :: tabin, h_in 881 967 REAL(wp), DIMENSION(1:jpk) :: h_out 882 INTEGER :: N_in, N_out 968 INTEGER :: N_in, N_out, item 883 969 REAL(wp) :: h_diff, zhtot 884 970 !!--------------------------------------------- 885 971 ! 886 IF (before) THEN 972 IF (before) THEN 973 974 item = Kmm_a 975 IF( l_ini_child ) Kmm_a = Kbb_a 976 887 977 DO jk=k1,k2 888 978 DO jj=j1,j2 889 979 DO ji=i1,i2 890 980 ptab(ji,jj,jk,1) = (e1v(ji,jj) * e3v(ji,jj,jk,Kmm_a) * vv(ji,jj,jk,Kmm_a)*vmask(ji,jj,jk)) 891 # if defined key_vertical 892 ! Interpolate thicknesses (masked for subsequent extrapolation) 893 ptab(ji,jj,jk,2) = vmask(ji,jj,jk) * e1v(ji,jj) * e3v(ji,jj,jk,Kmm_a) 894 # endif 895 END DO 896 END DO 897 END DO 898 # if defined key_vertical 981 IF( l_vremap .OR. l_ini_child) THEN 982 ! Interpolate thicknesses (masked for subsequent extrapolation) 983 ptab(ji,jj,jk,2) = vmask(ji,jj,jk) * e1v(ji,jj) * e3v(ji,jj,jk,Kmm_a) 984 ENDIF 985 END DO 986 END DO 987 END DO 988 989 IF( l_vremap .OR. l_ini_child) THEN 899 990 ! Extrapolate thicknesses in partial bottom cells: 900 991 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 901 IF (ln_zps) THEN 992 IF (ln_zps) THEN 993 DO jj=j1,j2 994 DO ji=i1,i2 995 jk = mbkv(ji,jj) 996 ptab(ji,jj,jk,2) = 0._wp 997 END DO 998 END DO 999 END IF 1000 ! Save ssh at last level: 1001 ptab(i1:i2,j1:j2,k2,2) = 0._wp 1002 IF (.NOT.ln_linssh) THEN 1003 ! This vertical sum below should be replaced by the sea-level at V-points (optimization): 1004 DO jk=1,jpk 1005 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) + e3v(i1:i2,j1:j2,jk,Kmm_a) * vmask(i1:i2,j1:j2,jk) 1006 END DO 1007 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) - hv_0(i1:i2,j1:j2) 1008 END IF 1009 ENDIF 1010 item = Kmm_a 1011 1012 ELSE 1013 zrhox = Agrif_rhox() 1014 1015 IF( l_vremap .OR. l_ini_child ) THEN 1016 1017 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 1018 902 1019 DO jj=j1,j2 903 1020 DO ji=i1,i2 904 jk = mbkv(ji,jj) 905 ptab(ji,jj,jk,2) = 0._wp 906 END DO 907 END DO 908 END IF 909 ! Save ssh at last level: 910 ptab(i1:i2,j1:j2,k2,2) = 0._wp 911 IF (.NOT.ln_linssh) THEN 912 ! This vertical sum below should be replaced by the sea-level at V-points (optimization): 913 DO jk=1,jpk 914 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) + e3v(i1:i2,j1:j2,jk,Kmm_a) * vmask(i1:i2,j1:j2,jk) 915 END DO 916 ptab(i1:i2,j1:j2,k2,2) = ptab(i1:i2,j1:j2,k2,2) - hv_0(i1:i2,j1:j2) 917 END IF 918 # endif 919 ELSE 920 zrhox = Agrif_rhox() 921 # if defined key_vertical 922 923 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 924 925 DO jj=j1,j2 926 DO ji=i1,i2 927 vv(ji,jj,:,Krhs_a) = 0._wp 928 N_in = mbkv_parent(ji,jj) 929 zhtot = 0._wp 930 DO jk=1,N_in 931 IF (jk==N_in) THEN 932 h_in(jk) = hv0_parent(ji,jj) + ptab(ji,jj,k2,2) - zhtot 933 ELSE 934 h_in(jk) = ptab(ji,jj,jk,2)/(e1v(ji,jj)*zrhox) 1021 vv(ji,jj,:,Krhs_a) = 0._wp 1022 N_in = mbkv_parent(ji,jj) 1023 zhtot = 0._wp 1024 DO jk=1,N_in 1025 IF (jk==N_in) THEN 1026 h_in(jk) = hv0_parent(ji,jj) + ptab(ji,jj,k2,2) - zhtot 1027 ELSE 1028 h_in(jk) = ptab(ji,jj,jk,2)/(e1v(ji,jj)*zrhox) 1029 ENDIF 1030 zhtot = zhtot + h_in(jk) 1031 IF( h_in(jk) .GT. 0. ) THEN 1032 tabin(jk) = ptab(ji,jj,jk,1)/(e1v(ji,jj)*zrhox*h_in(jk)) 1033 ELSE 1034 tabin(jk) = 0. 1035 ENDIF 1036 ENDDO 1037 1038 N_out = 0 1039 DO jk=1,jpk 1040 if (vmask(ji,jj,jk) == 0) EXIT 1041 N_out = N_out + 1 1042 h_out(N_out) = e3v(ji,jj,jk,Krhs_a) 1043 END DO 1044 IF (N_in*N_out > 0) THEN 1045 IF( l_ini_child ) THEN 1046 CALL remap_linear (tabin(1:N_in),h_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 1047 ELSE 1048 CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 1049 ENDIF 935 1050 ENDIF 936 zhtot = zhtot + h_in(jk) 937 tabin(jk) = ptab(ji,jj,jk,1)/(e1v(ji,jj)*zrhox*h_in(jk)) 938 ENDDO 939 940 N_out = 0 941 DO jk=1,jpk 942 if (vmask(ji,jj,jk) == 0) EXIT 943 N_out = N_out + 1 944 h_out(N_out) = e3v(ji,jj,jk,Krhs_a) 945 END DO 946 IF (N_in*N_out > 0) THEN 947 call reconstructandremap(tabin(1:N_in),h_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 948 ENDIF 949 END DO 950 END DO 951 # else 952 DO jk = 1, jpkm1 953 vv(i1:i2,j1:j2,jk,Krhs_a) = ptab(i1:i2,j1:j2,jk,1) / ( zrhox * e1v(i1:i2,j1:j2) * e3v(i1:i2,j1:j2,jk,Krhs_a) ) 954 END DO 955 # endif 1051 END DO 1052 END DO 1053 ELSE 1054 DO jk = 1, jpkm1 1055 vv(i1:i2,j1:j2,jk,Krhs_a) = ptab(i1:i2,j1:j2,jk,1) / ( zrhox * e1v(i1:i2,j1:j2) * e3v(i1:i2,j1:j2,jk,Krhs_a) ) 1056 END DO 1057 ENDIF 956 1058 ENDIF 957 1059 ! … … 1163 1265 END SUBROUTINE interpe3t 1164 1266 1165 1166 1267 SUBROUTINE interpavm( ptab, i1, i2, j1, j2, k1, k2, m1, m2, before ) 1167 1268 !!---------------------------------------------------------------------- … … 1185 1286 END DO 1186 1287 END DO 1187 END DO 1188 1189 # if defined key_vertical 1190 ! Interpolate thicknesses 1191 ! Warning: these are masked, hence extrapolated prior interpolation. 1192 DO jk=k1,k2 1193 DO jj=j1,j2 1194 DO ji=i1,i2 1195 ptab(ji,jj,jk,2) = tmask(ji,jj,jk) * e3t(ji,jj,jk,Kmm_a) 1196 END DO 1197 END DO 1198 END DO 1199 1200 ! Extrapolate thicknesses in partial bottom cells: 1201 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 1202 IF (ln_zps) THEN 1203 DO jj=j1,j2 1204 DO ji=i1,i2 1205 jk = mbkt(ji,jj) 1206 ptab(ji,jj,jk,2) = 0._wp 1207 END DO 1208 END DO 1209 END IF 1210 1211 ! Save ssh at last level: 1212 IF (.NOT.ln_linssh) THEN 1213 ptab(i1:i2,j1:j2,k2,2) = ssh(i1:i2,j1:j2,Kmm_a)*tmask(i1:i2,j1:j2,1) 1214 ELSE 1215 ptab(i1:i2,j1:j2,k2,2) = 0._wp 1216 END IF 1217 # endif 1288 END DO 1289 1290 IF( l_vremap ) THEN 1291 ! Interpolate thicknesses 1292 ! Warning: these are masked, hence extrapolated prior interpolation. 1293 DO jk=k1,k2 1294 DO jj=j1,j2 1295 DO ji=i1,i2 1296 ptab(ji,jj,jk,2) = tmask(ji,jj,jk) * e3t(ji,jj,jk,Kmm_a) 1297 END DO 1298 END DO 1299 END DO 1300 1301 ! Extrapolate thicknesses in partial bottom cells: 1302 ! Set them to Agrif_SpecialValue (0.). Correct bottom thicknesses are retrieved later on 1303 IF (ln_zps) THEN 1304 DO jj=j1,j2 1305 DO ji=i1,i2 1306 jk = mbkt(ji,jj) 1307 ptab(ji,jj,jk,2) = 0._wp 1308 END DO 1309 END DO 1310 END IF 1311 1312 ! Save ssh at last level: 1313 IF (.NOT.ln_linssh) THEN 1314 ptab(i1:i2,j1:j2,k2,2) = ssh(i1:i2,j1:j2,Kmm_a)*tmask(i1:i2,j1:j2,1) 1315 ELSE 1316 ptab(i1:i2,j1:j2,k2,2) = 0._wp 1317 END IF 1318 ENDIF 1319 1218 1320 ELSE 1219 #ifdef key_vertical 1220 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 1221 avm_k(i1:i2,j1:j2,k1:k2) = 0._wp 1222 1223 DO jj = j1, j2 1224 DO ji =i1, i2 1225 N_in = mbkt_parent(ji,jj) 1226 IF ( tmask(ji,jj,1) == 0._wp) N_in = 0 1227 z_in(N_in+1) = ht0_parent(ji,jj) + ptab(ji,jj,k2,2) 1228 DO jk = N_in, 1, -1 ! Parent vertical grid 1229 z_in(jk) = z_in(jk+1) - ptab(ji,jj,jk,2) 1230 tabin(jk) = ptab(ji,jj,jk,1) 1231 END DO 1232 N_out = mbkt(ji,jj) 1233 DO jk = 1, N_out ! Child vertical grid 1234 z_out(jk) = gdepw(ji,jj,jk,Kmm_a) 1321 1322 IF( l_vremap ) THEN 1323 IF (ln_linssh) ptab(i1:i2,j1:j2,k2,2) = 0._wp 1324 avm_k(i1:i2,j1:j2,k1:k2) = 0._wp 1325 1326 DO jj = j1, j2 1327 DO ji =i1, i2 1328 N_in = mbkt_parent(ji,jj) 1329 IF ( tmask(ji,jj,1) == 0._wp) N_in = 0 1330 z_in(N_in+1) = ht0_parent(ji,jj) + ptab(ji,jj,k2,2) 1331 DO jk = N_in, 1, -1 ! Parent vertical grid 1332 z_in(jk) = z_in(jk+1) - ptab(ji,jj,jk,2) 1333 tabin(jk) = ptab(ji,jj,jk,1) 1334 END DO 1335 N_out = mbkt(ji,jj) 1336 DO jk = 1, N_out ! Child vertical grid 1337 z_out(jk) = gdepw(ji,jj,jk,Kmm_a) 1338 ENDDO 1339 IF (N_in*N_out > 0) THEN 1340 CALL remap_linear(tabin(1:N_in),z_in(1:N_in),avm_k(ji,jj,1:N_out),z_out(1:N_out),N_in,N_out,1) 1341 ENDIF 1235 1342 ENDDO 1236 IF (N_in*N_out > 0) THEN1237 CALL remap_linear(tabin(1:N_in),z_in(1:N_in),avm_k(ji,jj,1:N_out),z_out(1:N_out),N_in,N_out,1)1238 ENDIF1239 1343 ENDDO 1240 ENDDO 1241 #else 1242 avm_k(i1:i2,j1:j2,k1:k2) = ptab (i1:i2,j1:j2,k1:k2,1) 1243 #endif 1344 ELSE 1345 avm_k(i1:i2,j1:j2,k1:k2) = ptab (i1:i2,j1:j2,k1:k2,1) 1346 ENDIF 1244 1347 ENDIF 1245 1348 ! 1246 1349 END SUBROUTINE interpavm 1247 1350 1248 # if defined key_vertical1249 1351 SUBROUTINE interpmbkt( ptab, i1, i2, j1, j2, before ) 1250 1352 !!---------------------------------------------------------------------- … … 1282 1384 ! 1283 1385 END SUBROUTINE interpht0 1284 #endif 1285 1386 1387 SUBROUTINE agrif_initts(tabres,i1,i2,j1,j2,k1,k2,m1,m2,before) 1388 INTEGER :: i1, i2, j1, j2, k1, k2, m1, m2 1389 REAL(wp):: tabres(i1:i2,j1:j2,k1:k2,m1:m2) 1390 LOGICAL :: before 1391 1392 INTEGER :: jm 1393 1394 IF (before) THEN 1395 DO jm=1,jpts 1396 tabres(i1:i2,j1:j2,k1:k2,jm) = ts(i1:i2,j1:j2,k1:k2,jm,Kbb_a) 1397 END DO 1398 ELSE 1399 DO jm=1,jpts 1400 ts(i1:i2,j1:j2,k1:k2,jm,Kbb_a)=tabres(i1:i2,j1:j2,k1:k2,jm) 1401 END DO 1402 ENDIF 1403 END SUBROUTINE agrif_initts 1404 1405 SUBROUTINE agrif_initssh( ptab, i1, i2, j1, j2, before ) 1406 !!---------------------------------------------------------------------- 1407 !! *** ROUTINE interpsshn *** 1408 !!---------------------------------------------------------------------- 1409 INTEGER , INTENT(in ) :: i1, i2, j1, j2 1410 REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: ptab 1411 LOGICAL , INTENT(in ) :: before 1412 ! 1413 !!---------------------------------------------------------------------- 1414 ! 1415 IF( before) THEN 1416 ptab(i1:i2,j1:j2) = ssh(i1:i2,j1:j2,Kbb_a) 1417 ELSE 1418 ssh(i1:i2,j1:j2,Kbb_a) = ptab(i1:i2,j1:j2)*tmask(i1:i2,j1:j2,1) 1419 ENDIF 1420 ! 1421 END SUBROUTINE agrif_initssh 1422 1286 1423 #else 1287 1424 !!---------------------------------------------------------------------- -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce_sponge.F90
r12489 r13026 80 80 Agrif_SpecialValue=0. 81 81 Agrif_UseSpecialValue = ln_spc_dyn 82 use_sign_north = .TRUE. 83 sign_north = -1. 82 84 ! 83 85 tabspongedone_u = .FALSE. … … 90 92 ! 91 93 Agrif_UseSpecialValue = .FALSE. 94 use_sign_north = .FALSE. 92 95 #endif 93 96 ! … … 127 130 128 131 ! --- West --- ! 129 ztabramp(:,:) = 0._wp 130 ind1 = 1+nbghostcells 131 DO ji = mi0(ind1), mi1(ind1) 132 ztabramp(ji,:) = ssumask(ji,:) 133 END DO 134 ! 135 zmskwest(:) = 0._wp 136 zmskwest(1:jpj) = MAXVAL(ztabramp(:,:), dim=1) 132 IF( lk_west) THEN 133 ztabramp(:,:) = 0._wp 134 ind1 = 1+nbghostcells 135 DO ji = mi0(ind1), mi1(ind1) 136 ztabramp(ji,:) = ssumask(ji,:) 137 END DO 138 ! 139 zmskwest(:) = 0._wp 140 zmskwest(1:jpj) = MAXVAL(ztabramp(:,:), dim=1) 141 ENDIF 137 142 138 143 ! --- East --- ! 139 ztabramp(:,:) = 0._wp 140 ind1 = jpiglo - nbghostcells - 1 141 DO ji = mi0(ind1), mi1(ind1) 142 ztabramp(ji,:) = ssumask(ji,:) 143 END DO 144 ! 145 zmskeast(:) = 0._wp 146 zmskeast(1:jpj) = MAXVAL(ztabramp(:,:), dim=1) 144 IF( lk_east ) THEN 145 ztabramp(:,:) = 0._wp 146 ind1 = jpiglo - nbghostcells - 1 147 DO ji = mi0(ind1), mi1(ind1) 148 ztabramp(ji,:) = ssumask(ji,:) 149 END DO 150 ! 151 zmskeast(:) = 0._wp 152 zmskeast(1:jpj) = MAXVAL(ztabramp(:,:), dim=1) 153 ENDIF 147 154 148 155 ! --- South --- ! 149 ztabramp(:,:) = 0._wp 150 ind1 = 1+nbghostcells 151 DO jj = mj0(ind1), mj1(ind1) 152 ztabramp(:,jj) = ssvmask(:,jj) 153 END DO 154 ! 155 zmsksouth(:) = 0._wp 156 zmsksouth(1:jpi) = MAXVAL(ztabramp(:,:), dim=2) 156 IF( lk_south ) THEN 157 ztabramp(:,:) = 0._wp 158 ind1 = 1+nbghostcells 159 DO jj = mj0(ind1), mj1(ind1) 160 ztabramp(:,jj) = ssvmask(:,jj) 161 END DO 162 ! 163 zmsksouth(:) = 0._wp 164 zmsksouth(1:jpi) = MAXVAL(ztabramp(:,:), dim=2) 165 ENDIF 157 166 158 167 ! --- North --- ! 159 ztabramp(:,:) = 0._wp 160 ind1 = jpjglo - nbghostcells - 1 161 DO jj = mj0(ind1), mj1(ind1) 162 ztabramp(:,jj) = ssvmask(:,jj) 163 END DO 164 ! 165 zmsknorth(:) = 0._wp 166 zmsknorth(1:jpi) = MAXVAL(ztabramp(:,:), dim=2) 168 IF( lk_north) THEN 169 ztabramp(:,:) = 0._wp 170 ind1 = jpjglo - nbghostcells - 1 171 DO jj = mj0(ind1), mj1(ind1) 172 ztabramp(:,jj) = ssvmask(:,jj) 173 END DO 174 ! 175 zmsknorth(:) = 0._wp 176 zmsknorth(1:jpi) = MAXVAL(ztabramp(:,:), dim=2) 177 ENDIF 178 167 179 ! JC: SPONGE MASKING TO BE SORTED OUT: 168 180 zmskwest(:) = 1._wp … … 192 204 193 205 ! --- West --- ! 194 ind1 = 1+nbghostcells 195 ind2 = 1+nbghostcells + ispongearea 196 DO ji = mi0(ind1), mi1(ind2) 197 DO jj = 1, jpj 198 ztabramp(ji,jj) = REAL( ind2 - mig(ji) ) * z1_ispongearea * zmskwest(jj) 199 END DO 200 END DO 201 202 ! ghost cells: 203 ind1 = 1 204 ind2 = nbghostcells + 1 205 DO ji = mi0(ind1), mi1(ind2) 206 DO jj = 1, jpj 207 ztabramp(ji,jj) = zmskwest(jj) 208 END DO 209 END DO 206 IF(lk_west) THEN 207 ind1 = 1+nbghostcells 208 ind2 = 1+nbghostcells + ispongearea 209 DO ji = mi0(ind1), mi1(ind2) 210 DO jj = 1, jpj 211 ztabramp(ji,jj) = REAL( ind2 - mig(ji) ) * z1_ispongearea * zmskwest(jj) 212 END DO 213 END DO 214 215 ! ghost cells: 216 ind1 = 1 217 ind2 = nbghostcells + 1 218 DO ji = mi0(ind1), mi1(ind2) 219 DO jj = 1, jpj 220 ztabramp(ji,jj) = zmskwest(jj) 221 END DO 222 END DO 223 ENDIF 210 224 211 225 ! --- East --- ! 212 ind1 = jpiglo - nbghostcells - ispongearea 213 ind2 = jpiglo - nbghostcells 214 DO ji = mi0(ind1), mi1(ind2) 215 DO jj = 1, jpj 216 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( mig(ji) - ind1 ) * z1_ispongearea) * zmskeast(jj) 217 ENDDO 218 END DO 219 220 ! ghost cells: 221 ind1 = jpiglo - nbghostcells 222 ind2 = jpiglo 223 DO ji = mi0(ind1), mi1(ind2) 224 DO jj = 1, jpj 225 ztabramp(ji,jj) = zmskeast(jj) 226 ENDDO 227 END DO 226 IF(lk_east) THEN 227 ind1 = jpiglo - nbghostcells - ispongearea 228 ind2 = jpiglo - nbghostcells 229 DO ji = mi0(ind1), mi1(ind2) 230 231 DO jj = 1, jpj 232 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( mig(ji) - ind1 ) * z1_ispongearea) * zmskeast(jj) 233 ENDDO 234 END DO 235 236 ! ghost cells: 237 ind1 = jpiglo - nbghostcells 238 ind2 = jpiglo 239 DO ji = mi0(ind1), mi1(ind2) 240 241 DO jj = 1, jpj 242 ztabramp(ji,jj) = zmskeast(jj) 243 ENDDO 244 END DO 245 ENDIF 228 246 229 247 ! --- South --- ! 230 ind1 = 1+nbghostcells 231 ind2 = 1+nbghostcells + jspongearea 232 DO jj = mj0(ind1), mj1(ind2) 233 DO ji = 1, jpi 234 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( ind2 - mjg(jj) ) * z1_jspongearea) * zmsksouth(ji) 235 END DO 236 END DO 237 238 ! ghost cells: 239 ind1 = 1 240 ind2 = nbghostcells + 1 241 DO jj = mj0(ind1), mj1(ind2) 242 DO ji = 1, jpi 243 ztabramp(ji,jj) = zmsksouth(ji) 244 END DO 245 END DO 248 IF( lk_south ) THEN 249 ind1 = 1+nbghostcells 250 ind2 = 1+nbghostcells + jspongearea 251 DO jj = mj0(ind1), mj1(ind2) 252 DO ji = 1, jpi 253 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( ind2 - mjg(jj) ) * z1_jspongearea) * zmsksouth(ji) 254 END DO 255 END DO 256 257 ! ghost cells: 258 ind1 = 1 259 ind2 = nbghostcells + 1 260 DO jj = mj0(ind1), mj1(ind2) 261 DO ji = 1, jpi 262 ztabramp(ji,jj) = zmsksouth(ji) 263 END DO 264 END DO 265 ENDIF 246 266 247 267 ! --- North --- ! 248 ind1 = jpjglo - nbghostcells - jspongearea 249 ind2 = jpjglo - nbghostcells 250 DO jj = mj0(ind1), mj1(ind2) 251 DO ji = 1, jpi 252 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( mjg(jj) - ind1 ) * z1_jspongearea) * zmsknorth(ji) 253 END DO 254 END DO 255 256 ! ghost cells: 257 ind1 = jpjglo - nbghostcells 258 ind2 = jpjglo 259 DO jj = mj0(ind1), mj1(ind2) 260 DO ji = 1, jpi 261 ztabramp(ji,jj) = zmsknorth(ji) 262 END DO 263 END DO 264 268 IF( lk_north ) THEN 269 ind1 = jpjglo - nbghostcells - jspongearea 270 ind2 = jpjglo - nbghostcells 271 DO jj = mj0(ind1), mj1(ind2) 272 DO ji = 1, jpi 273 ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( mjg(jj) - ind1 ) * z1_jspongearea) * zmsknorth(ji) 274 END DO 275 END DO 276 277 ! ghost cells: 278 ind1 = jpjglo - nbghostcells 279 ind2 = jpjglo 280 DO jj = mj0(ind1), mj1(ind2) 281 DO ji = 1, jpi 282 ztabramp(ji,jj) = zmsknorth(ji) 283 END DO 284 END DO 285 ENDIF 286 265 287 ENDIF 266 288 … … 646 668 647 669 jmax = j2-1 670 ! IF (lk_north) jmax = MIN(jmax,nlcj-nbghostcells-2) ! North 648 671 IF ((nbondj == 1).OR.(nbondj == 2)) jmax = MIN(jmax,nlcj-nbghostcells-2) ! North 649 672 … … 802 825 803 826 imax = i2 - 1 827 ! IF(lk_east) imax = MIN(imax,nlci-nbghostcells-2) ! East 804 828 IF ((nbondi == 1).OR.(nbondi == 2)) imax = MIN(imax,nlci-nbghostcells-2) ! East 805 829 -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce_update.F90
r12489 r13026 26 26 USE domvvl ! Need interpolation routines 27 27 USE vremap ! Vertical remapping 28 USE lbclnk 28 29 29 30 IMPLICIT NONE … … 81 82 IF (Agrif_Root()) RETURN 82 83 ! 84 #if defined TWO_WAY 83 85 IF (lwp.AND.lk_agrif_debug) Write(*,*) 'Update momentum from grid Number',Agrif_Fixed() 84 86 85 87 Agrif_UseSpecialValueInUpdate = .FALSE. 86 88 Agrif_SpecialValueFineGrid = 0. 89 90 use_sign_north = .TRUE. 91 sign_north = -1. 92 87 93 ! 88 94 # if ! defined DECAL_FEEDBACK … … 126 132 # endif 127 133 END IF 134 #endif 135 use_sign_north = .FALSE. 128 136 ! 129 137 END SUBROUTINE Agrif_Update_Dyn … … 148 156 # if defined VOL_REFLUX 149 157 IF ( ln_dynspg_ts.AND.ln_bt_fw ) THEN 158 use_sign_north = .TRUE. 159 sign_north = -1. 150 160 ! Refluxing on ssh: 151 161 # if defined DECAL_FEEDBACK_2D … … 156 166 CALL Agrif_Update_Variable(vb2b_update_id,locupdate1=(/ 0, 0/),locupdate2=(/-1,-1/),procname = reflux_sshv) 157 167 # endif 168 use_sign_north = .FALSE. 158 169 END IF 159 170 # endif … … 826 837 SUBROUTINE correct_v_bdy( tabres, i1, i2, j1, j2, k1, k2, n1, n2, before, nb, ndir ) 827 838 !!--------------------------------------------- 828 !! *** ROUTINE correct_ u_bdy ***839 !! *** ROUTINE correct_v_bdy *** 829 840 !!--------------------------------------------- 830 841 INTEGER , INTENT(in ) :: i1, i2, j1, j2, k1, k2, n1, n2 -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_top_interp.F90
r12377 r13026 119 119 tr(i1:i2,j1:j2,1:jpk,jn,Krhs_a)=ptab_child(i1:i2,j1:j2,1:jpk,jn)*tmask(i1:i2,j1:j2,1:jpk) 120 120 END DO 121 122 121 ENDIF 123 122 ! -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_user.F90
r12489 r13026 28 28 ! 29 29 ! !* Agrif initialization 30 CALL agrif_nemo_init31 CALL Agrif_InitValues_cont_dom32 30 CALL Agrif_InitValues_cont 33 31 # if defined key_top … … 40 38 END SUBROUTINE Agrif_initvalues 41 39 42 SUBROUTINE Agrif_InitValues_cont_dom 43 !!---------------------------------------------------------------------- 44 !! *** ROUTINE Agrif_InitValues_cont_dom *** 45 !!---------------------------------------------------------------------- 46 ! 47 CALL agrif_declare_var_dom 48 ! 49 END SUBROUTINE Agrif_InitValues_cont_dom 50 51 SUBROUTINE agrif_declare_var_dom 52 !!---------------------------------------------------------------------- 53 !! *** ROUTINE agrif_declare_var_dom *** 54 !!---------------------------------------------------------------------- 55 USE par_oce, ONLY: nbghostcells 40 SUBROUTINE agrif_istate( Kbb, Kmm, Kaa ) 41 42 USE domvvl 43 USE domain 44 USE par_oce 45 USE agrif_oce 46 USE agrif_oce_interp 47 USE oce 48 USE lib_mpp 49 USe lbclnk 50 51 INTEGER, INTENT(in) :: Kbb, Kmm, Kaa 52 INTEGER :: jn 53 54 l_ini_child = .TRUE. 55 Agrif_SpecialValue = 0._wp 56 Agrif_UseSpecialValue = .TRUE. 57 uu(:,:,:,:) = 0. ; vv(:,:,:,:) = 0. ; ts(:,:,:,:,:) = 0. 58 59 Krhs_a = Kbb ; Kmm_a = Kbb 60 61 ! Brutal fix to pas 1x1 refinment. 62 ! IF(Agrif_Irhox() == 1) THEN 63 CALL Agrif_Init_Variable(tsini_id, procname=agrif_initts) 64 ! ELSE 65 ! CALL Agrif_Init_Variable(tsini_id, procname=interptsn) 66 67 ! ENDIF 68 Agrif_UseSpecialValue = ln_spc_dyn 69 use_sign_north = .TRUE. 70 sign_north = -1. 71 ! CALL Agrif_Init_Variable(uini_id , procname=interpun ) 72 ! CALL Agrif_Init_Variable(vini_id , procname=interpvn ) 73 use_sign_north = .FALSE. 74 75 Agrif_UseSpecialValue = .FALSE. ! 76 l_ini_child = .FALSE. 77 Krhs_a = Kaa ; Kmm_a = Kmm 78 79 DO jn = 1, jpts 80 ts(:,:,:,jn,Kbb) = ts(:,:,:,jn,Kbb)*tmask(:,:,:) 81 END DO 82 uu(:,:,:,Kbb) = uu(:,:,:,Kbb) * umask(:,:,:) 83 vv(:,:,:,Kbb) = vv(:,:,:,Kbb) * vmask(:,:,:) 84 85 86 CALL lbc_lnk_multi( 'agrif_istate', uu(:,:,:,Kbb), 'U', -1. , vv(:,:,:,Kbb), 'V', -1. ) 87 CALL lbc_lnk( 'agrif_istate', ts(:,:,:,:,Kbb), 'T', 1. ) 88 89 END SUBROUTINE agrif_istate 90 91 SUBROUTINE agrif_declare_var_ini 92 !!---------------------------------------------------------------------- 93 !! *** ROUTINE agrif_declare_var *** 94 !!---------------------------------------------------------------------- 95 USE agrif_util 96 USE agrif_oce 97 USE par_oce 98 USE zdf_oce 99 USE oce 100 USE dom_oce 56 101 ! 57 102 IMPLICIT NONE 58 103 ! 59 104 INTEGER :: ind1, ind2, ind3 60 !!---------------------------------------------------------------------- 105 External :: nemo_mapping 106 !!---------------------------------------------------------------------- 107 108 ! In case of East-West periodicity, prevent AGRIF interpolation at east and west boundaries 109 ! The procnames will not be called at these boundaries 110 IF (jperio == 1) THEN 111 CALL Agrif_Set_NearCommonBorderX(.TRUE.) 112 CALL Agrif_Set_DistantCommonBorderX(.TRUE.) 113 ENDIF 114 115 IF ( .NOT. ln_bry_south) THEN 116 CALL Agrif_Set_NearCommonBorderY(.TRUE.) 117 ENDIF 61 118 62 119 ! 1. Declaration of the type of variable which have to be interpolated 63 120 !--------------------------------------------------------------------- 64 121 ind1 = nbghostcells 65 ind2 = 1 + nbghostcells 66 ind3 = 2 + nbghostcells 67 CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id) 68 CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id) 69 122 ind2 = 2 + nbghostcells_x 123 ind3 = 2 + nbghostcells_y_s 124 125 CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id) 126 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),mbkt_id) 127 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ht0_id) 128 129 CALL agrif_declare_variable((/1,2/),(/ind2-1,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id) 130 CALL agrif_declare_variable((/2,1/),(/ind2,ind3-1/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id) 131 132 133 ! Initial or restart velues 134 CALL Agrif_Set_MaskMaxSearch(25) 135 ! 136 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsini_id) 137 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/) ,uini_id ) 138 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/) ,vini_id ) 139 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshini_id) 140 ! 141 CALL Agrif_Set_MaskMaxSearch(5) 142 70 143 ! 2. Type of interpolation 71 144 !------------------------- 145 CALL Agrif_Set_bcinterp(e3t_id,interp=AGRIF_constant) 146 147 CALL Agrif_Set_bcinterp(mbkt_id,interp=AGRIF_constant) 148 CALL Agrif_Set_interp (mbkt_id,interp=AGRIF_constant) 149 CALL Agrif_Set_bcinterp(ht0_id ,interp=AGRIF_constant) 150 CALL Agrif_Set_interp (ht0_id ,interp=AGRIF_constant) 151 72 152 CALL Agrif_Set_bcinterp( e1u_id, interp1=Agrif_linear, interp2=AGRIF_ppm ) 73 153 CALL Agrif_Set_bcinterp( e2v_id, interp1=AGRIF_ppm , interp2=Agrif_linear ) 74 154 75 ! 3. Location of interpolation 155 ! Initial fields 156 CALL Agrif_Set_bcinterp(tsini_id ,interp=AGRIF_linear) 157 CALL Agrif_Set_interp (tsini_id ,interp=AGRIF_linear) 158 CALL Agrif_Set_bcinterp(uini_id ,interp=AGRIF_linear) 159 CALL Agrif_Set_interp (uini_id ,interp=AGRIF_linear) 160 CALL Agrif_Set_bcinterp(vini_id ,interp=AGRIF_linear) 161 CALL Agrif_Set_interp (vini_id ,interp=AGRIF_linear) 162 CALL Agrif_Set_bcinterp(sshini_id,interp=AGRIF_linear) 163 CALL Agrif_Set_interp (sshini_id,interp=AGRIF_linear) 164 165 ! 3. Location of interpolation 76 166 !----------------------------- 167 ! CALL Agrif_Set_bc( e3t_id, (/-nn_sponge_len*Agrif_irhox(),ind1-1/) ) 168 ! JC: check near the boundary only until matching in sponge has been sorted out: 169 CALL Agrif_Set_bc( e3t_id, (/0,ind1-1/) ) 170 171 ! extend the interpolation zone by 1 more point than necessary: 172 ! RB check here 173 CALL Agrif_Set_bc( mbkt_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 174 CALL Agrif_Set_bc( ht0_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 175 77 176 CALL Agrif_Set_bc(e1u_id,(/0,ind1-1/)) 78 CALL Agrif_Set_bc(e2v_id,(/0,ind1-1/)) 177 CALL Agrif_Set_bc(e2v_id,(/0,ind1-1/)) 178 179 CALL Agrif_Set_bc( tsini_id , (/0,ind1-1/) ) ! if west, rhox=3 and nbghost=3: columns 2 to 4 180 CALL Agrif_Set_bc( uini_id , (/0,ind1-1/) ) 181 CALL Agrif_Set_bc( vini_id , (/0,ind1-1/) ) 182 CALL Agrif_Set_bc( sshini_id, (/0,ind1-1/) ) 79 183 80 184 ! 4. Update type … … 87 191 CALL Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy) 88 192 #endif 89 90 END SUBROUTINE agrif_declare_var_dom 91 92 SUBROUTINE Agrif_InitValues_cont 93 !!---------------------------------------------------------------------- 94 !! *** ROUTINE Agrif_InitValues_cont *** 95 !!---------------------------------------------------------------------- 96 USE agrif_oce 193 194 CALL Agrif_Set_ExternalMapping(nemo_mapping) 195 ! 196 END SUBROUTINE agrif_declare_var_ini 197 198 199 SUBROUTINE Agrif_Init_Domain( Kbb, Kmm, Kaa ) 200 !!---------------------------------------------------------------------- 201 !! *** ROUTINE Agrif_InitValues_cont_dom *** 202 !!---------------------------------------------------------------------- 203 204 !!---------------------------------------------------------------------- 205 !! *** ROUTINE Agrif_InitValues_cont *** 206 !! 207 !! ** Purpose :: Declaration of variables to be interpolated 208 !!---------------------------------------------------------------------- 209 USE agrif_oce_update 97 210 USE agrif_oce_interp 98 211 USE agrif_oce_sponge 212 USE Agrif_Util 213 USE oce 99 214 USE dom_oce 100 USE oce 215 USE zdf_oce 216 USE nemogcm 217 USE agrif_oce 218 ! 219 USE lbclnk 101 220 USE lib_mpp 102 USE lbclnk221 USE in_out_manager 103 222 ! 104 223 IMPLICIT NONE 105 224 ! 106 INTEGER :: ji, jj 225 INTEGER, INTENT(in) :: Kbb, Kmm, Kaa 226 ! 107 227 LOGICAL :: check_namelist 108 228 CHARACTER(len=15) :: cl_check1, cl_check2, cl_check3, cl_check4 109 #if defined key_vertical110 229 REAL(wp), DIMENSION(jpi,jpj) :: zk ! workspace 111 #endif 112 !!---------------------------------------------------------------------- 113 114 ! 1. Declaration of the type of variable which have to be interpolated 115 !--------------------------------------------------------------------- 116 CALL agrif_declare_var 117 118 ! 2. First interpolations of potentially non zero fields 119 !------------------------------------------------------- 120 121 #if defined key_vertical 230 INTEGER :: ji, jj, jk, iminspon 231 !!---------------------------------------------------------------------- 232 233 ! CALL Agrif_Declare_Var_ini 234 235 IF( agrif_oce_alloc() > 0 ) CALL ctl_warn('agrif agrif_oce_alloc: allocation of arrays failed') 236 237 ! lk_west = ( ((nbondi == -1) .OR. (nbondi == 2) ).AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6)) 238 ! lk_east = ( ((nbondi == 1) .OR. (nbondi == 2) ).AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6)) 239 ! lk_south = ( ((nbondj == -1) .OR. (nbondj == 2) ).AND. ln_bry_south) 240 ! lk_north = ( ((nbondj == 1) .OR. (nbondj == 2) )) 241 242 lk_west = ( .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6) ) 243 lk_east = ( .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6) ) 244 lk_south = ln_bry_south 245 lk_north = .true. 246 247 ! Check sponge length: 248 iminspon = MIN(FLOOR(REAL(jpiglo-4)/REAL(2*Agrif_irhox())), FLOOR(REAL(jpjglo-4)/REAL(2*Agrif_irhox())) ) 249 IF (lk_mpp) iminspon = MIN(iminspon,FLOOR(REAL(jpi-2)/REAL(Agrif_irhox())), FLOOR(REAL(jpj-2)/REAL(Agrif_irhox())) ) 250 IF (nn_sponge_len > iminspon) CALL ctl_stop('agrif sponge length is too large') 251 122 252 ! Build consistent parent bathymetry and number of levels 123 253 ! on the child grid … … 126 256 mbkt_parent(:,:) = 0 127 257 ! 128 CALL Agrif_Bc_variable(ht0_id ,calledweight=1.,procname=interpht0 ) 129 CALL Agrif_Bc_variable(mbkt_id,calledweight=1.,procname=interpmbkt) 258 ! CALL Agrif_Bc_variable(ht0_id ,calledweight=1.,procname=interpht0 ) 259 ! CALL Agrif_Bc_variable(mbkt_id,calledweight=1.,procname=interpmbkt) 260 CALL Agrif_Init_Variable(ht0_id , procname=interpht0 ) 261 CALL Agrif_Init_Variable(mbkt_id, procname=interpmbkt) 130 262 ! 131 263 ! Assume step wise change of bathymetry near interface … … 149 281 ENDIF 150 282 ! 151 CALL lbc_lnk( 'Agrif_Init Values_cont', hu0_parent, 'U', 1. )152 CALL lbc_lnk( 'Agrif_Init Values_cont', hv0_parent, 'V', 1. )283 CALL lbc_lnk( 'Agrif_Init_Domain', hu0_parent, 'U', 1. ) 284 CALL lbc_lnk( 'Agrif_Init_Domain', hv0_parent, 'V', 1. ) 153 285 zk(:,:) = REAL( mbku_parent(:,:), wp ) ; CALL lbc_lnk( 'Agrif_InitValues_cont', zk, 'U', 1. ) 154 mbku_parent(:,:) = MAX( NINT( zk(:,:) ), 1 ) 286 mbku_parent(:,:) = MAX( NINT( zk(:,:) ), 1 ) ; 155 287 zk(:,:) = REAL( mbkv_parent(:,:), wp ) ; CALL lbc_lnk( 'Agrif_InitValues_cont', zk, 'V', 1. ) 156 288 mbkv_parent(:,:) = MAX( NINT( zk(:,:) ), 1 ) 157 #endif 158 289 290 291 CALL Agrif_Init_Variable(sshini_id, procname=agrif_initssh) 292 CALL lbc_lnk( 'Agrif_Init_Domain', ssh(:,:,Kbb), 'T', 1. ) 293 DO jk = 1, jpk 294 e3t(:,:,jk,Kbb) = e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb) ) & 295 & / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk) & 296 & + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 297 END DO 298 299 ! check if masks and bathymetries match 300 IF(ln_chk_bathy) THEN 301 Agrif_UseSpecialValue = .FALSE. 302 ! 303 IF(lwp) WRITE(numout,*) ' ' 304 IF(lwp) WRITE(numout,*) 'AGRIF: Check Bathymetry and masks near bdys. Level: ', Agrif_Level() 305 ! 306 kindic_agr = 0 307 IF( .NOT. l_vremap ) THEN 308 ! 309 ! check if tmask and vertical scale factors agree with parent in sponge area: 310 CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) 311 ! 312 ELSE 313 ! 314 ! In case of vertical interpolation, check only that total depths agree between child and parent: 315 DO ji = 1, jpi 316 DO jj = 1, jpj 317 IF ((mbkt_parent(ji,jj)/=0).AND.(ABS(ht0_parent(ji,jj)-ht_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 318 IF ((mbku_parent(ji,jj)/=0).AND.(ABS(hu0_parent(ji,jj)-hu_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 319 IF ((mbkv_parent(ji,jj)/=0).AND.(ABS(hv0_parent(ji,jj)-hv_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 320 END DO 321 END DO 322 323 CALL mpp_sum( 'agrif_user', kindic_agr ) 324 IF( kindic_agr /= 0 ) THEN 325 CALL ctl_stop('==> Child Bathymetry is NOT correct near boundaries.') 326 ELSE 327 IF(lwp) WRITE(numout,*) '==> Child Bathymetry is ok near boundaries.' 328 IF(lwp) WRITE(numout,*) ' ' 329 ENDIF 330 ENDIF 331 ENDIF 332 333 IF( l_vremap ) THEN 334 ! Additional constrain that should be removed someday: 335 IF ( Agrif_Parent(jpk).GT.jpk ) THEN 336 CALL ctl_stop( ' With l_vremap, child grids must have jpk greater or equal to the parent value' ) 337 ENDIF 338 ENDIF 339 ! 340 END SUBROUTINE Agrif_Init_Domain 341 342 343 SUBROUTINE Agrif_InitValues_cont 344 !!---------------------------------------------------------------------- 345 !! *** ROUTINE Agrif_InitValues_cont *** 346 !! 347 !! ** Purpose :: Declaration of variables to be interpolated 348 !!---------------------------------------------------------------------- 349 USE agrif_oce_update 350 USE agrif_oce_interp 351 USE agrif_oce_sponge 352 USE Agrif_Util 353 USE oce 354 USE dom_oce 355 USE zdf_oce 356 USE nemogcm 357 USE agrif_oce 358 ! 359 USE lbclnk 360 USE lib_mpp 361 USE in_out_manager 362 ! 363 IMPLICIT NONE 364 ! 365 LOGICAL :: check_namelist 366 CHARACTER(len=15) :: cl_check1, cl_check2, cl_check3, cl_check4 367 REAL(wp), DIMENSION(jpi,jpj) :: zk ! workspace 368 INTEGER :: ji, jj 369 370 ! 1. Declaration of the type of variable which have to be interpolated 371 !--------------------------------------------------------------------- 372 CALL agrif_declare_var 373 374 ! 2. First interpolations of potentially non zero fields 375 !------------------------------------------------------- 159 376 Agrif_SpecialValue = 0._wp 160 377 Agrif_UseSpecialValue = .TRUE. … … 163 380 tabspongedone_tsn = .FALSE. 164 381 CALL Agrif_Bc_variable(tsn_sponge_id,calledweight=1.,procname=interptsn_sponge) 165 ! reset ts (:,:,:,:,Krhs_a)to zero382 ! reset tsa to zero 166 383 ts(:,:,:,:,Krhs_a) = 0._wp 167 384 168 385 Agrif_UseSpecialValue = ln_spc_dyn 386 use_sign_north = .TRUE. 387 sign_north = -1. 169 388 CALL Agrif_Bc_variable(un_interp_id,calledweight=1.,procname=interpun) 170 389 CALL Agrif_Bc_variable(vn_interp_id,calledweight=1.,procname=interpvn) … … 175 394 tabspongedone_v = .FALSE. 176 395 CALL Agrif_Bc_variable(vn_sponge_id,calledweight=1.,procname=interpvn_sponge) 396 use_sign_north = .FALSE. 177 397 uu(:,:,:,Krhs_a) = 0._wp 178 398 vv(:,:,:,Krhs_a) = 0._wp … … 185 405 IF ( ln_dynspg_ts ) THEN 186 406 Agrif_UseSpecialValue = ln_spc_dyn 407 use_sign_north = .TRUE. 408 sign_north = -1. 187 409 CALL Agrif_Bc_variable(unb_id,calledweight=1.,procname=interpunb) 188 410 CALL Agrif_Bc_variable(vnb_id,calledweight=1.,procname=interpvnb) 189 411 CALL Agrif_Bc_variable(ub2b_interp_id,calledweight=1.,procname=interpub2b) 190 412 CALL Agrif_Bc_variable(vb2b_interp_id,calledweight=1.,procname=interpvb2b) 413 use_sign_north = .FALSE. 191 414 ubdy(:,:) = 0._wp 192 415 vbdy(:,:) = 0._wp 193 416 ENDIF 194 195 Agrif_UseSpecialValue = .FALSE. 196 197 ! 3. Some controls 417 Agrif_UseSpecialValue = .FALSE. 418 198 419 !----------------- 199 420 check_namelist = .TRUE. 200 421 201 422 IF( check_namelist ) THEN 202 203 ! Check time steps204 IF( NINT(Agrif_Rhot()) * NINT(rn_Dt) .NE. Agrif_Parent(rn_Dt) ) THEN205 WRITE(cl_check1,*) NINT(Agrif_Parent(rn_Dt))206 WRITE(cl_check2,*) NINT(rn_Dt)207 WRITE(cl_check3,*) NINT(Agrif_Parent(rn_Dt)/Agrif_Rhot())208 CALL ctl_stop( 'Incompatible time step between ocean grids', &209 & 'parent grid value : '//cl_check1 , &210 & 'child grid value : '//cl_check2 , &211 & 'value on child grid should be changed to : '//cl_check3 )212 ENDIF213 214 ! Check run length215 IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &216 Agrif_Parent(nit000)+1) .NE. (nitend-nit000+1) ) THEN217 WRITE(cl_check1,*) (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1218 WRITE(cl_check2,*) Agrif_Parent(nitend) *Agrif_IRhot()219 CALL ctl_warn( 'Incompatible run length between grids' , &220 & 'nit000 on fine grid will be changed to : '//cl_check1, &221 & 'nitend on fine grid will be changed to : '//cl_check2 )222 nit000 = (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1223 nitend = Agrif_Parent(nitend) *Agrif_IRhot()224 ENDIF225 226 423 ! Check free surface scheme 227 424 IF ( ( Agrif_Parent(ln_dynspg_ts ).AND.ln_dynspg_exp ).OR.& … … 251 448 STOP 252 449 ENDIF 253 254 ENDIF 255 256 ! check if masks and bathymetries match 257 IF(ln_chk_bathy) THEN 258 Agrif_UseSpecialValue = .FALSE. 259 ! 260 IF(lwp) WRITE(numout,*) ' ' 261 IF(lwp) WRITE(numout,*) 'AGRIF: Check Bathymetry and masks near bdys. Level: ', Agrif_Level() 262 ! 263 kindic_agr = 0 264 # if ! defined key_vertical 265 ! 266 ! check if tmask and vertical scale factors agree with parent in sponge area: 267 CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) 268 ! 269 # else 270 ! 271 ! In case of vertical interpolation, check only that total depths agree between child and parent: 272 DO ji = 1, jpi 273 DO jj = 1, jpj 274 IF ((mbkt_parent(ji,jj)/=0).AND.(ABS(ht0_parent(ji,jj)-ht_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 275 IF ((mbku_parent(ji,jj)/=0).AND.(ABS(hu0_parent(ji,jj)-hu_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 276 IF ((mbkv_parent(ji,jj)/=0).AND.(ABS(hv0_parent(ji,jj)-hv_0(ji,jj))>1.e-3)) kindic_agr = kindic_agr + 1 277 END DO 278 END DO 279 # endif 280 CALL mpp_sum( 'agrif_user', kindic_agr ) 281 IF( kindic_agr /= 0 ) THEN 282 CALL ctl_stop('==> Child Bathymetry is NOT correct near boundaries.') 283 ELSE 284 IF(lwp) WRITE(numout,*) '==> Child Bathymetry is ok near boundaries.' 285 IF(lwp) WRITE(numout,*) ' ' 286 END IF 287 ! 288 ENDIF 289 290 # if defined key_vertical 291 ! Additional constrain that should be removed someday: 292 IF ( Agrif_Parent(jpk).GT.jpk ) THEN 293 CALL ctl_stop( ' With key_vertical, child grids must have jpk greater or equal to the parent value' ) 294 ENDIF 295 # endif 296 ! 450 ENDIF 451 297 452 END SUBROUTINE Agrif_InitValues_cont 298 453 … … 314 469 ! 1. Declaration of the type of variable which have to be interpolated 315 470 !--------------------------------------------------------------------- 471 316 472 ind1 = nbghostcells 317 ind2 = 1 + nbghostcells 318 ind3 = 2 + nbghostcells 473 ind2 = 2 + nbghostcells_x 474 ind3 = 2 + nbghostcells_y_s 475 319 476 # if defined key_vertical 320 477 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_id) 321 478 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_sponge_id) 322 479 323 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_interp_id)324 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_interp_id)325 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_update_id)326 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_update_id)327 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_sponge_id)328 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_sponge_id)480 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_interp_id) ! 481 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_interp_id) 482 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_update_id) 483 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_update_id) 484 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_sponge_id) 485 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_sponge_id) 329 486 # else 330 487 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_id) 331 488 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_sponge_id) 332 489 333 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_interp_id)334 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_interp_id)335 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_update_id)336 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_update_id)337 CALL agrif_declare_variable((/1,2,0,0/),(/ind2 ,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_sponge_id)338 CALL agrif_declare_variable((/2,1,0,0/),(/ind 3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_sponge_id)490 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_interp_id) 491 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_interp_id) 492 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_update_id) 493 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_update_id) 494 CALL agrif_declare_variable((/1,2,0,0/),(/ind2-1,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_sponge_id) 495 CALL agrif_declare_variable((/2,1,0,0/),(/ind2,ind3-1,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_sponge_id) 339 496 # endif 340 341 CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id)342 343 # if defined key_vertical344 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),mbkt_id)345 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ht0_id)346 # endif347 348 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,3/),scales_t_id)349 497 350 498 CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),unb_id) … … 357 505 CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshn_id) 358 506 359 IF( ln_zdftke.OR.ln_zdfgls ) THEN 507 508 IF( ln_zdftke.OR.ln_zdfgls ) THEN ! logical not known at this point 360 509 ! CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/), en_id) 361 510 ! CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),avt_id) … … 366 515 # endif 367 516 ENDIF 368 517 369 518 ! 2. Type of interpolation 370 519 !------------------------- 371 520 CALL Agrif_Set_bcinterp(tsn_id,interp=AGRIF_linear) 372 373 521 CALL Agrif_Set_bcinterp(un_interp_id,interp1=Agrif_linear,interp2=AGRIF_ppm) 374 522 CALL Agrif_Set_bcinterp(vn_interp_id,interp1=AGRIF_ppm,interp2=Agrif_linear) 375 523 376 524 CALL Agrif_Set_bcinterp(tsn_sponge_id,interp=AGRIF_linear) 525 CALL Agrif_Set_bcinterp(un_sponge_id,interp1=Agrif_linear,interp2=AGRIF_ppm) 526 CALL Agrif_Set_bcinterp(vn_sponge_id,interp1=AGRIF_ppm,interp2=Agrif_linear) 377 527 378 528 CALL Agrif_Set_bcinterp(sshn_id,interp=AGRIF_linear) … … 390 540 !< 391 541 392 CALL Agrif_Set_bcinterp(un_sponge_id,interp1=Agrif_linear,interp2=AGRIF_ppm) 393 CALL Agrif_Set_bcinterp(vn_sponge_id,interp1=AGRIF_ppm,interp2=Agrif_linear) 394 395 CALL Agrif_Set_bcinterp(e3t_id,interp=AGRIF_constant) 396 397 # if defined key_vertical 398 CALL Agrif_Set_bcinterp(mbkt_id,interp=AGRIF_constant) 399 CALL Agrif_Set_bcinterp(ht0_id ,interp=AGRIF_constant) 400 # endif 401 402 IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bcinterp( avm_id, interp=AGRIF_linear ) 403 404 ! 3. Location of interpolation 542 IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bcinterp( avm_id, interp=AGRIF_linear ) 543 544 545 ! 3. Location of interpolation 405 546 !----------------------------- 406 547 CALL Agrif_Set_bc( tsn_id, (/0,ind1-1/) ) ! if west, rhox=3 and nbghost=3: columns 2 to 4 … … 418 559 CALL Agrif_Set_bc( vb2b_interp_id, (/0,ind1-1/) ) 419 560 420 ! CALL Agrif_Set_bc( e3t_id, (/-nn_sponge_len*Agrif_irhox(),ind1-1/) ) 421 ! JC: check near the boundary only until matching in sponge has been sorted out: 422 CALL Agrif_Set_bc( e3t_id, (/0,ind1-1/) ) 423 424 # if defined key_vertical 425 ! extend the interpolation zone by 1 more point than necessary: 426 CALL Agrif_Set_bc( mbkt_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 427 CALL Agrif_Set_bc( ht0_id, (/-nn_sponge_len*Agrif_irhox()-2,ind1/) ) 428 # endif 429 430 IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bc( avm_id, (/0,ind1/) ) 561 IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bc( avm_id, (/0,ind1/) ) 431 562 432 563 ! 4. Update type 433 564 !--------------- 434 CALL Agrif_Set_Updatetype(scales_t_id, update = AGRIF_Update_Average)435 565 436 566 # if defined UPD_HIGH … … 444 574 CALL Agrif_Set_Updatetype(e3t_id, update = Agrif_Update_Full_Weighting) 445 575 446 IF( ln_zdftke.OR.ln_zdfgls ) THEN576 ! IF( ln_zdftke.OR.ln_zdfgls ) THEN 447 577 ! CALL Agrif_Set_Updatetype( en_id, update = AGRIF_Update_Full_Weighting) 448 578 ! CALL Agrif_Set_Updatetype(avt_id, update = AGRIF_Update_Full_Weighting) 449 579 ! CALL Agrif_Set_Updatetype(avm_id, update = AGRIF_Update_Full_Weighting) 450 ENDIF580 ! ENDIF 451 581 452 582 #else … … 460 590 CALL Agrif_Set_Updatetype(e3t_id, update = AGRIF_Update_Average) 461 591 462 IF( ln_zdftke.OR.ln_zdfgls ) THEN592 ! IF( ln_zdftke.OR.ln_zdfgls ) THEN 463 593 ! CALL Agrif_Set_Updatetype( en_id, update = AGRIF_Update_Average) 464 594 ! CALL Agrif_Set_Updatetype(avt_id, update = AGRIF_Update_Average) 465 595 ! CALL Agrif_Set_Updatetype(avm_id, update = AGRIF_Update_Average) 466 ENDIF596 ! ENDIF 467 597 468 598 #endif … … 472 602 #if defined key_si3 473 603 SUBROUTINE Agrif_InitValues_cont_ice 474 !!----------------------------------------------------------------------475 !! *** ROUTINE Agrif_InitValues_cont_ice ***476 !!----------------------------------------------------------------------477 604 USE Agrif_Util 478 605 USE sbc_oce, ONLY : nn_fsbc ! clem: necessary otherwise Agrif_Parent(nn_fsbc) = nn_fsbc … … 482 609 USE agrif_ice_interp 483 610 USE lib_mpp 484 ! 485 IMPLICIT NONE 486 !!---------------------------------------------------------------------- 487 ! 488 ! Declaration of the type of variable which have to be interpolated (parent=>child) 489 !---------------------------------------------------------------------------------- 490 CALL agrif_declare_var_ice 611 !!---------------------------------------------------------------------- 612 !! *** ROUTINE Agrif_InitValues_cont_ice *** 613 !!---------------------------------------------------------------------- 491 614 492 615 ! Controls … … 495 618 ! the run must satisfy CFL=Uice/(dx/dt) < 0.6/nn_fsbc(child) 496 619 ! therefore, if nn_fsbc(child)>1 one must reduce the time-step in proportion to nn_fsbc(child), which is not acceptable 497 ! If a solution is found, the following stop could be removed because the rest of the code take nn_fsbc(child) into account 620 ! If a solution is found, the following stop could be removed because the rest of the code take nn_fsbc(child) into account 498 621 IF( nn_fsbc > 1 ) CALL ctl_stop('nn_fsbc(child) must be set to 1 otherwise agrif and sea-ice may not work properly') 499 622 … … 516 639 !! *** ROUTINE agrif_declare_var_ice *** 517 640 !!---------------------------------------------------------------------- 641 518 642 USE Agrif_Util 519 643 USE ice 520 USE par_oce, ONLY : nbghostcells 644 USE par_oce, ONLY : nbghostcells, nbghostcells_x, nbghostcells_y_s 521 645 ! 522 646 IMPLICIT NONE 523 647 ! 524 648 INTEGER :: ind1, ind2, ind3 525 !!----------------------------------------------------------------------649 !!---------------------------------------------------------------------- 526 650 ! 527 651 ! 1. Declaration of the type of variable which have to be interpolated (parent=>child) … … 532 656 ! 2,2 = two ghost lines 533 657 !------------------------------------------------------------------------------------- 658 534 659 ind1 = nbghostcells 535 ind2 = 1 + nbghostcells 536 ind3 = 2 + nbghostcells 537 CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(8+nlay_s+nlay_i)/),tra_ice_id) 538 CALL agrif_declare_variable((/1,2/) ,(/ind2,ind3/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,u_ice_id ) 539 CALL agrif_declare_variable((/2,1/) ,(/ind3,ind2/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,v_ice_id ) 660 ind2 = 2 + nbghostcells_x 661 ind3 = 2 + nbghostcells_y_s 662 CALL agrif_declare_variable((/2,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(8+nlay_s+nlay_i)/),tra_ice_id) 663 CALL agrif_declare_variable((/1,2/) ,(/ind2-1,ind3/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,u_ice_id ) 664 CALL agrif_declare_variable((/2,1/) ,(/ind2,ind3-1/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,v_ice_id ) 665 666 CALL Agrif_Set_MaskMaxSearch(25) 667 CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(8+nlay_s+nlay_i)/),tra_iceini_id) 668 CALL agrif_declare_variable((/1,2/) ,(/ind2-1,ind3/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,u_iceini_id ) 669 CALL agrif_declare_variable((/2,1/) ,(/ind2,ind3-1/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,v_iceini_id ) 670 CALL Agrif_Set_MaskMaxSearch(5) 540 671 541 672 ! 2. Set interpolations (normal & tangent to the grid cell for velocities) … … 545 676 CALL Agrif_Set_bcinterp(v_ice_id , interp1 = AGRIF_ppm ,interp2 = Agrif_linear) 546 677 678 CALL Agrif_Set_bcinterp(tra_iceini_id, interp = AGRIF_linear) 679 CALL Agrif_Set_interp (tra_iceini_id, interp = AGRIF_linear) 680 CALL Agrif_Set_bcinterp(u_iceini_id , interp = AGRIF_linear ) 681 CALL Agrif_Set_interp (u_iceini_id , interp = AGRIF_linear ) 682 CALL Agrif_Set_bcinterp(v_iceini_id , interp = AGRIF_linear) 683 CALL Agrif_Set_interp (v_iceini_id , interp = AGRIF_linear) 684 547 685 ! 3. Set location of interpolations 548 686 !---------------------------------- … … 550 688 CALL Agrif_Set_bc(u_ice_id ,(/0,ind1/)) 551 689 CALL Agrif_Set_bc(v_ice_id ,(/0,ind1/)) 690 691 CALL Agrif_Set_bc(tra_iceini_id,(/0,ind1/)) 692 CALL Agrif_Set_bc(u_iceini_id ,(/0,ind1/)) 693 CALL Agrif_Set_bc(v_iceini_id ,(/0,ind1/)) 552 694 553 695 ! 4. Set update type in case 2 ways (child=>parent) (normal & tangent to the grid cell for velocities) … … 557 699 CALL Agrif_Set_Updatetype(u_ice_id , update1 = Agrif_Update_Average , update2 = Agrif_Update_Full_Weighting) 558 700 CALL Agrif_Set_Updatetype(v_ice_id , update1 = Agrif_Update_Full_Weighting, update2 = Agrif_Update_Average ) 559 # else701 # else 560 702 CALL Agrif_Set_Updatetype(tra_ice_id, update = AGRIF_Update_Average) 561 703 CALL Agrif_Set_Updatetype(u_ice_id , update1 = Agrif_Update_Copy , update2 = Agrif_Update_Average) 562 704 CALL Agrif_Set_Updatetype(v_ice_id , update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy ) 563 # endif705 # endif 564 706 565 707 END SUBROUTINE agrif_declare_var_ice … … 585 727 USE agrif_top_sponge 586 728 !! 587 IMPLICIT NONE 588 ! 589 CHARACTER(len=10) :: cl_check1, cl_check2, cl_check3 590 LOGICAL :: check_namelist 591 !!---------------------------------------------------------------------- 592 593 ! 1. Declaration of the type of variable which have to be interpolated 594 !--------------------------------------------------------------------- 595 CALL agrif_declare_var_top 596 597 ! 2. First interpolations of potentially non zero fields 598 !------------------------------------------------------- 599 Agrif_SpecialValue=0._wp 600 Agrif_UseSpecialValue = .TRUE. 601 CALL Agrif_Bc_variable(trn_id,calledweight=1.,procname=interptrn) 602 Agrif_UseSpecialValue = .FALSE. 603 CALL Agrif_Sponge 604 tabspongedone_trn = .FALSE. 605 CALL Agrif_Bc_variable(trn_sponge_id,calledweight=1.,procname=interptrn_sponge) 606 ! reset ts(:,:,:,:,Krhs_a) to zero 607 tr(:,:,:,:,Krhs_a) = 0._wp 608 609 ! 3. Some controls 610 !----------------- 611 check_namelist = .TRUE. 612 613 IF( check_namelist ) THEN 614 ! Check time steps 615 IF( NINT(Agrif_Rhot()) * NINT(rn_Dt) .NE. Agrif_Parent(rn_Dt) ) THEN 616 WRITE(cl_check1,*) Agrif_Parent(rn_Dt) 617 WRITE(cl_check2,*) rn_Dt 618 WRITE(cl_check3,*) rn_Dt*Agrif_Rhot() 729 730 !! 731 IMPLICIT NONE 732 ! 733 CHARACTER(len=10) :: cl_check1, cl_check2, cl_check3 734 LOGICAL :: check_namelist 735 !!---------------------------------------------------------------------- 736 737 738 ! 1. Declaration of the type of variable which have to be interpolated 739 !--------------------------------------------------------------------- 740 CALL agrif_declare_var_top 741 742 ! 2. First interpolations of potentially non zero fields 743 !------------------------------------------------------- 744 Agrif_SpecialValue=0. 745 Agrif_UseSpecialValue = .TRUE. 746 CALL Agrif_Bc_variable(trn_id,calledweight=1.,procname=interptrn) 747 Agrif_UseSpecialValue = .FALSE. 748 CALL Agrif_Sponge 749 tabspongedone_trn = .FALSE. 750 CALL Agrif_Bc_variable(trn_sponge_id,calledweight=1.,procname=interptrn_sponge) 751 ! reset tsa to zero 752 tra(:,:,:,:) = 0. 753 754 ! 3. Some controls 755 !----------------- 756 check_namelist = .TRUE. 757 758 IF( check_namelist ) THEN 759 ! Check time steps 760 IF( NINT(Agrif_Rhot()) * NINT(rdt) .NE. Agrif_Parent(rdt) ) THEN 761 WRITE(cl_check1,*) Agrif_Parent(rdt) 762 WRITE(cl_check2,*) rdt 763 WRITE(cl_check3,*) rdt*Agrif_Rhot() 619 764 CALL ctl_stop( 'incompatible time step between grids', & 620 765 & 'parent grid value : '//cl_check1 , & … … 635 780 nitend = Agrif_Parent(nitend) *Agrif_IRhot() 636 781 ENDIF 637 638 782 ENDIF 639 783 ! … … 655 799 !!---------------------------------------------------------------------- 656 800 801 802 803 !RB_CMEMS : declare here init for top 657 804 ! 1. Declaration of the type of variable which have to be interpolated 658 805 !--------------------------------------------------------------------- 659 806 ind1 = nbghostcells 660 ind2 = 1 + nbghostcells661 ind3 = 2 + nbghostcells 807 ind2 = 2 + nbghostcells_x 808 ind3 = 2 + nbghostcells_y_s 662 809 # if defined key_vertical 663 CALL agrif_declare_variable((/2,2,0,0/),(/ind 3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_id)664 CALL agrif_declare_variable((/2,2,0,0/),(/ind 3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_sponge_id)810 CALL agrif_declare_variable((/2,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_id) 811 CALL agrif_declare_variable((/2,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_sponge_id) 665 812 # else 666 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id) 667 CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id) 813 ! LAURENT: STRANGE why (3,3) here ? 814 CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id) 815 CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id) 668 816 # endif 669 817 … … 705 853 !! *** ROUTINE agrif_init *** 706 854 !!---------------------------------------------------------------------- 707 USE agrif_oce 708 USE agrif_ice 709 USE in_out_manager 710 USE lib_mpp 855 USE agrif_oce 856 USE agrif_ice 857 USE dom_oce 858 USE in_out_manager 859 USE lib_mpp 711 860 !! 712 861 IMPLICIT NONE … … 714 863 INTEGER :: ios ! Local integer output status for namelist read 715 864 NAMELIST/namagrif/ ln_agrif_2way, rn_sponge_tra, rn_sponge_dyn, rn_trelax_tra, rn_trelax_dyn, & 716 & ln_spc_dyn, ln_chk_bathy 865 & ln_spc_dyn, ln_chk_bathy, ln_bry_south 717 866 !!-------------------------------------------------------------------------------------- 718 867 ! … … 735 884 WRITE(numout,*) ' use special values for dynamics ln_spc_dyn = ', ln_spc_dyn 736 885 WRITE(numout,*) ' check bathymetry ln_chk_bathy = ', ln_chk_bathy 737 ENDIF 738 ! 739 ! 740 IF( agrif_oce_alloc() > 0 ) CALL ctl_warn('agrif agrif_oce_alloc: allocation of arrays failed') 886 WRITE(numout,*) ' south boundary ln_bry_south = ', ln_bry_south 887 ENDIF 888 ! 889 ! Set the number of ghost cells according to periodicity 890 nbghostcells_x = nbghostcells 891 nbghostcells_y_s = nbghostcells 892 nbghostcells_y_n = nbghostcells 893 ! 894 IF ( jperio == 1 ) nbghostcells_x = 0 895 IF ( .NOT. ln_bry_south ) nbghostcells_y_s = 0 896 897 ! Some checks 898 IF( jpiglo /= nbcellsx + 2 + 2*nbghostcells_x ) & 899 CALL ctl_stop( 'STOP', 'agrif_nemo_init: Agrif children requires jpiglo == nbcellsx + 2 + 2*nbghostcells_x' ) 900 IF( jpjglo /= nbcellsy + 2 + nbghostcells_y_s + nbghostcells_y_n ) & 901 CALL ctl_stop( 'STOP', 'agrif_nemo_init: Agrif children requires jpjglo == nbcellsy + 2 + nbghostcells_y_s + nbghostcells_y_n' ) 902 IF( ln_use_jattr ) CALL ctl_stop( 'STOP', 'agrif_nemo_init:Agrif children requires ln_use_jattr = .false. ' ) 741 903 ! 742 904 END SUBROUTINE agrif_nemo_init 743 905 744 906 # if defined key_mpp_mpi 745 746 907 SUBROUTINE Agrif_InvLoc( indloc, nprocloc, i, indglob ) 747 908 !!---------------------------------------------------------------------- … … 803 964 # endif 804 965 966 SUBROUTINE nemo_mapping(ndim,ptx,pty,bounds,bounds_chunks,correction_required,nb_chunks) 967 !!---------------------------------------------------------------------- 968 !! *** ROUTINE Nemo_mapping *** 969 !!---------------------------------------------------------------------- 970 USE dom_oce 971 !! 972 IMPLICIT NONE 973 ! 974 INTEGER :: ndim 975 INTEGER :: ptx, pty 976 INTEGER, DIMENSION(ndim,2,2) :: bounds 977 INTEGER, DIMENSION(:,:,:,:), ALLOCATABLE :: bounds_chunks 978 LOGICAL, DIMENSION(:), ALLOCATABLE :: correction_required 979 INTEGER :: nb_chunks 980 ! 981 INTEGER :: i 982 983 IF (agrif_debug_interp) THEN 984 DO i=1,ndim 985 WRITE(*,*) 'direction = ',i,bounds(i,1,2),bounds(i,2,2) 986 ENDDO 987 ENDIF 988 989 IF( bounds(2,2,2) > jpjglo) THEN 990 IF( bounds(2,1,2) <=jpjglo) THEN 991 nb_chunks = 2 992 ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2)) 993 ALLOCATE(correction_required(nb_chunks)) 994 DO i = 1,nb_chunks 995 bounds_chunks(i,:,:,:) = bounds 996 END DO 997 998 ! FIRST CHUNCK (for j<=jpjglo) 999 1000 ! Original indices 1001 bounds_chunks(1,1,1,1) = bounds(1,1,2) 1002 bounds_chunks(1,1,2,1) = bounds(1,2,2) 1003 bounds_chunks(1,2,1,1) = bounds(2,1,2) 1004 bounds_chunks(1,2,2,1) = jpjglo 1005 1006 bounds_chunks(1,1,1,2) = bounds(1,1,2) 1007 bounds_chunks(1,1,2,2) = bounds(1,2,2) 1008 bounds_chunks(1,2,1,2) = bounds(2,1,2) 1009 bounds_chunks(1,2,2,2) = jpjglo 1010 1011 ! Correction required or not 1012 correction_required(1)=.FALSE. 1013 1014 ! SECOND CHUNCK (for j>jpjglo) 1015 1016 ! Original indices 1017 bounds_chunks(2,1,1,1) = bounds(1,1,2) 1018 bounds_chunks(2,1,2,1) = bounds(1,2,2) 1019 bounds_chunks(2,2,1,1) = jpjglo-2 1020 bounds_chunks(2,2,2,1) = bounds(2,2,2) 1021 1022 ! Where to find them 1023 ! We use the relation TAB(ji,jj)=TAB(jpiglo-ji+2,jpjglo-2-(jj-jpjglo)) 1024 1025 IF( ptx == 2) THEN ! T, V points 1026 bounds_chunks(2,1,1,2) = jpiglo-bounds(1,2,2)+2 1027 bounds_chunks(2,1,2,2) = jpiglo-bounds(1,1,2)+2 1028 ELSE ! U, F points 1029 bounds_chunks(2,1,1,2) = jpiglo-bounds(1,2,2)+1 1030 bounds_chunks(2,1,2,2) = jpiglo-bounds(1,1,2)+1 1031 ENDIF 1032 1033 IF( pty == 2) THEN ! T, U points 1034 bounds_chunks(2,2,1,2) = jpjglo-2-(bounds(2,2,2) -jpjglo) 1035 bounds_chunks(2,2,2,2) = jpjglo-2-(jpjglo-2 -jpjglo) 1036 ELSE ! V, F points 1037 bounds_chunks(2,2,1,2) = jpjglo-3-(bounds(2,2,2) -jpjglo) 1038 bounds_chunks(2,2,2,2) = jpjglo-3-(jpjglo-2 -jpjglo) 1039 ENDIF 1040 ! Correction required or not 1041 correction_required(2)=.TRUE. 1042 1043 ELSE 1044 nb_chunks = 1 1045 ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2)) 1046 ALLOCATE(correction_required(nb_chunks)) 1047 DO i=1,nb_chunks 1048 bounds_chunks(i,:,:,:) = bounds 1049 END DO 1050 1051 bounds_chunks(1,1,1,1) = bounds(1,1,2) 1052 bounds_chunks(1,1,2,1) = bounds(1,2,2) 1053 bounds_chunks(1,2,1,1) = bounds(2,1,2) 1054 bounds_chunks(1,2,2,1) = bounds(2,2,2) 1055 1056 bounds_chunks(1,1,1,2) = jpiglo-bounds(1,2,2)+2 1057 bounds_chunks(1,1,2,2) = jpiglo-bounds(1,1,2)+2 1058 1059 bounds_chunks(1,2,1,2) = jpjglo-2-(bounds(2,2,2)-jpjglo) 1060 bounds_chunks(1,2,2,2) = jpjglo-2-(bounds(2,1,2)-jpjglo) 1061 1062 IF( ptx == 2) THEN ! T, V points 1063 bounds_chunks(1,1,1,2) = jpiglo-bounds(1,2,2)+2 1064 bounds_chunks(1,1,2,2) = jpiglo-bounds(1,1,2)+2 1065 ELSE ! U, F points 1066 bounds_chunks(1,1,1,2) = jpiglo-bounds(1,2,2)+1 1067 bounds_chunks(1,1,2,2) = jpiglo-bounds(1,1,2)+1 1068 ENDIF 1069 1070 IF (pty == 2) THEN ! T, U points 1071 bounds_chunks(1,2,1,2) = jpjglo-2-(bounds(2,2,2) -jpjglo) 1072 bounds_chunks(1,2,2,2) = jpjglo-2-(bounds(2,1,2) -jpjglo) 1073 ELSE ! V, F points 1074 bounds_chunks(1,2,1,2) = jpjglo-3-(bounds(2,2,2) -jpjglo) 1075 bounds_chunks(1,2,2,2) = jpjglo-3-(bounds(2,1,2) -jpjglo) 1076 ENDIF 1077 1078 correction_required(1)=.TRUE. 1079 ENDIF 1080 1081 ELSE IF (bounds(1,1,2) < 1) THEN 1082 IF (bounds(1,2,2) > 0) THEN 1083 nb_chunks = 2 1084 ALLOCATE(correction_required(nb_chunks)) 1085 correction_required=.FALSE. 1086 ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2)) 1087 DO i=1,nb_chunks 1088 bounds_chunks(i,:,:,:) = bounds 1089 END DO 1090 1091 bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2 1092 bounds_chunks(1,1,2,2) = 1+jpiglo-2 1093 1094 bounds_chunks(1,1,1,1) = bounds(1,1,2) 1095 bounds_chunks(1,1,2,1) = 1 1096 1097 bounds_chunks(2,1,1,2) = 2 1098 bounds_chunks(2,1,2,2) = bounds(1,2,2) 1099 1100 bounds_chunks(2,1,1,1) = 2 1101 bounds_chunks(2,1,2,1) = bounds(1,2,2) 1102 1103 ELSE 1104 nb_chunks = 1 1105 ALLOCATE(correction_required(nb_chunks)) 1106 correction_required=.FALSE. 1107 ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2)) 1108 DO i=1,nb_chunks 1109 bounds_chunks(i,:,:,:) = bounds 1110 END DO 1111 bounds_chunks(1,1,1,2) = bounds(1,1,2)+jpiglo-2 1112 bounds_chunks(1,1,2,2) = bounds(1,2,2)+jpiglo-2 1113 1114 bounds_chunks(1,1,1,1) = bounds(1,1,2) 1115 bounds_chunks(1,1,2,1) = bounds(1,2,2) 1116 ENDIF 1117 ELSE 1118 nb_chunks=1 1119 ALLOCATE(correction_required(nb_chunks)) 1120 correction_required=.FALSE. 1121 ALLOCATE(bounds_chunks(nb_chunks,ndim,2,2)) 1122 DO i=1,nb_chunks 1123 bounds_chunks(i,:,:,:) = bounds 1124 END DO 1125 bounds_chunks(1,1,1,2) = bounds(1,1,2) 1126 bounds_chunks(1,1,2,2) = bounds(1,2,2) 1127 bounds_chunks(1,2,1,2) = bounds(2,1,2) 1128 bounds_chunks(1,2,2,2) = bounds(2,2,2) 1129 1130 bounds_chunks(1,1,1,1) = bounds(1,1,2) 1131 bounds_chunks(1,1,2,1) = bounds(1,2,2) 1132 bounds_chunks(1,2,1,1) = bounds(2,1,2) 1133 bounds_chunks(1,2,2,1) = bounds(2,2,2) 1134 ENDIF 1135 1136 END SUBROUTINE nemo_mapping 1137 1138 FUNCTION agrif_external_switch_index(ptx,pty,i1,isens) 1139 1140 USE dom_oce 1141 1142 INTEGER :: ptx, pty, i1, isens 1143 INTEGER :: agrif_external_switch_index 1144 1145 IF( isens == 1 ) THEN 1146 IF( ptx == 2 ) THEN ! T, V points 1147 agrif_external_switch_index = jpiglo-i1+2 1148 ELSE ! U, F points 1149 agrif_external_switch_index = jpiglo-i1+1 1150 ENDIF 1151 ELSE IF( isens ==2 ) THEN 1152 IF ( pty == 2 ) THEN ! T, U points 1153 agrif_external_switch_index = jpjglo-2-(i1 -jpjglo) 1154 ELSE ! V, F points 1155 agrif_external_switch_index = jpjglo-3-(i1 -jpjglo) 1156 ENDIF 1157 ENDIF 1158 1159 END function agrif_external_switch_index 1160 1161 SUBROUTINE Correct_field(tab2d,i1,i2,j1,j2) 1162 !!---------------------------------------------------------------------- 1163 !! *** ROUTINE Correct_field *** 1164 !!---------------------------------------------------------------------- 1165 1166 USE dom_oce 1167 USE agrif_oce 1168 1169 INTEGER :: i1,i2,j1,j2 1170 REAL(wp), DIMENSION(i1:i2,j1:j2) :: tab2d 1171 1172 INTEGER :: i,j 1173 REAL(wp), DIMENSION(i1:i2,j1:j2) :: tab2dtemp 1174 1175 tab2dtemp = tab2d 1176 1177 IF( .NOT. use_sign_north ) THEN 1178 DO j=j1,j2 1179 DO i=i1,i2 1180 tab2d(i,j)=tab2dtemp(i2-(i-i1),j2-(j-j1)) 1181 END DO 1182 END DO 1183 ELSE 1184 DO j=j1,j2 1185 DO i=i1,i2 1186 tab2d(i,j)=sign_north * tab2dtemp(i2-(i-i1),j2-(j-j1)) 1187 END DO 1188 END DO 1189 ENDIF 1190 1191 END SUBROUTINE Correct_field 1192 805 1193 #else 806 1194 SUBROUTINE Subcalledbyagrif -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/DOM/dom_oce.F90
r12933 r13026 215 215 #if defined key_agrif 216 216 LOGICAL, PUBLIC, PARAMETER :: lk_agrif = .TRUE. !: agrif flag 217 LOGICAL, PUBLIC :: lk_south, lk_north, lk_west, lk_east !: Child grid boundaries (interpolation or not) 217 218 #else 218 219 LOGICAL, PUBLIC, PARAMETER :: lk_agrif = .FALSE. !: agrif flag -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/DOM/domain.F90
r12489 r13026 187 187 ENDIF 188 188 ! 189 189 190 IF( lk_c1d ) CALL cor_c1d ! 1D configuration: Coriolis set at T-point 190 191 ! 192 193 #if defined key_agrif 194 IF( .NOT. Agrif_Root() ) CALL Agrif_Init_Domain( Kbb, Kmm, Kaa ) 195 #endif 191 196 IF( ln_meshmask ) CALL dom_wri ! Create a domain file 192 197 IF( .NOT.ln_rstart ) CALL dom_ctl ! Domain control … … 307 312 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namrun in configuration namelist' ) 308 313 IF(lwm) WRITE ( numond, namrun ) 314 315 #if defined key_agrif 316 IF( .NOT. Agrif_Root() ) THEN 317 nn_it000 = (Agrif_Parent(nn_it000)-1)*Agrif_IRhot() + 1 318 nn_itend = Agrif_Parent(nn_itend) *Agrif_IRhot() 319 ENDIF 320 #endif 309 321 ! 310 322 IF(lwp) THEN ! control print … … 403 415 IF(lwm) WRITE( numond, namdom ) 404 416 ! 417 #if defined key_agrif 418 IF( .NOT. Agrif_Root() ) THEN 419 rn_Dt = Agrif_Parent(rn_Dt) / Agrif_Rhot() 420 ENDIF 421 #endif 422 ! 405 423 IF(lwp) THEN 406 424 WRITE(numout,*) -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/DOM/istate.F90
r12489 r13026 35 35 USE lib_mpp ! MPP library 36 36 USE restart ! restart 37 #if defined key_agrif 38 USE agrif_oce_interp 39 USE agrif_oce 40 #endif 37 41 38 42 IMPLICIT NONE … … 70 74 !!gm Why not include in the first call of dta_tsd ? 71 75 !!gm probably associated with the use of internal damping... 72 76 CALL dta_tsd_init ! Initialisation of T & S input data 73 77 !!gm to be moved in usrdef of C1D case 74 78 ! IF( lk_c1d ) CALL dta_uvd_init ! Initialization of U & V input data … … 97 101 ! 98 102 IF( ln_tsd_init ) THEN 99 CALL dta_tsd( nit000, ts(:,:,:,:,Kbb) ) ! read 3D T and S data at nit000 103 IF( Agrif_root() ) THEN 104 CALL dta_tsd( nit000, ts(:,:,:,:,Kbb) ) ! read 3D T and S data at nit000 105 ssh(:,:,Kbb) = 0._wp ! set the ocean at rest 106 uu (:,:,:,Kbb) = 0._wp 107 vv (:,:,:,Kbb) = 0._wp 108 #if defined key_agrif 109 ELSE 110 CALL agrif_istate( Kbb, Kmm, Kaa ) 111 #endif 112 ENDIF 100 113 ! 101 ssh(:,:,Kbb) = 0._wp ! set the ocean at rest102 114 IF( ll_wd ) THEN 103 115 ssh(:,:,Kbb) = -ssh_ref ! Added in 30 here for bathy that adds 30 as Iterative test CEOD … … 111 123 END_2D 112 124 ENDIF 113 uu (:,:,:,Kbb) = 0._wp 114 vv (:,:,:,Kbb) = 0._wp 115 ! 125 ! 116 126 ELSE ! user defined initial T and S 117 127 CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb) ) -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/DYN/sshwzv.F90
r12965 r13026 204 204 ! Mask vertical velocity at first/last columns/row 205 205 ! inside computational domain (cosmetic) 206 ! --- West --- ! 207 DO ji = mi0(2), mi1(2) 208 DO jj = 1, jpj 209 pww(ji,jj,:) = 0._wp 206 ! --- West --- ! 207 IF( lk_west) THEN 208 DO ji = mi0(2), mi1(2) 209 DO jj = 1, jpj 210 pww(ji,jj,:) = 0._wp 211 ENDDO 210 212 ENDDO 211 END DO213 ENDIF 212 214 ! 213 215 ! --- East --- ! 214 DO ji = mi0(jpiglo-1), mi1(jpiglo-1) 215 DO jj = 1, jpj 216 pww(ji,jj,:) = 0._wp 216 IF( lk_east) THEN 217 DO ji = mi0(jpiglo-1), mi1(jpiglo-1) 218 DO jj = 1, jpj 219 pww(ji,jj,:) = 0._wp 220 ENDDO 217 221 ENDDO 218 END DO222 ENDIF 219 223 ! 220 224 ! --- South --- ! 221 DO jj = mj0(2), mj1(2) 222 DO ji = 1, jpi 223 pww(ji,jj,:) = 0._wp 225 IF( lk_south) THEN 226 DO jj = mj0(2), mj1(2) 227 DO ji = 1, jpi 228 pww(ji,jj,:) = 0._wp 229 ENDDO 224 230 ENDDO 225 END DO231 ENDIF 226 232 ! 227 233 ! --- North --- ! 228 DO jj = mj0(jpjglo-1), mj1(jpjglo-1) 229 DO ji = 1, jpi 230 pww(ji,jj,:) = 0._wp 234 IF( lk_north) THEN 235 DO jj = mj0(jpjglo-1), mj1(jpjglo-1) 236 DO ji = 1, jpi 237 pww(ji,jj,:) = 0._wp 238 ENDDO 231 239 ENDDO 232 ENDDO 240 ENDIF 241 ! 233 242 ENDIF 234 243 #endif -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/FLO/floblk.F90
r12649 r13026 41 41 INTEGER, INTENT( in ) :: Kbb, Kmm ! ocean time level indices 42 42 !! 43 #ifndef key_agrif 44 45 !RB super quick fix to compile with agrif 46 43 47 INTEGER :: jfl ! dummy loop arguments 44 48 INTEGER :: ind, ifin, iloop … … 364 368 GO TO 222 365 369 ENDIF 370 #endif 366 371 ! 367 372 ! -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/LBC/lib_mpp.F90
r12933 r13026 137 137 138 138 ! Communications summary report 139 CHARACTER(len= 128), DIMENSION(:), ALLOCATABLE :: crname_lbc !: names of lbc_lnk calling routines140 CHARACTER(len= 128), DIMENSION(:), ALLOCATABLE :: crname_glb !: names of global comm calling routines141 CHARACTER(len= 128), DIMENSION(:), ALLOCATABLE :: crname_dlg !: names of delayed global comm calling routines139 CHARACTER(len=lca), DIMENSION(:), ALLOCATABLE :: crname_lbc !: names of lbc_lnk calling routines 140 CHARACTER(len=lca), DIMENSION(:), ALLOCATABLE :: crname_glb !: names of global comm calling routines 141 CHARACTER(len=lca), DIMENSION(:), ALLOCATABLE :: crname_dlg !: names of delayed global comm calling routines 142 142 INTEGER, PUBLIC :: ncom_stp = 0 !: copy of time step # istp 143 143 INTEGER, PUBLIC :: ncom_fsbc = 1 !: copy of sbc time step # nn_fsbc -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/LBC/mppini.F90
r12377 r13026 102 102 & 'the domain is lay out for distributed memory computing!' ) 103 103 ! 104 #if defined key_agrif 105 IF (.NOT.agrif_root()) THEN 106 call agrif_nemo_init() 107 ENDIF 108 #endif 104 109 END SUBROUTINE mpp_init 105 110 … … 333 338 #if defined key_agrif 334 339 IF( .NOT. Agrif_Root() ) THEN ! AGRIF children: specific setting (cf. agrif_user.F90) 335 IF( jpiglo /= nbcellsx + 2 + 2*nbghostcells ) & 336 CALL ctl_stop( 'STOP', 'mpp_init: Agrif children requires jpiglo == nbcellsx + 2 + 2*nbghostcells' ) 337 IF( jpjglo /= nbcellsy + 2 + 2*nbghostcells ) & 338 CALL ctl_stop( 'STOP', 'mpp_init: Agrif children requires jpjglo == nbcellsy + 2 + 2*nbghostcells' ) 339 IF( ln_use_jattr ) CALL ctl_stop( 'STOP', 'mpp_init:Agrif children requires ln_use_jattr = .false. ' ) 340 CALL agrif_nemo_init() 340 341 ENDIF 341 342 #endif -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/OBS/diaobs.F90
r12489 r13026 94 94 TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) :: profdataqc !: Profile data after quality control 95 95 96 CHARACTER(len= 6), PUBLIC, DIMENSION(:), ALLOCATABLE :: cobstypesprof, cobstypessurf !: Profile & surface obs types96 CHARACTER(len=lca), PUBLIC, DIMENSION(:), ALLOCATABLE :: cobstypesprof, cobstypessurf !: Profile & surface obs types 97 97 98 98 !!---------------------------------------------------------------------- -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/SBC/sbcmod.F90
r12489 r13026 122 122 ! !* overwrite namelist parameter using CPP key information 123 123 #if defined key_agrif 124 IF( Agrif_Root() ) THEN ! AGRIF zoom (cf r1242: possibility to run without ice in fine grid)125 IF( lk_si3 ) nn_ice = 2126 IF( lk_cice ) nn_ice = 3127 ENDIF124 ! IF( Agrif_Root() ) THEN ! AGRIF zoom (cf r1242: possibility to run without ice in fine grid) 125 ! IF( lk_si3 ) nn_ice = 2 126 ! IF( lk_cice ) nn_ice = 3 127 ! ENDIF 128 128 !!GS: TBD 129 129 !#else -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/STO/stopar.F90
r12933 r13026 56 56 INTEGER, DIMENSION(:), ALLOCATABLE :: sto3d_ord ! order of autoregressive process 57 57 58 CHARACTER(len= 1), DIMENSION(:), ALLOCATABLE :: sto2d_typ ! nature of grid point (T, U, V, W, F, I)59 CHARACTER(len= 1), DIMENSION(:), ALLOCATABLE :: sto3d_typ ! nature of grid point (T, U, V, W, F, I)58 CHARACTER(len=lca), DIMENSION(:), ALLOCATABLE :: sto2d_typ ! nature of grid point (T, U, V, W, F, I) 59 CHARACTER(len=lca), DIMENSION(:), ALLOCATABLE :: sto3d_typ ! nature of grid point (T, U, V, W, F, I) 60 60 REAL(wp), DIMENSION(:), ALLOCATABLE :: sto2d_sgn ! control of the sign accross the north fold 61 61 REAL(wp), DIMENSION(:), ALLOCATABLE :: sto3d_sgn ! control of the sign accross the north fold -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/USR/usrdef_hgr.F90
r12489 r13026 95 95 #if defined key_agrif 96 96 ! ! Upper left longitude and latitude from parent: 97 ! Laurent: Should be modify in case of an east-west cyclic parent grid 97 98 IF (.NOT.Agrif_root()) THEN 98 99 zlam0 = zlam1 + Agrif_irhox() * REAL(Agrif_Parent(jpjglo)-2 , wp) * ze1deg * zcos_alpha & -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/USR/usrdef_nam.F90
r12377 r13026 74 74 #if defined key_agrif 75 75 IF( .NOT. Agrif_Root() ) THEN 76 kpi = nbcellsx + 2 + 2*nbghostcells 77 kpj = nbcellsy + 2 + 2*nbghostcells 76 kpi = nbcellsx + 2 + 2*nbghostcells_x 77 kpj = nbcellsy + 2 + 2*nbghostcells_y_s 78 78 ENDIF 79 79 #endif -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/nemogcm.F90
r12933 r13026 143 143 #if defined key_agrif 144 144 Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices 145 CALL Agrif_Declare_Var_dom ! AGRIF: set the meshes for DOM 146 CALL Agrif_Declare_Var ! " " " " " DYN/TRA 145 CALL Agrif_Declare_Var ! " " " " " DYN/TRA 147 146 # if defined key_top 148 147 CALL Agrif_Declare_Var_top ! " " " " " TOP 149 # endif150 # if defined key_si3151 CALL Agrif_Declare_Var_ice ! " " " " " Sea ice152 148 # endif 153 149 #endif … … 399 395 ! Initialise time level indices 400 396 Nbb = 1; Nnn = 2; Naa = 3; Nrhs = Naa 401 397 #if defined key_agrif 398 Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices 399 #endif 402 400 ! !-------------------------------! 403 401 ! ! NEMO general initialization ! … … 414 412 IF( lk_c1d ) CALL c1d_init ! 1D column configuration 415 413 CALL wad_init ! Wetting and drying options 414 415 #if defined key_agrif 416 CALL Agrif_Declare_Var_ini ! " " " " " DOM 417 #endif 416 418 CALL dom_init( Nbb, Nnn, Naa, "OPA") ! Domain 419 420 421 417 422 IF( ln_crs ) CALL crs_init( Nnn ) ! coarsened grid: domain initialization 418 423 IF( sn_cfctl%l_prtctl ) & … … 435 440 ENDIF 436 441 ! 437 442 438 443 CALL istate_init( Nbb, Nnn, Naa ) ! ocean initial state (Dynamics and tracers) 439 444 -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/par_kind.F90
r10068 r13026 31 31 32 32 ! !!** Integer ** 33 INTEGER, PUBLIC, PARAMETER :: lc = 256 !: Lenght of Character strings 33 INTEGER, PUBLIC, PARAMETER :: lc = 256 !: Lenght of Character strings 34 INTEGER, PUBLIC, PARAMETER :: lca = 400 !: Lenght of Character arrays 34 35 35 36 !!---------------------------------------------------------------------- -
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/par_oce.F90
r12377 r13026 47 47 ! global domain size for AGRIF !!! * total AGRIF computational domain * 48 48 INTEGER, PUBLIC :: nbug_in_agrif_conv_do_not_remove_or_modify = 1 - 1 49 INTEGER, PUBLIC, PARAMETER :: nbghostcells = 3 !: number of ghost cells 50 INTEGER, PUBLIC :: nbcellsx ! = jpiglo - 2 - 2*nbghostcells !: number of cells in i-direction 51 INTEGER, PUBLIC :: nbcellsy ! = jpjglo - 2 - 2*nbghostcells !: number of cells in j-direction 49 INTEGER, PUBLIC, PARAMETER :: nbghostcells = 3 !: number of ghost cells: default value 50 INTEGER, PUBLIC :: nbghostcells_x !: number of ghost cells in i-direction 51 INTEGER, PUBLIC :: nbghostcells_y_s !: number of ghost cells in j-direction at south 52 INTEGER, PUBLIC :: nbghostcells_y_n !: number of ghost cells in j-direction at north !: number of ghost cells 53 INTEGER, PUBLIC :: nbcellsx ! = jpiglo - 2 - 2*nbghostcells_x !: number of cells in i-direction 54 INTEGER, PUBLIC :: nbcellsy ! = jpjglo - 2 - 2*nbghostcells-y !: number of cells in j-direction 52 55 53 56 ! local domain size !!! * local computational domain *
Note: See TracChangeset
for help on using the changeset viewer.