From 7705e139b04444bd18a9df5cb4718c8ad097d2a8 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Fri, 3 Jun 2022 08:58:29 -0700 Subject: [PATCH] Update mct/cesm1 driver, fix ss_tlt implementation (#726) * Update ss_tltx, ss_tlty averaging/usage in evp, eap, vp Update mct/cesm1 driver for snow mods and other recent changes Remove USE_NETCDF cpp in io_pio2/ice_restart.F90, not needed or correct * Add tripoleOnly flag to ice_HaloUpdate2DR8. This is needed in very limited situations where we want to ensure bit-for-bit across the seam, but do NOT want to update the halo in general. In particular, this is needed for UAREA during initialization. UAREA is explicitly computed in the halo to avoid missing data. In some cases, uarea computed independently along the seam in the halo points results in roundoff level differences. This will produce a small error in the simulation but more important, breaks the symmetry across the seam. In that case, we just want to sync up the halo, but we do NOT want to update the independent UAREA halo computations elsewhere because of land block elimination and other situations where blocks have no neighbors. --- cicecore/cicedynB/dynamics/ice_dyn_eap.F90 | 10 +- cicecore/cicedynB/dynamics/ice_dyn_evp.F90 | 20 +- cicecore/cicedynB/dynamics/ice_dyn_vp.F90 | 14 +- .../infrastructure/comm/mpi/ice_boundary.F90 | 87 ++++++--- .../comm/serial/ice_boundary.F90 | 70 ++++--- cicecore/cicedynB/infrastructure/ice_grid.F90 | 16 ++ .../infrastructure/io/io_pio2/ice_restart.F90 | 6 +- cicecore/drivers/mct/cesm1/CICE_InitMod.F90 | 82 ++++++-- cicecore/drivers/mct/cesm1/CICE_RunMod.F90 | 180 ++++++++++++------ .../drivers/mct/cesm1/ice_import_export.F90 | 18 +- 10 files changed, 337 insertions(+), 166 deletions(-) diff --git a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 index 7a660a031..317a6ba0d 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 @@ -175,6 +175,8 @@ subroutine eap (dt) real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & uocnU , & ! i ocean current (m/s) vocnU , & ! j ocean current (m/s) + ss_tltxU , & ! sea surface slope, x-direction (m/m) + ss_tltyU , & ! sea surface slope, y-direction (m/m) tmass , & ! total mass of ice and snow (kg/m^2) waterx , & ! for ocean stress calculation, x (m/s) watery , & ! for ocean stress calculation, y (m/s) @@ -270,8 +272,10 @@ subroutine eap (dt) call grid_average_X2Y('F', tmass , 'T' , umass, 'U') call grid_average_X2Y('F', aice_init, 'T' , aiu , 'U') - call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnU, 'U') - call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnU, 'U') + call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnU , 'U') + call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnU , 'U') + call grid_average_X2Y('S', ss_tltx , grid_ocn_dynu, ss_tltxU, 'U') + call grid_average_X2Y('S', ss_tlty , grid_ocn_dynv, ss_tltyU, 'U') !---------------------------------------------------------------- ! Set wind stress to values supplied via NEMO or other forcing @@ -318,7 +322,7 @@ subroutine eap (dt) umask (:,:,iblk), & uocnU (:,:,iblk), vocnU (:,:,iblk), & strairx (:,:,iblk), strairy (:,:,iblk), & - ss_tltx (:,:,iblk), ss_tlty (:,:,iblk), & + ss_tltxU (:,:,iblk), ss_tltyU (:,:,iblk), & icetmask (:,:,iblk), iceumask (:,:,iblk), & fm (:,:,iblk), dt, & strtltx (:,:,iblk), strtlty (:,:,iblk), & diff --git a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 index 3c417e8b8..866775132 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 @@ -324,14 +324,18 @@ subroutine evp (dt) call grid_average_X2Y('S', ss_tlty , grid_ocn_dynv, ss_tltyU, 'U') if (grid_ice == 'CD' .or. grid_ice == 'C') then - call grid_average_X2Y('F', tmass , 'T' , emass, 'E') - call grid_average_X2Y('F', aice_init, 'T' , aie , 'E') - call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnE, 'E') - call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnE, 'E') - call grid_average_X2Y('F', tmass , 'T' , nmass, 'N') - call grid_average_X2Y('F', aice_init, 'T' , ain , 'N') - call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnN, 'N') - call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnN, 'N') + call grid_average_X2Y('F', tmass , 'T' , emass , 'E') + call grid_average_X2Y('F', aice_init, 'T' , aie , 'E') + call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnE , 'E') + call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnE , 'E') + call grid_average_X2Y('S', ss_tltx , grid_ocn_dynu, ss_tltxE, 'E') + call grid_average_X2Y('S', ss_tlty , grid_ocn_dynv, ss_tltyE, 'E') + call grid_average_X2Y('F', tmass , 'T' , nmass , 'N') + call grid_average_X2Y('F', aice_init, 'T' , ain , 'N') + call grid_average_X2Y('S', uocn , grid_ocn_dynu, uocnN , 'N') + call grid_average_X2Y('S', vocn , grid_ocn_dynv, vocnN , 'N') + call grid_average_X2Y('S', ss_tltx , grid_ocn_dynu, ss_tltxN, 'N') + call grid_average_X2Y('S', ss_tlty , grid_ocn_dynv, ss_tltyN, 'N') endif !---------------------------------------------------------------- ! Set wind stress to values supplied via NEMO or other forcing diff --git a/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 index 36a273c01..24421a91f 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 @@ -196,6 +196,8 @@ subroutine implicit_solver (dt) real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & uocnU , & ! i ocean current (m/s) vocnU , & ! j ocean current (m/s) + ss_tltxU , & ! sea surface slope, x-direction (m/m) + ss_tltyU , & ! sea surface slope, y-direction (m/m) tmass , & ! total mass of ice and snow (kg/m^2) waterx , & ! for ocean stress calculation, x (m/s) watery , & ! for ocean stress calculation, y (m/s) @@ -300,10 +302,12 @@ subroutine implicit_solver (dt) ! convert fields from T to U grid !----------------------------------------------------------------- - call grid_average_X2Y('F',tmass,'T',umass,'U') - call grid_average_X2Y('F',aice_init,'T', aiu,'U') - call grid_average_X2Y('S',uocn,grid_ocn_dynu,uocnU,'U') - call grid_average_X2Y('S',vocn,grid_ocn_dynv,vocnU,'U') + call grid_average_X2Y('F',tmass , 'T', umass, 'U') + call grid_average_X2Y('F',aice_init, 'T', aiu , 'U') + call grid_average_X2Y('S',uocn , grid_ocn_dynu, uocnU , 'U') + call grid_average_X2Y('S',vocn , grid_ocn_dynv, vocnU , 'U') + call grid_average_X2Y('S',ss_tltx, grid_ocn_dynu, ss_tltxU, 'U') + call grid_average_X2Y('S',ss_tlty, grid_ocn_dynv, ss_tltyU, 'U') !---------------------------------------------------------------- ! Set wind stress to values supplied via NEMO or other forcing @@ -351,7 +355,7 @@ subroutine implicit_solver (dt) umask (:,:,iblk), & uocnU (:,:,iblk), vocnU (:,:,iblk), & strairx (:,:,iblk), strairy (:,:,iblk), & - ss_tltx (:,:,iblk), ss_tlty (:,:,iblk), & + ss_tltxU (:,:,iblk), ss_tltyU (:,:,iblk), & icetmask (:,:,iblk), iceumask (:,:,iblk), & fm (:,:,iblk), dt, & strtltx (:,:,iblk), strtlty (:,:,iblk), & diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 index 5c9a28f10..76a7659a6 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 @@ -1159,7 +1159,7 @@ end subroutine ice_HaloMask subroutine ice_HaloUpdate2DR8(array, halo, & fieldLoc, fieldKind, & - fillValue) + fillValue, tripoleOnly) ! This routine updates ghost cells for an input array and is a ! member of a group of routines under the generic interface @@ -1181,6 +1181,12 @@ subroutine ice_HaloUpdate2DR8(array, halo, & ! (e.g. eliminated land blocks or ! closed boundaries) + logical (log_kind), intent(in), optional :: & + tripoleOnly ! optional flag to execute halo only across tripole seam. + ! this is required for a few fields where we just want to + ! ensure the tripole seam is synced up to preserve symmetry. + ! Added June, 2022 by tcraig. Only added to 2DR8 for now. + real (dbl_kind), dimension(:,:,:), intent(inout) :: & array ! array containing field for which halo ! needs to be updated @@ -1215,6 +1221,9 @@ subroutine ice_HaloUpdate2DR8(array, halo, & fill, &! value to use for unknown points x1,x2,xavg ! scalars for enforcing symmetry at U pts + logical (log_kind) :: & + ltripoleOnly ! local tripoleOnly value + integer (int_kind) :: len ! length of messages character(len=*), parameter :: subname = '(ice_HaloUpdate2DR8)' @@ -1231,6 +1240,12 @@ subroutine ice_HaloUpdate2DR8(array, halo, & fill = 0.0_dbl_kind endif + if (present(tripoleOnly)) then + ltripoleOnly = tripoleOnly + else + ltripoleOnly = .false. + endif + nxGlobal = 0 if (allocated(bufTripoleR8)) then nxGlobal = size(bufTripoleR8,dim=1) @@ -1302,19 +1317,24 @@ subroutine ice_HaloUpdate2DR8(array, halo, & ! !----------------------------------------------------------------------- - do iblk = 1, halo%numLocalBlocks - call get_block_parameter(halo%blockGlobalID(iblk), & - ilo=ilo, ihi=ihi, & - jlo=jlo, jhi=jhi) - do j = 1,nghost - array(1:nx_block, jlo-j,iblk) = fill - array(1:nx_block, jhi+j,iblk) = fill - enddo - do i = 1,nghost - array(ilo-i, 1:ny_block,iblk) = fill - array(ihi+i, 1:ny_block,iblk) = fill + if (ltripoleOnly) then + ! skip fill, not needed since tripole seam always exists if running + ! on tripole grid and set tripoleOnly flag + else + do iblk = 1, halo%numLocalBlocks + call get_block_parameter(halo%blockGlobalID(iblk), & + ilo=ilo, ihi=ihi, & + jlo=jlo, jhi=jhi) + do j = 1,nghost + array(1:nx_block, jlo-j,iblk) = fill + array(1:nx_block, jhi+j,iblk) = fill + enddo + do i = 1,nghost + array(ilo-i, 1:ny_block,iblk) = fill + array(ihi+i, 1:ny_block,iblk) = fill + enddo enddo - enddo + endif !----------------------------------------------------------------------- ! @@ -1334,16 +1354,25 @@ subroutine ice_HaloUpdate2DR8(array, halo, & jDst = halo%dstLocalAddr(2,nmsg) dstBlock = halo%dstLocalAddr(3,nmsg) - if (srcBlock > 0) then - if (dstBlock > 0) then - array(iDst,jDst,dstBlock) = & - array(iSrc,jSrc,srcBlock) - else if (dstBlock < 0) then ! tripole copy into buffer - bufTripoleR8(iDst,jDst) = & - array(iSrc,jSrc,srcBlock) + if (ltripoleOnly) then + if (srcBlock > 0) then + if (dstBlock < 0) then ! tripole copy into buffer + bufTripoleR8(iDst,jDst) = & + array(iSrc,jSrc,srcBlock) + endif + endif + else + if (srcBlock > 0) then + if (dstBlock > 0) then + array(iDst,jDst,dstBlock) = & + array(iSrc,jSrc,srcBlock) + else if (dstBlock < 0) then ! tripole copy into buffer + bufTripoleR8(iDst,jDst) = & + array(iSrc,jSrc,srcBlock) + endif + else if (srcBlock == 0) then + array(iDst,jDst,dstBlock) = fill endif - else if (srcBlock == 0) then - array(iDst,jDst,dstBlock) = fill endif end do @@ -1362,10 +1391,16 @@ subroutine ice_HaloUpdate2DR8(array, halo, & jDst = halo%recvAddr(2,n,nmsg) dstBlock = halo%recvAddr(3,n,nmsg) - if (dstBlock > 0) then - array(iDst,jDst,dstBlock) = bufRecvR8(n,nmsg) - else if (dstBlock < 0) then !tripole - bufTripoleR8(iDst,jDst) = bufRecvR8(n,nmsg) + if (ltripoleOnly) then + if (dstBlock < 0) then !tripole + bufTripoleR8(iDst,jDst) = bufRecvR8(n,nmsg) + endif + else + if (dstBlock > 0) then + array(iDst,jDst,dstBlock) = bufRecvR8(n,nmsg) + else if (dstBlock < 0) then !tripole + bufTripoleR8(iDst,jDst) = bufRecvR8(n,nmsg) + endif endif end do end do diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 index f3fffba59..eb8f5d948 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 @@ -643,7 +643,7 @@ end subroutine ice_HaloMask subroutine ice_HaloUpdate2DR8(array, halo, & fieldLoc, fieldKind, & - fillValue) + fillValue, tripoleOnly) ! This routine updates ghost cells for an input array and is a ! member of a group of routines under the generic interface @@ -665,6 +665,9 @@ subroutine ice_HaloUpdate2DR8(array, halo, & ! (e.g. eliminated land blocks or ! closed boundaries) + logical (log_kind), intent(in), optional :: & + tripoleOnly ! optional flag to execute halo only across tripole seam + real (dbl_kind), dimension(:,:,:), intent(inout) :: & array ! array containing field for which halo ! needs to be updated @@ -690,6 +693,9 @@ subroutine ice_HaloUpdate2DR8(array, halo, & fill, &! value to use for unknown points x1,x2,xavg ! scalars for enforcing symmetry at U pts + logical (log_kind) :: & + ltripoleOnly ! local tripoleOnly value + character(len=*), parameter :: subname = '(ice_HaloUpdate2DR8)' !----------------------------------------------------------------------- @@ -704,6 +710,12 @@ subroutine ice_HaloUpdate2DR8(array, halo, & fill = 0.0_dbl_kind endif + if (present(tripoleOnly)) then + ltripoleOnly = tripoleOnly + else + ltripoleOnly = .false. + endif + nxGlobal = 0 if (allocated(bufTripoleR8)) then nxGlobal = size(bufTripoleR8,dim=1) @@ -718,19 +730,24 @@ subroutine ice_HaloUpdate2DR8(array, halo, & ! !----------------------------------------------------------------------- - do iblk = 1, halo%numLocalBlocks - call get_block_parameter(halo%blockGlobalID(iblk), & - ilo=ilo, ihi=ihi, & - jlo=jlo, jhi=jhi) - do j = 1,nghost - array(1:nx_block, jlo-j,iblk) = fill - array(1:nx_block, jhi+j,iblk) = fill - enddo - do i = 1,nghost - array(ilo-i, 1:ny_block,iblk) = fill - array(ihi+i, 1:ny_block,iblk) = fill + if (ltripoleOnly) then + ! skip fill, not needed since tripole seam always exists if running + ! on tripole grid and set tripoleOnly flag + else + do iblk = 1, halo%numLocalBlocks + call get_block_parameter(halo%blockGlobalID(iblk), & + ilo=ilo, ihi=ihi, & + jlo=jlo, jhi=jhi) + do j = 1,nghost + array(1:nx_block, jlo-j,iblk) = fill + array(1:nx_block, jhi+j,iblk) = fill + enddo + do i = 1,nghost + array(ilo-i, 1:ny_block,iblk) = fill + array(ihi+i, 1:ny_block,iblk) = fill + enddo enddo - enddo + endif !----------------------------------------------------------------------- ! @@ -750,16 +767,25 @@ subroutine ice_HaloUpdate2DR8(array, halo, & jDst = halo%dstLocalAddr(2,nmsg) dstBlock = halo%dstLocalAddr(3,nmsg) - if (srcBlock > 0) then - if (dstBlock > 0) then - array(iDst,jDst,dstBlock) = & - array(iSrc,jSrc,srcBlock) - else if (dstBlock < 0) then ! tripole copy into buffer - bufTripoleR8(iDst,jDst) = & - array(iSrc,jSrc,srcBlock) + if (ltripoleOnly) then + if (srcBlock > 0) then + if (dstBlock < 0) then ! tripole copy into buffer + bufTripoleR8(iDst,jDst) = & + array(iSrc,jSrc,srcBlock) + endif + endif + else + if (srcBlock > 0) then + if (dstBlock > 0) then + array(iDst,jDst,dstBlock) = & + array(iSrc,jSrc,srcBlock) + else if (dstBlock < 0) then ! tripole copy into buffer + bufTripoleR8(iDst,jDst) = & + array(iSrc,jSrc,srcBlock) + endif + else if (srcBlock == 0) then + array(iDst,jDst,dstBlock) = fill endif - else if (srcBlock == 0) then - array(iDst,jDst,dstBlock) = fill endif end do diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index 0509f7623..f7b854b4f 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -604,12 +604,28 @@ subroutine init_grid2 !----------------------------------------------------------------- call ice_timer_start(timer_bound) + call ice_HaloUpdate (dxhy, halo_info, & field_loc_center, field_type_vector, & fillValue=c1) call ice_HaloUpdate (dyhx, halo_info, & field_loc_center, field_type_vector, & fillValue=c1) + + ! Update just on the tripole seam to ensure bit-for-bit symmetry across seam + call ice_HaloUpdate (tarea, halo_info, & + field_loc_center, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (uarea, halo_info, & + field_loc_NEcorner, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (tarear, halo_info, & + field_loc_center, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (uarear, halo_info, & + field_loc_NEcorner, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_timer_stop(timer_bound) !----------------------------------------------------------------- diff --git a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 index e585788b7..59682fe32 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 @@ -946,16 +946,12 @@ logical function query_field(nu,vname) character(len=*), parameter :: subname = '(query_field)' query_field = .false. -#ifdef USE_NETCDF + if (my_task == master_task) then status = pio_inq_varid(File,trim(vname),vardesc) if (status == PIO_noerr) query_field = .true. endif call broadcast_scalar(query_field,master_task) -#else - call abort_ice(subname//'ERROR: USE_NETCDF cpp not defined for '//trim(ice_ic), & - file=__FILE__, line=__LINE__) -#endif end function query_field diff --git a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 index c3de87f68..4725b1d41 100644 --- a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 @@ -15,9 +15,11 @@ module CICE_InitMod use ice_kinds_mod use ice_exit, only: abort_ice use ice_fileunits, only: init_fileunits, nu_diag + use ice_memusage, only: ice_memusage_init, ice_memusage_print use icepack_intfc, only: icepack_aggregate use icepack_intfc, only: icepack_init_itd, icepack_init_itd_hist use icepack_intfc, only: icepack_init_fsd_bounds, icepack_init_wave + use icepack_intfc, only: icepack_init_snow use icepack_intfc, only: icepack_configure use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags, & @@ -65,7 +67,7 @@ subroutine cice_init(mpicom_ice) use ice_state, only: alloc_state use ice_flux_bgc, only: alloc_flux_bgc use ice_calendar, only: dt, dt_dyn, istep, istep1, write_ic, & - init_calendar, calendar + init_calendar, advance_timestep, calc_timesteps use ice_communicate, only: init_communicate, my_task, master_task use ice_diagnostics, only: init_diags use ice_domain, only: init_domain_blocks @@ -76,7 +78,7 @@ subroutine cice_init(mpicom_ice) use ice_flux, only: init_coupler_flux, init_history_therm, & init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & - get_forcing_atmo, get_forcing_ocn, get_wave_spec + get_forcing_atmo, get_forcing_ocn, get_wave_spec, init_snowtable use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & faero_default, faero_optics, alloc_forcing_bgc, fiso_default use ice_grid, only: init_grid1, init_grid2, alloc_grid @@ -93,12 +95,16 @@ subroutine cice_init(mpicom_ice) mpicom_ice ! communicator for sequential ccsm logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & - tr_iso, tr_fsd, wave_spec + tr_iso, tr_fsd, wave_spec, tr_snow + character(len=char_len) :: snw_aging_table character(len=*), parameter :: subname = '(cice_init)' call init_communicate(mpicom_ice) ! initial setup for message passing call init_fileunits ! unit numbers + ! tcx debug, this will create a different logfile for each pe + ! if (my_task /= master_task) nu_diag = 100+my_task + call icepack_configure() ! initialize icepack call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & @@ -108,6 +114,12 @@ subroutine cice_init(mpicom_ice) call input_zbgc ! vertical biogeochemistry namelist call count_tracers ! count tracers + ! Call this as early as possible, must be after memory_stats is read + if (my_task == master_task) then + call ice_memusage_init(nu_diag) + call ice_memusage_print(nu_diag,subname//':start') + endif + call init_domain_blocks ! set up block decomposition call init_grid1 ! domain distribution call alloc_grid ! allocate grid arrays @@ -156,15 +168,13 @@ subroutine cice_init(mpicom_ice) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - call calendar ! determine the initial date - call init_forcing_ocn(dt) ! initialize sss and sst from data call init_state ! initialize the ice state call init_transport ! initialize horizontal transport call ice_HaloRestore_init ! restored boundary conditions call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, & - wave_spec_out=wave_spec) + wave_spec_out=wave_spec, snw_aging_table_out=snw_aging_table) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -175,9 +185,10 @@ subroutine cice_init(mpicom_ice) call init_diags ! initialize diagnostic output points call init_history_therm ! initialize thermo history variables call init_history_dyn ! initialize dynamic history variables + call calc_timesteps ! update timestep counter if not using npt_unit="1" call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) - call icepack_query_tracer_flags(tr_iso_out=tr_iso) + call icepack_query_tracer_flags(tr_iso_out=tr_iso, tr_snow_out=tr_snow) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -191,10 +202,7 @@ subroutine cice_init(mpicom_ice) if (trim(runtype) == 'continue' .or. restart) & call init_shortwave ! initialize radiative transfer -! istep = istep + 1 ! update time step counters -! istep1 = istep1 + 1 -! time = time + dt ! determine the time and date -! call calendar(time) ! at the end of the first timestep +! call advance_timestep() !-------------------------------------------------------------------- ! coupler communication or forcing data initialization @@ -202,19 +210,29 @@ subroutine cice_init(mpicom_ice) call init_forcing_atmo ! initialize atmospheric forcing (standalone) -! for standalone ! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice ! call get_forcing_atmo ! atmospheric forcing from data ! call get_forcing_ocn(dt) ! ocean forcing from data + ! snow aging lookup table initialization + if (tr_snow) then ! advanced snow physics + call icepack_init_snow() + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + if (snw_aging_table(1:4) /= 'test') then + call init_snowtable() + endif + endif + ! ! isotopes ! if (tr_iso) call fiso_default ! default values + ! ! aerosols ! ! if (tr_aero) call faero_data ! data file ! ! if (tr_zaero) call fzaero_data ! data file (gx1) ! if (tr_aero .or. tr_zaero) call faero_default ! default values ! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry - if (z_tracers) call get_atm_bgc ! biogeochemistry if (runtype == 'initial' .and. .not. restart) & @@ -223,7 +241,11 @@ 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 + if (write_ic) call accum_hist(dt) ! write initial conditions + + if (my_task == master_task) then + call ice_memusage_print(nu_diag,subname//':end') + endif end subroutine cice_init @@ -236,12 +258,12 @@ subroutine init_restart use ice_calendar, only: calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, n_iso, n_aero, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, nfsd, nslyr use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask use ice_init, only: ice_ic - use ice_init_column, only: init_age, init_FY, init_lvl, & + use ice_init_column, only: init_age, init_FY, init_lvl, init_snowtracers, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd use ice_restart_column, only: restart_age, read_restart_age, & @@ -249,6 +271,7 @@ subroutine init_restart restart_pond_cesm, read_restart_pond_cesm, & restart_pond_lvl, read_restart_pond_lvl, & restart_pond_topo, read_restart_pond_topo, & + restart_snow, read_restart_snow, & restart_fsd, read_restart_fsd, & restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & @@ -263,12 +286,13 @@ subroutine init_restart iblk ! block index logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & - tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, & + tr_pond_topo, tr_snow, tr_fsd, tr_iso, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & + nt_smice, nt_smliq, nt_rhos, nt_rsnw, & nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice character(len=*), parameter :: subname = '(init_restart)' @@ -283,10 +307,12 @@ subroutine init_restart call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & - tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) + tr_snow_out=tr_snow, tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & + nt_rhos_out=nt_rhos, nt_rsnw_out=nt_rsnw, & nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -295,7 +321,7 @@ subroutine init_restart if (trim(runtype) == 'continue') then ! start from core restart file call restartfile() ! given by pointer in ice_in - call calendar ! update time parameters + call calendar() ! update time parameters if (kdyn == 2) call read_restart_eap ! EAP else if (restart) then ! ice_ic = core restart file call restartfile (ice_ic) ! or 'default' or 'none' @@ -383,6 +409,22 @@ subroutine init_restart enddo ! iblk endif ! .not. restart_pond endif + + ! snow redistribution/metamorphism + if (tr_snow) then + if (trim(runtype) == 'continue') restart_snow = .true. + if (restart_snow) then + call read_restart_snow + else + do iblk = 1, nblocks + call init_snowtracers(trcrn(:,:,nt_smice:nt_smice+nslyr-1,:,iblk), & + trcrn(:,:,nt_smliq:nt_smliq+nslyr-1,:,iblk), & + trcrn(:,:,nt_rhos :nt_rhos +nslyr-1,:,iblk), & + trcrn(:,:,nt_rsnw :nt_rsnw +nslyr-1,:,iblk)) + enddo ! iblk + endif + endif + ! floe size distribution if (tr_fsd) then if (trim(runtype) == 'continue') restart_fsd = .true. @@ -399,7 +441,7 @@ subroutine init_restart if (restart_iso) then call read_restart_iso else - do iblk = 1, nblocks + do iblk = 1, nblocks call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), & trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk)) enddo ! iblk diff --git a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 index 6ede4411d..d2efaa8d4 100644 --- a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 @@ -15,16 +15,18 @@ module CICE_RunMod use ice_kinds_mod - use perf_mod, only : t_startf, t_stopf, t_barrierf + use ice_communicate, only: my_task, master_task use ice_fileunits, only: nu_diag use ice_arrays_column, only: oceanmixed_ice use ice_constants, only: c0, c1 use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice + use ice_memusage, only: ice_memusage_print use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes + use perf_mod, only : t_startf, t_stopf, t_barrierf implicit none private @@ -44,7 +46,7 @@ module CICE_RunMod subroutine CICE_Run - use ice_calendar, only: istep, istep1, dt, stop_now, calendar, advance_timestep + use ice_calendar, only: istep, istep1, dt, stop_now, advance_timestep use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & @@ -73,25 +75,15 @@ subroutine CICE_Run if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - !-------------------------------------------------------------------- - ! timestep loop - !-------------------------------------------------------------------- - -! timeLoop: do - -! call ice_step - +! tcraig, use advance_timestep now ! istep = istep + 1 ! update time step counters ! istep1 = istep1 + 1 ! time = time + dt ! determine the time and date - ! call calendar(time) ! at the end of the timestep - - call advance_timestep() ! advance timestep and update calendar data + call advance_timestep() ! advance time call ice_timer_start(timer_couple) ! atm/ocn coupling -! for standalone ! for now, wave_spectrum is constant in time ! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice ! call get_forcing_atmo ! atmospheric forcing from data @@ -103,22 +95,17 @@ subroutine CICE_Run ! ! if (tr_aero) call faero_data ! data file ! ! if (tr_zaero) call fzaero_data ! data file (gx1) ! if (tr_aero .or. tr_zaero) call faero_default ! default values -! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry +! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry if (z_tracers) call get_atm_bgc ! biogeochemistry call init_flux_atm ! Initialize atmosphere fluxes sent to coupler call init_flux_ocn ! initialize ocean fluxes sent to coupler -! call calendar(time) ! at the end of the timestep - call ice_timer_stop(timer_couple) ! atm/ocn coupling call ice_step -! if (stop_now >= 1) exit timeLoop -! enddo timeLoop - !-------------------------------------------------------------------- ! end of timestep loop !-------------------------------------------------------------------- @@ -139,7 +126,7 @@ subroutine ice_step use ice_boundary, only: ice_HaloUpdate use ice_calendar, only: dt, dt_dyn, ndtd, diagfreq, write_restart, istep use ice_calendar, only: idate, msec - use ice_diagnostics, only: init_mass_diags, runtime_diags + use ice_diagnostics, only: init_mass_diags, runtime_diags, debug_model, debug_ice use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags use ice_domain, only: halo_info, nblocks use ice_dyn_eap, only: write_restart_eap @@ -152,12 +139,13 @@ subroutine ice_step use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_iso, write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine, & + write_restart_snow use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & update_state, step_dyn_horiz, step_dyn_ridge, step_radiation, & - biogeochemistry, step_prep, step_dyn_wave + biogeochemistry, step_prep, step_dyn_wave, step_snow use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_diags, timer_column, timer_thermo, timer_bound, & timer_hist, timer_readwrite @@ -173,19 +161,28 @@ subroutine ice_step offset ! d(age)/dt time offset logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_lvl, tr_fsd, & + tr_iage, tr_FY, tr_lvl, tr_fsd, tr_snow, & tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' + character (len=char_len) :: plabeld + + if (debug_model) then + plabeld = 'beginning time step' + do iblk = 1, nblocks + call debug_ice (iblk, plabeld) + enddo + endif + call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc, skl_bgc_out=skl_bgc, & solve_zsal_out=solve_zsal, z_tracers_out=z_tracers, ktherm_out=ktherm, & wave_spec_out=wave_spec) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd, tr_snow_out=tr_snow) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -206,6 +203,9 @@ subroutine ice_step call init_history_bgc call ice_timer_stop(timer_diags) ! diagnostics/history + call ice_timer_start(timer_column) ! column physics + call ice_timer_start(timer_thermo) ! thermodynamics + if (prescribed_ice) then ! read prescribed ice call t_barrierf('cice_run_presc_BARRIER',MPI_COMM_ICE) call t_startf ('cice_run_presc') @@ -215,13 +215,9 @@ subroutine ice_step call step_prep - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics - - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - - if (ktherm >= 0) then + if (ktherm >= 0) then + !$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime) + do iblk = 1, nblocks !----------------------------------------------------------------- ! scale radiation fields @@ -229,19 +225,39 @@ subroutine ice_step if (calc_Tsfc) call prep_radiation (iblk) + if (debug_model) then + plabeld = 'post prep_radiation' + call debug_ice (iblk, plabeld) + endif + !----------------------------------------------------------------- ! thermodynamics and biogeochemistry !----------------------------------------------------------------- - + call step_therm1 (dt, iblk) ! vertical thermodynamics + + if (debug_model) then + plabeld = 'post step_therm1' + call debug_ice (iblk, plabeld) + endif + call biogeochemistry (dt, iblk) ! biogeochemistry - if (.not.prescribed_ice) & - call step_therm2 (dt, iblk) ! ice thickness distribution thermo - endif ! ktherm > 0 + if (debug_model) then + plabeld = 'post biogeochemistry' + call debug_ice (iblk, plabeld) + endif - enddo ! iblk - !$OMP END PARALLEL DO + call step_therm2 (dt, iblk) ! ice thickness distribution thermo + + if (debug_model) then + plabeld = 'post step_therm2' + call debug_ice (iblk, plabeld) + endif + + enddo + !$OMP END PARALLEL DO + endif ! ktherm > 0 ! clean up, update tendency diagnostics offset = dt @@ -254,8 +270,6 @@ subroutine ice_step ! dynamics, transport, ridging !----------------------------------------------------------------- - if (.not.prescribed_ice) then - ! wave fracture of the floe size distribution ! note this is called outside of the dynamics subcycling loop if (tr_fsd .and. wave_spec) call step_dyn_wave(dt) @@ -265,39 +279,81 @@ subroutine ice_step ! momentum, stress, transport call step_dyn_horiz (dt_dyn) + if (debug_model) then + plabeld = 'post step_dyn_horiz' + do iblk = 1, nblocks + call debug_ice (iblk, plabeld) + enddo ! iblk + endif + ! ridging - !$OMP PARALLEL DO PRIVATE(iblk) + !$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime) do iblk = 1, nblocks if (kridge > 0) call step_dyn_ridge (dt_dyn, ndtd, iblk) enddo !$OMP END PARALLEL DO + if (debug_model) then + plabeld = 'post step_dyn_ridge' + do iblk = 1, nblocks + call debug_ice (iblk, plabeld) + enddo ! iblk + endif + ! clean up, update tendency diagnostics offset = c0 call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset) enddo - endif ! not prescribed ice + if (debug_model) then + plabeld = 'post dynamics' + do iblk = 1, nblocks + call debug_ice (iblk, plabeld) + enddo + endif + + call ice_timer_start(timer_column) ! column physics + call ice_timer_start(timer_thermo) ! thermodynamics !----------------------------------------------------------------- - ! albedo, shortwave radiation + ! snow redistribution and metamorphosis !----------------------------------------------------------------- - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics + if (tr_snow) then ! advanced snow physics + !$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime) + do iblk = 1, nblocks + call step_snow (dt, iblk) + enddo + !$OMP END PARALLEL DO + call update_state (dt) ! clean up + endif - !$OMP PARALLEL DO PRIVATE(iblk) + !$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime) do iblk = 1, nblocks + !----------------------------------------------------------------- + ! albedo, shortwave radiation + !----------------------------------------------------------------- + if (ktherm >= 0) call step_radiation (dt, iblk) + if (debug_model) then + plabeld = 'post step_radiation' + call debug_ice (iblk, plabeld) + endif + !----------------------------------------------------------------- ! get ready for coupling and the next time step !----------------------------------------------------------------- call coupling_prep (iblk) + if (debug_model) then + plabeld = 'post coupling_prep' + call debug_ice (iblk, plabeld) + endif + enddo ! iblk !$OMP END PARALLEL DO @@ -319,6 +375,9 @@ subroutine ice_step if (solve_zsal) call zsal_diags if (skl_bgc .or. z_tracers) call bgc_diags if (tr_brine) call hbrine_diags + if (my_task == master_task) then + call ice_memusage_print(nu_diag,subname) + endif endif call ice_timer_stop(timer_diags) ! diagnostics @@ -335,6 +394,7 @@ subroutine ice_step if (tr_pond_cesm) call write_restart_pond_cesm if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo + if (tr_snow) call write_restart_snow if (tr_fsd) call write_restart_fsd if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero @@ -344,7 +404,6 @@ subroutine ice_step if (kdyn == 2) call write_restart_eap call final_restart endif - call ice_timer_stop(timer_readwrite) ! reading/writing end subroutine ice_step @@ -367,8 +426,8 @@ subroutine coupling_prep (iblk) albpnd, albcnt, apeff_ai, fpond, fresh, l_mpond_fresh, & alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, & fresh_ai, fsalt_ai, fsalt, & - fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, & - fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf, & + fswthru_ai, fhocn, scale_factor, snowfrac, & + fswthru, fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt, Uref, wind @@ -410,8 +469,6 @@ subroutine coupling_prep (iblk) character(len=*), parameter :: subname = '(coupling_prep)' - !----------------------------------------------------------------- - call icepack_query_parameters(puny_out=puny, rhofresh_out=rhofresh) call icepack_query_parameters(skl_bgc_out=skl_bgc) call icepack_query_tracer_sizes(nbtrcr_out=nbtrcr) @@ -566,11 +623,12 @@ subroutine coupling_prep (iblk) evap (:,:,iblk), & Tref (:,:,iblk), Qref (:,:,iblk), & fresh (:,:,iblk), fsalt (:,:,iblk), & - fhocn (:,:,iblk), fswthru (:,:,iblk), & - fswthru_vdr(:,:,iblk), & - fswthru_vdf(:,:,iblk), & - fswthru_idr(:,:,iblk), & - fswthru_idf(:,:,iblk), & + fhocn (:,:,iblk), & + fswthru (:,:,iblk), & + fswthru_vdr (:,:,iblk), & + fswthru_vdf (:,:,iblk), & + fswthru_idr (:,:,iblk), & + fswthru_idf (:,:,iblk), & faero_ocn(:,:,:,iblk), & alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & @@ -581,10 +639,6 @@ subroutine coupling_prep (iblk) fiso_ocn =fiso_ocn (:,:,:,iblk), & Uref=Uref(:,:,iblk), wind=wind(:,:,iblk) ) - !----------------------------------------------------------------- - ! Define ice-ocean bgc fluxes - !----------------------------------------------------------------- - if (nbtrcr > 0 .or. skl_bgc) then call bgcflux_ice_to_ocn (nx_block, ny_block, & flux_bio(:,:,1:nbtrcr,iblk), & @@ -616,6 +670,7 @@ subroutine coupling_prep (iblk) end subroutine coupling_prep + !======================================================================= ! ! If surface heat fluxes are provided to CICE instead of CICE calculating @@ -651,7 +706,6 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) -#ifdef CICE_IN_NEMO ! local variables integer (kind=int_kind) :: & @@ -659,11 +713,12 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & real (kind=dbl_kind) :: & puny, & ! + Lsub, & ! rLsub ! 1/Lsub character(len=*), parameter :: subname = '(sfcflux_to_ocn)' - call icepack_query_parameters(puny_out=puny) + call icepack_query_parameters(puny_out=puny, Lsub_out=Lsub) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -682,7 +737,6 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & enddo ! j enddo ! n -#endif end subroutine sfcflux_to_ocn diff --git a/cicecore/drivers/mct/cesm1/ice_import_export.F90 b/cicecore/drivers/mct/cesm1/ice_import_export.F90 index f88cc2b2d..3acf9bdaa 100644 --- a/cicecore/drivers/mct/cesm1/ice_import_export.F90 +++ b/cicecore/drivers/mct/cesm1/ice_import_export.F90 @@ -65,7 +65,6 @@ subroutine ice_import( x2i ) type(block) :: this_block ! block information for current block integer,parameter :: nflds=17,nfldv=6,nfldb=27 real (kind=dbl_kind),allocatable :: aflds(:,:,:,:) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: work real (kind=dbl_kind) :: workx, worky real (kind=dbl_kind) :: MIN_RAIN_TEMP, MAX_SNOW_TEMP character(len=char_len) :: tfrz_option @@ -469,19 +468,10 @@ subroutine ice_import( x2i ) if (.not.prescribed_ice) then call t_startf ('cice_imp_t2u') - call ice_HaloUpdate(uocn, halo_info, field_loc_center, field_type_scalar) - call ice_HaloUpdate(vocn, halo_info, field_loc_center, field_type_scalar) - call ice_HaloUpdate(ss_tltx, halo_info, field_loc_center, field_type_scalar) - call ice_HaloUpdate(ss_tlty, halo_info, field_loc_center, field_type_scalar) - ! tcraig, moved to dynamics for consistency - !work = uocn - !call grid_average_X2Y('F',work,'T',uocn,'U') - !work = vocn - !call grid_average_X2Y('F',work,'T',vocn,'U') - !work = ss_tltx - !call grid_average_X2Y('F',work,'T',ss_tltx,'U') - !work = ss_tlty - !call grid_average_X2Y('F',work,'T',ss_tlty,'U') + call ice_HaloUpdate(uocn, halo_info, field_loc_center, field_type_vector) + call ice_HaloUpdate(vocn, halo_info, field_loc_center, field_type_vector) + call ice_HaloUpdate(ss_tltx, halo_info, field_loc_center, field_type_vector) + call ice_HaloUpdate(ss_tlty, halo_info, field_loc_center, field_type_vector) call t_stopf ('cice_imp_t2u') end if