Skip to content

Commit

Permalink
Update CICE from Consortium/main (NOAA-EMC#62)
Browse files Browse the repository at this point in the history
* Fix CESMCOUPLED compile issue in icepack. (CICE-Consortium#823)
* Update global reduction implementation to improve performance, fix VP bug (CICE-Consortium#824)
* Update VP global sum to exclude local implementation with tripole grids
* Add functionality to change hist_avg for each stream (CICE-Consortium#827)
* Update Icepack to #6703bc533c968 May 22, 2023 (CICE-Consortium#829)
* Fix for mesh check in CESM driver (CICE-Consortium#830)
* Namelist option for time axis position. (CICE-Consortium#839)
  • Loading branch information
DeniseWorthen committed Sep 22, 2023
1 parent 630d1b3 commit 69ce14b
Show file tree
Hide file tree
Showing 47 changed files with 1,469 additions and 103 deletions.
10 changes: 10 additions & 0 deletions cicecore/cicedyn/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,17 @@ subroutine runtime_diags (dt)
enddo
enddo
!$OMP END PARALLEL DO
<<<<<<< HEAD
extentn = global_sum(work1, distrb_info, field_loc_center, &
tarean)
extents = global_sum(work1, distrb_info, field_loc_center, &
tareas)
=======
extentn = c0
extents = c0
extentn = global_sum(work1, distrb_info, field_loc_center, tarean)
extents = global_sum(work1, distrb_info, field_loc_center, tareas)
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
extentn = extentn * m2_to_km2
extents = extents * m2_to_km2

Expand Down Expand Up @@ -1882,6 +1889,7 @@ subroutine print_state(plabel,i,j,iblk)
end subroutine print_state

!=======================================================================
<<<<<<< HEAD
#ifdef UNDEPRECATE_print_points_state

! This routine is useful for debugging.
Expand Down Expand Up @@ -2027,6 +2035,8 @@ subroutine print_points_state(plabel,ilabel)
end subroutine print_points_state
#endif
!=======================================================================
=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))

! prints error information prior to aborting

Expand Down
8 changes: 8 additions & 0 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ subroutine init_hist (dt)
endif
end do
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90

=======
Expand All @@ -316,6 +317,9 @@ subroutine init_hist (dt)
=======

>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======

>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand Down Expand Up @@ -2302,6 +2306,7 @@ subroutine accum_hist (dt)
n4Dfcum = n4Dscum + num_avail_hist_fields_4Df ! should equal num_avail_hist_fields_tot

do ns = 1,nstreams
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
if (.not. hist_avg(ns)) then ! write snapshots
Expand All @@ -2311,6 +2316,9 @@ subroutine accum_hist (dt)
=======
if (.not. hist_avg) then ! write snapshots
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_history.F90
=======
if (.not. hist_avg(ns)) then ! write snapshots
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
do n = 1,n2D
if (avail_hist_fields(n)%vhistfreq == histfreq(ns)) &
a2D(:,:,n,:) = c0
Expand Down
9 changes: 8 additions & 1 deletion cicecore/cicedyn/analysis/ice_history_pond.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ subroutine init_hist_pond_2D
file=__FILE__, line=__LINE__)
endif

<<<<<<< HEAD
! goto this namelist in file
call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
Expand All @@ -142,13 +143,15 @@ subroutine init_hist_pond_2D
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history_pond.F90
=======

=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
! goto this namelist in file
call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: searching for '// trim(nml_name), &
file=__FILE__, line=__LINE__)
endif

! read namelist
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
nml_error = 1
Expand All @@ -164,6 +167,7 @@ subroutine init_hist_pond_2D
endif
end do
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_pond.F90

=======
Expand All @@ -175,6 +179,9 @@ subroutine init_hist_pond_2D
=======

>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======

>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand Down
8 changes: 8 additions & 0 deletions cicecore/cicedyn/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ subroutine construct_filename(ncfile,suffix,ns)
imonth,'-',iday,'-',isec,'.',trim(suffix)
else

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
Expand All @@ -796,6 +797,9 @@ subroutine construct_filename(ncfile,suffix,ns)
=======
if (hist_avg) then
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_history_shared.F90
=======
if (hist_avg(ns)) then
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
if (histfreq(ns) == '1' .or. histfreq(ns) == 'h'.or.histfreq(ns) == 'H') then
! do nothing
elseif (new_year) then
Expand Down Expand Up @@ -837,6 +841,7 @@ subroutine construct_filename(ncfile,suffix,ns)
!echmod ! of other groups (including RASM which uses CESMCOUPLED)
!echmod if (ns > 1) write(cstream,'(i1.1)') ns-1

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_shared.F90
Expand All @@ -847,6 +852,9 @@ subroutine construct_filename(ncfile,suffix,ns)
=======
if (hist_avg) then ! write averaged data
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_history_shared.F90
=======
if (hist_avg(ns)) then ! write averaged data
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
if (histfreq(ns) == '1' .and. histfreq_n(ns) == 1) then ! timestep
write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') &
history_file(1:lenstr(history_file))//trim(cstream),'_inst.', &
Expand Down
4 changes: 4 additions & 0 deletions cicecore/cicedyn/analysis/ice_history_snow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ subroutine init_hist_snow_2D (dt)
integer (kind=int_kind) :: ns
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
real (kind=dbl_kind) :: rhofresh, secday
<<<<<<< HEAD
<<<<<<< HEAD
logical (kind=log_kind) :: tr_snow
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_snow.F90
Expand All @@ -102,6 +103,9 @@ subroutine init_hist_snow_2D (dt)
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_history_snow.F90
=======
logical (kind=log_kind) :: tr_snow
=======
logical (kind=log_kind) :: tr_snow
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
character(len=char_len_long) :: tmpstr2 ! for namelist check
character(len=char_len) :: nml_name ! for namelist check

Expand Down
48 changes: 34 additions & 14 deletions cicecore/cicedyn/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3587,11 +3587,15 @@ function global_dot_product (nx_block , ny_block , &
vector2_x , vector2_y) &
result(dot_product)

<<<<<<< HEAD
<<<<<<< HEAD
use ice_domain, only: distrb_info, ns_boundary_type
=======
use ice_domain, only: distrb_info
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======
use ice_domain, only: distrb_info, ns_boundary_type
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
use ice_domain_size, only: max_blocks
use ice_fileunits, only: bfbflag

Expand Down Expand Up @@ -3642,6 +3646,9 @@ function global_dot_product (nx_block , ny_block , &
!$OMP END PARALLEL DO

<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
! Use faster local summation result for several bfbflag settings.
! The local implementation sums over each block, sums over local
! blocks, and calls global_sum on a scalar and should be just as accurate as
Expand All @@ -3650,10 +3657,13 @@ function global_dot_product (nx_block , ny_block , &
! if bfbflag is more strict or for tripole grids (requires special masking)
if (ns_boundary_type /= 'tripole' .and. ns_boundary_type /= 'tripoleT' .and. &
(bfbflag == 'off' .or. bfbflag == 'lsum8' .or. bfbflag == 'lsum4')) then
<<<<<<< HEAD
=======
! Use local summation result unless bfbflag is active
if (bfbflag == 'off') then
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
dot_product = global_sum(sum(dot), distrb_info)
else
dot_product = global_sum(prod, distrb_info, field_loc_NEcorner)
Expand Down Expand Up @@ -4487,11 +4497,15 @@ subroutine fgmres (zetaD , &
j = indxUj(ij, iblk)

workspace_x(i, j, iblk) = workspace_x(i, j, iblk) + rhs_hess(it) * arnoldi_basis_x(i, j, iblk, it)
<<<<<<< HEAD
<<<<<<< HEAD
workspace_y(i, j, iblk) = workspace_y(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
=======
workspace_y(i, j, iblk) = workspace_x(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======
workspace_y(i, j, iblk) = workspace_y(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
enddo ! ij
enddo
!$OMP END PARALLEL DO
Expand Down Expand Up @@ -4531,6 +4545,9 @@ subroutine pgmres (zetaD , &
use ice_boundary, only: ice_HaloUpdate
use ice_domain, only: maskhalo_dyn, halo_info
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks,4), intent(in) :: &
Expand Down Expand Up @@ -4855,22 +4872,21 @@ subroutine pgmres (zetaD , &
=======

! Update workspace with boundary values
! NOTE: skipped for efficiency since this is just a preconditioner
! unless bfbflag is active
if (bfbflag /= 'off') then
call stack_fields(workspace_x, workspace_y, fld2)
call ice_timer_start(timer_bound)
if (maskhalo_dyn) then
call ice_HaloUpdate (fld2, halo_info_mask, &
field_loc_NEcorner, field_type_vector)
else
call ice_HaloUpdate (fld2, halo_info, &
field_loc_NEcorner, field_type_vector)
endif
call ice_timer_stop(timer_bound)
call unstack_fields(fld2, workspace_x, workspace_y)
call stack_fields(workspace_x, workspace_y, fld2)
call ice_timer_start(timer_bound)
if (maskhalo_dyn) then
call ice_HaloUpdate (fld2, halo_info_mask, &
field_loc_NEcorner, field_type_vector)
else
call ice_HaloUpdate (fld2, halo_info, &
field_loc_NEcorner, field_type_vector)
endif
<<<<<<< HEAD
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======
call ice_timer_stop(timer_bound)
call unstack_fields(fld2, workspace_x, workspace_y)
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))

!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
Expand Down Expand Up @@ -5155,11 +5171,15 @@ subroutine pgmres (zetaD , &
j = indxUj(ij, iblk)

workspace_x(i, j, iblk) = workspace_x(i, j, iblk) + rhs_hess(it) * arnoldi_basis_x(i, j, iblk, it)
<<<<<<< HEAD
<<<<<<< HEAD
workspace_y(i, j, iblk) = workspace_y(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
=======
workspace_y(i, j, iblk) = workspace_x(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
=======
workspace_y(i, j, iblk) = workspace_y(i, j, iblk) + rhs_hess(it) * arnoldi_basis_y(i, j, iblk, it)
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
enddo ! ij
enddo
!$OMP END PARALLEL DO
Expand Down
37 changes: 37 additions & 0 deletions cicecore/cicedyn/dynamics/ice_transport_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ module ice_transport_driver
! 'remap' => remapping scheme
! 'none' => advection off (ktransport = -1 also turns it off)

<<<<<<< HEAD
logical, parameter :: & ! if true, prescribe area flux across each edge
l_fixed_area = .false.

=======
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))
! NOTE: For remapping, hice and hsno are considered tracers.
! ntrace is not equal to ntrcr!

Expand Down Expand Up @@ -82,6 +85,7 @@ subroutine init_transport
use ice_state, only: trcr_depend
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_advect
use ice_transport_remap, only: init_remap
use ice_grid, only: grid_ice

integer (kind=int_kind) :: &
k, nt, nt1 ! tracer indices
Expand Down Expand Up @@ -229,7 +233,13 @@ subroutine init_transport

if (trim(advection)=='remap') call init_remap ! grid quantities

<<<<<<< HEAD
call ice_timer_stop(timer_advect) ! advection
=======
if (trim(advection)=='remap') call init_remap ! grid quantities

call ice_timer_stop(timer_advect) ! advection
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))

end subroutine init_transport

Expand Down Expand Up @@ -528,6 +538,7 @@ subroutine transport_remap (dt)

endif ! l_monotonicity_check

<<<<<<< HEAD
!-------------------------------------------------------------------
! Main remapping routine: Step ice area and tracers forward in time.
!-------------------------------------------------------------------
Expand All @@ -543,6 +554,32 @@ subroutine transport_remap (dt)
!-------------------------------------------------------------------
! Given new fields, recompute state variables.
!-------------------------------------------------------------------
=======
!-------------------------------------------------------------------
! Main remapping routine: Step ice area and tracers forward in time.
!-------------------------------------------------------------------

if (grid_ice == 'CD' .or. grid_ice == 'C') then
call horizontal_remap (dt, ntrace, &
uvel (:,:,:), vvel (:,:,:), &
aim (:,:,:,:), trm(:,:,:,:,:), &
tracer_type, depend, &
has_dependents, integral_order, &
l_dp_midpt, &
uvelE (:,:,:), vvelN (:,:,:))
else
call horizontal_remap (dt, ntrace, &
uvel (:,:,:), vvel (:,:,:), &
aim (:,:,:,:), trm(:,:,:,:,:), &
tracer_type, depend, &
has_dependents, integral_order, &
l_dp_midpt)
endif

!-------------------------------------------------------------------
! Given new fields, recompute state variables.
!-------------------------------------------------------------------
>>>>>>> d41c61dd (Update CICE from Consortium/main (#62))

!$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime)
do iblk = 1, nblocks
Expand Down
Loading

0 comments on commit 69ce14b

Please sign in to comment.