diff --git a/cicecore/cicedyn/general/ice_flux.F90 b/cicecore/cicedyn/general/ice_flux.F90 index 4d19bb8b2..f1c6c3be6 100644 --- a/cicecore/cicedyn/general/ice_flux.F90 +++ b/cicecore/cicedyn/general/ice_flux.F90 @@ -368,8 +368,6 @@ module ice_flux real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & uatmT , & ! uatm on T grid (m/s) vatmT , & ! vatm on T grid (m/s) - rside , & ! fraction of ice that melts laterally - fside , & ! lateral heat flux (W/m^2) wlat , & ! lateral heat rate (m/s) fsw , & ! incoming shortwave radiation (W/m^2) coszen , & ! cosine solar zenith angle, < 0 for sun below horizon @@ -377,6 +375,7 @@ module ice_flux rdg_shear ! shear term for ridging (1/s) real (kind=dbl_kind), dimension(:,:,:,:), allocatable, public :: & + rsiden ,& ! fraction of ice that melts laterally salinz ,& ! initial salinity profile (ppt) Tmltz ! initial melting temperature (^oC) @@ -546,13 +545,12 @@ subroutine alloc_flux fsalt_da (nx_block,ny_block,max_blocks), & ! salt flux to ocean due to data assimilation(kg/m^2/s) uatmT (nx_block,ny_block,max_blocks), & ! uatm on T grid vatmT (nx_block,ny_block,max_blocks), & ! vatm on T grid - rside (nx_block,ny_block,max_blocks), & ! fraction of ice that melts laterally - fside (nx_block,ny_block,max_blocks), & ! lateral melt flux (W/m^2) wlat (nx_block,ny_block,max_blocks), & ! lateral melt rate (m/s) fsw (nx_block,ny_block,max_blocks), & ! incoming shortwave radiation (W/m^2) coszen (nx_block,ny_block,max_blocks), & ! cosine solar zenith angle, < 0 for sun below horizon rdg_conv (nx_block,ny_block,max_blocks), & ! convergence term for ridging (1/s) rdg_shear (nx_block,ny_block,max_blocks), & ! shear term for ridging (1/s) + rsiden (nx_block,ny_block,ncat,max_blocks), & ! fraction of ice that melts laterally dardg1ndt (nx_block,ny_block,ncat,max_blocks), & ! rate of area loss by ridging ice (1/s) dardg2ndt (nx_block,ny_block,ncat,max_blocks), & ! rate of area gain by new ridges (1/s) dvirdgndt (nx_block,ny_block,ncat,max_blocks), & ! rate of ice volume ridged (m/s) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index 26aef9f9c..af589c795 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -5473,8 +5473,6 @@ subroutine wave_spec_data logical (kind=log_kind) :: wave_spec character(len=*), parameter :: subname = '(wave_spec_data)' - - debug_n_d = .false. !usually false call icepack_query_parameters(secday_out=secday) diff --git a/cicecore/cicedyn/general/ice_init.F90 b/cicecore/cicedyn/general/ice_init.F90 index e966043fb..5cbaedcb6 100644 --- a/cicecore/cicedyn/general/ice_init.F90 +++ b/cicecore/cicedyn/general/ice_init.F90 @@ -63,7 +63,7 @@ subroutine input_data diag_file, print_global, print_points, latpnt, lonpnt, & debug_model, debug_model_step, debug_model_task, & debug_model_i, debug_model_j, debug_model_iblk - use ice_domain, only: close_boundaries, orca_halogrid + use ice_domain, only: close_boundaries use ice_domain_size, only: & ncat, nilyr, nslyr, nblyr, nfsd, nfreq, & n_iso, n_aero, n_zaero, n_algae, & @@ -174,6 +174,7 @@ subroutine input_data logical (kind=log_kind) :: tr_pond_lvl, tr_pond_topo integer (kind=int_kind) :: numin, numax ! unit number limits logical (kind=log_kind) :: lcdf64 ! deprecated, backwards compatibility + logical (kind=log_kind) :: orca_halogrid !deprecated integer (kind=int_kind) :: rplvl, rptopo real (kind=dbl_kind) :: Cf, ksno, puny, ice_ref_salinity, Tocnfrz @@ -382,7 +383,7 @@ subroutine input_data grid_atm = 'A' ! underlying atm forcing/coupling grid grid_ocn = 'A' ! underlying atm forcing/coupling grid gridcpl_file = 'unknown_gridcpl_file' - orca_halogrid = .false. ! orca haloed grid + orca_halogrid = .false. ! orca haloed grid - deprecated bathymetry_file = 'unknown_bathymetry_file' bathymetry_format = 'default' use_bathymetry = .false. @@ -1198,10 +1199,6 @@ subroutine input_data call broadcast_scalar(sw_frac, master_task) call broadcast_scalar(sw_dtemp, master_task) -#ifdef CESMCOUPLED - pointer_file = trim(pointer_file) // trim(inst_suffix) -#endif - !----------------------------------------------------------------- ! update defaults !----------------------------------------------------------------- @@ -1270,7 +1267,7 @@ subroutine input_data endif abort_list = trim(abort_list)//":1" endif - + if (history_format /= 'cdf1' .and. & history_format /= 'cdf2' .and. & history_format /= 'cdf5' .and. & @@ -1833,6 +1830,20 @@ subroutine input_data endif endif + if (orca_halogrid) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: orca_halogrid has been deprecated' + endif + abort_list = trim(abort_list)//":63" + endif + + if (trim(grid_type) == 'cpom_grid') then + if (my_task == master_task) then + write(nu_diag,*) subname//" ERROR: grid_type = 'cpom_grid' has been deprecated" + endif + abort_list = trim(abort_list)//":64" + endif + ice_IOUnitsMinUnit = numin ice_IOUnitsMaxUnit = numax @@ -2583,7 +2594,6 @@ subroutine input_data if (trim(kmt_type) == 'file') & write(nu_diag,1031) ' kmt_file = ', trim(kmt_file) endif - write(nu_diag,1011) ' orca_halogrid = ', orca_halogrid write(nu_diag,1011) ' conserv_check = ', conserv_check diff --git a/cicecore/cicedyn/general/ice_step_mod.F90 b/cicecore/cicedyn/general/ice_step_mod.F90 index 56805b625..6a6810a4f 100644 --- a/cicecore/cicedyn/general/ice_step_mod.F90 +++ b/cicecore/cicedyn/general/ice_step_mod.F90 @@ -224,9 +224,9 @@ subroutine step_therm1 (dt, iblk) fswsfcn, fswintn, Sswabsn, Iswabsn, meltsliqn, meltsliq, & fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf use ice_calendar, only: yday - use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero - use ice_flux, only: frzmlt, sst, Tf, strocnxT_iavg, strocnyT_iavg, rside, fbot, Tbot, Tsnice, & - meltsn, melttn, meltbn, congeln, snoicen, uatmT, vatmT, fside, wlat, & + use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero, nfsd + use ice_flux, only: frzmlt, sst, Tf, strocnxT_iavg, strocnyT_iavg, rsiden, fbot, Tbot, Tsnice, & + meltsn, melttn, meltbn, congeln, snoicen, uatmT, vatmT, wlat, & wind, rhoa, potT, Qa, zlvl, zlvs, strax, stray, flatn, fsensn, fsurfn, fcondtopn, & flw, fsnow, fpond, sss, mlt_onset, frz_onset, fcondbotn, fcondbot, fsloss, & frain, Tair, strairxT, strairyT, fsurf, fcondtop, fsens, & @@ -269,7 +269,7 @@ subroutine step_therm1 (dt, iblk) integer (kind=int_kind) :: & ntrcr, nt_apnd, nt_hpnd, nt_ipnd, nt_alvl, nt_vlvl, nt_Tsfc, & - nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno, & + nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno, nt_fsd, & nt_isosno, nt_isoice, nt_rsnw, nt_smice, nt_smliq logical (kind=log_kind) :: & @@ -304,7 +304,7 @@ subroutine step_therm1 (dt, iblk) call icepack_query_tracer_indices( & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_Tsfc_out=nt_Tsfc, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, & + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_fsd_out=nt_fsd, & nt_qice_out=nt_qice, nt_sice_out=nt_sice, & nt_aero_out=nt_aero, nt_qsno_out=nt_qsno, & nt_rsnw_out=nt_rsnw, nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & @@ -412,6 +412,7 @@ subroutine step_therm1 (dt, iblk) ipnd = trcrn (i,j,nt_ipnd,:,iblk), & iage = trcrn (i,j,nt_iage,:,iblk), & FY = trcrn (i,j,nt_FY ,:,iblk), & + afsdn = trcrn (i,j,nt_fsd:nt_fsd+nfsd-1,:,iblk), & rsnwn = rsnwn (:,:), & smicen = smicen (:,:), & smliqn = smliqn (:,:), & @@ -464,8 +465,7 @@ subroutine step_therm1 (dt, iblk) Tbot = Tbot (i,j, iblk), & Tsnice = Tsnice (i,j, iblk), & frzmlt = frzmlt (i,j, iblk), & - rside = rside (i,j, iblk), & - fside = fside (i,j, iblk), & + rsiden = rsiden (i,j,:,iblk), & wlat = wlat (i,j, iblk), & fsnow = fsnow (i,j, iblk), & frain = frain (i,j, iblk), & @@ -611,12 +611,12 @@ subroutine step_therm2 (dt, iblk) use ice_arrays_column, only: hin_max, ocean_bio, wave_sig_ht, & wave_spectrum, wavefreq, dwavefreq, & - first_ice, bgrid, cgrid, igrid, floe_rad_c, floe_binwidth, & + first_ice, bgrid, cgrid, igrid, & d_afsd_latg, d_afsd_newi, d_afsd_latm, d_afsd_weld use ice_calendar, only: yday use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, nfsd use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, & - fsalt, Tf, sss, salinz, fhocn, rside, fside, wlat, & + fsalt, Tf, sss, salinz, fhocn, rsiden, wlat, & meltl, frazil_diag use ice_flux_bgc, only: flux_bio, faero_ocn, & fiso_ocn, HDO_ocn, H2_16O_ocn, H2_18O_ocn @@ -695,9 +695,8 @@ subroutine step_therm2 (dt, iblk) Tf = Tf (i,j, iblk), & sss = sss (i,j, iblk), & salinz = salinz (i,j,:,iblk), & - rside = rside (i,j, iblk), & + rsiden = rsiden (i,j,:,iblk), & meltl = meltl (i,j, iblk), & - fside = fside (i,j, iblk), & wlat = wlat (i,j, iblk), & frzmlt = frzmlt (i,j, iblk), & frazil = frazil (i,j, iblk), & @@ -724,9 +723,7 @@ subroutine step_therm2 (dt, iblk) d_afsd_latg= d_afsd_latg(i,j,:,iblk),& d_afsd_newi= d_afsd_newi(i,j,:,iblk),& d_afsd_latm= d_afsd_latm(i,j,:,iblk),& - d_afsd_weld= d_afsd_weld(i,j,:,iblk),& - floe_rad_c = floe_rad_c(:), & - floe_binwidth = floe_binwidth(:)) + d_afsd_weld= d_afsd_weld(i,j,:,iblk)) endif ! tmask enddo ! i @@ -863,7 +860,7 @@ end subroutine update_state subroutine step_dyn_wave (dt) use ice_arrays_column, only: wave_spectrum, & - d_afsd_wave, floe_rad_l, floe_rad_c, wavefreq, dwavefreq + d_afsd_wave, wavefreq, dwavefreq use ice_domain_size, only: ncat, nfsd, nfreq use ice_state, only: trcrn, aicen, aice, vice use ice_timers, only: ice_timer_start, ice_timer_stop, timer_column, & @@ -911,8 +908,6 @@ subroutine step_dyn_wave (dt) aice = aice (i,j, iblk), & vice = vice (i,j, iblk), & aicen = aicen (i,j,:, iblk), & - floe_rad_l = floe_rad_l (:), & - floe_rad_c = floe_rad_c (:), & wave_spectrum = wave_spectrum(i,j,:, iblk), & wavefreq = wavefreq (:), & dwavefreq = dwavefreq (:), & diff --git a/cicecore/cicedyn/infrastructure/ice_domain.F90 b/cicecore/cicedyn/infrastructure/ice_domain.F90 index 91af49947..301120108 100644 --- a/cicecore/cicedyn/infrastructure/ice_domain.F90 +++ b/cicecore/cicedyn/infrastructure/ice_domain.F90 @@ -64,8 +64,7 @@ module ice_domain maskhalo_remap , & ! if true, use masked halo updates for transport maskhalo_bound , & ! if true, use masked halo updates for bound_state halo_dynbundle , & ! if true, bundle halo update in dynamics - landblockelim , & ! if true, land block elimination is on - orca_halogrid ! if true, input fields are haloed as defined by orca grid + landblockelim ! if true, land block elimination is on !----------------------------------------------------------------------- ! diff --git a/cicecore/cicedyn/infrastructure/ice_grid.F90 b/cicecore/cicedyn/infrastructure/ice_grid.F90 index 54bc3ad92..53082aeaf 100644 --- a/cicecore/cicedyn/infrastructure/ice_grid.F90 +++ b/cicecore/cicedyn/infrastructure/ice_grid.F90 @@ -169,6 +169,10 @@ module ice_grid logical (kind=log_kind), private :: & l_readCenter ! If anglet exist in grid file read it otherwise calculate it + character (len=char_len), private :: & + mask_fieldname !field/var name for the mask variable (in nc files) + + interface grid_average_X2Y module procedure grid_average_X2Y_base , & grid_average_X2Y_userwghts, & @@ -291,6 +295,11 @@ end subroutine dealloc_grid subroutine init_grid1 +#ifdef USE_NETCDF + use netcdf, only: nf90_inq_varid , nf90_noerr + integer (kind=int_kind) :: status, varid +#endif + integer (kind=int_kind) :: & fid_grid, & ! file id for netCDF grid file fid_kmt ! file id for netCDF kmt file @@ -342,19 +351,31 @@ subroutine init_grid1 trim(grid_type) == 'regional' ) then if (trim(grid_format) == 'nc') then - - call ice_open_nc(grid_file,fid_grid) - call ice_open_nc(kmt_file,fid_kmt) - + fieldname='ulat' + call ice_open_nc(grid_file,fid_grid) call ice_read_global_nc(fid_grid,1,fieldname,work_g1,.true.) - fieldname='kmt' - call ice_read_global_nc(fid_kmt,1,fieldname,work_g2,.true.) - - if (my_task == master_task) then - call ice_close_nc(fid_grid) - call ice_close_nc(fid_kmt) + call ice_close_nc(fid_grid) + + ! mask variable name might be kmt or mask, check both + call ice_open_nc(kmt_file,fid_kmt) +#ifdef USE_NETCDF + if ( my_task==master_task ) then + status = nf90_inq_varid(fid_kmt, 'kmt', varid) + if (status == nf90_noerr) then + mask_fieldname = 'kmt' + else + status = nf90_inq_varid(fid_kmt, 'mask', varid) + call ice_check_nc(status, subname//' ERROR: does '//trim(kmt_file)//& + ' contain "kmt" or "mask" variable?', file=__FILE__, line=__LINE__) + mask_fieldname = 'mask' + endif endif +#endif + call broadcast_scalar(mask_fieldname, master_task) + + call ice_read_global_nc(fid_kmt,1,mask_fieldname,work_g2,.true.) + call ice_close_nc(fid_kmt) else @@ -466,8 +487,10 @@ subroutine init_grid2 trim(grid_type) == 'tripole' .or. & trim(grid_type) == 'regional' ) then if (trim(grid_format) == 'nc') then + call kmtmask_nc ! read mask from nc file call popgrid_nc ! read POP grid lengths from nc file else + call kmtmask ! read kmt directly call popgrid ! read POP grid lengths directly endif #ifdef CESMCOUPLED @@ -475,8 +498,6 @@ subroutine init_grid2 call latlongrid ! lat lon grid for sequential CESM (CAM mode) return #endif - elseif (trim(grid_type) == 'cpom_grid') then - call cpomgrid ! cpom model orca1 type grid else call rectgrid ! regular rectangular grid endif @@ -607,12 +628,20 @@ subroutine init_grid2 file=__FILE__, line=__LINE__) endif + if (l_readCenter) then + out_of_range = .false. + where (ANGLET < -pi .or. ANGLET > pi) out_of_range = .true. + if (count(out_of_range) > 0) then + write(nu_diag,*) subname,' angle = ',minval(ANGLET),maxval(ANGLET),count(out_of_range) + call abort_ice (subname//' ANGLET out of expected range', & + file=__FILE__, line=__LINE__) + endif + endif + !----------------------------------------------------------------- ! Compute ANGLE on T-grid !----------------------------------------------------------------- - if (trim(grid_type) == 'cpom_grid') then - ANGLET(:,:,:) = ANGLE(:,:,:) - else if (.not. (l_readCenter)) then + if (.not. (l_readCenter)) then ANGLET = c0 !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, & @@ -642,7 +671,7 @@ subroutine init_grid2 enddo enddo !$OMP END PARALLEL DO - endif ! cpom_grid + endif if (trim(grid_type) == 'regional' .and. & (.not. (l_readCenter))) then @@ -722,21 +751,10 @@ end subroutine init_grid2 !======================================================================= -! POP displaced pole grid and land mask (or tripole). -! Grid record number, field and units are: \\ -! (1) ULAT (radians) \\ -! (2) ULON (radians) \\ -! (3) HTN (cm) \\ -! (4) HTE (cm) \\ -! (5) HUS (cm) \\ -! (6) HUW (cm) \\ -! (7) ANGLE (radians) -! +! POP land mask ! Land mask record number and field is (1) KMT. -! -! author: Elizabeth C. Hunke, LANL - subroutine popgrid + subroutine kmtmask integer (kind=int_kind) :: & i, j, iblk, & @@ -744,18 +762,14 @@ subroutine popgrid logical (kind=log_kind) :: diag - real (kind=dbl_kind), dimension(:,:), allocatable :: & - work_g1 - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & work1 type (block) :: & this_block ! block information for current block - character(len=*), parameter :: subname = '(popgrid)' + character(len=*), parameter :: subname = '(kmtmask)' - call ice_open(nu_grid,grid_file,64) call ice_open(nu_kmt,kmt_file,32) diag = .true. ! write diagnostic info @@ -763,13 +777,13 @@ subroutine popgrid !----------------------------------------------------------------- ! topography !----------------------------------------------------------------- + kmt(:,:,:) = c0 + hm (:,:,:) = c0 - call ice_read(nu_kmt,1,work1,'ida4',diag, & + call ice_read(nu_kmt,1,kmt,'ida4',diag, & field_loc=field_loc_center, & field_type=field_type_scalar) - hm (:,:,:) = c0 - kmt(:,:,:) = c0 !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -780,12 +794,44 @@ subroutine popgrid do j = jlo, jhi do i = ilo, ihi - kmt(i,j,iblk) = work1(i,j,iblk) if (kmt(i,j,iblk) >= p5) hm(i,j,iblk) = c1 enddo enddo enddo !$OMP END PARALLEL DO + + if (my_task == master_task) then + close (nu_kmt) + endif + + end subroutine kmtmask + +!======================================================================= + +! POP displaced pole grid (or tripole). +! Grid record number, field and units are: \\ +! (1) ULAT (radians) \\ +! (2) ULON (radians) \\ +! (3) HTN (cm) \\ +! (4) HTE (cm) \\ +! (5) HUS (cm) \\ +! (6) HUW (cm) \\ +! (7) ANGLE (radians) +! +! author: Elizabeth C. Hunke, LANL + + subroutine popgrid + + logical (kind=log_kind) :: diag + + real (kind=dbl_kind), dimension(:,:), allocatable :: & + work_g1 + + character(len=*), parameter :: subname = '(popgrid)' + + call ice_open(nu_grid,grid_file,64) + + diag = .true. ! write diagnostic info !----------------------------------------------------------------- ! lat, lon, angle @@ -827,13 +873,65 @@ subroutine popgrid if (my_task == master_task) then close (nu_grid) - close (nu_kmt) endif end subroutine popgrid !======================================================================= +! POP/MOM land mask. +! Land mask field is kmt or mask, saved in mask_fieldname. + + subroutine kmtmask_nc + + integer (kind=int_kind) :: & + i, j, iblk, & + ilo,ihi,jlo,jhi, & ! beginning and end of physical domain + fid_kmt ! file id for netCDF kmt file + + logical (kind=log_kind) :: diag + + real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & + work1 + + type (block) :: & + this_block ! block information for current block + + character(len=*), parameter :: subname = '(kmtmask_nc)' + + diag = .true. ! write diagnostic info + + hm (:,:,:) = c0 + kmt(:,:,:) = c0 + + call ice_open_nc(kmt_file,fid_kmt) + + call ice_read_nc(fid_kmt,1,mask_fieldname,kmt,diag, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + + call ice_close_nc(fid_kmt) + + !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) + do iblk = 1, nblocks + this_block = get_block(blocks_ice(iblk),iblk) + ilo = this_block%ilo + ihi = this_block%ihi + jlo = this_block%jlo + jhi = this_block%jhi + + do j = jlo, jhi + do i = ilo, ihi + if (kmt(i,j,iblk) >= c1) hm(i,j,iblk) = c1 + enddo + enddo + enddo + !$OMP END PARALLEL DO + + end subroutine kmtmask_nc + +!======================================================================= + ! POP displaced pole grid and land mask. ! Grid record number, field and units are: \\ ! (1) ULAT (radians) \\ @@ -844,8 +942,6 @@ end subroutine popgrid ! (6) HUW (cm) \\ ! (7) ANGLE (radians) ! -! Land mask record number and field is (1) KMT. -! ! author: Elizabeth C. Hunke, LANL ! Revised for netcdf input: Ann Keen, Met Office, May 2007 @@ -858,8 +954,7 @@ subroutine popgrid_nc integer (kind=int_kind) :: & i, j, iblk, & ilo,ihi,jlo,jhi, & ! beginning and end of physical domain - fid_grid, & ! file id for netCDF grid file - fid_kmt ! file id for netCDF kmt file + fid_grid ! file id for netCDF grid file logical (kind=log_kind) :: diag @@ -872,17 +967,8 @@ subroutine popgrid_nc real (kind=dbl_kind), dimension(:,:), allocatable :: & work_g1 - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & - work1 - - type (block) :: & - this_block ! block information for current block - integer(kind=int_kind) :: & - varid - integer (kind=int_kind) :: & - status ! status flag - + varid, status character(len=*), parameter :: subname = '(popgrid_nc)' @@ -893,37 +979,9 @@ subroutine popgrid_nc file=__FILE__, line=__LINE__) call ice_open_nc(grid_file,fid_grid) - call ice_open_nc(kmt_file,fid_kmt) diag = .true. ! write diagnostic info - !----------------------------------------------------------------- - ! topography - !----------------------------------------------------------------- - - fieldname='kmt' - call ice_read_nc(fid_kmt,1,fieldname,work1,diag, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - - hm (:,:,:) = c0 - kmt(:,:,:) = c0 - !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - - do j = jlo, jhi - do i = ilo, ihi - kmt(i,j,iblk) = work1(i,j,iblk) - if (kmt(i,j,iblk) >= c1) hm(i,j,iblk) = c1 - enddo - enddo - enddo - !$OMP END PARALLEL DO - + !----------------------------------------------------------------- ! lat, lon, angle !----------------------------------------------------------------- @@ -996,10 +1054,8 @@ subroutine popgrid_nc deallocate(work_g1) - if (my_task == master_task) then - call ice_close_nc(fid_grid) - call ice_close_nc(fid_kmt) - endif + call ice_close_nc(fid_grid) + #else call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', & file=__FILE__, line=__LINE__) @@ -1773,112 +1829,6 @@ subroutine grid_boxislands_kmt (work) end subroutine grid_boxislands_kmt -!======================================================================= - -! CPOM displaced pole grid and land mask. \\ -! Grid record number, field and units are: \\ -! (1) ULAT (degrees) \\ -! (2) ULON (degrees) \\ -! (3) HTN (m) \\ -! (4) HTE (m) \\ -! (7) ANGLE (radians) \\ -! -! Land mask record number and field is (1) KMT. -! -! author: Adrian K. Turner, CPOM, UCL, 09/08/06 - - subroutine cpomgrid - - integer (kind=int_kind) :: & - i, j, iblk, & - ilo,ihi,jlo,jhi ! beginning and end of physical domain - - logical (kind=log_kind) :: diag - - real (kind=dbl_kind), dimension(:,:), allocatable :: & - work_g1 - - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & - work1 - - real (kind=dbl_kind) :: & - rad_to_deg - - type (block) :: & - this_block ! block information for current block - - character(len=*), parameter :: subname = '(cpomgrid)' - - call icepack_query_parameters(rad_to_deg_out=rad_to_deg) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - call ice_open(nu_grid,grid_file,64) - call ice_open(nu_kmt,kmt_file,32) - - diag = .true. ! write diagnostic info - - ! topography - call ice_read(nu_kmt,1,work1,'ida4',diag) - - hm (:,:,:) = c0 - kmt(:,:,:) = c0 - !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - - do j = jlo, jhi - do i = ilo, ihi - kmt(i,j,iblk) = work1(i,j,iblk) - if (kmt(i,j,iblk) >= c1) hm(i,j,iblk) = c1 - enddo - enddo - enddo - !$OMP END PARALLEL DO - - allocate(work_g1(nx_global,ny_global)) - - ! lat, lon, cell dimensions, angles - call ice_read_global(nu_grid,1,work_g1, 'rda8',diag) - call scatter_global(ULAT, work_g1, master_task, distrb_info, & - field_loc_NEcorner, field_type_scalar) - - call ice_read_global(nu_grid,2,work_g1, 'rda8',diag) - call scatter_global(ULON, work_g1, master_task, distrb_info, & - field_loc_NEcorner, field_type_scalar) - - call ice_read_global(nu_grid,3,work_g1, 'rda8',diag) - work_g1 = work_g1 * m_to_cm - call primary_grid_lengths_HTN(work_g1) ! dxU, dxT, dxN, dxE - - call ice_read_global(nu_grid,4,work_g1, 'rda8',diag) - work_g1 = work_g1 * m_to_cm - call primary_grid_lengths_HTE(work_g1) ! dyU, dyT, dyN, dyE - - call ice_read_global(nu_grid,7,work_g1,'rda8',diag) - call scatter_global(ANGLE, work_g1, master_task, distrb_info, & - field_loc_NEcorner, field_type_scalar) - - ! fix units - ULAT = ULAT / rad_to_deg - ULON = ULON / rad_to_deg - - deallocate(work_g1) - - if (my_task == master_task) then - close (nu_grid) - close (nu_kmt) - endif - - write(nu_diag,*) subname," min/max HTN: ", minval(HTN), maxval(HTN) - write(nu_diag,*) subname," min/max HTE: ", minval(HTE), maxval(HTE) - - end subroutine cpomgrid !======================================================================= diff --git a/cicecore/cicedyn/infrastructure/ice_read_write.F90 b/cicecore/cicedyn/infrastructure/ice_read_write.F90 index 4613843b5..784f54f07 100644 --- a/cicecore/cicedyn/infrastructure/ice_read_write.F90 +++ b/cicecore/cicedyn/infrastructure/ice_read_write.F90 @@ -18,7 +18,7 @@ module ice_read_write field_loc_noupdate, field_type_noupdate use ice_communicate, only: my_task, master_task use ice_broadcast, only: broadcast_scalar - use ice_domain, only: distrb_info, orca_halogrid + use ice_domain, only: distrb_info use ice_domain_size, only: max_blocks, nx_global, ny_global, ncat use ice_blocks, only: nx_block, ny_block, nghost use ice_exit, only: abort_ice @@ -1143,20 +1143,8 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, & integer (kind=int_kind) :: lnrec ! local value of nrec - real (kind=dbl_kind), dimension(:,:), allocatable :: & - work_g2 - lnrec = nrec - if (orca_halogrid .and. .not. present(restart_ext)) then - if (my_task == master_task) then - allocate(work_g2(nx_global+2,ny_global+1)) - else - allocate(work_g2(1,1)) ! to save memory - endif - work_g2(:,:) = c0 - endif - nx = nx_global ny = ny_global @@ -1207,18 +1195,10 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, & ! Read global array !-------------------------------------------------------------- - if (orca_halogrid .and. .not. present(restart_ext)) then - status = nf90_get_var( fid, varid, work_g2, & - start=(/1,1,lnrec/), count=(/nx_global+2,ny_global+1,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - work_g1 = work_g2(2:nx_global+1,1:ny_global) - else - status = nf90_get_var( fid, varid, work_g1, & - start=(/1,1,lnrec/), count=(/nx,ny,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - endif + status = nf90_get_var( fid, varid, work_g1, & + start=(/1,1,lnrec/), count=(/nx,ny,1/)) + call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & + file=__FILE__, line=__LINE__) endif ! my_task = master_task @@ -1272,8 +1252,6 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, & ! echmod: this should not be necessary if fill/missing are only on land where (work > 1.0e+30_dbl_kind) work = c0 - if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2) - #else work = c0 ! to satisfy intent(out) attribute call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', & @@ -1346,20 +1324,8 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, & integer (kind=int_kind) :: lnrec ! local value of nrec - real (kind=dbl_kind), dimension(:,:,:), allocatable :: & - work_g2 - lnrec = nrec - if (orca_halogrid .and. .not. present(restart_ext)) then - if (my_task == master_task) then - allocate(work_g2(nx_global+2,ny_global+1,ncat)) - else - allocate(work_g2(1,1,ncat)) ! to save memory - endif - work_g2(:,:,:) = c0 - endif - nx = nx_global ny = ny_global @@ -1408,18 +1374,10 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, & ! Read global array !-------------------------------------------------------------- - if (orca_halogrid .and. .not. present(restart_ext)) then - status = nf90_get_var( fid, varid, work_g2, & - start=(/1,1,1,lnrec/), count=(/nx_global+2,ny_global+1,ncat,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - work_g1 = work_g2(2:nx_global+1,1:ny_global,:) - else - status = nf90_get_var( fid, varid, work_g1, & - start=(/1,1,1,lnrec/), count=(/nx,ny,ncat,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - endif + status = nf90_get_var( fid, varid, work_g1, & + start=(/1,1,1,lnrec/), count=(/nx,ny,ncat,1/)) + call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & + file=__FILE__, line=__LINE__) endif ! my_task = master_task @@ -1478,7 +1436,6 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, & endif deallocate(work_g1) - if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2) #else call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', & @@ -1558,20 +1515,9 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, & character(len=*), parameter :: subname = '(ice_read_nc_xyf)' #ifdef USE_NETCDF - real (kind=dbl_kind), dimension(:,:,:), allocatable :: & - work_g2 lnrec = nrec - if (orca_halogrid .and. .not. present(restart_ext)) then - if (my_task == master_task) then - allocate(work_g2(nx_global+2,ny_global+1,nfreq)) - else - allocate(work_g2(1,1,nfreq)) ! to save memory - endif - work_g2(:,:,:) = c0 - endif - nx = nx_global ny = ny_global @@ -1620,18 +1566,10 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, & ! Read global array !-------------------------------------------------------------- - if (orca_halogrid .and. .not. present(restart_ext)) then - status = nf90_get_var( fid, varid, work_g2, & - start=(/1,1,1,lnrec/), count=(/nx_global+2,ny_global+1,nfreq,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - work_g1 = work_g2(2:nx_global+1,1:ny_global,:) - else - status = nf90_get_var( fid, varid, work_g1, & - start=(/1,1,1,lnrec/), count=(/nx,ny,nfreq,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - endif + status = nf90_get_var( fid, varid, work_g1, & + start=(/1,1,1,lnrec/), count=(/nx,ny,nfreq,1/)) + call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & + file=__FILE__, line=__LINE__) endif ! my_task = master_task @@ -1693,7 +1631,6 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, & where (work > 1.0e+30_dbl_kind) work = c0 deallocate(work_g1) - if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2) #else call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', & @@ -2474,7 +2411,7 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) character (char_len), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), dimension(nx_global,ny_global), intent(out) :: & + real (kind=dbl_kind), dimension(:,:), intent(out) :: & work_g ! output array (real, 8-byte) logical (kind=log_kind) :: & @@ -2485,13 +2422,15 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) character(len=*), parameter :: subname = '(ice_read_global_nc)' #ifdef USE_NETCDF -! netCDF file diagnostics: + ! netCDF file diagnostics: integer (kind=int_kind) :: & - varid, & ! netcdf id for field - status ! status output from netcdf routines -! ndim, nvar, & ! sizes of netcdf file + varid, & ! netcdf id for field + status, & ! status output from netcdf routines + ndim, & ! number of variable dimensions + dimids(NF90_MAX_VAR_DIMS) , & !ids of dimensions + dimlen ! size of dimension +! nvar, & ! sizes of netcdf file ! id, & ! dimension index -! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array @@ -2499,17 +2438,6 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) ! character (char_len) :: & ! dimname ! dimension name ! - real (kind=dbl_kind), dimension(:,:), allocatable :: & - work_g3 - - if (orca_halogrid) then - if (my_task == master_task) then - allocate(work_g3(nx_global+2,ny_global+1)) - else - allocate(work_g3(1,1)) ! to save memory - endif - work_g3(:,:) = c0 - endif work_g(:,:) = c0 @@ -2527,18 +2455,35 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) ! Read global array !-------------------------------------------------------------- - if (orca_halogrid) then - status = nf90_get_var( fid, varid, work_g3, & - start=(/1,1,nrec/), count=(/nx_global+2,ny_global+1,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) - work_g=work_g3(2:nx_global+1,1:ny_global) - else - status = nf90_get_var( fid, varid, work_g, & - start=(/1,1,nrec/), count=(/nx_global,ny_global,1/)) - call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & - file=__FILE__, line=__LINE__) + ! Check var size : is var 2d ? + status = nf90_inquire_variable(fid, varid, ndims=ndim, dimids=dimids) + call ice_check_nc(status, subname//' ERROR: Cannot check variable '//trim(varname), & + file=__FILE__, line=__LINE__) + if ( ndim > 2 ) then + call abort_ice(subname//' ERROR: '//trim(varname)//' cannot have more than 2 dimensions', & + file=__FILE__, line=__LINE__) + endif + ! Is work_g the same size as the variable? + status = nf90_inquire_dimension(fid, dimids(1), len=dimlen) + call ice_check_nc(status, subname//' ERROR: Cannot check variable '//trim(varname), & + file=__FILE__, line=__LINE__) + if ( dimlen /= size(work_g,1) ) then + call abort_ice(subname//' ERROR: x dim of '//trim(varname)//' wrong size, check nx_global', & + file=__FILE__, line=__LINE__) endif + status = nf90_inquire_dimension(fid, dimids(2), len=dimlen) + call ice_check_nc(status, subname//' ERROR: Cannot check variable '//trim(varname), & + file=__FILE__, line=__LINE__) + if ( dimlen /= size(work_g,2) ) then + call abort_ice(subname//' ERROR: y dim of '//trim(varname)//' wrong size, check ny_global', & + file=__FILE__, line=__LINE__) + endif + + ! Get the data + status = nf90_get_var( fid, varid, work_g, start=(/1,1,nrec/)) + call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), & + file=__FILE__, line=__LINE__) + endif ! my_task = master_task !------------------------------------------------------------------- @@ -2561,8 +2506,6 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) write(nu_diag,*) subname,' min, max, sum = ', amin, amax, asum, trim(varname) endif - if (orca_halogrid) deallocate(work_g3) - #else call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', & file=__FILE__, line=__LINE__) diff --git a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90 index 9bf3b1d8a..3c0c126b0 100644 --- a/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90 @@ -67,7 +67,7 @@ subroutine init_restart_read(ice_ic) filename = trim(ice_ic) else if (my_task == master_task) then - open(nu_rst_pointer,file=pointer_file) + open(nu_rst_pointer,file=pointer_file, status='old') read(nu_rst_pointer,'(a)') filename0 filename = trim(filename0) close(nu_rst_pointer) diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 index b8971a872..05f1144a3 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90 @@ -1255,6 +1255,12 @@ subroutine ice_write_hist (ns) write(nu_diag,*) 'Finished writing ',trim(ncfile) endif + !----------------------------------------------------------------- + ! clean up PIO + !----------------------------------------------------------------- + + call ice_pio_finalize() + first_call = .false. end subroutine ice_write_hist diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90 index 94331edf1..943ab9d91 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90 @@ -27,6 +27,7 @@ module ice_pio public ice_pio_init public ice_pio_initdecomp + public ice_pio_finalize public ice_pio_check #ifdef CESMCOUPLED @@ -529,6 +530,27 @@ subroutine ice_pio_initdecomp_4d (ndim3, ndim4, iodesc, precision) end subroutine ice_pio_initdecomp_4d +!================================================================================ + + ! PIO Finalize + + subroutine ice_pio_finalize() + + integer(kind=int_kind) :: status + character(len=*), parameter :: subname = '(ice_pio_finalize)' + + status = PIO_NOERR +#ifndef CESMCOUPLED + call pio_seterrorhandling(ice_pio_subsystem, PIO_RETURN_ERROR) + call pio_finalize(ice_pio_subsystem,status) + call ice_pio_check( status, subname//' ERROR: Failed to finalize ', & + file=__FILE__,line=__LINE__) +! do not call this, ice_pio_subsystem does not exist anymore +! call pio_seterrorhandling(ice_pio_subsystem, PIO_INTERNAL_ERROR) +#endif + + end subroutine ice_pio_finalize + !================================================================================ ! PIO Error handling diff --git a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 2d98716b2..0f9070fef 100644 --- a/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 @@ -9,6 +9,9 @@ module ice_restart use ice_communicate, only: my_task, master_task use ice_exit, only: abort_ice use ice_fileunits, only: nu_diag, nu_restart, nu_rst_pointer +#ifdef CESMCOUPLED + use ice_fileunits, only: inst_suffix +#endif use ice_kinds_mod use ice_restart_shared use ice_pio @@ -46,7 +49,6 @@ subroutine init_restart_read(ice_ic) mday, msec, npt use ice_domain_size, only: ncat use ice_read_write, only: ice_open - character(len=char_len_long), intent(in), optional :: ice_ic ! local variables @@ -64,7 +66,7 @@ subroutine init_restart_read(ice_ic) filename = trim(ice_ic) else if (my_task == master_task) then - open(nu_rst_pointer,file=pointer_file) + open(nu_rst_pointer,file=pointer_file, status='old') read(nu_rst_pointer,'(a)') filename0 filename = trim(filename0) close(nu_rst_pointer) @@ -174,6 +176,7 @@ subroutine init_restart_write(filename_spec) integer (kind=int_kind) :: nbtrcr character(len=char_len_long) :: filename + character(len=char_len_long) :: lpointer_file integer (kind=int_kind) :: & dimid_ncat, dimid_nilyr, dimid_nslyr, dimid_naero @@ -220,7 +223,13 @@ subroutine init_restart_write(filename_spec) ! write pointer (path/file) if (my_task == master_task) then - open(nu_rst_pointer,file=pointer_file) +#ifdef CESMCOUPLED + write(lpointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & + 'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec +#else + lpointer_file = pointer_file +#endif + open(nu_rst_pointer,file=lpointer_file) write(nu_rst_pointer,'(a)') filename close(nu_rst_pointer) endif @@ -740,7 +749,6 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & call ice_pio_check(pio_inq_varndims(File, vardesc, ndims), & subname// " ERROR: missing varndims "//trim(vname),file=__FILE__,line=__LINE__) - call pio_seterrorhandling(File, PIO_INTERNAL_ERROR) if (ndim3 == ncat .and. ndims == 3) then @@ -897,6 +905,7 @@ subroutine final_restart() call PIO_freeDecomp(File,iodesc2d) call PIO_freeDecomp(File,iodesc3d_ncat) call pio_closefile(File) + call ice_pio_finalize() if (my_task == master_task) then write(nu_diag,'(a,i8,4x,i4.4,a,i2.2,a,i2.2,a,i5.5)') & diff --git a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 index b9ab6a39d..0a5e27840 100644 --- a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 @@ -158,10 +158,10 @@ subroutine cice_init(mpicom_ice) file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -199,6 +199,8 @@ subroutine cice_init(mpicom_ice) if (trim(runtype) == 'continue' .or. restart) & call init_shortwave ! initialize radiative transfer + if (write_ic) call accum_hist(dt) ! write initial conditions + ! call advance_timestep() !-------------------------------------------------------------------- @@ -238,8 +240,6 @@ subroutine cice_init(mpicom_ice) call init_flux_atm ! initialize atmosphere fluxes sent to coupler call init_flux_ocn ! initialize ocean fluxes sent to coupler - if (write_ic) call accum_hist(dt) ! write initial conditions - call dealloc_grid ! deallocate temporary grid arrays if (my_task == master_task) then call ice_memusage_print(nu_diag,subname//':end') @@ -274,7 +274,7 @@ subroutine init_restart restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & - restart_zsal, restart_bgc + restart_bgc use ice_restart_driver, only: restartfile use ice_restart_shared, only: runtype, restart use ice_state ! almost everything @@ -285,7 +285,7 @@ subroutine init_restart logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_lvl, & tr_pond_topo, tr_snow, tr_fsd, tr_iso, tr_aero, tr_brine, & - skl_bgc, z_tracers, solve_zsal + skl_bgc, z_tracers integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & @@ -301,7 +301,7 @@ subroutine init_restart file=__FILE__, line=__LINE__) call icepack_query_parameters(skl_bgc_out=skl_bgc, & - z_tracers_out=z_tracers, solve_zsal_out=solve_zsal) + z_tracers_out=z_tracers) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & @@ -447,8 +447,6 @@ subroutine init_restart if (trim(runtype) == 'continue') then if (tr_brine) & restart_hbrine = .true. - if (solve_zsal) & - restart_zsal = .true. if (skl_bgc .or. z_tracers) & restart_bgc = .true. endif @@ -458,7 +456,7 @@ subroutine init_restart if (tr_brine .and. restart_hbrine) call read_restart_hbrine endif - if (solve_zsal .or. skl_bgc .or. z_tracers) then ! biogeochemistry + if (skl_bgc .or. z_tracers) then ! biogeochemistry if (tr_fsd) then write (nu_diag,*) 'FSD implementation incomplete for use with BGC' call icepack_warnings_flush(nu_diag) diff --git a/cicecore/drivers/mct/cesm1/ice_prescribed_mod.F90 b/cicecore/drivers/mct/cesm1/ice_prescribed_mod.F90 index 27bae6eb6..d14fde505 100644 --- a/cicecore/drivers/mct/cesm1/ice_prescribed_mod.F90 +++ b/cicecore/drivers/mct/cesm1/ice_prescribed_mod.F90 @@ -549,8 +549,7 @@ subroutine ice_prescribed_phys ! compute aggregate ice state and open water area !-------------------------------------------------------------------- if (tmask(i,j,iblk)) & - call icepack_aggregate(ncat = ncat, & - aicen = aicen(i,j,:,iblk), & + call icepack_aggregate(aicen = aicen(i,j,:,iblk), & trcrn = trcrn(i,j,1:ntrcr,:,iblk), & vicen = vicen(i,j,:,iblk), & vsnon = vsnon(i,j,:,iblk), & @@ -559,7 +558,6 @@ subroutine ice_prescribed_phys vice = vice (i,j, iblk), & vsno = vsno (i,j, iblk), & aice0 = aice0(i,j, iblk), & - ntrcr = ntrcr, & trcr_depend = trcr_depend(1:ntrcr), & trcr_base = trcr_base(1:ntrcr,:), & n_trcr_strata = n_trcr_strata(1:ntrcr), & diff --git a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 index ac2268824..29df8626a 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 @@ -129,10 +129,10 @@ subroutine cice_init2() file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index d6626c0cf..d4a43a3a9 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -417,6 +417,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Determine attributes - also needed in realize phase to get grid information !---------------------------------------------------------------------------- + ! Get orbital values ! Note that these values are obtained in a call to init_orbit in ice_shortwave.F90 ! if CESMCOUPLED is not defined @@ -689,8 +690,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if(mastertask) write(nu_diag,*) trim(subname)//'WARNING: pio_typename from driver needs to be set for netcdf output to work' end if - - #else ! Read the cice namelist as part of the call to cice_init1 @@ -841,6 +840,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) myear = (idate/10000) ! integer year of basedate mmonth= (idate-myear*10000)/100 ! integer month of basedate mday = idate-myear*10000-mmonth*100 ! day of month of basedate + msec = start_tod ! start from basedate if (my_task == master_task) then write(nu_diag,*) trim(subname),' curr_ymd = ',curr_ymd @@ -1343,59 +1343,58 @@ subroutine ModelSetRunClock(gcomp, rc) call ESMF_LogWrite(subname//'setting alarms for ' // trim(name), ESMF_LOGMSG_INFO) !---------------- - ! Restart alarm + ! Stop alarm !---------------- - call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) restart_n + read(cvalue,*) stop_n - call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) restart_ymd + read(cvalue,*) stop_ymd - call alarmInit(mclock, restart_alarm, restart_option, & - opt_n = restart_n, & - opt_ymd = restart_ymd, & + call alarmInit(mclock, stop_alarm, stop_option, & + opt_n = stop_n, & + opt_ymd = stop_ymd, & RefTime = mcurrTime, & - alarmname = 'alarm_restart', rc=rc) + alarmname = 'alarm_stop', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc) + call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------- - ! Stop alarm + ! Restart alarm !---------------- - call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) stop_n + read(cvalue,*) restart_n - call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) stop_ymd + read(cvalue,*) restart_ymd - call alarmInit(mclock, stop_alarm, stop_option, & - opt_n = stop_n, & - opt_ymd = stop_ymd, & + call alarmInit(mclock, restart_alarm, restart_option, & + opt_n = restart_n, & + opt_ymd = restart_ymd, & RefTime = mcurrTime, & - alarmname = 'alarm_stop', rc=rc) + alarmname = 'alarm_restart', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc) + call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return #ifndef CESMCOUPLED - call ESMF_TimeIntervalGet( dtimestep, s=dtime, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call init_is_restart_fh(mcurrTime, dtime, my_task == master_task, restartfh_info) + call ESMF_TimeIntervalGet( dtimestep, s=dtime, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call init_is_restart_fh(mcurrTime, dtime, my_task == master_task, restartfh_info) #endif - end if !-------------------------------- @@ -1464,8 +1463,9 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) type(ESMF_Time) :: CurrTime ! current time integer :: year ! model year at current time integer :: orb_year ! orbital year for current orbital computation + integer, save :: prev_orb_year=0 ! orbital year for previous orbital computation logical :: lprint - logical :: first_time = .true. + logical, save :: first_time = .true. character(len=*) , parameter :: subname = "(cice_orbital_init)" !------------------------------------------------------------------------------- @@ -1547,24 +1547,24 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) return ! bail out endif end if - + lprint = .false. if (trim(orb_mode) == trim(orb_variable_year)) then call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet(CurrTime, yy=year, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return orb_year = orb_iyear + (year - orb_iyear_align) - lprint = mastertask else orb_year = orb_iyear - if (first_time) then - lprint = mastertask - else - lprint = .false. - end if end if + if (orb_year .ne. prev_orb_year) then + lprint = mastertask + ! this prevents the orbital print happening before the log file is opened. + if (.not. first_time) prev_orb_year = orb_year + endif eccen = orb_eccen + call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, lprint) if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. & diff --git a/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 b/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 index 65596d822..94a2f8b23 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 @@ -12,7 +12,7 @@ module ice_shr_methods use ESMF , only : ESMF_Mesh, ESMF_MeshGet use ESMF , only : ESMF_GEOMTYPE_MESH, ESMF_GEOMTYPE_GRID, ESMF_FIELDSTATUS_COMPLETE use ESMF , only : ESMF_Clock, ESMF_ClockCreate, ESMF_ClockGet, ESMF_ClockSet - use ESMF , only : ESMF_ClockPrint, ESMF_ClockAdvance + use ESMF , only : ESMF_ClockPrint, ESMF_ClockAdvance, ESMF_ClockGetAlarm use ESMF , only : ESMF_Alarm, ESMF_AlarmCreate, ESMF_AlarmGet, ESMF_AlarmSet use ESMF , only : ESMF_Calendar, ESMF_CALKIND_NOLEAP, ESMF_CALKIND_GREGORIAN use ESMF , only : ESMF_Time, ESMF_TimeGet, ESMF_TimeSet @@ -65,6 +65,7 @@ module ice_shr_methods optMonthly = "monthly" , & optYearly = "yearly" , & optDate = "date" , & + optEnd = "end" , & optIfdays0 = "ifdays0" ! Module data @@ -920,6 +921,14 @@ subroutine alarmInit( clock, alarm, option, & if (chkerr(rc,__LINE__,u_FILE_u)) return update_nextalarm = .true. + case (optEnd) + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_ClockGetAlarm(clock, alarmname="alarm_stop", alarm=alarm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_AlarmGet(alarm, ringTime=NextAlarm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + case default call abort_ice(subname//'unknown option '//trim(option)) diff --git a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 index 25c126201..2cc29cb9c 100644 --- a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 @@ -167,10 +167,10 @@ subroutine cice_init(mpi_comm) file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/standalone/cice/CICE_InitMod.F90 b/cicecore/drivers/standalone/cice/CICE_InitMod.F90 index edb091941..9e212799e 100644 --- a/cicecore/drivers/standalone/cice/CICE_InitMod.F90 +++ b/cicecore/drivers/standalone/cice/CICE_InitMod.F90 @@ -155,10 +155,10 @@ subroutine cice_init file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90 b/cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90 index edb091941..9e212799e 100644 --- a/cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90 +++ b/cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90 @@ -155,10 +155,10 @@ subroutine cice_init file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/unittest/halochk/CICE_InitMod.F90 b/cicecore/drivers/unittest/halochk/CICE_InitMod.F90 index edb091941..9e212799e 100644 --- a/cicecore/drivers/unittest/halochk/CICE_InitMod.F90 +++ b/cicecore/drivers/unittest/halochk/CICE_InitMod.F90 @@ -155,10 +155,10 @@ subroutine cice_init file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/unittest/opticep/CICE_InitMod.F90 b/cicecore/drivers/unittest/opticep/CICE_InitMod.F90 index edb091941..9e212799e 100644 --- a/cicecore/drivers/unittest/opticep/CICE_InitMod.F90 +++ b/cicecore/drivers/unittest/opticep/CICE_InitMod.F90 @@ -155,10 +155,10 @@ subroutine cice_init file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/drivers/unittest/opticep/ice_init_column.F90 b/cicecore/drivers/unittest/opticep/ice_init_column.F90 index 0b45a78af..7140454ba 100644 --- a/cicecore/drivers/unittest/opticep/ice_init_column.F90 +++ b/cicecore/drivers/unittest/opticep/ice_init_column.F90 @@ -581,8 +581,7 @@ end subroutine init_snowtracers subroutine init_fsd(floesize) - use ice_arrays_column, only: floe_rad_c, floe_binwidth, & - wavefreq, dwavefreq, wave_sig_ht, wave_spectrum, & + use ice_arrays_column, only: wavefreq, dwavefreq, wave_sig_ht, wave_spectrum, & d_afsd_newi, d_afsd_latg, d_afsd_latm, d_afsd_wave, d_afsd_weld use ice_domain_size, only: ncat, max_blocks, nfsd use ice_init, only: ice_ic @@ -636,8 +635,6 @@ subroutine init_fsd(floesize) ! initialize floe size distribution the same in every column and category call icepack_init_fsd(ice_ic = ice_ic, & - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) afsd = afsd) ! floe size distribution do iblk = 1, max_blocks diff --git a/cicecore/drivers/unittest/opticep/ice_step_mod.F90 b/cicecore/drivers/unittest/opticep/ice_step_mod.F90 index 6e46ec51f..69f49a6f5 100644 --- a/cicecore/drivers/unittest/opticep/ice_step_mod.F90 +++ b/cicecore/drivers/unittest/opticep/ice_step_mod.F90 @@ -224,9 +224,9 @@ subroutine step_therm1 (dt, iblk) fswsfcn, fswintn, Sswabsn, Iswabsn, meltsliqn, meltsliq, & fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf use ice_calendar, only: yday - use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero - use ice_flux, only: frzmlt, sst, Tf, strocnxT_iavg, strocnyT_iavg, rside, fbot, Tbot, Tsnice, & - meltsn, melttn, meltbn, congeln, snoicen, uatmT, vatmT, fside, wlat, & + use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero, nfsd + use ice_flux, only: frzmlt, sst, Tf, strocnxT_iavg, strocnyT_iavg, rsiden, fbot, Tbot, Tsnice, & + meltsn, melttn, meltbn, congeln, snoicen, uatmT, vatmT, wlat, & wind, rhoa, potT, Qa, zlvl, zlvs, strax, stray, flatn, fsensn, fsurfn, fcondtopn, & flw, fsnow, fpond, sss, mlt_onset, frz_onset, fcondbotn, fcondbot, fsloss, & frain, Tair, strairxT, strairyT, fsurf, fcondtop, fsens, & @@ -269,7 +269,7 @@ subroutine step_therm1 (dt, iblk) integer (kind=int_kind) :: & ntrcr, nt_apnd, nt_hpnd, nt_ipnd, nt_alvl, nt_vlvl, nt_Tsfc, & - nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno, & + nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno, nt_fsd, & nt_isosno, nt_isoice, nt_rsnw, nt_smice, nt_smliq logical (kind=log_kind) :: & @@ -304,7 +304,7 @@ subroutine step_therm1 (dt, iblk) call icepack_query_tracer_indices( & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_Tsfc_out=nt_Tsfc, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, & + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_fsd_out=nt_fsd, & nt_qice_out=nt_qice, nt_sice_out=nt_sice, & nt_aero_out=nt_aero, nt_qsno_out=nt_qsno, & nt_rsnw_out=nt_rsnw, nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & @@ -412,6 +412,7 @@ subroutine step_therm1 (dt, iblk) ipnd = trcrn (i,j,nt_ipnd,:,iblk), & iage = trcrn (i,j,nt_iage,:,iblk), & FY = trcrn (i,j,nt_FY ,:,iblk), & + afsdn = trcrn (i,j,nt_fsd:nt_fsd+nfsd-1,:,iblk), & !opt rsnwn = rsnwn (:,:), & !opt smicen = smicen (:,:), & !opt smliqn = smliqn (:,:), & @@ -464,8 +465,7 @@ subroutine step_therm1 (dt, iblk) Tbot = Tbot (i,j, iblk), & Tsnice = Tsnice (i,j, iblk), & frzmlt = frzmlt (i,j, iblk), & - rside = rside (i,j, iblk), & - fside = fside (i,j, iblk), & + rsiden = rsiden (i,j,:,iblk), & !opt wlat = wlat (i,j, iblk), & fsnow = fsnow (i,j, iblk), & frain = frain (i,j, iblk), & @@ -529,7 +529,7 @@ subroutine step_therm1 (dt, iblk) snoice = snoice (i,j, iblk), & snoicen = snoicen (i,j,:,iblk), & !opt dsnow = dsnow (i,j, iblk), & - dsnown = dsnown (i,j,:,iblk), & +!opt dsnown = dsnown (i,j,:,iblk), & !opt meltsliq = meltsliq (i,j, iblk), & !opt meltsliqn = meltsliqn (i,j,:,iblk), & lmask_n = lmask_n (i,j, iblk), & @@ -612,12 +612,12 @@ subroutine step_therm2 (dt, iblk) use ice_arrays_column, only: hin_max, ocean_bio, wave_sig_ht, & wave_spectrum, wavefreq, dwavefreq, & - first_ice, bgrid, cgrid, igrid, floe_rad_c, floe_binwidth, & + first_ice, bgrid, cgrid, igrid, & d_afsd_latg, d_afsd_newi, d_afsd_latm, d_afsd_weld use ice_calendar, only: yday use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, nfsd use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, & - fsalt, Tf, sss, salinz, fhocn, rside, fside, wlat, & + fsalt, Tf, sss, salinz, fhocn, rsiden, wlat, & meltl, frazil_diag use ice_flux_bgc, only: flux_bio, faero_ocn, & fiso_ocn, HDO_ocn, H2_16O_ocn, H2_18O_ocn @@ -696,9 +696,8 @@ subroutine step_therm2 (dt, iblk) Tf = Tf (i,j, iblk), & sss = sss (i,j, iblk), & salinz = salinz (i,j,:,iblk), & - rside = rside (i,j, iblk), & + rsiden = rsiden (i,j,:,iblk), & meltl = meltl (i,j, iblk), & - fside = fside (i,j, iblk), & !opt wlat = wlat (i,j, iblk), & frzmlt = frzmlt (i,j, iblk), & frazil = frazil (i,j, iblk), & @@ -726,9 +725,7 @@ subroutine step_therm2 (dt, iblk) !opt d_afsd_latg= d_afsd_latg(i,j,:,iblk),& !opt d_afsd_newi= d_afsd_newi(i,j,:,iblk),& !opt d_afsd_latm= d_afsd_latm(i,j,:,iblk),& -!opt d_afsd_weld= d_afsd_weld(i,j,:,iblk),& -!opt floe_rad_c = floe_rad_c(:), & -!opt floe_binwidth = floe_binwidth(:)) +!opt d_afsd_weld= d_afsd_weld(i,j,:,iblk)) ) endif ! tmask @@ -866,7 +863,7 @@ end subroutine update_state subroutine step_dyn_wave (dt) use ice_arrays_column, only: wave_spectrum, & - d_afsd_wave, floe_rad_l, floe_rad_c, wavefreq, dwavefreq + d_afsd_wave, wavefreq, dwavefreq use ice_domain_size, only: ncat, nfsd, nfreq use ice_state, only: trcrn, aicen, aice, vice use ice_timers, only: ice_timer_start, ice_timer_stop, timer_column, & @@ -914,8 +911,6 @@ subroutine step_dyn_wave (dt) aice = aice (i,j, iblk), & vice = vice (i,j, iblk), & aicen = aicen (i,j,:, iblk), & - floe_rad_l = floe_rad_l (:), & - floe_rad_c = floe_rad_c (:), & wave_spectrum = wave_spectrum(i,j,:, iblk), & wavefreq = wavefreq (:), & dwavefreq = dwavefreq (:), & diff --git a/cicecore/drivers/unittest/sumchk/CICE_InitMod.F90 b/cicecore/drivers/unittest/sumchk/CICE_InitMod.F90 index edb091941..9e212799e 100644 --- a/cicecore/drivers/unittest/sumchk/CICE_InitMod.F90 +++ b/cicecore/drivers/unittest/sumchk/CICE_InitMod.F90 @@ -155,10 +155,10 @@ subroutine cice_init file=__FILE__,line= __LINE__) if (tr_fsd) call icepack_init_fsd_bounds ( & - floe_rad_l = floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range = c_fsd_range, & ! string for history output + floe_rad_l_out = floe_rad_l, & ! fsd size lower bound in m (radius) + floe_rad_c_out = floe_rad_c, & ! fsd size bin centre in m (radius) + floe_binwidth_out = floe_binwidth, & ! fsd size bin width in m (radius) + c_fsd_range_out = c_fsd_range, & ! string for history output write_diags=(my_task == master_task)) ! write diag on master only call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index 10936fa7e..73f11a93b 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -581,8 +581,7 @@ end subroutine init_snowtracers subroutine init_fsd(floesize) - use ice_arrays_column, only: floe_rad_c, floe_binwidth, & - wavefreq, dwavefreq, wave_sig_ht, wave_spectrum, & + use ice_arrays_column, only: wavefreq, dwavefreq, wave_sig_ht, wave_spectrum, & d_afsd_newi, d_afsd_latg, d_afsd_latm, d_afsd_wave, d_afsd_weld use ice_domain_size, only: ncat, max_blocks, nfsd use ice_init, only: ice_ic @@ -636,8 +635,6 @@ subroutine init_fsd(floesize) ! initialize floe size distribution the same in every column and category call icepack_init_fsd(ice_ic = ice_ic, & - floe_rad_c = floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth = floe_binwidth, & ! fsd size bin width in m (radius) afsd = afsd) ! floe size distribution do iblk = 1, max_blocks diff --git a/cicecore/version.txt b/cicecore/version.txt index 083549d70..b5b0c4a76 100644 --- a/cicecore/version.txt +++ b/cicecore/version.txt @@ -1 +1 @@ -CICE 6.5.1 +CICE 6.6.0 diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index a68852602..bb2edc17e 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -56,12 +56,23 @@ EOFB else if (${ICE_MACHINE} =~ gadi*) then if (${queue} =~ *sr) then #sapphire rapids @ memuse = ( $ncores * 481 / 100 ) + set corespernode = 52 else if (${queue} =~ *bw) then #broadwell @ memuse = ( $ncores * 457 / 100 ) + set corespernode = 28 else if (${queue} =~ *sl) then @ memuse = ( $ncores * 6 ) + set corespernode = 32 else #normal queues @ memuse = ( $ncores * 395 / 100 ) + set corespernode = 48 +endif +if (${ncores} > ${corespernode}) then + # need to use a whole number of nodes + @ ncores = ( ( $ncores + $corespernode - 1 ) / $corespernode ) * $corespernode +endif +if (${runlength} <= 0) then + set batchtime = "00:30:00" endif cat >> ${jobfile} << EOFB #PBS -q ${queue} diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index d97671021..b3fc5404d 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -100,7 +100,6 @@ nilyr = 7 nslyr = 1 nblyr = 1 - orca_halogrid = .false. / &tracer_nml diff --git a/configuration/scripts/machines/Macros.gadi_intel b/configuration/scripts/machines/Macros.gadi_intel index df7746731..3663af20d 100644 --- a/configuration/scripts/machines/Macros.gadi_intel +++ b/configuration/scripts/machines/Macros.gadi_intel @@ -13,11 +13,11 @@ NCI_INTEL_FLAGS := -r8 -i4 -traceback -w -fpe0 -ftz -convert big_endian -assume NCI_REPRO_FLAGS := -fp-model precise -fp-model source -align all ifeq ($(ICE_BLDDEBUG), true) - NCI_DEBUG_FLAGS := -g3 -O0 -debug all -check all -no-vec -assume nobuffered_io + NCI_DEBUG_FLAGS := -O0 -debug all -check all -no-vec -assume nobuffered_io FFLAGS := $(NCI_INTEL_FLAGS) $(NCI_REPRO_FLAGS) $(NCI_DEBUG_FLAGS) CPPDEFS := $(CPPDEFS) -DDEBUG=$(DEBUG) else - NCI_OPTIM_FLAGS := -g3 -O2 -axCORE-AVX2 -debug all -check none -qopt-report=5 -qopt-report-annotate -assume buffered_io + NCI_OPTIM_FLAGS := -O2 -axCORE-AVX2 -debug all -check none -qopt-report=5 -qopt-report-annotate -assume buffered_io FFLAGS := $(NCI_INTEL_FLAGS) $(NCI_REPRO_FLAGS) $(NCI_OPTIM_FLAGS) endif diff --git a/configuration/scripts/options/set_nml.histhrly b/configuration/scripts/options/set_nml.histhrly new file mode 100644 index 000000000..47879677e --- /dev/null +++ b/configuration/scripts/options/set_nml.histhrly @@ -0,0 +1,8 @@ + histfreq = 'm','h','x','x','x' + histfreq_n = 1,1,1,1,1 + histfreq_base = 'zero','zero','zero','zero','zero' + write_ic = .true. + f_aice = 'mh' + f_hi = 'hm' + f_hs = 'mh' + f_Tsfc = 'mh' diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index 2ac855a24..1e5302461 100644 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -5,7 +5,7 @@ smoke gx3 1x4 debug,diag1,run2day smoke gx3 4x1 debug,diag1,run5day restart gx3 8x2 debug restart gx3 8x2 debug,gx3nc -smoke gx3 8x2 diag24,run1year,medium +smoke gx3 8x2 diag24,run1year,long smoke gx3 7x2 diag1,bigdiag,run1day,diagpt1 decomp gx3 4x2x25x29x5 none smoke gx3 4x2 diag1,run5day smoke_gx3_8x2_diag1_run5day @@ -14,21 +14,17 @@ smoke gx3 1x8 diag1,run5day,evp1d restart gx1 40x4 droundrobin,medium restart tx1 40x4 dsectrobin,medium restart tx1 40x4 dsectrobin,medium,jra55do -restart gx3 4x4 none -restart gx3 4x4 gx3nc -restart gx3 10x4 maskhalo +restart gx3 4x4 medium +restart gx3 4x4 gx3nc,short +restart gx3 10x4 maskhalo,medium restart gx3 6x2 alt01 restart gx3 8x2 alt02 restart gx3 4x2 alt03 restart gx3 12x2 alt03,maskhalo,droundrobin restart gx3 4x4 alt04 -restart gx3 4x4 alt05 +restart gx3 4x4 alt05,medium restart gx3 8x2 alt06 -restart gx3 8x3 alt07 restart gx3 16x2 snicar -restart gx3 12x2 snicartest -restart gx3 8x2 congel -restart gx3 8x3 saltflux restart gx3 18x2 debug,maskhalo restart gx3 6x2 alt01,debug,short restart gx3 8x2 alt02,debug,short @@ -48,7 +44,7 @@ restart gbox128 4x2 boxnodyn,short restart gbox128 4x2 boxnodyn,short,debug restart gbox128 2x2 boxadv,short smoke gbox128 2x2 boxadv,short,debug -restart gbox128 4x4 boxrestore,short +restart gbox128 4x4 boxrestore,medium smoke gbox128 4x4 boxrestore,short,debug restart gbox80 1x1 box2001 smoke gbox80 1x1 boxslotcyl @@ -79,13 +75,13 @@ restart gx3 8x2 isotope smoke gx3 4x1 snwitdrdg,snwgrain,icdefault,debug smoke gx3 4x1 snw30percent,icdefault,debug restart gx3 8x2 snwitdrdg,icdefault,snwgrain -restart gx3 4x4 gx3ncarbulk,iobinary -restart gx3 4x4 histall,precision8,cdf64 +restart gx3 4x4 gx3ncarbulk,iobinary,medium +restart gx3 4x4 cdf64,histall,precision8,medium smoke gx3 30x1 bgcz,histall smoke gx3 14x2 fsd12,histall smoke gx3 4x1 dynpicard restart gx3 8x2 gx3ncarbulk,debug -restart gx3 4x4 gx3ncarbulk,diag1 +restart gx3 4x4 diag1,gx3ncarbulk,short smoke gx3 4x1 calcdragio restart gx3 4x2 atmbndyconstant restart gx3 4x2 atmbndymixed diff --git a/configuration/scripts/tests/io_suite.ts b/configuration/scripts/tests/io_suite.ts index 0f8bedc1a..015336416 100644 --- a/configuration/scripts/tests/io_suite.ts +++ b/configuration/scripts/tests/io_suite.ts @@ -1,4 +1,7 @@ # Test Grid PEs Sets BFB-compare +smoke gx3 32x1 run1year,histhrly,ionetcdf,iocdf2,short +smoke gx3 32x1 run1year,histhrly,iopio2,iocdf5,short + # some iobinary configurations fail due to bathymetry netcdf file requirement, remove them # iobinary cannot work with JRA55 because netcdf is turned off restart gx3 8x4 gx3ncarbulk,debug,histall,iobinary,precision8 diff --git a/doc/source/conf.py b/doc/source/conf.py index fec9406c0..86760baaa 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -65,9 +65,9 @@ # built documents. # # The short X.Y version. -version = u'6.5.1' +version = u'6.6.0' # The full version, including alpha/beta/rc tags. -version = u'6.5.1' +version = u'6.6.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 21726f295..9bfd3a65b 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -337,7 +337,6 @@ grid_nml "``nfsd``", "integer", "number of floe size categories", "1" "``nilyr``", "integer", "number of vertical layers in ice", "0" "``nslyr``", "integer", "number of vertical layers in snow", "0" - "``orca_halogrid``", "logical", "use orca haloed grid for data/grid read", "``.false.``" "``scale_dxdy``", "logical", "apply dxscale, dyscale to rectgrid", "``false``" "``use_bathymetry``", "logical", "use read in bathymetry file for seabedstress option", "``.false.``" "", "", "", "" diff --git a/doc/source/user_guide/ug_implementation.rst b/doc/source/user_guide/ug_implementation.rst index 91909082c..0e03c2f13 100644 --- a/doc/source/user_guide/ug_implementation.rst +++ b/doc/source/user_guide/ug_implementation.rst @@ -129,16 +129,25 @@ This is shown in Figure :ref:`fig-Cgrid`. Schematic of CICE CD-grid. -The user has several ways to initialize the grid: *popgrid* reads grid -lengths and other parameters for a nonuniform grid (including tripole -and regional grids), and *rectgrid* creates a regular rectangular grid. -The input files **global_gx3.grid** and **global_gx3.kmt** contain the +The user has several ways to initialize the grid, which can be read from +files or created internally. The *rectgrid* code creates a regular rectangular +grid (use the namelist option ``grid_type='rectangular'``). The *popgrid* and *popgrid_nc* +code reads grid lengths and other parameters for a nonuniform grid (including tripole +and regional grids). +The input files **grid_gx3.bin** and **kmt_gx3.bin** contain the :math:`\left<3^\circ\right>` POP grid and land mask; -**global_gx1.grid** and **global_gx1.kmt** contain the -:math:`\left<1^\circ\right>` grid and land mask, and **global_tx1.grid** -and **global_tx1.kmt** contain the :math:`\left<1^\circ\right>` POP +**grid_gx1.bin** and **kmt_gx1.bin** contain the +:math:`\left<1^\circ\right>` grid and land mask, and **grid_tx1.bin** +and **kmt_tx1.bin** contain the :math:`\left<1^\circ\right>` POP tripole grid and land mask. These are binary unformatted, direct access, -Big Endian files. +Big Endian files. + +The are also input files in netcdf format for the **gx3** grid, +(**grid_gx3.nc** and **kmt_gx3.nc**) which can serve as a template for defining +other grids. At a minimum the grid file needs to to contain ULAT, ULON, HTN, HTE +and ANGLE variables. If the variables exist, ANGLET, TLON and TLAT will also be +read from a netcdf grid file. The kmt (mask) netcdf file needs a variable named +kmt or mask, set to 0 for land and 1 for ocean. The input grid file for the B-grid and CD-grid is identical. That file contains each cells' HTN, HTE, ULON, ULAT, and kmt value. From those diff --git a/icepack b/icepack index 05ac0ec3e..379252056 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit 05ac0ec3ea666080eed36e67f6cf8ce1255b243f +Subproject commit 3792520561cf9419082ef41f9f0dffd03edf2e43