Changeset 13899 for NEMO/branches/2020/tickets_icb_1900/src/SAS
- Timestamp:
- 2020-11-27T17:26:33+01:00 (4 years ago)
- Location:
- NEMO/branches/2020/tickets_icb_1900
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/tickets_icb_1900
- Property svn:externals
-
NEMO/branches/2020/tickets_icb_1900/src/SAS/nemogcm.F90
r13365 r13899 2 2 !!====================================================================== 3 3 !! *** MODULE nemogcm *** 4 !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats 4 !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats + ABL 5 5 !!====================================================================== 6 6 !! History : 3.6 ! 2011-11 (S. Alderson, G. Madec) original code … … 36 36 USE icb_oce ! icebergs 37 37 ! 38 USE prtctl ! Print control 38 39 USE in_out_manager ! I/O manager 39 40 USE lib_mpp ! distributed memory computing 40 41 USE mppini ! shared/distributed memory setting (mpp_init routine) 41 USE lbcnfd , ONLY : isendto, nsndto , nfsloop, nfeloop! Setup of north fold exchanges42 USE lbcnfd , ONLY : isendto, nsndto ! Setup of north fold exchanges 42 43 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 43 44 #if defined key_iomput … … 47 48 USE agrif_ice_update ! ice update 48 49 #endif 50 USE halo_mng 49 51 50 52 IMPLICIT NONE … … 57 59 58 60 #if defined key_mpp_mpi 61 ! need MPI_Wtime 59 62 INCLUDE 'mpif.h' 60 63 #endif … … 82 85 !!---------------------------------------------------------------------- 83 86 INTEGER :: istp ! time step index 87 REAL(wp):: zstptiming ! elapsed time for 1 time step 84 88 !!---------------------------------------------------------------------- 85 89 ! … … 92 96 #if defined key_agrif 93 97 Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs ! agrif_oce module copies of time level indices 94 CALL Agrif_Declare_Var ! " " " " " DYN/TRA 98 CALL Agrif_Declare_Var ! " " " " " DYN/TRA 95 99 # if defined key_top 96 100 CALL Agrif_Declare_Var_top ! " " " " " TOP … … 106 110 ! !== time stepping ==! 107 111 ! !-----------------------! 112 ! 113 ! !== set the model time-step ==! 114 ! 108 115 istp = nit000 109 116 ! … … 123 130 END DO 124 131 ! 125 # else132 # else 126 133 ! 127 134 IF( .NOT.ln_diurnal_only ) THEN !== Standard time-stepping ==! 128 135 ! 129 136 DO WHILE( istp <= nitend .AND. nstop == 0 ) 130 #if defined key_mpp_mpi 137 131 138 ncom_stp = istp 132 IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 133 IF ( istp == nitend ) elapsed_time = MPI_Wtime() - elapsed_time 134 #endif 139 IF( ln_timing ) THEN 140 zstptiming = MPI_Wtime() 141 IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 142 IF ( istp == nitend ) elapsed_time = zstptiming - elapsed_time 143 ENDIF 144 135 145 CALL stp ( istp ) 136 146 istp = istp + 1 147 148 IF( lwp .AND. ln_timing ) WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 149 137 150 END DO 138 151 ! … … 198 211 INTEGER :: ios, ilocal_comm ! local integers 199 212 !! 200 NAMELIST/namctl/ sn_cfctl, nn_print, nn_ictls, nn_ictle, & 201 & nn_isplt , nn_jsplt, nn_jctls, nn_jctle, & 202 & ln_timing, ln_diacfl 213 NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl, & 214 & nn_isplt, nn_jsplt, nn_ictls, nn_ictle, nn_jctls, nn_jctle 203 215 NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr 204 216 !!---------------------------------------------------------------------- … … 207 219 ELSE ; cxios_context = 'nemo' 208 220 ENDIF 221 nn_hls = 1 209 222 ! 210 223 ! !-------------------------------------------------! … … 304 317 WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " 305 318 WRITE(numout,*) " ( ( \_/ '-._\ ) ) " 306 WRITE(numout,*) " ) ) jgs `( ( "319 WRITE(numout,*) " ) ) jgs ` ( ( " 307 320 WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 308 321 WRITE(numout,*) … … 325 338 ! 326 339 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 327 CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )340 CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 328 341 ELSE ! user-defined namelist 329 CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )342 CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 330 343 ENDIF 331 344 ! … … 337 350 CALL mpp_init 338 351 352 CALL halo_mng_init() 339 353 ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays 340 354 CALL nemo_alloc() … … 353 367 ! 354 368 ! ! General initialization 355 IF( ln_timing ) CALL timing_init ! timing369 IF( ln_timing ) CALL timing_init ( 'timing_sas.output' ) 356 370 IF( ln_timing ) CALL timing_start( 'nemo_init') 357 371 … … 365 379 & CALL prt_ctl_init ! Print control 366 380 381 IF( ln_rstart ) CALL rst_read_open 367 382 CALL day_init ! model calendar (using both namelist and restart infos) 368 IF( ln_rstart ) CALL rst_read_open 369 383 384 #if defined key_agrif 385 uu(:,:,:,:) = 0.0_wp ; vv(:,:,:,:) = 0.0_wp ; ts(:,:,:,:,:) = 0.0_wp ! needed for interp done at initialization phase 386 #endif 370 387 ! ! external forcing 371 388 CALL sbc_init( Nbb, Nnn, Naa ) ! Forcings : surface module … … 416 433 WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr 417 434 WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr 418 WRITE(numout,*) ' level of print nn_print = ', nn_print419 WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls420 WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle421 WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls422 WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle423 WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt424 WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt425 435 WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing 426 436 WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl 427 437 ENDIF 428 438 ! 429 nprint = nn_print ! convert DOCTOR namelist names into OLD names 430 nictls = nn_ictls 431 nictle = nn_ictle 432 njctls = nn_jctls 433 njctle = nn_jctle 434 isplt = nn_isplt 435 jsplt = nn_jsplt 436 439 IF( .NOT.ln_read_cfg ) ln_closea = .FALSE. ! dealing possible only with a domcfg file 437 440 IF(lwp) THEN ! control print 438 441 WRITE(numout,*) … … 445 448 WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr 446 449 ENDIF 447 IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file448 !449 ! ! Parameter control450 !451 IF( sn_cfctl%l_prtctl .OR. sn_cfctl%l_prttrc ) THEN ! sub-domain area indices for the control prints452 IF( lk_mpp .AND. jpnij > 1 ) THEN453 isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain454 ELSE455 IF( isplt == 1 .AND. jsplt == 1 ) THEN456 CALL ctl_warn( ' - isplt & jsplt are equal to 1', &457 & ' - the print control will be done over the whole domain' )458 ENDIF459 ijsplt = isplt * jsplt ! total number of processors ijsplt460 ENDIF461 IF(lwp) WRITE(numout,*)' - The total number of processors over which the'462 IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt463 !464 ! ! indices used for the SUM control465 IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area466 lsp_area = .FALSE.467 ELSE ! print control done over a specific area468 lsp_area = .TRUE.469 IF( nictls < 1 .OR. nictls > jpiglo ) THEN470 CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' )471 nictls = 1472 ENDIF473 IF( nictle < 1 .OR. nictle > jpiglo ) THEN474 CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' )475 nictle = jpiglo476 ENDIF477 IF( njctls < 1 .OR. njctls > jpjglo ) THEN478 CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' )479 njctls = 1480 ENDIF481 IF( njctle < 1 .OR. njctle > jpjglo ) THEN482 CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' )483 njctle = jpjglo484 ENDIF485 ENDIF486 ENDIF487 450 ! 488 451 IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & … … 538 501 ierr = dia_wri_alloc() 539 502 ierr = ierr + dom_oce_alloc() ! ocean domain 540 ierr = ierr + oce_alloc () ! (ts n...) needed for agrif and/or SI3 and bdy503 ierr = ierr + oce_alloc () ! (ts...) needed for agrif and/or SI3 and bdy 541 504 ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) 542 505 ! -
NEMO/branches/2020/tickets_icb_1900/src/SAS/sbcssm.F90
r13365 r13899 294 294 ! ! fill sf with slf_i and control print 295 295 CALL fld_fill( sf_ssm_3d, slf_3d, cn_dir, 'sbc_ssm_init', '3D Data in file', 'namsbc_ssm' ) 296 sf_ssm_3d(jf_usp)%cltype = 'U' ; sf_ssm_3d(jf_usp)%zsgn = -1._wp 297 sf_ssm_3d(jf_vsp)%cltype = 'V' ; sf_ssm_3d(jf_vsp)%zsgn = -1._wp 296 298 ENDIF 297 299 ! … … 310 312 ! 311 313 CALL fld_fill( sf_ssm_2d, slf_2d, cn_dir, 'sbc_ssm_init', '2D Data in file', 'namsbc_ssm' ) 314 IF( .NOT. ln_3d_uve ) THEN 315 sf_ssm_2d(jf_usp)%cltype = 'U' ; sf_ssm_2d(jf_usp)%zsgn = -1._wp 316 sf_ssm_2d(jf_vsp)%cltype = 'V' ; sf_ssm_2d(jf_vsp)%zsgn = -1._wp 317 ENDIF 312 318 ENDIF 313 319 ! -
NEMO/branches/2020/tickets_icb_1900/src/SAS/stpctl.F90
r13136 r13899 20 20 USE dom_oce ! ocean space and time domain variables 21 21 USE ice , ONLY : vt_i, u_ice, tm_i 22 USE phycst , ONLY : rt0 23 USE sbc_oce , ONLY : lk_oasis 22 24 ! 23 25 USE diawri ! Standard run outputs (dia_wri_state routine) … … 48 50 !! 49 51 !! ** Method : - Save the time step in numstp 50 !! - Print it each 50 time steps51 52 !! - Stop the run IF problem encountered by setting nstop > 0 52 53 !! Problems checked: ice thickness maximum > 100 m … … 67 68 REAL(wp) :: zzz ! local real 68 69 REAL(wp), DIMENSION(4) :: zmax, zmaxlocal 69 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns 70 LOGICAL :: ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 70 71 LOGICAL, DIMENSION(jpi,jpj) :: llmsk 71 72 CHARACTER(len=20) :: clname … … 85 86 ENDIF 86 87 ! ! open time.step ascii file, done only by 1st subdomain 87 IF( lwm ) CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 88 IF( lk_oasis ) THEN ; clname = 'time_sas.step' 89 ELSE ; clname = 'time.step' 90 ENDIF 91 IF( lwm ) CALL ctl_opn( numstp, clname, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 88 92 ! 89 93 IF( ll_wrtruns ) THEN 94 IF( lk_oasis ) THEN ; clname = 'run_sas.stat' 95 ELSE ; clname = 'run.stat' 96 ENDIF 90 97 ! ! open run.stat ascii file, done only by 1st subdomain 91 CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )98 CALL ctl_opn( numrun, clname, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 92 99 ! ! open run.stat.nc netcdf file, done only by 1st subdomain 93 clname = 'run.stat.nc'100 clname = TRIM(clname)//'.nc' 94 101 IF( .NOT. Agrif_Root() ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 95 102 istatus = NF90_CREATE( TRIM(clname), NF90_CLOBBER, nrunid ) … … 111 118 ! !== test of local extrema ==! 112 119 ! !== done by all processes at every time step ==! 113 llmsk(:,:) = tmask(:,:,1) == 1._wp 114 IF( COUNT( llmsk(:,:) ) > 0 ) THEN ! avoid huge values sent back for land processors... 115 zmax(1) = MAXVAL( vt_i (:,:) , mask = llmsk ) ! max ice thickness 116 zmax(2) = MAXVAL( ABS( u_ice(:,:) ) , mask = llmsk ) ! max ice velocity (zonal only) 117 zmax(3) = MAXVAL( -tm_i (:,:) + 273.15_wp, mask = llmsk ) ! min ice temperature 118 ELSE 119 IF( ll_colruns ) THEN ! default value: must not be kept when calling mpp_max -> must be as small as possible 120 zmax(1:3) = -HUGE(1._wp) 121 ELSE ! default value: must not give true for any of the tests bellow (-> avoid manipulating HUGE...) 122 zmax(1:3) = 0._wp 123 ENDIF 124 ENDIF 125 zmax(4) = REAL( nstop, wp ) ! stop indicator 120 ! 121 llmsk( 1:Nis1,:) = .FALSE. ! exclude halos from the checked region 122 llmsk(Nie1: jpi,:) = .FALSE. 123 llmsk(:, 1:Njs1) = .FALSE. 124 llmsk(:,Nje1: jpj) = .FALSE. 125 ! 126 llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp ! test only the inner domain 127 ! 128 ll_0oce = .NOT. ANY( llmsk(:,:) ) ! no ocean point in the inner domain? 129 ! 130 zmax(1) = MAXVAL( vt_i (:,:) , mask = llmsk ) ! max ice thickness 131 zmax(2) = MAXVAL( ABS( u_ice(:,:) ) , mask = llmsk ) ! max ice velocity (zonal only) 132 zmax(3) = MAXVAL( -tm_i (:,:) + rt0, mask = llmsk ) ! min ice temperature (in degC) 133 zmax(4) = REAL( nstop, wp ) ! stop indicator 134 ! 126 135 ! !== get global extrema ==! 127 136 ! !== done by all processes if writting run.stat ==! 128 137 IF( ll_colruns ) THEN 129 138 zmaxlocal(:) = zmax(:) 130 CALL mpp_max( "stpctl", zmax ) ! max over the global domain 139 CALL mpp_max( "stpctl", zmax ) ! max over the global domain: ok even of ll_0oce = .true. 131 140 nstop = NINT( zmax(4) ) ! update nstop indicator (now sheared among all local domains) 132 ENDIF 141 ELSE 142 ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 143 IF( ll_0oce ) zmax(1:3) = 0._wp ! default "valid" values... 144 ENDIF 145 ! 146 zmax(3) = -zmax(3) ! move back from max(-zz) to min(zz) : easier to manage! 147 IF( ll_colruns ) zmaxlocal(3) = -zmaxlocal(3) ! move back from max(-zz) to min(zz) : easier to manage! 148 ! 133 149 ! !== write "run.stat" files ==! 134 150 ! !== done only by 1st subdomain at writting timestep ==! 135 151 IF( ll_wrtruns ) THEN 136 WRITE(numrun,9500) kt, zmax(1), zmax(2), -zmax(3)137 istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ zmax(1)/), (/kt/), (/1/) )138 istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ zmax(2)/), (/kt/), (/1/) )139 istatus = NF90_PUT_VAR( nrunid, nvarid(3), (/-zmax(3)/), (/kt/), (/1/) )152 WRITE(numrun,9500) kt, zmax(1), zmax(2), zmax(3) 153 DO ji = 1, 3 154 istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 155 END DO 140 156 IF( kt == nitend ) istatus = NF90_CLOSE(nrunid) 141 157 END IF … … 145 161 IF( zmax(1) > 100._wp .OR. & ! too large ice thickness maximum ( > 100 m) 146 162 & zmax(2) > 10._wp .OR. & ! too large ice velocity ( > 10 m/s) 147 & zmax(3) >101._wp .OR. & ! too cold ice temperature ( < -100 degC)163 & zmax(3) < -101._wp .OR. & ! too cold ice temperature ( < -100 degC) 148 164 & ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR. & ! NaN encounter in the tests 149 165 & ABS( zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN ! Infinity encounter in the tests … … 154 170 IF( lwm .AND. kt /= nitend ) istatus = NF90_CLOSE(nrunid) 155 171 ! get global loc on the min/max 156 CALL mpp_maxloc( 'stpctl', vt_i(:,:) , tmask(:,:,1), zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F157 CALL mpp_maxloc( 'stpctl',ABS( u_ice(:,:) ) , tmask(:,:,1), zzz, iloc(1:2,2) )158 CALL mpp_minloc( 'stpctl', tm_i(:,:) - 273.15_wp, tmask(:,:,1), zzz, iloc(1:2,3) )172 CALL mpp_maxloc( 'stpctl', vt_i(:,:) , llmsk, zzz, iloc(1:2,1) ) ! mpp_maxloc ok if mask = F 173 CALL mpp_maxloc( 'stpctl',ABS( u_ice(:,:) ) , llmsk, zzz, iloc(1:2,2) ) 174 CALL mpp_minloc( 'stpctl', tm_i(:,:) - rt0, llmsk, zzz, iloc(1:2,3) ) 159 175 ! find which subdomain has the max. 160 176 iareamin(:) = jpnij+1 ; iareamax(:) = 0 ; iareasum(:) = 0 … … 169 185 ELSE ! find local min and max locations: 170 186 ! if we are here, this means that the subdomain contains some oce points -> no need to test the mask used in maxloc 171 iloc(1:2,1) = MAXLOC( vt_i(:,:) , mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 172 iloc(1:2,2) = MAXLOC( ABS( u_ice(:,:) ) , mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 173 iloc(1:2,3) = MINLOC( tm_i(:,:) - 273.15_wp, mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 187 iloc(1:2,1) = MAXLOC( vt_i(:,:) , mask = llmsk ) 188 iloc(1:2,2) = MAXLOC( ABS( u_ice(:,:) ) , mask = llmsk ) 189 iloc(1:2,3) = MINLOC( tm_i(:,:) - rt0, mask = llmsk ) 190 DO ji = 1, 3 ! local domain indices ==> global domain indices, excluding halos 191 iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 192 END DO 174 193 iareamin(:) = narea ; iareamax(:) = narea ; iareasum(:) = 1 ! this is local information 175 194 ENDIF 176 195 ! 177 196 WRITE(ctmp1,*) ' stp_ctl: ice_thick > 100 m or |ice_vel| > 10 m/s or ice_temp < -100 degC or NaN encounter in the tests' 178 CALL wrt_line( ctmp2, kt, 'ice_thick max', 179 CALL wrt_line( ctmp3, kt, '|ice_vel| max', 180 CALL wrt_line( ctmp4, kt, 'ice_temp min', -zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) )197 CALL wrt_line( ctmp2, kt, 'ice_thick max', zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) ) 198 CALL wrt_line( ctmp3, kt, '|ice_vel| max', zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) ) 199 CALL wrt_line( ctmp4, kt, 'ice_temp min', zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) ) 181 200 IF( Agrif_Root() ) THEN 182 201 WRITE(ctmp6,*) ' ===> output of last computed fields in output.abort* files'
Note: See TracChangeset
for help on using the changeset viewer.