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 0537ce3fe..f74edc88b 100644 --- a/cicecore/cicedyn/general/ice_init.F90 +++ b/cicecore/cicedyn/general/ice_init.F90 @@ -1199,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 !----------------------------------------------------------------- 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_grid.F90 b/cicecore/cicedyn/infrastructure/ice_grid.F90 index 80e03ce3c..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 @@ -605,6 +628,16 @@ 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 !----------------------------------------------------------------- @@ -718,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, & @@ -740,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 @@ -759,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) @@ -776,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 @@ -823,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) \\ @@ -840,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 @@ -854,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 @@ -868,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)' @@ -889,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 !----------------------------------------------------------------- @@ -992,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__) diff --git a/cicecore/cicedyn/infrastructure/ice_read_write.F90 b/cicecore/cicedyn/infrastructure/ice_read_write.F90 index 5e3715cb2..784f54f07 100644 --- a/cicecore/cicedyn/infrastructure/ice_read_write.F90 +++ b/cicecore/cicedyn/infrastructure/ice_read_write.F90 @@ -2411,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) :: & @@ -2422,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 @@ -2453,10 +2455,35 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) ! Read global array !-------------------------------------------------------------- - status = nf90_get_var( fid, varid, work_g, & - start=(/1,1,nrec/), count=(/nx_global,ny_global,1/)) + ! 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 !------------------------------------------------------------------- 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_restart.F90 b/cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90 index 2d98716b2..8000b1e05 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 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/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 704180d12..1363503db 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -684,8 +684,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 @@ -1331,51 +1329,51 @@ 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 end if 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..71b290c95 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), & @@ -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/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index 6bd93a047..1e5302461 100644 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -24,11 +24,7 @@ restart gx3 12x2 alt03,maskhalo,droundrobin restart gx3 4x4 alt04 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,short restart gx3 18x2 debug,maskhalo restart gx3 6x2 alt01,debug,short restart gx3 8x2 alt02,debug,short 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