Changeset 13077
- Timestamp:
- 2020-06-09T17:00:38+02:00 (4 years ago)
- Location:
- NEMO/branches/2020/r4.0-HEAD_ticket2425
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/ICE/iceistate.F90
r12398 r13077 176 176 ! 177 177 ! -- mandatory fields -- ! 178 zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1) 179 zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1) 180 zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1) 178 zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1) * tmask(:,:,1) 179 zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1) * tmask(:,:,1) 180 zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1) * tmask(:,:,1) 181 181 182 182 ! -- optional fields -- ! … … 216 216 & si(jp_hpd)%fnow(:,:,1) = ( rn_hpd_ini_n * zswitch + rn_hpd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 217 217 ! 218 zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) 219 ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) 220 zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1) 221 ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1) 222 zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1) 223 zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1) 218 zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) * tmask(:,:,1) 219 ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) * tmask(:,:,1) 220 zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1) * tmask(:,:,1) 221 ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1) * tmask(:,:,1) 222 zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1) * tmask(:,:,1) 223 zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1) * tmask(:,:,1) 224 224 ! 225 225 ! change the switch for the following -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/NST/agrif_oce_interp.F90
r10068 r13077 96 96 i1 = 1 ; i2 = nlci 97 97 j1 = 1 ; j2 = nlcj 98 IF( nbondj == -1 .OR. nbondj == 2) j1 = 2 + nbghostcells99 IF( nbondj == +1 .OR. nbondj == 2) j2 = nlcj - nbghostcells - 1100 IF( nbondi == -1 .OR. nbondi == 2 )i1 = 2 + nbghostcells101 IF( nbondi == +1 .OR. nbondi == 2 )i2 = nlci - nbghostcells - 198 IF( l_Southedge ) j1 = 2 + nbghostcells 99 IF( l_Northedge ) j2 = nlcj - nbghostcells - 1 100 IF( l_Westedge ) i1 = 2 + nbghostcells 101 IF( l_Eastedge ) i2 = nlci - nbghostcells - 1 102 102 103 103 ! --- West --- ! 104 IF( nbondi == -1 .OR. nbondi == 2) THEN104 IF( l_Westedge ) THEN 105 105 ibdy1 = 2 106 106 ibdy2 = 1+nbghostcells … … 173 173 174 174 ! --- East --- ! 175 IF( nbondi == 1 .OR. nbondi == 2) THEN175 IF( l_Eastedge ) THEN 176 176 ibdy1 = nlci-1-nbghostcells 177 177 ibdy2 = nlci-2 … … 246 246 247 247 ! --- South --- ! 248 IF ( nbondj == -1 .OR. nbondj == 2) THEN248 IF ( l_Southedge ) THEN 249 249 jbdy1 = 2 250 250 jbdy2 = 1+nbghostcells … … 318 318 319 319 ! --- North --- ! 320 IF( nbondj == 1 .OR. nbondj == 2) THEN320 IF( l_Northedge ) THEN 321 321 jbdy1 = nlcj-1-nbghostcells 322 322 jbdy2 = nlcj-2 … … 405 405 IF( Agrif_Root() ) RETURN 406 406 ! 407 IF( (nbondi == -1).OR.(nbondi == 2)) THEN407 IF( l_Westedge ) THEN 408 408 DO jj=1,jpj 409 409 va_e(2:nbghostcells+1,jj) = vbdy_w(1:nbghostcells,jj) * hvr_e(2:nbghostcells+1,jj) … … 416 416 ENDIF 417 417 ! 418 IF( (nbondi == 1).OR.(nbondi == 2)) THEN418 IF( l_Eastedge ) THEN 419 419 DO jj=1,jpj 420 420 va_e(nlci-nbghostcells:nlci-1,jj) = vbdy_e(1:nbghostcells,jj) * hvr_e(nlci-nbghostcells:nlci-1,jj) … … 427 427 ENDIF 428 428 ! 429 IF ((nbondj == -1).OR.(nbondj == 2)) THEN429 IF ( l_Southedge ) THEN 430 430 DO ji=1,jpi 431 431 ua_e(ji,2:nbghostcells+1) = ubdy_s(ji,1:nbghostcells) * hur_e(ji,2:nbghostcells+1) … … 438 438 ENDIF 439 439 ! 440 IF ((nbondj == 1).OR.(nbondj == 2)) THEN440 IF ( l_Northedge ) THEN 441 441 DO ji=1,jpi 442 442 ua_e(ji,nlcj-nbghostcells:nlcj-1) = ubdy_n(ji,1:nbghostcells) * hur_e(ji,nlcj-nbghostcells:nlcj-1) … … 516 516 ! 517 517 ! --- West --- ! 518 IF( (nbondi == -1).OR.(nbondi == 2)) THEN518 IF( l_Westedge ) THEN 519 519 indx = 1+nbghostcells 520 520 DO jj = 1, jpj … … 526 526 ! 527 527 ! --- East --- ! 528 IF( (nbondi == 1).OR.(nbondi == 2)) THEN528 IF( l_Eastedge ) THEN 529 529 indx = nlci-nbghostcells 530 530 DO jj = 1, jpj … … 536 536 ! 537 537 ! --- South --- ! 538 IF ((nbondj == -1).OR.(nbondj == 2)) THEN538 IF ( l_Southedge ) THEN 539 539 indy = 1+nbghostcells 540 540 DO jj = 2, indy … … 546 546 ! 547 547 ! --- North --- ! 548 IF ((nbondj == 1).OR.(nbondj == 2)) THEN548 IF ( l_Northedge ) THEN 549 549 indy = nlcj-nbghostcells 550 550 DO jj = indy, nlcj-1 … … 571 571 ! 572 572 ! --- West --- ! 573 IF( (nbondi == -1).OR.(nbondi == 2)) THEN573 IF( l_Westedge ) THEN 574 574 indx = 1+nbghostcells 575 575 DO jj = 1, jpj … … 581 581 ! 582 582 ! --- East --- ! 583 IF( (nbondi == 1).OR.(nbondi == 2)) THEN583 IF( l_Eastedge ) THEN 584 584 indx = nlci-nbghostcells 585 585 DO jj = 1, jpj … … 591 591 ! 592 592 ! --- South --- ! 593 IF( (nbondj == -1).OR.(nbondj == 2)) THEN593 IF( l_Southedge ) THEN 594 594 indy = 1+nbghostcells 595 595 DO jj = 2, indy … … 601 601 ! 602 602 ! --- North --- ! 603 IF( (nbondj == 1).OR.(nbondj == 2)) THEN603 IF( l_Northedge ) THEN 604 604 indy = nlcj-nbghostcells 605 605 DO jj = indy, nlcj-1 … … 722 722 ! 723 723 ! Remove CORNERS 724 IF( (nbondj == -1).OR.(nbondj == 2)) jmin = 2 + nbghostcells725 IF( (nbondj == +1).OR.(nbondj == 2)) jmax = nlcj - nbghostcells - 1726 IF( (nbondi == -1).OR.(nbondi == 2))imin = 2 + nbghostcells727 IF( (nbondi == +1).OR.(nbondi == 2))imax = nlci - nbghostcells - 1724 IF( l_Southedge ) jmin = 2 + nbghostcells 725 IF( l_Northedge ) jmax = nlcj - nbghostcells - 1 726 IF( l_Westedge ) imin = 2 + nbghostcells 727 IF( l_Eastedge ) imax = nlci - nbghostcells - 1 728 728 ! 729 729 IF( eastern_side ) THEN -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/NST/agrif_oce_sponge.F90
r10425 r13077 109 109 110 110 ! --- West --- ! 111 IF( (nbondi == -1) .OR. (nbondi == 2)) THEN111 IF( l_Westedge ) THEN 112 112 ind1 = 1+nbghostcells 113 113 ind2 = 1+nbghostcells + ispongearea … … 120 120 121 121 ! --- East --- ! 122 IF( (nbondi == 1) .OR. (nbondi == 2)) THEN122 IF( l_Eastedge ) THEN 123 123 ind1 = nlci - nbghostcells - ispongearea 124 124 ind2 = nlci - nbghostcells … … 131 131 132 132 ! --- South --- ! 133 IF( (nbondj == -1) .OR. (nbondj == 2)) THEN133 IF( l_Southedge ) THEN 134 134 ind1 = 1+nbghostcells 135 135 ind2 = 1+nbghostcells + ispongearea … … 142 142 143 143 ! --- North --- ! 144 IF( (nbondj == 1) .OR. (nbondj == 2)) THEN144 IF( l_Northedge ) THEN 145 145 ind1 = nlcj - nbghostcells - ispongearea 146 146 ind2 = nlcj - nbghostcells … … 454 454 455 455 jmax = j2-1 456 IF ( (nbondj == 1).OR.(nbondj == 2)) jmax = MIN(jmax,nlcj-nbghostcells-2) ! North456 IF ( l_Northedge ) jmax = MIN(jmax,nlcj-nbghostcells-2) ! North 457 457 458 458 DO jj = j1+1, jmax … … 580 580 581 581 imax = i2 - 1 582 IF ( (nbondi == 1).OR.(nbondi == 2)) imax = MIN(imax,nlci-nbghostcells-2) ! East582 IF ( l_Eastedge ) imax = MIN(imax,nlci-nbghostcells-2) ! East 583 583 584 584 DO jj = j1+1, j2 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/NST/agrif_top_interp.F90
r10068 r13077 136 136 ! 137 137 ! Remove CORNERS 138 IF( (nbondj == -1).OR.(nbondj == 2)) jmin = 2 + nbghostcells139 IF( (nbondj == +1).OR.(nbondj == 2)) jmax = nlcj - nbghostcells - 1140 IF( (nbondi == -1).OR.(nbondi == 2))imin = 2 + nbghostcells141 IF( (nbondi == +1).OR.(nbondi == 2))imax = nlci - nbghostcells - 1138 IF( l_Southedge ) jmin = 2 + nbghostcells 139 IF( l_Northedge ) jmax = nlcj - nbghostcells - 1 140 IF( l_Westedge ) imin = 2 + nbghostcells 141 IF( l_Eastedge ) imax = nlci - nbghostcells - 1 142 142 ! 143 143 IF( eastern_side ) THEN -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/BDY/bdydta.F90
r12639 r13077 95 95 INTEGER :: jbdy, jfld, jstart, jend, ib, jl ! dummy loop indices 96 96 INTEGER :: ii, ij, ik, igrd, ipl ! local integers 97 INTEGER, DIMENSION(jpbgrd) :: ilen198 97 TYPE(OBC_DATA) , POINTER :: dta_alias ! short cut 99 98 TYPE(FLD), DIMENSION(:), POINTER :: bf_alias … … 120 119 END DO 121 120 ENDIF 122 IF( dta_bdy(jbdy)%lneed_dyn2d .AND. ASSOCIATED(dta_bdy(jbdy)%u2d) ) THEN ! no SIZE with a unassociated pointer121 IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain 123 122 igrd = 2 124 DO ib = 1, SIZE(dta_bdy(jbdy)%u2d) ! u2d is used only on the rim except if ln_full_vel = T, see bdy_dta_init123 DO ib = 1, SIZE(dta_bdy(jbdy)%u2d) ! u2d is used either over the whole bdy or only on the rim 125 124 ii = idx_bdy(jbdy)%nbi(ib,igrd) 126 125 ij = idx_bdy(jbdy)%nbj(ib,igrd) 127 126 dta_bdy(jbdy)%u2d(ib) = un_b(ii,ij) * umask(ii,ij,1) 128 127 END DO 128 ENDIF 129 IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain 129 130 igrd = 3 130 DO ib = 1, SIZE(dta_bdy(jbdy)%v2d) ! v2d is used only on the rim except if ln_full_vel = T, see bdy_dta_init131 DO ib = 1, SIZE(dta_bdy(jbdy)%v2d) ! v2d is used either over the whole bdy or only on the rim 131 132 ii = idx_bdy(jbdy)%nbi(ib,igrd) 132 133 ij = idx_bdy(jbdy)%nbj(ib,igrd) … … 214 215 ! 215 216 ! if runoff condition: change river flow we read (in m3/s) into barotropic velocity (m/s) 216 IF( cn_tra(jbdy) == 'runoff' .AND. TRIM(bf_alias(jp_bdyu2d)%clrootname) /= 'NOT USED' ) THEN ! runoff and we read u/v2d217 IF( cn_tra(jbdy) == 'runoff' ) THEN ! runoff 217 218 ! 218 igrd = 2 ! zonal flow (m3/s) to barotropic zonal velocity (m/s) 219 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 220 ii = idx_bdy(jbdy)%nbi(ib,igrd) 221 ij = idx_bdy(jbdy)%nbj(ib,igrd) 222 dta_alias%u2d(ib) = dta_alias%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) 223 END DO 224 igrd = 3 ! meridional flow (m3/s) to barotropic meridional velocity (m/s) 225 DO ib = 1, idx_bdy(jbdy)%nblen(igrd) 226 ii = idx_bdy(jbdy)%nbi(ib,igrd) 227 ij = idx_bdy(jbdy)%nbj(ib,igrd) 228 dta_alias%v2d(ib) = dta_alias%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) 229 END DO 219 IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain 220 igrd = 2 ! zonal flow (m3/s) to barotropic zonal velocity (m/s) 221 DO ib = 1, SIZE(dta_alias%u2d) ! u2d is used either over the whole bdy or only on the rim 222 ii = idx_bdy(jbdy)%nbi(ib,igrd) 223 ij = idx_bdy(jbdy)%nbj(ib,igrd) 224 dta_alias%u2d(ib) = dta_alias%u2d(ib) / ( e2u(ii,ij) * hu_0(ii,ij) ) 225 END DO 226 ENDIF 227 IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) THEN ! no SIZE with a unassociated pointer. v2d and u2d can differ on subdomain 228 igrd = 3 ! meridional flow (m3/s) to barotropic meridional velocity (m/s) 229 DO ib = 1, SIZE(dta_alias%v2d) ! v2d is used either over the whole bdy or only on the rim 230 ii = idx_bdy(jbdy)%nbi(ib,igrd) 231 ij = idx_bdy(jbdy)%nbj(ib,igrd) 232 dta_alias%v2d(ib) = dta_alias%v2d(ib) / ( e1v(ii,ij) * hv_0(ii,ij) ) 233 END DO 234 ENDIF 230 235 ENDIF 231 236 232 237 ! tidal harmonic forcing ONLY: initialise arrays 233 238 IF( nn_dyn2d_dta(jbdy) == 2 ) THEN ! we did not read ssh, u/v2d 234 IF( dta_alias%lneed_ssh .AND.ASSOCIATED(dta_alias%ssh) ) dta_alias%ssh(:) = 0._wp235 IF( dta_alias%lneed_dyn2d .AND.ASSOCIATED(dta_alias%u2d) ) dta_alias%u2d(:) = 0._wp236 IF( dta_alias%lneed_dyn2d .AND.ASSOCIATED(dta_alias%v2d) ) dta_alias%v2d(:) = 0._wp239 IF( ASSOCIATED(dta_alias%ssh) ) dta_alias%ssh(:) = 0._wp 240 IF( ASSOCIATED(dta_alias%u2d) ) dta_alias%u2d(:) = 0._wp 241 IF( ASSOCIATED(dta_alias%v2d) ) dta_alias%v2d(:) = 0._wp 237 242 ENDIF 238 243 … … 340 345 DO jbdy = 1, nb_bdy ! Tidal component added in ts loop 341 346 IF ( nn_dyn2d_dta(jbdy) .GE. 2 ) THEN 342 IF( cn_dyn2d(jbdy) == 'frs' ) THEN ; ilen1(:)=idx_bdy(jbdy)%nblen(:) 343 ELSE ; ilen1(:)=idx_bdy(jbdy)%nblenrim(:) 344 ENDIF 345 IF ( dta_bdy(jbdy)%lneed_ssh ) dta_bdy_s(jbdy)%ssh(1:ilen1(1)) = dta_bdy(jbdy)%ssh(1:ilen1(1)) 346 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%u2d(1:ilen1(2)) = dta_bdy(jbdy)%u2d(1:ilen1(2)) 347 IF ( dta_bdy(jbdy)%lneed_dyn2d ) dta_bdy_s(jbdy)%v2d(1:ilen1(3)) = dta_bdy(jbdy)%v2d(1:ilen1(3)) 348 ENDIF 349 END DO 350 ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 351 ! 352 CALL bdy_dta_tides( kt=kt, kt_offset=kt_offset ) 353 ENDIF 354 ENDIF 355 ! 356 IF( ln_timing ) CALL timing_stop('bdy_dta') 357 ! 358 END SUBROUTINE bdy_dta 359 347 IF( ASSOCIATED(dta_bdy(jbdy)%ssh) ) dta_bdy_s(jbdy)%ssh(:) = dta_bdy(jbdy)%ssh(:) 348 IF( ASSOCIATED(dta_bdy(jbdy)%u2d) ) dta_bdy_s(jbdy)%u2d(:) = dta_bdy(jbdy)%u2d(:) 349 IF( ASSOCIATED(dta_bdy(jbdy)%v2d) ) dta_bdy_s(jbdy)%v2d(:) = dta_bdy(jbdy)%v2d(:) 350 ENDIF 351 END DO 352 ELSE ! Add tides if not split-explicit free surface else this is done in ts loop 353 ! 354 CALL bdy_dta_tides( kt=kt, kt_offset=kt_offset ) 355 ENDIF 356 ENDIF 357 ! 358 IF( ln_timing ) CALL timing_stop('bdy_dta') 359 ! 360 END SUBROUTINE bdy_dta 361 360 362 361 363 SUBROUTINE bdy_dta_init … … 387 389 LOGICAL :: llneed ! 388 390 LOGICAL :: llread ! 391 LOGICAL :: llfullbdy ! 389 392 TYPE(FLD_N), DIMENSION(1), TARGET :: bn_tem, bn_sal, bn_u3d, bn_v3d ! must be an array to be used with fld_fill 390 393 TYPE(FLD_N), DIMENSION(1), TARGET :: bn_ssh, bn_u2d, bn_v2d ! informations about the fields to be read … … 487 490 igrd = 2 ! U point 488 491 ipk = 1 ! surface data 489 llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)% sshwill be needed492 llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)%u2d will be needed 490 493 llread = .NOT. ln_full_vel .AND. MOD(nn_dyn2d_dta(jbdy),2) == 1 ! don't get u2d from u3d and read NetCDF file 491 494 bf_alias => bf(jp_bdyu2d,jbdy:jbdy) ! alias for u2d structure of bdy number jbdy 492 495 bn_alias => bn_u2d ! alias for u2d structure of nambdy_dta 493 IF( ln_full_vel ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) ! will be computed from u3d -> need on the full bdy 494 ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) ! used only on the rim 496 llfullbdy = ln_full_vel .OR. cn_dyn2d(jbdy) == 'frs' ! need u2d over the whole bdy or only over the rim? 497 IF( llfullbdy ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) 498 ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) 495 499 ENDIF 496 500 ENDIF … … 499 503 igrd = 3 ! V point 500 504 ipk = 1 ! surface data 501 llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)% sshwill be needed505 llneed = dta_bdy(jbdy)%lneed_dyn2d ! dta_bdy(jbdy)%v2d will be needed 502 506 llread = .NOT. ln_full_vel .AND. MOD(nn_dyn2d_dta(jbdy),2) == 1 ! don't get v2d from v3d and read NetCDF file 503 507 bf_alias => bf(jp_bdyv2d,jbdy:jbdy) ! alias for v2d structure of bdy number jbdy 504 508 bn_alias => bn_v2d ! alias for v2d structure of nambdy_dta 505 IF( ln_full_vel ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) ! will be computed from v3d -> need on the full bdy 506 ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) ! used only on the rim 509 llfullbdy = ln_full_vel .OR. cn_dyn2d(jbdy) == 'frs' ! need v2d over the whole bdy or only over the rim? 510 IF( llfullbdy ) THEN ; iszdim = idx_bdy(jbdy)%nblen(igrd) 511 ELSE ; iszdim = idx_bdy(jbdy)%nblenrim(igrd) 507 512 ENDIF 508 513 ENDIF -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/BDY/bdytides.F90
r11536 r13077 62 62 !! namelist variables 63 63 !!------------------- 64 CHARACTER(len=80) :: filtide ! :Filename root for tidal input files65 LOGICAL :: ln_bdytide_2ddta ! :If true, read 2d harmonic data66 LOGICAL :: ln_bdytide_conj ! :If true, assume complex conjugate tidal data64 CHARACTER(len=80) :: filtide ! Filename root for tidal input files 65 LOGICAL :: ln_bdytide_2ddta ! If true, read 2d harmonic data 66 LOGICAL :: ln_bdytide_conj ! If true, assume complex conjugate tidal data 67 67 !! 68 INTEGER :: ib_bdy, itide, ib ! :dummy loop indices69 INTEGER :: ii, ij ! :dummy loop indices68 INTEGER :: ib_bdy, itide, ib ! dummy loop indices 69 INTEGER :: ii, ij ! dummy loop indices 70 70 INTEGER :: inum, igrd 71 INTEGER , DIMENSION(3) :: ilen0 !: length of boundary data (from OBC arrays)71 INTEGER :: isz ! bdy data size 72 72 INTEGER :: ios ! Local integer output status for namelist read 73 CHARACTER(len=80) :: clfile ! :full file name for tidal input file74 REAL(wp),ALLOCATABLE, DIMENSION(:,:,:) :: dta_read ! :work space to read in tidal harmonics data75 REAL(wp),ALLOCATABLE, DIMENSION(:,:) :: ztr, zti ! :" " " " " " " "73 CHARACTER(len=80) :: clfile ! full file name for tidal input file 74 REAL(wp),ALLOCATABLE, DIMENSION(:,:,:) :: dta_read ! work space to read in tidal harmonics data 75 REAL(wp),ALLOCATABLE, DIMENSION(:,:) :: ztr, zti ! " " " " " " " " 76 76 !! 77 TYPE(TIDES_DATA), POINTER :: td !: local short cut 77 TYPE(TIDES_DATA), POINTER :: td ! local short cut 78 TYPE( OBC_DATA), POINTER :: dta ! local short cut 78 79 !! 79 80 NAMELIST/nambdy_tide/filtide, ln_bdytide_2ddta, ln_bdytide_conj … … 89 90 IF( nn_dyn2d_dta(ib_bdy) >= 2 ) THEN 90 91 ! 91 td => tides(ib_bdy) 92 92 td => tides(ib_bdy) 93 dta => dta_bdy(ib_bdy) 94 93 95 ! Namelist nambdy_tide : tidal harmonic forcing at open boundaries 94 96 filtide(:) = '' … … 115 117 IF(lwp) WRITE(numout,*) ' ' 116 118 117 ! Allocate space for tidal harmonics data - get size from OBC data arrays 119 ! Allocate space for tidal harmonics data - get size from BDY data arrays 120 ! Allocate also slow varying data in the case of time splitting: 121 ! Do it anyway because at this stage knowledge of free surface scheme is unknown 118 122 ! ----------------------------------------------------------------------- 119 120 ! JC: If FRS scheme is used, we assume that tidal is needed over the whole 121 ! relaxation area 122 IF( cn_dyn2d(ib_bdy) == 'frs' ) THEN ; ilen0(:) = idx_bdy(ib_bdy)%nblen (:) 123 ELSE ; ilen0(:) = idx_bdy(ib_bdy)%nblenrim(:) 123 IF( ASSOCIATED(dta%ssh) ) THEN ! we use bdy ssh on this mpi subdomain 124 isz = SIZE(dta%ssh) 125 ALLOCATE( td%ssh0( isz, nb_harmo, 2 ), td%ssh( isz, nb_harmo, 2 ), dta_bdy_s(ib_bdy)%ssh( isz ) ) 126 dta_bdy_s(ib_bdy)%ssh(:) = 0._wp ! needed? 124 127 ENDIF 125 126 ALLOCATE( td%ssh0( ilen0(1), nb_harmo, 2 ) ) 127 ALLOCATE( td%ssh ( ilen0(1), nb_harmo, 2 ) ) 128 129 ALLOCATE( td%u0( ilen0(2), nb_harmo, 2 ) ) 130 ALLOCATE( td%u ( ilen0(2), nb_harmo, 2 ) ) 131 132 ALLOCATE( td%v0( ilen0(3), nb_harmo, 2 ) ) 133 ALLOCATE( td%v ( ilen0(3), nb_harmo, 2 ) ) 134 135 td%ssh0(:,:,:) = 0._wp 136 td%ssh (:,:,:) = 0._wp 137 td%u0 (:,:,:) = 0._wp 138 td%u (:,:,:) = 0._wp 139 td%v0 (:,:,:) = 0._wp 140 td%v (:,:,:) = 0._wp 141 128 IF( ASSOCIATED(dta%u2d) ) THEN ! we use bdy u2d on this mpi subdomain 129 isz = SIZE(dta%u2d) 130 ALLOCATE( td%u0 ( isz, nb_harmo, 2 ), td%u ( isz, nb_harmo, 2 ), dta_bdy_s(ib_bdy)%u2d( isz ) ) 131 dta_bdy_s(ib_bdy)%u2d(:) = 0._wp ! needed? 132 ENDIF 133 IF( ASSOCIATED(dta%v2d) ) THEN ! we use bdy v2d on this mpi subdomain 134 isz = SIZE(dta%v2d) 135 ALLOCATE( td%v0 ( isz, nb_harmo, 2 ), td%v ( isz, nb_harmo, 2 ), dta_bdy_s(ib_bdy)%v2d( isz ) ) 136 dta_bdy_s(ib_bdy)%v2d(:) = 0._wp ! needed? 137 ENDIF 138 139 ! fill td%ssh0, td%u0, td%v0 140 ! ----------------------------------------------------------------------- 142 141 IF( ln_bdytide_2ddta ) THEN 142 ! 143 143 ! It is assumed that each data file contains all complex harmonic amplitudes 144 144 ! given on the global domain (ie global, jpiglo x jpjglo) … … 147 147 ! 148 148 ! SSH fields 149 clfile = TRIM(filtide)//'_grid_T.nc' 150 CALL iom_open( clfile , inum ) 151 igrd = 1 ! Everything is at T-points here 152 DO itide = 1, nb_harmo 153 CALL iom_get( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_z1', ztr(:,:) ) 154 CALL iom_get( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_z2', zti(:,:) ) 155 DO ib = 1, ilen0(igrd) 156 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 157 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 158 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE ! to remove? 159 td%ssh0(ib,itide,1) = ztr(ii,ij) 160 td%ssh0(ib,itide,2) = zti(ii,ij) 149 IF( ASSOCIATED(dta%ssh) ) THEN ! we use bdy ssh on this mpi subdomain 150 clfile = TRIM(filtide)//'_grid_T.nc' 151 CALL iom_open( clfile , inum ) 152 igrd = 1 ! Everything is at T-points here 153 DO itide = 1, nb_harmo 154 CALL iom_get( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_z1', ztr(:,:) ) 155 CALL iom_get( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_z2', zti(:,:) ) 156 DO ib = 1, SIZE(dta%ssh) 157 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 158 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 159 td%ssh0(ib,itide,1) = ztr(ii,ij) 160 td%ssh0(ib,itide,2) = zti(ii,ij) 161 END DO 161 162 END DO 162 END DO163 CALL iom_close( inum )163 CALL iom_close( inum ) 164 END IF 164 165 ! 165 166 ! U fields 166 clfile = TRIM(filtide)//'_grid_U.nc' 167 CALL iom_open( clfile , inum ) 168 igrd = 2 ! Everything is at U-points here 169 DO itide = 1, nb_harmo 170 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_u1', ztr(:,:) ) 171 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_u2', zti(:,:) ) 172 DO ib = 1, ilen0(igrd) 173 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 174 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 175 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE ! to remove? 176 td%u0(ib,itide,1) = ztr(ii,ij) 177 td%u0(ib,itide,2) = zti(ii,ij) 167 IF( ASSOCIATED(dta%u2d) ) THEN ! we use bdy u2d on this mpi subdomain 168 clfile = TRIM(filtide)//'_grid_U.nc' 169 CALL iom_open( clfile , inum ) 170 igrd = 2 ! Everything is at U-points here 171 DO itide = 1, nb_harmo 172 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_u1', ztr(:,:) ) 173 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_u2', zti(:,:) ) 174 DO ib = 1, SIZE(dta%u2d) 175 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 176 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 177 td%u0(ib,itide,1) = ztr(ii,ij) 178 td%u0(ib,itide,2) = zti(ii,ij) 179 END DO 178 180 END DO 179 END DO180 CALL iom_close( inum )181 CALL iom_close( inum ) 182 END IF 181 183 ! 182 184 ! V fields 183 clfile = TRIM(filtide)//'_grid_V.nc' 184 CALL iom_open( clfile , inum ) 185 igrd = 3 ! Everything is at V-points here 186 DO itide = 1, nb_harmo 187 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_v1', ztr(:,:) ) 188 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_v2', zti(:,:) ) 189 DO ib = 1, ilen0(igrd) 190 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 191 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 192 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE ! to remove? 193 td%v0(ib,itide,1) = ztr(ii,ij) 194 td%v0(ib,itide,2) = zti(ii,ij) 185 IF( ASSOCIATED(dta%v2d) ) THEN ! we use bdy v2d on this mpi subdomain 186 clfile = TRIM(filtide)//'_grid_V.nc' 187 CALL iom_open( clfile , inum ) 188 igrd = 3 ! Everything is at V-points here 189 DO itide = 1, nb_harmo 190 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_v1', ztr(:,:) ) 191 CALL iom_get ( inum, jpdom_autoglo, TRIM(Wave(ntide(itide))%cname_tide)//'_v2', zti(:,:) ) 192 DO ib = 1, SIZE(dta%v2d) 193 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 194 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 195 td%v0(ib,itide,1) = ztr(ii,ij) 196 td%v0(ib,itide,2) = zti(ii,ij) 197 END DO 195 198 END DO 196 END DO197 CALL iom_close( inum )199 CALL iom_close( inum ) 200 END IF 198 201 ! 199 202 DEALLOCATE( ztr, zti ) … … 203 206 ! Read tidal data only on bdy segments 204 207 ! 205 ALLOCATE( dta_read( MAXVAL( ilen0(1:3)), 1, 1 ) )208 ALLOCATE( dta_read( MAXVAL( idx_bdy(ib_bdy)%nblen(:) ), 1, 1 ) ) 206 209 ! 207 210 ! Open files and read in tidal forcing data … … 210 213 DO itide = 1, nb_harmo 211 214 ! ! SSH fields 212 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_T.nc' 213 CALL iom_open( clfile, inum ) 214 CALL fld_map( inum, 'z1' , dta_read(1:ilen0(1),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,1) ) 215 td%ssh0(:,itide,1) = dta_read(1:ilen0(1),1,1) 216 CALL fld_map( inum, 'z2' , dta_read(1:ilen0(1),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,1) ) 217 td%ssh0(:,itide,2) = dta_read(1:ilen0(1),1,1) 218 CALL iom_close( inum ) 215 IF( ASSOCIATED(dta%ssh) ) THEN ! we use bdy ssh on this mpi subdomain 216 isz = SIZE(dta%ssh) 217 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_T.nc' 218 CALL iom_open( clfile, inum ) 219 CALL fld_map( inum, 'z1', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,1) ) 220 td%ssh0(:,itide,1) = dta_read(1:isz,1,1) 221 CALL fld_map( inum, 'z2', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,1) ) 222 td%ssh0(:,itide,2) = dta_read(1:isz,1,1) 223 CALL iom_close( inum ) 224 ENDIF 219 225 ! ! U fields 220 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_U.nc' 221 CALL iom_open( clfile, inum ) 222 CALL fld_map( inum, 'u1' , dta_read(1:ilen0(2),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,2) ) 223 td%u0(:,itide,1) = dta_read(1:ilen0(2),1,1) 224 CALL fld_map( inum, 'u2' , dta_read(1:ilen0(2),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,2) ) 225 td%u0(:,itide,2) = dta_read(1:ilen0(2),1,1) 226 CALL iom_close( inum ) 226 IF( ASSOCIATED(dta%u2d) ) THEN ! we use bdy u2d on this mpi subdomain 227 isz = SIZE(dta%u2d) 228 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_U.nc' 229 CALL iom_open( clfile, inum ) 230 CALL fld_map( inum, 'u1', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,2) ) 231 td%u0(:,itide,1) = dta_read(1:isz,1,1) 232 CALL fld_map( inum, 'u2', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,2) ) 233 td%u0(:,itide,2) = dta_read(1:isz,1,1) 234 CALL iom_close( inum ) 235 ENDIF 227 236 ! ! V fields 228 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_V.nc' 229 CALL iom_open( clfile, inum ) 230 CALL fld_map( inum, 'v1' , dta_read(1:ilen0(3),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,3) ) 231 td%v0(:,itide,1) = dta_read(1:ilen0(3),1,1) 232 CALL fld_map( inum, 'v2' , dta_read(1:ilen0(3),1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,3) ) 233 td%v0(:,itide,2) = dta_read(1:ilen0(3),1,1) 234 CALL iom_close( inum ) 237 IF( ASSOCIATED(dta%v2d) ) THEN ! we use bdy v2d on this mpi subdomain 238 isz = SIZE(dta%v2d) 239 clfile = TRIM(filtide)//TRIM(Wave(ntide(itide))%cname_tide)//'_grid_V.nc' 240 CALL iom_open( clfile, inum ) 241 CALL fld_map( inum, 'v1', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,3) ) 242 td%v0(:,itide,1) = dta_read(1:isz,1,1) 243 CALL fld_map( inum, 'v2', dta_read(1:isz,1:1,1:1) , 1, idx_bdy(ib_bdy)%nbmap(:,3) ) 244 td%v0(:,itide,2) = dta_read(1:isz,1,1) 245 CALL iom_close( inum ) 246 ENDIF 235 247 ! 236 248 END DO ! end loop on tidal components … … 241 253 ! 242 254 IF( ln_bdytide_conj ) THEN ! assume complex conjugate in data files 243 td%ssh0(:,:,2) = - td%ssh0(:,:,2)244 td%u0 (:,:,2) = - td%u0 (:,:,2)245 td%v0 (:,:,2) = - td%v0 (:,:,2)255 IF( ASSOCIATED(dta%ssh) ) td%ssh0(:,:,2) = - td%ssh0(:,:,2) 256 IF( ASSOCIATED(dta%u2d) ) td%u0 (:,:,2) = - td%u0 (:,:,2) 257 IF( ASSOCIATED(dta%v2d) ) td%v0 (:,:,2) = - td%v0 (:,:,2) 246 258 ENDIF 247 !248 ! Allocate slow varying data in the case of time splitting:249 ! Do it anyway because at this stage knowledge of free surface scheme is unknown250 ALLOCATE( dta_bdy_s(ib_bdy)%ssh ( ilen0(1) ) )251 ALLOCATE( dta_bdy_s(ib_bdy)%u2d ( ilen0(2) ) )252 ALLOCATE( dta_bdy_s(ib_bdy)%v2d ( ilen0(3) ) )253 dta_bdy_s(ib_bdy)%ssh(:) = 0._wp254 dta_bdy_s(ib_bdy)%u2d(:) = 0._wp255 dta_bdy_s(ib_bdy)%v2d(:) = 0._wp256 259 ! 257 260 ENDIF ! nn_dyn2d_dta(ib_bdy) >= 2 … … 281 284 ! ! etc. 282 285 ! 283 INTEGER :: itide, i grd, ib! dummy loop indices286 INTEGER :: itide, ib ! dummy loop indices 284 287 INTEGER :: time_add ! time offset in units of timesteps 285 INTEGER , DIMENSION(3) :: ilen0 ! length of boundary data (from OBC arrays)288 INTEGER :: isz ! bdy data size 286 289 REAL(wp) :: z_arg, z_sarg, zflag, zramp ! local scalars 287 290 REAL(wp), DIMENSION(jpmax_harmo) :: z_sist, z_cost 288 291 !!---------------------------------------------------------------------- 289 292 ! 290 ilen0(1) = SIZE(td%ssh(:,1,1))291 ilen0(2) = SIZE(td%u(:,1,1))292 ilen0(3) = SIZE(td%v(:,1,1))293 294 293 zflag=1 295 294 IF ( PRESENT(kit) ) THEN 296 295 IF ( kit /= 1 ) zflag=0 297 296 ENDIF 298 297 ! 299 298 IF ( (nsec_day == NINT(0.5_wp * rdt) .OR. kt==nit000) .AND. zflag==1 ) THEN 300 299 ! … … 334 333 335 334 DO itide = 1, nb_harmo 336 igrd=1 ! SSH on tracer grid 337 DO ib = 1, ilen0(igrd) 338 dta%ssh(ib) = dta%ssh(ib) + zramp*(td%ssh(ib,itide,1)*z_cost(itide) + td%ssh(ib,itide,2)*z_sist(itide)) 339 END DO 340 igrd=2 ! U grid 341 DO ib = 1, ilen0(igrd) 342 dta%u2d(ib) = dta%u2d(ib) + zramp*(td%u (ib,itide,1)*z_cost(itide) + td%u (ib,itide,2)*z_sist(itide)) 343 END DO 344 igrd=3 ! V grid 345 DO ib = 1, ilen0(igrd) 346 dta%v2d(ib) = dta%v2d(ib) + zramp*(td%v (ib,itide,1)*z_cost(itide) + td%v (ib,itide,2)*z_sist(itide)) 347 END DO 335 ! SSH on tracer grid 336 IF( ASSOCIATED(dta%ssh) ) THEN ! we use bdy ssh on this mpi subdomain 337 DO ib = 1, SIZE(dta%ssh) 338 dta%ssh(ib) = dta%ssh(ib) + zramp*(td%ssh(ib,itide,1)*z_cost(itide) + td%ssh(ib,itide,2)*z_sist(itide)) 339 END DO 340 ENDIF 341 ! U grid 342 IF( ASSOCIATED(dta%u2d) ) THEN ! we use bdy u2d on this mpi subdomain 343 DO ib = 1, SIZE(dta%u2d) 344 dta%u2d(ib) = dta%u2d(ib) + zramp*(td%u (ib,itide,1)*z_cost(itide) + td%u (ib,itide,2)*z_sist(itide)) 345 END DO 346 ENDIF 347 ! V grid 348 IF( ASSOCIATED(dta%v2d) ) THEN ! we use bdy v2d on this mpi subdomain 349 DO ib = 1, SIZE(dta%v2d) 350 dta%v2d(ib) = dta%v2d(ib) + zramp*(td%v (ib,itide,1)*z_cost(itide) + td%v (ib,itide,2)*z_sist(itide)) 351 END DO 352 ENDIF 348 353 END DO 349 354 ! … … 368 373 ! 369 374 LOGICAL :: lk_first_btstp ! =.TRUE. if time splitting and first barotropic step 370 INTEGER :: itide, ib_bdy, ib , igrd! loop indices375 INTEGER :: itide, ib_bdy, ib ! loop indices 371 376 INTEGER :: time_add ! time offset in units of timesteps 372 INTEGER, DIMENSION(jpbgrd) :: ilen0373 INTEGER, DIMENSION(1:jpbgrd) :: nblen, nblenrim ! short cuts374 377 REAL(wp) :: z_arg, z_sarg, zramp, zoff, z_cost, z_sist 375 378 !!---------------------------------------------------------------------- … … 398 401 IF( nn_dyn2d_dta(ib_bdy) >= 2 ) THEN 399 402 ! 400 nblen(1:jpbgrd) = idx_bdy(ib_bdy)%nblen(1:jpbgrd)401 nblenrim(1:jpbgrd) = idx_bdy(ib_bdy)%nblenrim(1:jpbgrd)402 !403 IF( cn_dyn2d(ib_bdy) == 'frs' ) THEN ; ilen0(:) = nblen (:)404 ELSE ; ilen0(:) = nblenrim(:)405 ENDIF406 !407 403 ! We refresh nodal factors every day below 408 404 ! This should be done somewhere else … … 425 421 ! If time splitting, initialize arrays from slow varying open boundary data: 426 422 IF ( PRESENT(kit) ) THEN 427 IF ( dta_bdy(ib_bdy)%lneed_ssh ) dta_bdy(ib_bdy)%ssh(1:ilen0(1)) = dta_bdy_s(ib_bdy)%ssh(1:ilen0(1))428 IF ( dta_bdy(ib_bdy)%lneed_dyn2d ) dta_bdy(ib_bdy)%u2d(1:ilen0(2)) = dta_bdy_s(ib_bdy)%u2d(1:ilen0(2))429 IF ( dta_bdy(ib_bdy)%lneed_dyn2d ) dta_bdy(ib_bdy)%v2d(1:ilen0(3)) = dta_bdy_s(ib_bdy)%v2d(1:ilen0(3))423 IF ( ASSOCIATED(dta_bdy(ib_bdy)%ssh) ) dta_bdy(ib_bdy)%ssh(:) = dta_bdy_s(ib_bdy)%ssh(:) 424 IF ( ASSOCIATED(dta_bdy(ib_bdy)%u2d) ) dta_bdy(ib_bdy)%u2d(:) = dta_bdy_s(ib_bdy)%u2d(:) 425 IF ( ASSOCIATED(dta_bdy(ib_bdy)%v2d) ) dta_bdy(ib_bdy)%v2d(:) = dta_bdy_s(ib_bdy)%v2d(:) 430 426 ENDIF 431 427 ! … … 437 433 z_sist = zramp * SIN( z_sarg ) 438 434 ! 439 IF ( dta_bdy(ib_bdy)%lneed_ssh ) THEN 440 igrd=1 ! SSH on tracer grid 441 DO ib = 1, ilen0(igrd) 435 IF ( ASSOCIATED(dta_bdy(ib_bdy)%ssh) ) THEN ! SSH on tracer grid 436 DO ib = 1, SIZE(dta_bdy(ib_bdy)%ssh) 442 437 dta_bdy(ib_bdy)%ssh(ib) = dta_bdy(ib_bdy)%ssh(ib) + & 443 438 & ( tides(ib_bdy)%ssh(ib,itide,1)*z_cost + & … … 446 441 ENDIF 447 442 ! 448 IF ( dta_bdy(ib_bdy)%lneed_dyn2d ) THEN 449 igrd=2 ! U grid 450 DO ib = 1, ilen0(igrd) 443 IF ( ASSOCIATED(dta_bdy(ib_bdy)%u2d) ) THEN ! U grid 444 DO ib = 1, SIZE(dta_bdy(ib_bdy)%u2d) 451 445 dta_bdy(ib_bdy)%u2d(ib) = dta_bdy(ib_bdy)%u2d(ib) + & 452 446 & ( tides(ib_bdy)%u(ib,itide,1)*z_cost + & 453 447 & tides(ib_bdy)%u(ib,itide,2)*z_sist ) 454 448 END DO 455 igrd=3 ! V grid 456 DO ib = 1, ilen0(igrd) 449 ENDIF 450 ! 451 IF ( ASSOCIATED(dta_bdy(ib_bdy)%v2d) ) THEN ! V grid 452 DO ib = 1, SIZE(dta_bdy(ib_bdy)%v2d) 457 453 dta_bdy(ib_bdy)%v2d(ib) = dta_bdy(ib_bdy)%v2d(ib) + & 458 454 & ( tides(ib_bdy)%v(ib,itide,1)*z_cost + & … … 460 456 END DO 461 457 ENDIF 458 ! 462 459 END DO 463 460 END IF … … 474 471 TYPE(TIDES_DATA), INTENT(inout) :: td ! tidal harmonics data 475 472 ! 476 INTEGER :: itide, igrd, ib ! dummy loop indices 477 INTEGER, DIMENSION(1) :: ilen0 ! length of boundary data (from OBC arrays) 473 INTEGER :: itide, isz, ib ! dummy loop indices 478 474 REAL(wp),ALLOCATABLE, DIMENSION(:) :: mod_tide, phi_tide 479 475 !!---------------------------------------------------------------------- 480 476 ! 481 igrd=1 482 ! SSH on tracer grid. 483 ilen0(1) = SIZE(td%ssh0(:,1,1)) 484 ! 485 ALLOCATE( mod_tide(ilen0(igrd)), phi_tide(ilen0(igrd)) ) 486 ! 487 DO itide = 1, nb_harmo 488 DO ib = 1, ilen0(igrd) 489 mod_tide(ib)=SQRT(td%ssh0(ib,itide,1)**2.+td%ssh0(ib,itide,2)**2.) 490 phi_tide(ib)=ATAN2(-td%ssh0(ib,itide,2),td%ssh0(ib,itide,1)) 477 IF( ASSOCIATED(td%ssh0) ) THEN ! SSH on tracer grid. 478 ! 479 isz = SIZE( td%ssh0, dim = 1 ) 480 ALLOCATE( mod_tide(isz), phi_tide(isz) ) 481 ! 482 DO itide = 1, nb_harmo 483 DO ib = 1, isz 484 mod_tide(ib)=SQRT( td%ssh0(ib,itide,1)*td%ssh0(ib,itide,1) + td%ssh0(ib,itide,2)*td%ssh0(ib,itide,2) ) 485 phi_tide(ib)=ATAN2(-td%ssh0(ib,itide,2),td%ssh0(ib,itide,1)) 486 END DO 487 DO ib = 1, isz 488 mod_tide(ib)=mod_tide(ib)*ftide(itide) 489 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 490 END DO 491 DO ib = 1, isz 492 td%ssh(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 493 td%ssh(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 494 END DO 491 495 END DO 492 DO ib = 1 , ilen0(igrd) 493 mod_tide(ib)=mod_tide(ib)*ftide(itide) 494 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 495 ENDDO 496 DO ib = 1 , ilen0(igrd) 497 td%ssh(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 498 td%ssh(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 499 ENDDO 500 END DO 501 ! 502 DEALLOCATE( mod_tide, phi_tide ) 496 ! 497 DEALLOCATE( mod_tide, phi_tide ) 498 ! 499 ENDIF 503 500 ! 504 501 END SUBROUTINE tide_init_elevation … … 512 509 TYPE(TIDES_DATA), INTENT(inout) :: td ! tidal harmonics data 513 510 ! 514 INTEGER :: itide, igrd, ib ! dummy loop indices 515 INTEGER, DIMENSION(3) :: ilen0 ! length of boundary data (from OBC arrays) 511 INTEGER :: itide, isz, ib ! dummy loop indices 516 512 REAL(wp),ALLOCATABLE, DIMENSION(:) :: mod_tide, phi_tide 517 513 !!---------------------------------------------------------------------- 518 514 ! 519 ilen0(2) = SIZE(td%u0(:,1,1)) 520 ilen0(3) = SIZE(td%v0(:,1,1)) 521 ! 522 igrd=2 ! U grid. 523 ! 524 ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 525 ! 526 DO itide = 1, nb_harmo 527 DO ib = 1, ilen0(igrd) 528 mod_tide(ib)=SQRT(td%u0(ib,itide,1)**2.+td%u0(ib,itide,2)**2.) 529 phi_tide(ib)=ATAN2(-td%u0(ib,itide,2),td%u0(ib,itide,1)) 515 IF( ASSOCIATED(td%u0) ) THEN ! U grid. we use bdy u2d on this mpi subdomain 516 ! 517 isz = SIZE( td%u0, dim = 1 ) 518 ALLOCATE( mod_tide(isz), phi_tide(isz) ) 519 ! 520 DO itide = 1, nb_harmo 521 DO ib = 1, isz 522 mod_tide(ib)=SQRT( td%u0(ib,itide,1)*td%u0(ib,itide,1) + td%u0(ib,itide,2)*td%u0(ib,itide,2) ) 523 phi_tide(ib)=ATAN2(-td%u0(ib,itide,2),td%u0(ib,itide,1)) 524 END DO 525 DO ib = 1, isz 526 mod_tide(ib)=mod_tide(ib)*ftide(itide) 527 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 528 END DO 529 DO ib = 1, isz 530 td%u(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 531 td%u(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 532 END DO 530 533 END DO 531 DO ib = 1, ilen0(igrd) 532 mod_tide(ib)=mod_tide(ib)*ftide(itide) 533 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 534 ENDDO 535 DO ib = 1, ilen0(igrd) 536 td%u(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 537 td%u(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 538 ENDDO 539 END DO 540 ! 541 DEALLOCATE( mod_tide , phi_tide ) 542 ! 543 igrd=3 ! V grid. 544 ! 545 ALLOCATE( mod_tide(ilen0(igrd)) , phi_tide(ilen0(igrd)) ) 546 547 DO itide = 1, nb_harmo 548 DO ib = 1, ilen0(igrd) 549 mod_tide(ib)=SQRT(td%v0(ib,itide,1)**2.+td%v0(ib,itide,2)**2.) 550 phi_tide(ib)=ATAN2(-td%v0(ib,itide,2),td%v0(ib,itide,1)) 534 ! 535 DEALLOCATE( mod_tide, phi_tide ) 536 ! 537 ENDIF 538 ! 539 IF( ASSOCIATED(td%v0) ) THEN ! V grid. we use bdy u2d on this mpi subdomain 540 ! 541 isz = SIZE( td%v0, dim = 1 ) 542 ALLOCATE( mod_tide(isz), phi_tide(isz) ) 543 ! 544 DO itide = 1, nb_harmo 545 DO ib = 1, isz 546 mod_tide(ib)=SQRT( td%v0(ib,itide,1)*td%v0(ib,itide,1) + td%v0(ib,itide,2)*td%v0(ib,itide,2) ) 547 phi_tide(ib)=ATAN2(-td%v0(ib,itide,2),td%v0(ib,itide,1)) 548 END DO 549 DO ib = 1, isz 550 mod_tide(ib)=mod_tide(ib)*ftide(itide) 551 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 552 END DO 553 DO ib = 1, isz 554 td%v(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 555 td%v(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 556 END DO 551 557 END DO 552 DO ib = 1, ilen0(igrd) 553 mod_tide(ib)=mod_tide(ib)*ftide(itide) 554 phi_tide(ib)=phi_tide(ib)+v0tide(itide)+utide(itide) 555 ENDDO 556 DO ib = 1, ilen0(igrd) 557 td%v(ib,itide,1)= mod_tide(ib)*COS(phi_tide(ib)) 558 td%v(ib,itide,2)=-mod_tide(ib)*SIN(phi_tide(ib)) 559 ENDDO 560 END DO 561 ! 562 DEALLOCATE( mod_tide, phi_tide ) 563 ! 564 END SUBROUTINE tide_init_velocities 558 ! 559 DEALLOCATE( mod_tide, phi_tide ) 560 ! 561 ENDIF 562 ! 563 END SUBROUTINE tide_init_velocities 565 564 566 565 !!====================================================================== -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/C1D/step_c1d.F90
r10068 r13077 54 54 ! 55 55 INTEGER :: jk ! dummy loop indice 56 INTEGER :: indic ! error indicator if < 057 56 !! --------------------------------------------------------------------- 58 59 indic = 0 ! reset to no error condition60 57 IF( kstp == nit000 ) CALL iom_init( "nemo") ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) 61 58 IF( kstp /= nit000 ) CALL day( kstp ) ! Calendar (day was already called at nit000 in day_init) … … 131 128 ! Control and restarts 132 129 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 133 CALL stp_ctl( kstp , indic)130 CALL stp_ctl( kstp ) 134 131 IF( kstp == nit000 ) CALL iom_close( numror ) ! close input ocean restart file 135 132 IF( lrst_oce ) CALL rst_write( kstp ) ! write output ocean restart file 136 133 ! 137 134 #if defined key_iomput 138 IF( kstp == nitend .OR. indic <0 ) CALL xios_context_finalize() ! needed for XIOS135 IF( kstp == nitend .OR. nstop > 0 ) CALL xios_context_finalize() ! needed for XIOS 139 136 ! 140 137 #endif -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DOM/dom_oce.F90
r10068 r13077 74 74 ! ! = 7 bi-cyclic East-West AND North-South 75 75 LOGICAL, PUBLIC :: l_Iperio, l_Jperio ! should we explicitely take care I/J periodicity 76 LOGICAL, PUBLIC :: l_Westedge, l_Eastedge, l_Northedge, l_Southedge ! flag to detect global domain edges 77 ! on local domain (needed for AGRIF) 76 78 77 79 ! ! domain MPP decomposition parameters … … 231 233 Agrif_CFixed = '0' 232 234 END FUNCTION Agrif_CFixed 235 236 INTEGER FUNCTION Agrif_Fixed() 237 Agrif_Fixed = 0 238 END FUNCTION Agrif_Fixed 233 239 #endif 234 240 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DOM/dommsk.F90
r11536 r13077 273 273 #if defined key_agrif 274 274 IF( .NOT. AGRIF_Root() ) THEN 275 IF ( (nbondi == 1).OR.(nbondi == 2))fmask(nlci-1 , : ,jk) = 0.e0 ! east276 IF ( (nbondi == -1).OR.(nbondi == 2))fmask(1 , : ,jk) = 0.e0 ! west277 IF ( (nbondj == 1).OR.(nbondj == 2)) fmask(: ,nlcj-1 ,jk) = 0.e0 ! north278 IF ( (nbondj == -1).OR.(nbondj == 2)) fmask(: ,1 ,jk) = 0.e0 ! south275 IF ( l_Eastedge ) fmask(nlci-1 , : ,jk) = 0.e0 ! east 276 IF ( l_Westedge ) fmask(1 , : ,jk) = 0.e0 ! west 277 IF ( l_Northedge ) fmask(: ,nlcj-1 ,jk) = 0.e0 ! north 278 IF ( l_Southedge ) fmask(: ,1 ,jk) = 0.e0 ! south 279 279 ENDIF 280 280 #endif -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DYN/divhor.F90
r12141 r13077 88 88 #if defined key_agrif 89 89 IF( .NOT. Agrif_Root() ) THEN 90 IF( nbondi == -1 .OR. nbondi == 2) hdivn( 2 , : ,:) = 0._wp ! west91 IF( nbondi == 1 .OR. nbondi == 2) hdivn( nlci-1, : ,:) = 0._wp ! east92 IF( nbondj == -1 .OR. nbondj == 2 )hdivn( : , 2 ,:) = 0._wp ! south93 IF( nbondj == 1 .OR. nbondj == 2 )hdivn( : ,nlcj-1,:) = 0._wp ! north90 IF( l_Westedge ) hdivn( 2 , : ,:) = 0._wp ! west 91 IF( l_Eastedge ) hdivn( nlci-1, : ,:) = 0._wp ! east 92 IF( l_Southedge ) hdivn( : , 2 ,:) = 0._wp ! south 93 IF( l_Northedge ) hdivn( : ,nlcj-1,:) = 0._wp ! north 94 94 ENDIF 95 95 #endif -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DYN/dynldf_lap_blp.F90
r10425 r13077 74 74 DO ji = fs_2, jpi ! vector opt. 75 75 ! ! ahm * e3 * curl (computed from 1 to jpim1/jpjm1) 76 !!gm open question here : e3f at before or now ? probably now... 77 !!gm note that ahmf has already been multiplied by fmask 78 zcur(ji-1,jj-1) = ahmf(ji-1,jj-1,jk) * e3f_n(ji-1,jj-1,jk) * r1_e1e2f(ji-1,jj-1) & 76 zcur(ji-1,jj-1) = ahmf(ji-1,jj-1,jk) * e3f_n(ji-1,jj-1,jk) * r1_e1e2f(ji-1,jj-1) & ! ahmf already * by fmask 79 77 & * ( e2v(ji ,jj-1) * pvb(ji ,jj-1,jk) - e2v(ji-1,jj-1) * pvb(ji-1,jj-1,jk) & 80 78 & - e1u(ji-1,jj ) * pub(ji-1,jj ,jk) + e1u(ji-1,jj-1) * pub(ji-1,jj-1,jk) ) 81 79 ! ! ahm * div (computed from 2 to jpi/jpj) 82 !!gm note that ahmt has already been multiplied by tmask 83 zdiv(ji,jj) = ahmt(ji,jj,jk) * r1_e1e2t(ji,jj) / e3t_b(ji,jj,jk) & 80 zdiv(ji,jj) = ahmt(ji,jj,jk) * r1_e1e2t(ji,jj) / e3t_b(ji,jj,jk) & ! ahmt already * by tmask 84 81 & * ( e2u(ji,jj)*e3u_b(ji,jj,jk) * pub(ji,jj,jk) - e2u(ji-1,jj)*e3u_b(ji-1,jj,jk) * pub(ji-1,jj,jk) & 85 82 & + e1v(ji,jj)*e3v_b(ji,jj,jk) * pvb(ji,jj,jk) - e1v(ji,jj-1)*e3v_b(ji,jj-1,jk) * pvb(ji,jj-1,jk) ) … … 89 86 DO jj = 2, jpjm1 ! - curl( curl) + grad( div ) 90 87 DO ji = fs_2, fs_jpim1 ! vector opt. 91 pua(ji,jj,jk) = pua(ji,jj,jk) + zsign * ( &88 pua(ji,jj,jk) = pua(ji,jj,jk) + zsign * umask(ji,jj,jk) * ( & ! * by umask is mandatory for dyn_ldf_blp use 92 89 & - ( zcur(ji ,jj) - zcur(ji,jj-1) ) * r1_e2u(ji,jj) / e3u_n(ji,jj,jk) & 93 90 & + ( zdiv(ji+1,jj) - zdiv(ji,jj ) ) * r1_e1u(ji,jj) ) 94 91 ! 95 pva(ji,jj,jk) = pva(ji,jj,jk) + zsign * ( &92 pva(ji,jj,jk) = pva(ji,jj,jk) + zsign * vmask(ji,jj,jk) * ( & ! * by vmask is mandatory for dyn_ldf_blp use 96 93 & ( zcur(ji,jj ) - zcur(ji-1,jj) ) * r1_e1v(ji,jj) / e3v_n(ji,jj,jk) & 97 94 & + ( zdiv(ji,jj+1) - zdiv(ji ,jj) ) * r1_e2v(ji,jj) ) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DYN/dynspg_ts.F90
r12206 r13077 487 487 ! Set fluxes during predictor step to ensure volume conservation 488 488 IF( .NOT.Agrif_Root() .AND. ln_bt_fw ) THEN 489 IF( (nbondi == -1).OR.(nbondi == 2)) THEN489 IF( l_Westedge ) THEN 490 490 DO jj = 1, jpj 491 491 zhU(2:nbghostcells+1,jj) = ubdy_w(1:nbghostcells,jj) * e2u(2:nbghostcells+1,jj) … … 493 493 END DO 494 494 ENDIF 495 IF( (nbondi == 1).OR.(nbondi == 2)) THEN495 IF( l_Eastedge ) THEN 496 496 DO jj=1,jpj 497 497 zhU(nlci-nbghostcells-1:nlci-2,jj) = ubdy_e(1:nbghostcells,jj) * e2u(nlci-nbghostcells-1:nlci-2,jj) … … 499 499 END DO 500 500 ENDIF 501 IF( (nbondj == -1).OR.(nbondj == 2)) THEN501 IF( l_Southedge ) THEN 502 502 DO ji=1,jpi 503 503 zhV(ji,2:nbghostcells+1) = vbdy_s(ji,1:nbghostcells) * e1v(ji,2:nbghostcells+1) … … 505 505 END DO 506 506 ENDIF 507 IF( (nbondj == 1).OR.(nbondj == 2)) THEN507 IF( l_Northedge ) THEN 508 508 DO ji=1,jpi 509 509 zhV(ji,nlcj-nbghostcells-1:nlcj-2) = vbdy_n(ji,1:nbghostcells) * e1v(ji,nlcj-nbghostcells-1:nlcj-2) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DYN/dynvor.F90
r11536 r13077 881 881 DO ji = 1, jpim1 882 882 IF( tmask(ji,jj+1,jk) + tmask(ji+1,jj+1,jk) & 883 & + tmask(ji,jj ,jk) + tmask(ji+1,jj +1,jk) == 3._wp ) fmask(ji,jj,jk) = 1._wp883 & + tmask(ji,jj ,jk) + tmask(ji+1,jj ,jk) == 3._wp ) fmask(ji,jj,jk) = 1._wp 884 884 END DO 885 885 END DO -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/DYN/sshwzv.F90
r11414 r13077 203 203 #if defined key_agrif 204 204 IF( .NOT. AGRIF_Root() ) THEN 205 IF ( (nbondi == 1).OR.(nbondi == 2))wn(nlci-1 , : ,:) = 0.e0 ! east206 IF ( (nbondi == -1).OR.(nbondi == 2))wn(2 , : ,:) = 0.e0 ! west207 IF ( (nbondj == 1).OR.(nbondj == 2)) wn(: ,nlcj-1 ,:) = 0.e0 ! north208 IF ( (nbondj == -1).OR.(nbondj == 2)) wn(: ,2 ,:) = 0.e0 ! south205 IF ( l_Eastedge ) wn(nlci-1 , : ,:) = 0.e0 ! east 206 IF ( l_Westedge ) wn(2 , : ,:) = 0.e0 ! west 207 IF ( l_Northedge ) wn(: ,nlcj-1 ,:) = 0.e0 ! north 208 IF ( l_Southedge ) wn(: ,2 ,:) = 0.e0 ! south 209 209 ENDIF 210 210 #endif -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/ICB/icbrst.F90
r11536 r13077 189 189 ! 190 190 INTEGER :: jn ! dummy loop index 191 INTEGER :: idg ! number of digits 191 192 INTEGER :: ix_dim, iy_dim, ik_dim, in_dim 192 193 CHARACTER(len=256) :: cl_path 193 194 CHARACTER(len=256) :: cl_filename 195 CHARACTER(len=8 ) :: cl_kt 196 CHARACTER(LEN=12 ) :: clfmt ! writing format 194 197 TYPE(iceberg), POINTER :: this 195 198 TYPE(point) , POINTER :: pt … … 206 209 cl_path = TRIM(cn_ocerst_outdir) 207 210 IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 211 WRITE(cl_kt, '(i8.8)') kt 212 cl_filename = TRIM(cexper)//"_icebergs_"//cl_kt//"_restart" 208 213 IF( lk_mpp ) THEN 209 WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart_",I4.4,".nc")') TRIM(cexper), kt, narea-1 214 idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 ) ! how many digits to we need to write? min=4, max=9 215 WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg ! '(a,a,ix.x,a)' 216 WRITE(cl_filename, clfmt) TRIM(cl_filename), '_', narea-1, '.nc' 210 217 ELSE 211 WRITE(cl_filename,'( A,"_icebergs_",I8.8,"_restart.nc")') TRIM(cexper), kt218 WRITE(cl_filename,'(a,a)') TRIM(cl_filename), '.nc' 212 219 ENDIF 213 220 IF ( lwp .AND. nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ', & -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/ICB/icbtrj.F90
r10068 r13077 62 62 ! 63 63 INTEGER :: iret, iyear, imonth, iday 64 INTEGER :: idg ! number of digits 64 65 REAL(wp) :: zfjulday, zsec 65 66 CHARACTER(len=80) :: cl_filename 66 CHARACTER(LEN=20) :: cldate_ini, cldate_end 67 CHARACTER(LEN=8 ) :: cldate_ini, cldate_end 68 CHARACTER(LEN=12) :: clfmt ! writing format 67 69 TYPE(iceberg), POINTER :: this 68 70 TYPE(point) , POINTER :: pt … … 80 82 81 83 ! define trajectory output name 82 IF ( lk_mpp ) THEN ; WRITE(cl_filename,'("trajectory_icebergs_",A,"-",A,"_",I4.4,".nc")') & 83 & TRIM(ADJUSTL(cldate_ini)), TRIM(ADJUSTL(cldate_end)), narea-1 84 ELSE ; WRITE(cl_filename,'("trajectory_icebergs_",A,"-",A ,".nc")') & 85 & TRIM(ADJUSTL(cldate_ini)), TRIM(ADJUSTL(cldate_end)) 84 cl_filename = 'trajectory_icebergs_'//cldate_ini//'-'//cldate_end 85 IF ( lk_mpp ) THEN 86 idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 ) ! how many digits to we need to write? min=4, max=9 87 WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg ! '(a,a,ix.x,a)' 88 WRITE(cl_filename, clfmt) TRIM(cl_filename), '_', narea-1, '.nc' 89 ELSE 90 WRITE(cl_filename,'(a,a)') TRIM(cl_filename), '.nc' 86 91 ENDIF 87 92 IF( lwp .AND. nn_verbose_level >= 0 ) WRITE(numout,'(2a)') 'icebergs, icb_trj_init: creating ',TRIM(cl_filename) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/IOM/in_out_manager.F90
r11536 r13077 159 159 INTEGER :: no_print = 0 !: optional argument of fld_fill (if present, suppress some control print) 160 160 INTEGER :: nstop = 0 !: error flag (=number of reason for a premature stop run) 161 !$AGRIF_DO_NOT_TREAT 162 INTEGER :: ngrdstop = -1 !: grid number having nstop > 1 163 !$AGRIF_END_DO_NOT_TREAT 161 164 INTEGER :: nwarn = 0 !: warning flag (=number of warning found during the run) 162 165 CHARACTER(lc) :: ctmp1, ctmp2, ctmp3 !: temporary characters 1 to 3 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/IOM/iom.F90
r12598 r13077 2460 2460 #else 2461 2461 IF( .FALSE. ) WRITE(numout,*) cdname, pmiss_val ! useless test to avoid compilation warnings 2462 IF( .FALSE. ) pmiss_val = 0._wp ! useless assignment to avoid compilation warnings 2462 2463 #endif 2463 2464 END SUBROUTINE iom_miss_val -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/IOM/iom_def.F90
r10425 r13077 33 33 INTEGER, PARAMETER, PUBLIC :: jpmax_vars = 1200 !: maximum number of variables in one file 34 34 INTEGER, PARAMETER, PUBLIC :: jpmax_dims = 4 !: maximum number of dimensions for one variable 35 INTEGER, PARAMETER, PUBLIC :: jpmax_digits = 5!: maximum number of digits for the cpu number in the file name35 INTEGER, PARAMETER, PUBLIC :: jpmax_digits = 9 !: maximum number of digits for the cpu number in the file name 36 36 37 37 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/IOM/iom_nf90.F90
r11536 r13077 60 60 CHARACTER(LEN=256) :: clinfo ! info character 61 61 CHARACTER(LEN=256) :: cltmp ! temporary character 62 CHARACTER(LEN=12 ) :: clfmt ! writing format 63 INTEGER :: idg ! number of digits 62 64 INTEGER :: iln ! lengths of character 63 65 INTEGER :: istop ! temporary storage of nstop … … 69 71 INTEGER :: ihdf5 ! local variable for retrieval of value for NF90_HDF5 70 72 LOGICAL :: llclobber ! local definition of ln_clobber 71 INTEGER :: ilevels 73 INTEGER :: ilevels ! vertical levels 72 74 !--------------------------------------------------------------------- 73 75 ! … … 104 106 IF( ldwrt ) THEN !* the file should be open in write mode so we create it... 105 107 IF( jpnij > 1 ) THEN 106 WRITE(cltmp,'(a,a,i4.4,a)') cdname(1:iln-1), '_', narea-1, '.nc' 108 idg = MAX( INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1, 4 ) ! how many digits to we need to write? min=4, max=9 109 WRITE(clfmt, "('(a,a,i', i1, '.', i1, ',a)')") idg, idg ! '(a,a,ix.x,a)' 110 WRITE(cltmp,clfmt) cdname(1:iln-1), '_', narea-1, '.nc' 107 111 cdname = TRIM(cltmp) 108 112 ENDIF -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/LBC/lib_mpp.F90
r12518 r13077 1084 1084 CHARACTER(len=*), INTENT(in ), OPTIONAL :: cd2, cd3, cd4, cd5 1085 1085 CHARACTER(len=*), INTENT(in ), OPTIONAL :: cd6, cd7, cd8, cd9, cd10 1086 ! 1087 INTEGER :: inum 1086 1088 !!---------------------------------------------------------------------- 1087 1089 ! 1088 1090 nstop = nstop + 1 1089 1091 ! 1090 ! force to open ocean.output file if not already opened 1091 IF( numout == 6 ) CALL ctl_opn( numout, 'ocean.output', 'APPEND', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 1092 IF( cd1 == 'STOP' .AND. narea /= 1 ) THEN ! Immediate stop: add an arror message in 'ocean.output' file 1093 CALL ctl_opn( inum, 'ocean.output', 'APPEND', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 1094 WRITE(inum,*) 1095 WRITE(inum,*) ' ==>>> Look for "E R R O R" messages in all existing *ocean.output* files' 1096 CLOSE(inum) 1097 ENDIF 1098 IF( numout == 6 ) THEN ! force to open ocean.output file if not already opened 1099 CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 1100 ENDIF 1092 1101 ! 1093 1102 WRITE(numout,*) … … 1117 1126 WRITE(numout,*) 'huge E-R-R-O-R : immediate stop' 1118 1127 WRITE(numout,*) 1128 CALL FLUSH(numout) 1129 CALL SLEEP(60) ! make sure that all output and abort files are written by all cores. 60s should be enough... 1119 1130 CALL mppstop( ld_abort = .true. ) 1120 1131 ENDIF … … 1179 1190 ! 1180 1191 CHARACTER(len=80) :: clfile 1192 CHARACTER(LEN=10) :: clfmt ! writing format 1181 1193 INTEGER :: iost 1194 INTEGER :: idg ! number of digits 1182 1195 !!---------------------------------------------------------------------- 1183 1196 ! … … 1186 1199 clfile = TRIM(cdfile) 1187 1200 IF( PRESENT( karea ) ) THEN 1188 IF( karea > 1 ) WRITE(clfile, "(a,'_',i4.4)") TRIM(clfile), karea-1 1201 IF( karea > 1 ) THEN 1202 ! Warning: jpnij is maybe not already defined when calling ctl_opn -> use mppsize instead of jpnij 1203 idg = MAX( INT(LOG10(REAL(MAX(1,mppsize-1),wp))) + 1, 4 ) ! how many digits to we need to write? min=4, max=9 1204 WRITE(clfmt, "('(a,a,i', i1, '.', i1, ')')") idg, idg ! '(a,a,ix.x)' 1205 WRITE(clfile, clfmt) TRIM(clfile), '_', karea-1 1206 ENDIF 1189 1207 ENDIF 1190 1208 #if defined key_agrif … … 1206 1224 & OPEN(UNIT=knum,FILE='NUL', FORM=cdform, ACCESS=cdacce, STATUS=cdstat , ERR=100, IOSTAT=iost ) 1207 1225 IF( iost == 0 ) THEN 1208 IF(ldwp ) THEN1226 IF(ldwp .AND. kout > 0) THEN 1209 1227 WRITE(kout,*) ' file : ', TRIM(clfile),' open ok' 1210 1228 WRITE(kout,*) ' unit = ', knum -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/LBC/mpp_loc_generic.h90
r10716 r13077 32 32 REAL(wp) , INTENT( out) :: pmin ! Global minimum of ptab 33 33 INDEX_TYPE(:) ! index of minimum in global frame 34 # if defined key_mpp_mpi35 34 ! 36 35 INTEGER :: ierror, ii, idim … … 77 76 ! 78 77 IF( ln_timing ) CALL tic_tac(.TRUE., ld_global = .TRUE.) 78 #if defined key_mpp_mpi 79 79 CALL MPI_ALLREDUCE( zain, zaout, 1, MPI_2DOUBLE_PRECISION, MPI_OPERATION ,MPI_COMM_OCE, ierror) 80 #else 81 zaout(:,:) = zain(:,:) 82 #endif 80 83 IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.) 81 84 ! … … 92 95 kindex(1) = index0 93 96 kindex(:) = kindex(:) + 1 ! start indices at 1 94 #else95 kindex = 0 ; pmin = 0.96 WRITE(*,*) 'ROUTINE_LOC: You should not have seen this print! error?'97 #endif98 97 99 98 END SUBROUTINE ROUTINE_LOC -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/LBC/mppini.F90
r11640 r13077 90 90 l_Jperio = jpnj == 1 .AND. (jperio == 2 .OR. jperio == 7) 91 91 ! 92 ! Set flags to detect global domain edges for AGRIF 93 l_Westedge = .true. ; l_Eastedge = .true. ; l_Northedge = .true.; l_Southedge = .true. 94 ! 92 95 IF(lwp) THEN 93 96 WRITE(numout,*) … … 162 165 INTEGER, ALLOCATABLE, DIMENSION(:,:) :: ilej, ildj, ioso, iowe ! - - 163 166 LOGICAL, ALLOCATABLE, DIMENSION(:,:) :: llisoce ! - - 167 LOGICAL, ALLOCATABLE, DIMENSION(:,:) :: lliswest, lliseast, llisnorth, llissouth ! - - 164 168 NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file, & 165 169 & ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta, & … … 331 335 & ilei(jpni,jpnj), ildi(jpni,jpnj), iono(jpni,jpnj), ioea(jpni,jpnj), & 332 336 & ilej(jpni,jpnj), ildj(jpni,jpnj), ioso(jpni,jpnj), iowe(jpni,jpnj), & 337 #if defined key_agrif 338 lliswest(jpni,jpnj), lliseast(jpni,jpnj), & 339 & llisnorth(jpni,jpnj),llissouth(jpni,jpnj), & 340 #endif 333 341 & STAT=ierr ) 334 342 CALL mpp_sum( 'mppini', ierr ) … … 343 351 IF( ln_use_jattr ) CALL ctl_stop( 'STOP', 'mpp_init:Agrif children requires ln_use_jattr = .false. ' ) 344 352 ENDIF 353 lliswest(:,:) = .false. ; lliseast(:,:) = .false. ; llisnorth(:,:) = .false. ; llissouth(:,:) = .false. 345 354 #endif 346 355 ! … … 430 439 ENDIF 431 440 ! 441 #if defined key_agrif 442 IF ((ibondi(ii,ij) == 1).OR.(ibondi(ii,ij) == 2)) lliseast(ii,ij) = .true. ! east 443 IF ((ibondi(ii,ij) == -1).OR.(ibondi(ii,ij) == 2)) lliswest(ii,ij) = .true. ! west 444 IF ((ibondj(ii,ij) == 1).OR.(ibondj(ii,ij) == 2)) llisnorth(ii,ij) = .true. ! north 445 IF ((ibondj(ii,ij) == -1).OR.(ibondj(ii,ij) == 2)) llissouth(ii,ij) = .true. ! south 446 #endif 432 447 END DO 433 434 448 ! 4. deal with land subdomains 435 449 ! ---------------------------- … … 601 615 ! Suppress once vertical online interpolation is ok 602 616 !!$ IF(.NOT.Agrif_Root()) jpkglo = Agrif_Parent( jpkglo ) 617 l_Westedge = lliswest(ii,ij) 618 l_Eastedge = lliseast(ii,ij) 619 l_Northedge = llisnorth(ii,ij) 620 l_Southedge = llissouth(ii,ij) 603 621 #endif 604 622 jpim1 = jpi-1 ! inner domain indices … … 716 734 & ilci, ilcj, ilei, ilej, ildi, ildj, & 717 735 & iono, ioea, ioso, iowe, llisoce) 736 #if defined key_agrif 737 DEALLOCATE(lliswest, lliseast, llisnorth, llissouth) 738 #endif 718 739 ! 719 740 END SUBROUTINE mpp_init -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/SBC/sbcblk.F90
r12276 r13077 78 78 REAL(wp), PARAMETER :: R_vap = 461.495_wp !: Specific gas constant for water vapor [J/K/kg] 79 79 REAL(wp), PARAMETER :: reps0 = R_dry/R_vap !: ratio of gas constant for dry air and water vapor => ~ 0.622 80 REAL(wp), PARAMETER :: rctv0 = R_vap/R_dry 80 REAL(wp), PARAMETER :: rctv0 = R_vap/R_dry - 1._wp !: for virtual temperature (== (1-eps)/eps) => ~ 0.608 81 81 82 82 INTEGER , PARAMETER :: jpfld =10 ! maximum number of files to read … … 706 706 REAL(wp) :: zwndi_f , zwndj_f, zwnorm_f ! relative wind module and components at F-point 707 707 REAL(wp) :: zwndi_t , zwndj_t ! relative wind components at T-point 708 REAL(wp) :: zztmp1 , zztmp2 ! temporary values 708 709 REAL(wp), DIMENSION(jpi,jpj) :: zrhoa ! transfer coefficient for momentum (tau) 709 710 !!--------------------------------------------------------------------- … … 744 745 zrhoa (:,:) = rho_air(sf(jp_tair)%fnow(:,:,1), sf(jp_humi)%fnow(:,:,1), sf(jp_slp)%fnow(:,:,1)) 745 746 746 !!gm brutal....747 utau_ice (:,:) = 0._wp748 vtau_ice (:,:) = 0._wp749 !!gm end750 751 747 ! ------------------------------------------------------------ ! 752 748 ! Wind stress relative to the moving ice ( U10m - U_ice ) ! 753 749 ! ------------------------------------------------------------ ! 754 ! C-grid ice dynamics : U & V-points (same as ocean) 755 DO jj = 2, jpjm1 750 zztmp1 = rn_vfac * 0.5_wp 751 DO jj = 2, jpj ! at T point 752 DO ji = 2, jpi 753 zztmp2 = zrhoa(ji,jj) * Cd_atm(ji,jj) * wndm_ice(ji,jj) 754 utau_ice(ji,jj) = zztmp2 * ( sf(jp_wndi)%fnow(ji,jj,1) - zztmp1 * ( u_ice(ji-1,jj ) + u_ice(ji,jj) ) ) 755 vtau_ice(ji,jj) = zztmp2 * ( sf(jp_wndj)%fnow(ji,jj,1) - zztmp1 * ( v_ice(ji ,jj-1) + v_ice(ji,jj) ) ) 756 END DO 757 END DO 758 ! 759 DO jj = 2, jpjm1 ! U & V-points (same as ocean). 756 760 DO ji = fs_2, fs_jpim1 ! vect. opt. 757 utau_ice(ji,jj) = 0.5 * zrhoa(ji,jj) * Cd_atm(ji,jj) * ( wndm_ice(ji+1,jj ) + wndm_ice(ji,jj) ) & 758 & * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - rn_vfac * u_ice(ji,jj) ) 759 vtau_ice(ji,jj) = 0.5 * zrhoa(ji,jj) * Cd_atm(ji,jj) * ( wndm_ice(ji,jj+1 ) + wndm_ice(ji,jj) ) & 760 & * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - rn_vfac * v_ice(ji,jj) ) 761 ! take care of the land-sea mask to avoid "pollution" of coastal stress. p[uv]taui used in frazil and rheology 762 zztmp1 = 0.5_wp * ( 2. - umask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji+1,jj ,1) ) 763 zztmp2 = 0.5_wp * ( 2. - vmask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji ,jj+1,1) ) 764 utau_ice(ji,jj) = zztmp1 * ( utau_ice(ji,jj) + utau_ice(ji+1,jj ) ) 765 vtau_ice(ji,jj) = zztmp2 * ( vtau_ice(ji,jj) + vtau_ice(ji ,jj+1) ) 761 766 END DO 762 767 END DO -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/SBC/sbccpl.F90
r12288 r13077 1482 1482 INTEGER :: ji, jj ! dummy loop indices 1483 1483 INTEGER :: itx ! index of taux over ice 1484 REAL(wp) :: zztmp1, zztmp2 1484 1485 REAL(wp), DIMENSION(jpi,jpj) :: ztx, zty 1485 1486 !!---------------------------------------------------------------------- … … 1545 1546 p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1) ! (U,V) ==> (U,V) 1546 1547 p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1) 1547 CASE( 'F' )1548 DO jj = 2, jpjm1 ! F ==> (U,V)1549 DO ji = fs_2, fs_jpim1 ! vector opt.1550 p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji ,jj-1,1) )1551 p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji,jj,1) + frcv(jpr_ity1)%z3(ji-1,jj ,1) )1552 END DO1553 END DO1554 1548 CASE( 'T' ) 1555 1549 DO jj = 2, jpjm1 ! T ==> (U,V) 1556 1550 DO ji = fs_2, fs_jpim1 ! vector opt. 1557 p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj ,1) + frcv(jpr_itx1)%z3(ji,jj,1) ) 1558 p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) ) 1551 ! take care of the land-sea mask to avoid "pollution" of coastal stress. p[uv]taui used in frazil and rheology 1552 zztmp1 = 0.5_wp * ( 2. - umask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji+1,jj ,1) ) 1553 zztmp2 = 0.5_wp * ( 2. - vmask(ji,jj,1) ) * MAX( tmask(ji,jj,1),tmask(ji ,jj+1,1) ) 1554 p_taui(ji,jj) = zztmp1 * ( frcv(jpr_itx1)%z3(ji+1,jj ,1) + frcv(jpr_itx1)%z3(ji,jj,1) ) 1555 p_tauj(ji,jj) = zztmp2 * ( frcv(jpr_ity1)%z3(ji ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) ) 1559 1556 END DO 1560 1557 END DO 1561 CASE( 'I' ) 1562 DO jj = 2, jpjm1 ! I ==> (U,V) 1563 DO ji = 2, jpim1 ! NO vector opt. 1564 p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj ,1) ) 1565 p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji+1,jj+1,1) + frcv(jpr_ity1)%z3(ji ,jj+1,1) ) 1566 END DO 1567 END DO 1558 CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U', -1., p_tauj, 'V', -1. ) 1568 1559 END SELECT 1569 IF( srcv(jpr_itx1)%clgrid /= 'U' ) THEN1570 CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U', -1., p_tauj, 'V', -1. )1571 ENDIF1572 1560 1573 1561 ENDIF … … 1798 1786 ENDDO 1799 1787 ELSE 1800 qns_tot(:,:) =qns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1)1788 zqns_tot(:,:) = zqns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 1801 1789 DO jl = 1, jpl 1802 zqns_tot(:,: ) = zqns_tot(:,:) + picefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1)1803 1790 zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) 1804 1791 END DO … … 1939 1926 END DO 1940 1927 ELSE 1941 qsr_tot(:,: ) =qsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1)1928 zqsr_tot(:,:) = zqsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1) 1942 1929 DO jl = 1, jpl 1943 zqsr_tot(:,: ) = zqsr_tot(:,:) + picefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1)1944 1930 zqsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1) 1945 1931 END DO -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/SBC/sbcwave.F90
r11536 r13077 233 233 #if defined key_agrif 234 234 IF( .NOT. Agrif_Root() ) THEN 235 IF( nbondi == -1 .OR. nbondi == 2 )ze3divh( 2:nbghostcells+1,: ,:) = 0._wp ! west236 IF( nbondi == 1 .OR. nbondi == 2 )ze3divh( nlci-nbghostcells:nlci-1,:,:) = 0._wp ! east237 IF( nbondj == -1 .OR. nbondj == 2) ze3divh( :,2:nbghostcells+1 ,:) = 0._wp ! south238 IF( nbondj == 1 .OR. nbondj == 2) ze3divh( :,nlcj-nbghostcells:nlcj-1,:) = 0._wp ! north235 IF( l_Westedge ) ze3divh( 2:nbghostcells+1,: ,:) = 0._wp ! west 236 IF( l_Eastedge ) ze3divh( nlci-nbghostcells:nlci-1,:,:) = 0._wp ! east 237 IF( l_Southedge ) ze3divh( :,2:nbghostcells+1 ,:) = 0._wp ! south 238 IF( l_Northedge ) ze3divh( :,nlcj-nbghostcells:nlcj-1,:) = 0._wp ! north 239 239 ENDIF 240 240 #endif -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/TRD/trdtra.F90
r10425 r13077 81 81 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: ptra ! now tracer variable 82 82 ! 83 INTEGER :: jk ! loop indices 83 INTEGER :: jk ! loop indices 84 INTEGER :: i01 ! 0 or 1 84 85 REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztrds ! 3D workspace 85 86 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zwt, zws, ztrdt ! 3D workspace … … 89 90 IF( trd_tra_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'trd_tra : unable to allocate arrays' ) 90 91 ENDIF 91 92 ! 93 i01 = COUNT( (/ PRESENT(pun) .OR. ( ktrd /= jptra_xad .AND. ktrd /= jptra_yad .AND. ktrd /= jptra_zad ) /) ) 94 ! 92 95 IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN !== Temperature trend ==! 93 96 ! 94 SELECT CASE( ktrd )97 SELECT CASE( ktrd*i01 ) 95 98 ! ! advection: transform the advective flux into a trend 96 99 CASE( jptra_xad ) ; CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx ) … … 111 114 IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN !== Salinity trends ==! 112 115 ! 113 SELECT CASE( ktrd )116 SELECT CASE( ktrd*i01 ) 114 117 ! ! advection: transform the advective flux into a trend 115 118 ! ! and send T & S trends to trd_tra_mng … … 162 165 IF( ctype == 'TRC' ) THEN !== passive tracer trend ==! 163 166 ! 164 SELECT CASE( ktrd )167 SELECT CASE( ktrd*i01 ) 165 168 ! ! advection: transform the advective flux into a masked trend 166 169 CASE( jptra_xad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'X', ztrds ) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/nemogcm.F90
r12640 r13077 179 179 END DO 180 180 ! 181 IF( .NOT. Agrif_Root() ) THEN182 CALL Agrif_ParentGrid_To_ChildGrid()183 IF( ln_diaobs ) CALL dia_obs_wri184 IF( ln_timing ) CALL timing_finalize185 CALL Agrif_ChildGrid_To_ParentGrid()186 ENDIF187 !188 181 # else 189 182 ! … … 230 223 IF( nstop /= 0 .AND. lwp ) THEN ! error print 231 224 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 232 CALL ctl_stop( ctmp1 ) 225 IF( ngrdstop > 0 ) THEN 226 WRITE(ctmp9,'(i2)') ngrdstop 227 WRITE(ctmp2,*) ' E R R O R detected in Agrif grid '//TRIM(ctmp9) 228 WRITE(ctmp3,*) ' Look for "E R R O R" messages in all existing '//TRIM(ctmp9)//'_ocean_output* files' 229 CALL ctl_stop( ' ', ctmp1, ' ', ctmp2, ' ', ctmp3 ) 230 ELSE 231 WRITE(ctmp2,*) ' Look for "E R R O R" messages in all existing ocean_output* files' 232 CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) 233 ENDIF 233 234 ENDIF 234 235 ! -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/step.F90
r12651 r13077 76 76 !!---------------------------------------------------------------------- 77 77 INTEGER :: ji, jj, jk ! dummy loop indice 78 INTEGER :: indic ! error indicator if < 079 78 !!gm kcall can be removed, I guess 80 79 INTEGER :: kcall ! optional integer argument (dom_vvl_sf_nxt) 81 80 !! --------------------------------------------------------------------- 82 81 #if defined key_agrif 83 IF( nstop > 0 ) return ! avoid to go further if an error was detected during previous time step82 IF( nstop > 0 ) RETURN ! avoid to go further if an error was detected during previous time step (child grid) 84 83 kstp = nit000 + Agrif_Nb_Step() 85 84 IF( lk_agrif_debug ) THEN … … 98 97 ! update I/O and calendar 99 98 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 100 indic = 0 ! reset to no error condition101 102 99 IF( kstp == nit000 ) THEN ! initialize IOM context (must be done after nemo_init for AGRIF+XIOS+OASIS) 103 100 CALL iom_init( cxios_context ) ! for model grid (including passible AGRIF zoom) … … 288 285 ! Control 289 286 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 290 CALL stp_ctl ( kstp , indic)287 CALL stp_ctl ( kstp ) 291 288 292 289 #if defined key_agrif … … 294 291 ! AGRIF update 295 292 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 296 IF( Agrif_NbStepint() == 0 .AND. nstop == 0 ) CALL Agrif_update_all( ) ! Update all components 293 IF( Agrif_NbStepint() == 0 .AND. nstop == 0 ) THEN 294 CALL Agrif_update_all( ) ! Update all components 295 ENDIF 297 296 #endif 298 297 … … 312 311 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 313 312 !!gm why lk_oasis and not lk_cpl ???? 314 IF( lk_oasis 313 IF( lk_oasis .AND. nstop == 0 ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges 315 314 ! 316 315 #if defined key_iomput … … 318 317 ! Finalize contextes if end of simulation or error detected 319 318 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 320 IF( kstp == nitend .OR. indic <0 ) THEN321 CALL iom_context_finalize( cxios_context) ! needed for XIOS+AGRIF319 IF( kstp == nitend .OR. nstop > 0 ) THEN 320 CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF 322 321 IF( lrxios ) CALL iom_context_finalize( crxios_context ) 323 322 IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) ! … … 328 327 ! 329 328 END SUBROUTINE stp 330 329 ! 331 330 !!====================================================================== 332 331 END MODULE step -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OCE/stpctl.F90
r11407 r13077 34 34 35 35 INTEGER :: idrun, idtime, idssh, idu, ids1, ids2, idt1, idt2, idc1, idw1, istatus 36 LOGICAL :: lsomeoce37 36 !!---------------------------------------------------------------------- 38 37 !! NEMO/OCE 4.0 , NEMO Consortium (2018) … … 42 41 CONTAINS 43 42 44 SUBROUTINE stp_ctl( kt , kindic)43 SUBROUTINE stp_ctl( kt ) 45 44 !!---------------------------------------------------------------------- 46 45 !! *** ROUTINE stp_ctl *** … … 50 49 !! ** Method : - Save the time step in numstp 51 50 !! - Print it each 50 time steps 52 !! - Stop the run IF problem encountered by setting indic=-351 !! - Stop the run IF problem encountered by setting nstop > 0 53 52 !! Problems checked: |ssh| maximum larger than 10 m 54 53 !! |U| maximum larger than 10 m/s … … 57 56 !! ** Actions : "time.step" file = last ocean time-step 58 57 !! "run.stat" file = run statistics 59 !! nstop indicator sheared among all local domain (lk_mpp=T)58 !! nstop indicator sheared among all local domain 60 59 !!---------------------------------------------------------------------- 61 60 INTEGER, INTENT(in ) :: kt ! ocean time-step index 62 INTEGER, INTENT(inout) :: kindic ! error indicator63 61 !! 64 62 INTEGER :: ji, jj, jk ! dummy loop indices 65 INTEGER, DIMENSION(2) :: ih! min/max loc indices66 INTEGER, DIMENSION(3) :: iu, is1, is2 ! min/max loc indices63 INTEGER, DIMENSION(3) :: ih, iu, is1, is2 ! min/max loc indices 64 INTEGER, DIMENSION(9) :: iareasum, iareamin, iareamax 67 65 REAL(wp) :: zzz ! local real 68 REAL(wp), DIMENSION(9) :: zmax 66 REAL(wp), DIMENSION(9) :: zmax, zmaxlocal 69 67 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns 70 68 CHARACTER(len=20) :: clname 71 69 !!---------------------------------------------------------------------- 72 ! 73 ll_wrtstp = ( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 74 ll_colruns = ll_wrtstp .AND. ( ln_ctl .OR. sn_cfctl%l_runstat ) 75 ll_wrtruns = ll_colruns .AND. lwm 76 IF( kt == nit000 .AND. lwp ) THEN 77 WRITE(numout,*) 78 WRITE(numout,*) 'stp_ctl : time-stepping control' 79 WRITE(numout,*) '~~~~~~~' 70 IF( nstop > 0 .AND. ngrdstop > -1 ) RETURN ! stpctl was already called by a child grid 71 ! 72 ll_wrtstp = ( MOD( kt-nit000, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 73 ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 74 ll_wrtruns = ( ll_colruns .OR. jpnij == 1 ) .AND. lwm 75 ! 76 IF( kt == nit000 ) THEN 77 ! 78 IF( lwp ) THEN 79 WRITE(numout,*) 80 WRITE(numout,*) 'stp_ctl : time-stepping control' 81 WRITE(numout,*) '~~~~~~~' 82 ENDIF 80 83 ! ! open time.step file 81 84 IF( lwm ) CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 82 85 ! ! open run.stat file(s) at start whatever 83 86 ! ! the value of sn_cfctl%ptimincr 84 IF( l wm .AND. ( ln_ctl .OR. sn_cfctl%l_runstat )) THEN87 IF( ll_wrtruns ) THEN 85 88 CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 86 89 clname = 'run.stat.nc' … … 99 102 ENDIF 100 103 istatus = NF90_ENDDEF(idrun) 101 zmax(8:9) = 0._wp ! initialise to zero in case ln_zad_Aimp option is not in use 102 ENDIF 103 ENDIF 104 IF( kt == nit000 ) lsomeoce = COUNT( ssmask(:,:) == 1._wp ) > 0 104 ENDIF 105 ENDIF 105 106 ! 106 107 IF(lwm .AND. ll_wrtstp) THEN !== current time step ==! ("time.step" file) … … 118 119 zmax(3) = MAXVAL( -tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp ) ! minus salinity max 119 120 zmax(4) = MAXVAL( tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp ) ! salinity max 120 zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! minus temperature max 121 zmax(6) = MAXVAL( tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! temperature max 121 IF( ll_colruns ) THEN ! following variables are used only in the netcdf file 122 zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! minus temperature max 123 zmax(6) = MAXVAL( tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! temperature max 124 IF( ln_zad_Aimp ) THEN 125 zmax(8) = MAXVAL( ABS( wi(:,:,:) ) , mask = wmask(:,:,:) == 1._wp ) ! implicit vertical vel. max 126 zmax(9) = MAXVAL( Cu_adv(:,:,:) , mask = tmask(:,:,:) == 1._wp ) ! partitioning coeff. max 127 ELSE 128 zmax(8:9) = 0._wp 129 ENDIF 130 ELSE 131 zmax(5:9) = 0._wp 132 ENDIF 122 133 zmax(7) = REAL( nstop , wp ) ! stop indicator 123 IF( ln_zad_Aimp ) THEN124 zmax(8) = MAXVAL( ABS( wi(:,:,:) ) , mask = wmask(:,:,:) == 1._wp ) ! implicit vertical vel. max125 zmax(9) = MAXVAL( Cu_adv(:,:,:) , mask = tmask(:,:,:) == 1._wp ) ! partitioning coeff. max126 ENDIF127 134 ! 128 135 IF( ll_colruns ) THEN 136 zmaxlocal(:) = zmax(:) 129 137 CALL mpp_max( "stpctl", zmax ) ! max over the global domain 130 138 nstop = NINT( zmax(7) ) ! nstop indicator sheared among all local domains … … 143 151 istatus = NF90_PUT_VAR( idrun, idc1, (/ zmax(9)/), (/kt/), (/1/) ) 144 152 ENDIF 145 IF( MOD( kt , 100 ) == 0 ) istatus = NF90_SYNC(idrun) 146 IF( kt == nitend ) istatus = NF90_CLOSE(idrun) 153 IF( kt == nitend ) istatus = NF90_CLOSE(idrun) 147 154 END IF 148 155 ! !== error handling ==! 149 IF( ( ln_ctl .OR. lsomeoce ) .AND. ( & ! have use mpp_max (because ln_ctl=.T.) or contains some ocean points 150 & zmax(1) > 20._wp .OR. & ! too large sea surface height ( > 20 m ) 156 IF( zmax(1) > 20._wp .OR. & ! too large sea surface height ( > 20 m ) 151 157 & zmax(2) > 10._wp .OR. & ! too large velocity ( > 10 m/s) 152 158 & zmax(3) >= 0._wp .OR. & ! negative or zero sea surface salinity 153 159 & zmax(4) >= 100._wp .OR. & ! too large sea surface salinity ( > 100 ) 154 160 & zmax(4) < 0._wp .OR. & ! too large sea surface salinity (keep this line for sea-ice) 155 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) ) ) THEN ! NaN encounter in the tests 156 IF( lk_mpp .AND. ln_ctl ) THEN 157 CALL mpp_maxloc( 'stpctl', ABS(sshn) , ssmask(:,:) , zzz, ih ) 161 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR. & ! NaN encounter in the tests 162 & ABS( zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests 163 IF( ll_colruns ) THEN 164 ! first: close the netcdf file, so we can read it 165 IF( lwm .AND. kt /= nitend ) istatus = NF90_CLOSE(idrun) 166 CALL mpp_maxloc( 'stpctl', ABS(sshn) , ssmask(:,:) , zzz, ih(1:2) ) ; ih(3) = 0 158 167 CALL mpp_maxloc( 'stpctl', ABS(un) , umask (:,:,:), zzz, iu ) 159 168 CALL mpp_minloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is1 ) 160 169 CALL mpp_maxloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is2 ) 170 ! find which subdomain has the max. 171 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 172 DO ji = 1, 9 173 IF( zmaxlocal(ji) == zmax(ji) ) THEN 174 iareamin(ji) = narea ; iareamax(ji) = narea ; iareasum(ji) = 1 175 ENDIF 176 END DO 177 CALL mpp_min( "stpctl", iareamin ) ! min over the global domain 178 CALL mpp_max( "stpctl", iareamax ) ! max over the global domain 179 CALL mpp_sum( "stpctl", iareasum ) ! sum over the global domain 161 180 ELSE 162 ih( :) = MAXLOC( ABS( sshn(:,:) ) ) + (/ nimpp - 1, njmpp - 1 /)181 ih(1:2)= MAXLOC( ABS( sshn(:,:) ) ) + (/ nimpp - 1, njmpp - 1 /) ; ih(3) = 0 163 182 iu(:) = MAXLOC( ABS( un (:,:,:) ) ) + (/ nimpp - 1, njmpp - 1, 0 /) 164 183 is1(:) = MINLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 165 184 is2(:) = MAXLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 166 ENDIF 167 185 iareamin(:) = narea ; iareamax(:) = narea ; iareasum(:) = 1 ! this is local information 186 ENDIF 187 ! 168 188 WRITE(ctmp1,*) ' stp_ctl: |ssh| > 20 m or |U| > 10 m/s or S <= 0 or S >= 100 or NaN encounter in the tests' 169 WRITE(ctmp2,9100) kt, zmax(1), ih(1) , ih(2) 170 WRITE(ctmp3,9200) kt, zmax(2), iu(1) , iu(2) , iu(3) 171 WRITE(ctmp4,9300) kt, - zmax(3), is1(1), is1(2), is1(3) 172 WRITE(ctmp5,9400) kt, zmax(4), is2(1), is2(2), is2(3) 173 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort.nc file' 174 175 CALL dia_wri_state( 'output.abort' ) ! create an output.abort file 176 177 IF( .NOT. ln_ctl ) THEN 178 WRITE(ctmp8,*) 'E R R O R message from sub-domain: ', narea 179 CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp8, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ctmp6 ) 189 CALL wrt_line(ctmp2, kt, ' |ssh| max ', zmax(1), ih , iareasum(1), iareamin(1), iareamax(1) ) 190 CALL wrt_line(ctmp3, kt, ' |U| max ', zmax(2), iu , iareasum(2), iareamin(2), iareamax(2) ) 191 CALL wrt_line(ctmp4, kt, ' Sal min ', - zmax(3), is1, iareasum(3), iareamin(3), iareamax(3) ) 192 CALL wrt_line(ctmp5, kt, ' Sal max ', zmax(4), is2, iareasum(4), iareamin(4), iareamax(4) ) 193 IF( Agrif_Root() ) THEN 194 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort* files' 180 195 ELSE 181 CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6, ' ' ) 182 ENDIF 183 184 kindic = -3 185 ! 186 ENDIF 187 ! 188 9100 FORMAT (' kt=',i8,' |ssh| max: ',1pg11.4,', at i j : ',2i5) 189 9200 FORMAT (' kt=',i8,' |U| max: ',1pg11.4,', at i j k: ',3i5) 190 9300 FORMAT (' kt=',i8,' S min: ',1pg11.4,', at i j k: ',3i5) 191 9400 FORMAT (' kt=',i8,' S max: ',1pg11.4,', at i j k: ',3i5) 196 WRITE(ctmp6,*) ' ===> output of last computed fields in '//TRIM(Agrif_CFixed())//'_output.abort* files' 197 ENDIF 198 ! 199 CALL dia_wri_state( 'output.abort' ) ! create an output.abort file 200 ! 201 IF( ll_colruns .or. jpnij == 1 ) THEN ! all processes synchronized -> use lwp to print in opened ocean.output files 202 IF(lwp) CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 203 ELSE ! only mpi subdomains with errors are here -> STOP now 204 CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 205 ENDIF 206 ! 207 IF( nstop == 0 ) nstop = 1 208 ngrdstop = Agrif_Fixed() 209 ! 210 ENDIF 211 ! 192 212 9500 FORMAT(' it :', i8, ' |ssh|_max: ', D23.16, ' |U|_max: ', D23.16,' S_min: ', D23.16,' S_max: ', D23.16) 193 213 ! 194 214 END SUBROUTINE stp_ctl 215 216 217 SUBROUTINE wrt_line( cdline, kt, cdprefix, pval, kloc, ksum, kmin, kmax ) 218 !!---------------------------------------------------------------------- 219 !! *** ROUTINE wrt_line *** 220 !! 221 !! ** Purpose : write information line 222 !! 223 !!---------------------------------------------------------------------- 224 CHARACTER(len=*), INTENT( out) :: cdline 225 CHARACTER(len=*), INTENT(in ) :: cdprefix 226 REAL(wp), INTENT(in ) :: pval 227 INTEGER, DIMENSION(3), INTENT(in ) :: kloc 228 INTEGER, INTENT(in ) :: kt, ksum, kmin, kmax 229 ! 230 CHARACTER(len=80) :: clsuff 231 CHARACTER(len=9 ) :: clkt, clsum, clmin, clmax 232 CHARACTER(len=9 ) :: cli, clj, clk 233 CHARACTER(len=1 ) :: clfmt 234 CHARACTER(len=4 ) :: cl4 ! needed to be able to compile with Agrif, I don't know why 235 INTEGER :: ifmtk 236 !!---------------------------------------------------------------------- 237 WRITE(clkt , '(i9)') kt 238 239 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij ,wp))) + 1 ! how many digits to we need to write ? (we decide max = 9) 240 !!! WRITE(clsum, '(i'//clfmt//')') ksum ! this is creating a compilation error with AGRIF 241 cl4 = '(i'//clfmt//')' ; WRITE(clsum, cl4) ksum 242 WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1 ! how many digits to we need to write ? (we decide max = 9) 243 cl4 = '(i'//clfmt//')' ; WRITE(clmin, cl4) kmin-1 244 WRITE(clmax, cl4) kmax-1 245 ! 246 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpiglo,wp))) + 1 ! how many digits to we need to write jpiglo? (we decide max = 9) 247 cl4 = '(i'//clfmt//')' ; WRITE(cli, cl4) kloc(1) ! this is ok with AGRIF 248 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpjglo,wp))) + 1 ! how many digits to we need to write jpjglo? (we decide max = 9) 249 cl4 = '(i'//clfmt//')' ; WRITE(clj, cl4) kloc(2) ! this is ok with AGRIF 250 ! 251 IF( ksum == 1 ) THEN ; WRITE(clsuff,9100) TRIM(clmin) 252 ELSE ; WRITE(clsuff,9200) TRIM(clsum), TRIM(clmin), TRIM(clmax) 253 ENDIF 254 IF(kloc(3) == 0) THEN 255 ifmtk = INT(LOG10(REAL(jpk,wp))) + 1 ! how many digits to we need to write jpk? (we decide max = 9) 256 clk = REPEAT(' ', ifmtk) ! create the equivalent in blank string 257 WRITE(cdline,9300) TRIM(ADJUSTL(clkt)), TRIM(ADJUSTL(cdprefix)), pval, TRIM(cli), TRIM(clj), clk(1:ifmtk), TRIM(clsuff) 258 ELSE 259 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpk,wp))) + 1 ! how many digits to we need to write jpk? (we decide max = 9) 260 !!! WRITE(clk, '(i'//clfmt//')') kloc(3) ! this is creating a compilation error with AGRIF 261 cl4 = '(i'//clfmt//')' ; WRITE(clk, cl4) kloc(3) ! this is ok with AGRIF 262 WRITE(cdline,9400) TRIM(ADJUSTL(clkt)), TRIM(ADJUSTL(cdprefix)), pval, TRIM(cli), TRIM(clj), TRIM(clk), TRIM(clsuff) 263 ENDIF 264 ! 265 9100 FORMAT('MPI rank ', a) 266 9200 FORMAT('found in ', a, ' MPI tasks, spread out among ranks ', a, ' to ', a) 267 9300 FORMAT('kt ', a, ' ', a, ' ', 1pg11.4, ' at i j ', a, ' ', a, ' ', a, ' ', a) 268 9400 FORMAT('kt ', a, ' ', a, ' ', 1pg11.4, ' at i j k ', a, ' ', a, ' ', a, ' ', a) 269 ! 270 END SUBROUTINE wrt_line 271 195 272 196 273 !!====================================================================== -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/OFF/nemogcm.F90
r12640 r13077 27 27 USE usrdef_nam ! user defined configuration 28 28 USE eosbn2 ! equation of state (eos bn2 routine) 29 ! ! ocean physics 29 ! ! ocean physics 30 USE bdy_oce, ONLY : ln_bdy 31 USE bdyini ! open boundary cond. setting (bdy_init routine) 30 32 USE ldftra ! lateral diffusivity setting (ldf_tra_init routine) 31 33 USE ldfslp ! slopes of neutral surfaces (ldf_slp_init routine) … … 134 136 IF( nstop /= 0 .AND. lwp ) THEN ! error print 135 137 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 136 CALL ctl_stop( ctmp1 ) 138 WRITE(ctmp2,*) ' Look for "E R R O R" messages in all existing ocean_output* files' 139 CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) 137 140 ENDIF 138 141 ! … … 312 315 313 316 CALL sbc_init ! Forcings : surface module 317 CALL bdy_init ! Open boundaries initialisation 314 318 315 319 ! ! Tracer physics … … 476 480 USE zdf_oce, ONLY : zdf_oce_alloc 477 481 USE trc_oce, ONLY : trc_oce_alloc 482 USE bdy_oce, ONLY : bdy_oce_alloc 478 483 ! 479 484 INTEGER :: ierr … … 485 490 ierr = ierr + zdf_oce_alloc() ! ocean vertical physics 486 491 ierr = ierr + trc_oce_alloc() ! shared TRC / TRA arrays 492 ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) 493 487 494 ! 488 495 CALL mpp_sum( 'nemogcm', ierr ) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/SAS/nemogcm.F90
r12640 r13077 153 153 IF( nstop /= 0 .AND. lwp ) THEN ! error print 154 154 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 155 CALL ctl_stop( ctmp1 ) 155 WRITE(ctmp2,*) ' Look for "E R R O R" messages in all existing ocean_output* files' 156 CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) 156 157 ENDIF 157 158 ! -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/SAS/stpctl.F90
r10603 r13077 32 32 33 33 INTEGER :: idrun, idtime, idssh, idu, ids, istatus 34 LOGICAL :: lsomeoce35 34 !!---------------------------------------------------------------------- 36 35 !! NEMO/SAS 4.0 , NEMO Consortium (2018) … … 62 61 !!---------------------------------------------------------------------- 63 62 ! 64 ll_wrtstp = ( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 65 ll_colruns = ll_wrtstp .AND. ( ln_ctl .OR. sn_cfctl%l_runstat ) 66 ll_wrtruns = ll_colruns .AND. lwm 67 IF( kt == nit000 .AND. lwp ) THEN 68 WRITE(numout,*) 69 WRITE(numout,*) 'stp_ctl : time-stepping control' 70 WRITE(numout,*) '~~~~~~~' 63 ll_wrtstp = ( MOD( kt-nit000, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 64 ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 65 ll_wrtruns = ( ll_colruns .OR. jpnij == 1 ) .AND. lwm 66 ! 67 IF( kt == nit000 ) THEN 68 ! 69 IF( lwp ) THEN 70 WRITE(numout,*) 71 WRITE(numout,*) 'stp_ctl : time-stepping control' 72 WRITE(numout,*) '~~~~~~~' 73 ENDIF 71 74 ! ! open time.step file 72 75 IF( lwm ) CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 73 76 ! ! open run.stat file(s) at start whatever 74 77 ! ! the value of sn_cfctl%ptimincr 75 IF( l wm .AND. ( ln_ctl .OR. sn_cfctl%l_runstat )) THEN78 IF( ll_wrtruns ) THEN 76 79 CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 77 80 clname = 'run.stat.nc' … … 85 88 ENDIF 86 89 ENDIF 87 IF( kt == nit000 ) lsomeoce = COUNT( ssmask(:,:) == 1._wp ) > 088 90 ! 89 91 IF(lwm .AND. ll_wrtstp) THEN !== current time step ==! ("time.step" file) … … 92 94 ENDIF 93 95 ! !== test of extrema ==! 94 IF( ll_colruns ) THEN96 IF( ll_colruns .OR. jpnij == 1 ) THEN 95 97 zmax(1) = MAXVAL( vt_i (:,:) ) ! max ice thickness 96 98 zmax(2) = MAXVAL( ABS( u_ice(:,:) ) ) ! max ice velocity (zonal only) 97 99 zmax(3) = MAXVAL( -tm_i (:,:)+273.15_wp , mask = ssmask(:,:) == 1._wp ) ! min ice temperature 98 CALL mpp_max( "stpctl", zmax )! max over the global domain100 IF( ll_colruns ) CALL mpp_max( "stpctl", zmax ) ! max over the global domain 99 101 END IF 100 102 ! !== run statistics ==! ("run.stat" file) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/MY_TRC/trcsms_my_trc.F90
r10425 r13077 15 15 USE trd_oce 16 16 USE trdtrc 17 USE trcbc, only : trc_bc18 17 19 18 IMPLICIT NONE … … 54 53 IF( l_trdtrc ) ALLOCATE( ztrmyt(jpi,jpj,jpk) ) 55 54 56 CALL trc_bc ( kt ) ! tracers: surface and lateral Boundary Conditions57 58 55 ! add here the call to BGC model 59 56 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/P4Z/p4zmeso.F90
r12276 r13077 66 66 REAL(wp) :: zfact , zfood, zfoodlim, zproport, zbeta 67 67 REAL(wp) :: zmortzgoc, zfrac, zfracfe, zratio, zratio2, zfracal, zgrazcal 68 REAL(wp) :: zepsherf, zepshert, zepsherv, zgrarsig, zgraztotc, zgraztotn, zgraztotf 68 REAL(wp) :: zepsherf, zepshert, zepsherv, zepsherq 69 REAL(wp) :: zgrarsig, zgraztotc, zgraztotn, zgraztotf 69 70 REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz, zgrasrat, zgrasratn 70 71 REAL(wp) :: zrespz, ztortz, zgrazd, zgrazz, zgrazpof … … 155 156 zgrazing2(ji,jj,jk) = zgraztotc 156 157 157 ! Mesozooplankton efficiency 158 ! -------------------------- 158 ! Mesozooplankton efficiency. 159 ! We adopt a formulation proposed by Mitra et al. (2007) 160 ! The gross growth efficiency is controled by the most limiting nutrient. 161 ! Growth is also further decreased when the food quality is poor. This is currently 162 ! hard coded : it can be decreased by up to 50% (zepsherq) 163 ! GGE can also be decreased when food quantity is high, zepsherf (Montagnes and 164 ! Fulton, 2012) 165 ! ----------------------------------------------------------------------------------- 159 166 zgrasrat = ( zgraztotf + rtrn )/ ( zgraztotc + rtrn ) 160 167 zgrasratn = ( zgraztotn + rtrn )/ ( zgraztotc + rtrn ) … … 162 169 zbeta = MAX(0., (epsher2 - epsher2min) ) 163 170 zepsherf = epsher2min + zbeta / ( 1.0 + 0.04E6 * 12. * zfood * zbeta ) 164 zepsherv = zepsherf * zepshert 171 zepsherq = 0.5 + (1.0 - 0.5) * zepshert * ( 1.0 + 1.0 ) / ( zepshert + 1.0 ) 172 zepsherv = zepsherf * zepshert * zepsherq 165 173 166 174 zgrarem2 = zgraztotc * ( 1. - zepsherv - unass2 ) & -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/P4Z/p4zmicro.F90
r12276 r13077 64 64 REAL(wp) :: zgraze , zdenom, zdenom2 65 65 REAL(wp) :: zfact , zfood, zfoodlim, zbeta 66 REAL(wp) :: zepsherf, zepshert, zepsherv, zgrarsig, zgraztotc, zgraztotn, zgraztotf 66 REAL(wp) :: zepsherf, zepshert, zepsherv, zepsherq 67 REAL(wp) :: zgrarsig, zgraztotc, zgraztotn, zgraztotf 67 68 REAL(wp) :: zgrarem, zgrafer, zgrapoc, zprcaca, zmortz 68 69 REAL(wp) :: zrespz, ztortz, zgrasrat, zgrasratn … … 118 119 zgrazing(ji,jj,jk) = zgraztotc 119 120 120 ! Various remineralization and excretion terms 121 ! -------------------------------------------- 121 ! Microzooplankton efficiency. 122 ! We adopt a formulation proposed by Mitra et al. (2007) 123 ! The gross growth efficiency is controled by the most limiting nutrient. 124 ! Growth is also further decreased when the food quality is poor. This is currently 125 ! hard coded : it can be decreased by up to 50% (zepsherq) 126 ! GGE can also be decreased when food quantity is high, zepsherf (Montagnes and 127 ! Fulton, 2012) 128 ! ----------------------------------------------------------------------------- 122 129 zgrasrat = ( zgraztotf + rtrn ) / ( zgraztotc + rtrn ) 123 130 zgrasratn = ( zgraztotn + rtrn ) / ( zgraztotc + rtrn ) … … 125 132 zbeta = MAX(0., (epsher - epshermin) ) 126 133 zepsherf = epshermin + zbeta / ( 1.0 + 0.04E6 * 12. * zfood * zbeta ) 127 zepsherv = zepsherf * zepshert 134 zepsherq = 0.5 + (1.0 - 0.5) * zepshert * ( 1.0 + 1.0 ) / ( zepshert + 1.0 ) 135 zepsherv = zepsherf * zepshert * zepsherq 128 136 129 137 zgrafer = zgraztotc * MAX( 0. , ( 1. - unass ) * zgrasrat - ferat3 * zepsherv ) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/P4Z/p4zsbc.F90
r11536 r13077 270 270 ENDIF 271 271 272 ! set the number of level over which river runoffs are applied273 ! online configuration : computed in sbcrnf274 IF( l_offline ) THEN275 nk_rnf(:,:) = 1276 h_rnf (:,:) = gdept_n(:,:,1)277 ENDIF278 272 279 273 ! dust input from the atmosphere -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/P4Z/p4zsms.F90
r12276 r13077 207 207 IF( l_trdtrc ) THEN 208 208 DO jn = jp_pcs0, jp_pcs1 209 ztrdt(:,:,:,jn) = ( trb(:,:,:,jn) - ztrdt(:,:,:,jn) ) * rfact 2r209 ztrdt(:,:,:,jn) = ( trb(:,:,:,jn) - ztrdt(:,:,:,jn) ) * rfactr 210 210 CALL trd_trc( ztrdt(:,:,:,jn), jn, jptra_sms, kt ) ! save trends 211 211 END DO -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/SED/sedchem.F90
r10356 r13077 577 577 saltprac(:) = salt(:) * 35.0 / 35.16504 578 578 ELSE 579 saltprac(:) = temp(:)579 saltprac(:) = salt(:) 580 580 ENDIF 581 581 -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/PISCES/SED/sedinorg.F90
r10225 r13077 89 89 zsolcpcl = zsolcpcl + solcp(ji,jk,jsclay) * dz(jk) 90 90 END DO 91 zsolcpsi = MAX( zsolcpsi, rtrn ) 91 92 zsieq(ji) = sieqs(ji) * MAX(0.25, 1.0 - (0.045 * zsolcpcl / zsolcpsi )**0.58 ) 92 93 zsieq(ji) = MAX( rtrn, sieqs(ji) ) -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/TRP/trctrp.F90
r10068 r13077 24 24 USE trcsbc ! surface boundary condition (trc_sbc routine) 25 25 USE zpshde ! partial step: hor. derivative (zps_hde routine) 26 USE trcbc ! Tracers boundary condtions ( trc_bc routine) 26 27 USE bdy_oce , ONLY: ln_bdy 27 28 USE trcbdy ! BDY open boundaries … … 63 64 IF( ln_trabbl ) CALL trc_bbl ( kt ) ! advective (and/or diffusive) bottom boundary layer scheme 64 65 IF( ln_trcdmp ) CALL trc_dmp ( kt ) ! internal damping trends 66 CALL trc_bc ( kt ) ! BC for BDY 65 67 IF( ln_bdy ) CALL trc_bdy_dmp( kt ) ! BDY damping trends 66 68 CALL trc_adv ( kt ) ! horizontal & vertical advection -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/trcbc.F90
r11536 r13077 153 153 IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) /= 0 ) & 154 154 & CALL ctl_stop( 'trc_bc_ini: Use FRS OR relaxation' ) 155 IF( .NOT.( 0 < nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) )&155 IF( .NOT.( 0 <= nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) ) & 156 156 & CALL ctl_stop( 'trc_bc_ini: Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' ) 157 157 END DO -
NEMO/branches/2020/r4.0-HEAD_ticket2425/src/TOP/trcini.F90
r12136 r13077 218 218 IF( ln_trcdta ) CALL trc_dta_ini( jptra ) ! set initial tracers values 219 219 ! 220 IF( ln_my_trc )CALL trc_bc_ini ( jptra ) ! set tracers Boundary Conditions220 CALL trc_bc_ini ( jptra ) ! set tracers Boundary Conditions 221 221 ! 222 222 ! -
NEMO/branches/2020/r4.0-HEAD_ticket2425/tests/CANAL/MY_SRC/stpctl.F90
r10572 r13077 34 34 35 35 INTEGER :: idrun, idtime, idssh, idu, ids1, ids2, idt1, idt2, idc1, idw1, istatus 36 LOGICAL :: lsomeoce37 36 !!---------------------------------------------------------------------- 38 37 !! NEMO/OCE 4.0 , NEMO Consortium (2018) … … 42 41 CONTAINS 43 42 44 SUBROUTINE stp_ctl( kt , kindic)43 SUBROUTINE stp_ctl( kt ) 45 44 !!---------------------------------------------------------------------- 46 45 !! *** ROUTINE stp_ctl *** … … 50 49 !! ** Method : - Save the time step in numstp 51 50 !! - Print it each 50 time steps 52 !! - Stop the run IF problem encountered by setting indic=-351 !! - Stop the run IF problem encountered by setting nstop > 0 53 52 !! Problems checked: |ssh| maximum larger than 10 m 54 53 !! |U| maximum larger than 10 m/s … … 57 56 !! ** Actions : "time.step" file = last ocean time-step 58 57 !! "run.stat" file = run statistics 59 !! nstop indicator sheared among all local domain (lk_mpp=T)58 !! nstop indicator sheared among all local domain 60 59 !!---------------------------------------------------------------------- 61 60 INTEGER, INTENT(in ) :: kt ! ocean time-step index 62 INTEGER, INTENT(inout) :: kindic ! error indicator63 61 !! 64 62 INTEGER :: ji, jj, jk ! dummy loop indices 65 INTEGER, DIMENSION(2) :: ih! min/max loc indices66 INTEGER, DIMENSION(3) :: iu, is1, is2 ! min/max loc indices63 INTEGER, DIMENSION(3) :: ih, iu, is1, is2 ! min/max loc indices 64 INTEGER, DIMENSION(9) :: iareasum, iareamin, iareamax 67 65 REAL(wp) :: zzz ! local real 68 REAL(wp), DIMENSION(9) :: zmax 66 REAL(wp), DIMENSION(9) :: zmax, zmaxlocal 69 67 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns 70 68 CHARACTER(len=20) :: clname 71 69 !!---------------------------------------------------------------------- 72 ! 73 ll_wrtstp = ( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 74 ll_colruns = ll_wrtstp .AND. ( ln_ctl .OR. sn_cfctl%l_runstat ) 75 ll_wrtruns = ll_colruns .AND. lwm 76 IF( kt == nit000 .AND. lwp ) THEN 77 WRITE(numout,*) 78 WRITE(numout,*) 'stp_ctl : time-stepping control' 79 WRITE(numout,*) '~~~~~~~' 70 IF( nstop > 0 .AND. ngrdstop > -1 ) RETURN ! stpctl was already called by a child grid 71 ! 72 ll_wrtstp = ( MOD( kt-nit000, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend ) 73 ll_colruns = ll_wrtstp .AND. sn_cfctl%l_runstat .AND. jpnij > 1 74 ll_wrtruns = ( ll_colruns .OR. jpnij == 1 ) .AND. lwm 75 ! 76 IF( kt == nit000 ) THEN 77 ! 78 IF( lwp ) THEN 79 WRITE(numout,*) 80 WRITE(numout,*) 'stp_ctl : time-stepping control' 81 WRITE(numout,*) '~~~~~~~' 82 ENDIF 80 83 ! ! open time.step file 81 84 IF( lwm ) CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 82 85 ! ! open run.stat file(s) at start whatever 83 86 ! ! the value of sn_cfctl%ptimincr 84 IF( l wm .AND. ( ln_ctl .OR. sn_cfctl%l_runstat )) THEN87 IF( ll_wrtruns ) THEN 85 88 CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 86 89 clname = 'run.stat.nc' … … 96 99 IF( ln_zad_Aimp ) THEN 97 100 istatus = NF90_DEF_VAR( idrun, 'abs_wi_max', NF90_DOUBLE, (/ idtime /), idw1 ) 98 istatus = NF90_DEF_VAR( idrun, 'C u_max', NF90_DOUBLE, (/ idtime /), idc1 )101 istatus = NF90_DEF_VAR( idrun, 'Cf_max', NF90_DOUBLE, (/ idtime /), idc1 ) 99 102 ENDIF 100 103 istatus = NF90_ENDDEF(idrun) 101 zmax(8:9) = 0._wp ! initialise to zero in case ln_zad_Aimp option is not in use 102 ENDIF 103 ENDIF 104 IF( kt == nit000 ) lsomeoce = COUNT( ssmask(:,:) == 1._wp ) > 0 104 ENDIF 105 ENDIF 105 106 ! 106 107 IF(lwm .AND. ll_wrtstp) THEN !== current time step ==! ("time.step" file) … … 118 119 zmax(3) = MAXVAL( -tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp ) ! minus salinity max 119 120 zmax(4) = MAXVAL( tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp ) ! salinity max 120 zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! minus temperature max 121 zmax(6) = MAXVAL( tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! temperature max 121 IF( ll_colruns ) THEN ! following variables are used only in the netcdf file 122 zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! minus temperature max 123 zmax(6) = MAXVAL( tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp ) ! temperature max 124 IF( ln_zad_Aimp ) THEN 125 zmax(8) = MAXVAL( ABS( wi(:,:,:) ) , mask = wmask(:,:,:) == 1._wp ) ! implicit vertical vel. max 126 zmax(9) = MAXVAL( Cu_adv(:,:,:) , mask = tmask(:,:,:) == 1._wp ) ! partitioning coeff. max 127 ELSE 128 zmax(8:9) = 0._wp 129 ENDIF 130 ELSE 131 zmax(5:9) = 0._wp 132 ENDIF 122 133 zmax(7) = REAL( nstop , wp ) ! stop indicator 123 IF( ln_zad_Aimp ) THEN124 zmax(8) = MAXVAL( ABS( wi(:,:,:) ) , mask = wmask(:,:,:) == 1._wp ) ! implicit vertical vel. max125 zmax(9) = MAXVAL( Cu_adv(:,:,:) , mask = tmask(:,:,:) == 1._wp ) ! cell Courant no. max126 ENDIF127 134 ! 128 135 IF( ll_colruns ) THEN 136 zmaxlocal(:) = zmax(:) 129 137 CALL mpp_max( "stpctl", zmax ) ! max over the global domain 130 138 nstop = NINT( zmax(7) ) ! nstop indicator sheared among all local domains … … 143 151 istatus = NF90_PUT_VAR( idrun, idc1, (/ zmax(9)/), (/kt/), (/1/) ) 144 152 ENDIF 145 IF( MOD( kt , 100 ) == 0 ) istatus = NF90_SYNC(idrun) 146 IF( kt == nitend ) istatus = NF90_CLOSE(idrun) 153 IF( kt == nitend ) istatus = NF90_CLOSE(idrun) 147 154 END IF 148 155 ! !== error handling ==! 149 IF( ( ln_ctl .OR. lsomeoce ) .AND. ( & ! have use mpp_max (because ln_ctl=.T.) or contains some ocean points 150 & zmax(1) > 50._wp .OR. & ! too large sea surface height ( > 50 m ) 151 & zmax(2) > 20._wp .OR. & ! too large velocity ( > 20 m/s) 156 IF( zmax(1) > 20._wp .OR. & ! too large sea surface height ( > 20 m ) 157 & zmax(2) > 10._wp .OR. & ! too large velocity ( > 10 m/s) 152 158 !!$ & zmax(3) >= 0._wp .OR. & ! negative or zero sea surface salinity 153 159 !!$ & zmax(4) >= 100._wp .OR. & ! too large sea surface salinity ( > 100 ) 154 160 !!$ & zmax(4) < 0._wp .OR. & ! too large sea surface salinity (keep this line for sea-ice) 155 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) ) ) THEN ! NaN encounter in the tests 156 IF( lk_mpp .AND. ln_ctl ) THEN 157 CALL mpp_maxloc( 'stpctl', ABS(sshn) , ssmask(:,:) , zzz, ih ) 161 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR. & ! NaN encounter in the tests 162 & ABS( zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests 163 IF( ll_colruns ) THEN 164 ! first: close the netcdf file, so we can read it 165 IF( lwm .AND. kt /= nitend ) istatus = NF90_CLOSE(idrun) 166 CALL mpp_maxloc( 'stpctl', ABS(sshn) , ssmask(:,:) , zzz, ih(1:2) ) ; ih(3) = 0 158 167 CALL mpp_maxloc( 'stpctl', ABS(un) , umask (:,:,:), zzz, iu ) 159 168 CALL mpp_minloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is1 ) 160 169 CALL mpp_maxloc( 'stpctl', tsn(:,:,:,jp_sal), tmask (:,:,:), zzz, is2 ) 170 ! find which subdomain has the max. 171 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 172 DO ji = 1, 9 173 IF( zmaxlocal(ji) == zmax(ji) ) THEN 174 iareamin(ji) = narea ; iareamax(ji) = narea ; iareasum(ji) = 1 175 ENDIF 176 END DO 177 CALL mpp_min( "stpctl", iareamin ) ! min over the global domain 178 CALL mpp_max( "stpctl", iareamax ) ! max over the global domain 179 CALL mpp_sum( "stpctl", iareasum ) ! sum over the global domain 161 180 ELSE 162 ih( :) = MAXLOC( ABS( sshn(:,:) ) ) + (/ nimpp - 1, njmpp - 1 /)181 ih(1:2)= MAXLOC( ABS( sshn(:,:) ) ) + (/ nimpp - 1, njmpp - 1 /) ; ih(3) = 0 163 182 iu(:) = MAXLOC( ABS( un (:,:,:) ) ) + (/ nimpp - 1, njmpp - 1, 0 /) 164 183 is1(:) = MINLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 165 184 is2(:) = MAXLOC( tsn(:,:,:,jp_sal), mask = tmask(:,:,:) == 1._wp ) + (/ nimpp - 1, njmpp - 1, 0 /) 166 ENDIF 167 168 WRITE(ctmp1,*) ' stp_ctl: |ssh| > 50 m or |U| > 20 m/s or NaN encounter in the tests' 169 WRITE(ctmp2,9100) kt, zmax(1), ih(1) , ih(2) 170 WRITE(ctmp3,9200) kt, zmax(2), iu(1) , iu(2) , iu(3) 171 WRITE(ctmp4,9300) kt, - zmax(3), is1(1), is1(2), is1(3) 172 WRITE(ctmp5,9400) kt, zmax(4), is2(1), is2(2), is2(3) 173 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort.nc file' 174 175 CALL dia_wri_state( 'output.abort' ) ! create an output.abort file 176 177 IF( .NOT. ln_ctl ) THEN 178 WRITE(ctmp8,*) 'E R R O R message from sub-domain: ', narea 179 CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp8, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ctmp6 ) 185 iareamin(:) = narea ; iareamax(:) = narea ; iareasum(:) = 1 ! this is local information 186 ENDIF 187 ! 188 WRITE(ctmp1,*) ' stp_ctl: |ssh| > 20 m or |U| > 10 m/s or S <= 0 or S >= 100 or NaN encounter in the tests' 189 CALL wrt_line(ctmp2, kt, ' |ssh| max ', zmax(1), ih , iareasum(1), iareamin(1), iareamax(1) ) 190 CALL wrt_line(ctmp3, kt, ' |U| max ', zmax(2), iu , iareasum(2), iareamin(2), iareamax(2) ) 191 CALL wrt_line(ctmp4, kt, ' Sal min ', - zmax(3), is1, iareasum(3), iareamin(3), iareamax(3) ) 192 CALL wrt_line(ctmp5, kt, ' Sal max ', zmax(4), is2, iareasum(4), iareamin(4), iareamax(4) ) 193 IF( Agrif_Root() ) THEN 194 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort* files' 180 195 ELSE 181 CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6, ' ' ) 182 ENDIF 183 184 kindic = -3 185 ! 186 ENDIF 187 ! 188 9100 FORMAT (' kt=',i8,' |ssh| max: ',1pg11.4,', at i j : ',2i5) 189 9200 FORMAT (' kt=',i8,' |U| max: ',1pg11.4,', at i j k: ',3i5) 190 9300 FORMAT (' kt=',i8,' S min: ',1pg11.4,', at i j k: ',3i5) 191 9400 FORMAT (' kt=',i8,' S max: ',1pg11.4,', at i j k: ',3i5) 196 WRITE(ctmp6,*) ' ===> output of last computed fields in '//TRIM(Agrif_CFixed())//'_output.abort* files' 197 ENDIF 198 ! 199 CALL dia_wri_state( 'output.abort' ) ! create an output.abort file 200 ! 201 IF( ll_colruns .or. jpnij == 1 ) THEN ! all processes synchronized -> use lwp to print in opened ocean.output files 202 IF(lwp) CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 203 ELSE ! only mpi subdomains with errors are here -> STOP now 204 CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 205 ENDIF 206 ! 207 IF( nstop == 0 ) nstop = 1 208 ngrdstop = Agrif_Fixed() 209 ! 210 ENDIF 211 ! 192 212 9500 FORMAT(' it :', i8, ' |ssh|_max: ', D23.16, ' |U|_max: ', D23.16,' S_min: ', D23.16,' S_max: ', D23.16) 193 213 ! 194 214 END SUBROUTINE stp_ctl 215 216 217 SUBROUTINE wrt_line( cdline, kt, cdprefix, pval, kloc, ksum, kmin, kmax ) 218 !!---------------------------------------------------------------------- 219 !! *** ROUTINE wrt_line *** 220 !! 221 !! ** Purpose : write information line 222 !! 223 !!---------------------------------------------------------------------- 224 CHARACTER(len=*), INTENT( out) :: cdline 225 CHARACTER(len=*), INTENT(in ) :: cdprefix 226 REAL(wp), INTENT(in ) :: pval 227 INTEGER, DIMENSION(3), INTENT(in ) :: kloc 228 INTEGER, INTENT(in ) :: kt, ksum, kmin, kmax 229 ! 230 CHARACTER(len=80) :: clsuff 231 CHARACTER(len=9 ) :: clkt, clsum, clmin, clmax 232 CHARACTER(len=9 ) :: cli, clj, clk 233 CHARACTER(len=1 ) :: clfmt 234 CHARACTER(len=4 ) :: cl4 ! needed to be able to compile with Agrif, I don't know why 235 INTEGER :: ifmtk 236 !!---------------------------------------------------------------------- 237 WRITE(clkt , '(i9)') kt 238 239 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpnij ,wp))) + 1 ! how many digits to we need to write ? (we decide max = 9) 240 !!! WRITE(clsum, '(i'//clfmt//')') ksum ! this is creating a compilation error with AGRIF 241 cl4 = '(i'//clfmt//')' ; WRITE(clsum, cl4) ksum 242 WRITE(clfmt, '(i1)') INT(LOG10(REAL(MAX(1,jpnij-1),wp))) + 1 ! how many digits to we need to write ? (we decide max = 9) 243 cl4 = '(i'//clfmt//')' ; WRITE(clmin, cl4) kmin-1 244 WRITE(clmax, cl4) kmax-1 245 ! 246 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpiglo,wp))) + 1 ! how many digits to we need to write jpiglo? (we decide max = 9) 247 cl4 = '(i'//clfmt//')' ; WRITE(cli, cl4) kloc(1) ! this is ok with AGRIF 248 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpjglo,wp))) + 1 ! how many digits to we need to write jpjglo? (we decide max = 9) 249 cl4 = '(i'//clfmt//')' ; WRITE(clj, cl4) kloc(2) ! this is ok with AGRIF 250 ! 251 IF( ksum == 1 ) THEN ; WRITE(clsuff,9100) TRIM(clmin) 252 ELSE ; WRITE(clsuff,9200) TRIM(clsum), TRIM(clmin), TRIM(clmax) 253 ENDIF 254 IF(kloc(3) == 0) THEN 255 ifmtk = INT(LOG10(REAL(jpk,wp))) + 1 ! how many digits to we need to write jpk? (we decide max = 9) 256 clk = REPEAT(' ', ifmtk) ! create the equivalent in blank string 257 WRITE(cdline,9300) TRIM(ADJUSTL(clkt)), TRIM(ADJUSTL(cdprefix)), pval, TRIM(cli), TRIM(clj), clk(1:ifmtk), TRIM(clsuff) 258 ELSE 259 WRITE(clfmt, '(i1)') INT(LOG10(REAL(jpk,wp))) + 1 ! how many digits to we need to write jpk? (we decide max = 9) 260 !!! WRITE(clk, '(i'//clfmt//')') kloc(3) ! this is creating a compilation error with AGRIF 261 cl4 = '(i'//clfmt//')' ; WRITE(clk, cl4) kloc(3) ! this is ok with AGRIF 262 WRITE(cdline,9400) TRIM(ADJUSTL(clkt)), TRIM(ADJUSTL(cdprefix)), pval, TRIM(cli), TRIM(clj), TRIM(clk), TRIM(clsuff) 263 ENDIF 264 ! 265 9100 FORMAT('MPI rank ', a) 266 9200 FORMAT('found in ', a, ' MPI tasks, spread out among ranks ', a, ' to ', a) 267 9300 FORMAT('kt ', a, ' ', a, ' ', 1pg11.4, ' at i j ', a, ' ', a, ' ', a, ' ', a) 268 9400 FORMAT('kt ', a, ' ', a, ' ', 1pg11.4, ' at i j k ', a, ' ', a, ' ', a, ' ', a) 269 ! 270 END SUBROUTINE wrt_line 271 195 272 196 273 !!======================================================================
Note: See TracChangeset
for help on using the changeset viewer.