Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mom_mosaic
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Nov 7, 2024
2 parents ff7d76a + b3d5813 commit d0f8a34
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 141 deletions.
22 changes: 18 additions & 4 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ subroutine input_data
diag_file, print_global, print_points, latpnt, lonpnt, &
debug_model, debug_model_step, debug_model_task, &
debug_model_i, debug_model_j, debug_model_iblk
use ice_domain, only: close_boundaries, orca_halogrid
use ice_domain, only: close_boundaries
use ice_domain_size, only: &
ncat, nilyr, nslyr, nblyr, nfsd, nfreq, &
n_iso, n_aero, n_zaero, n_algae, &
Expand Down Expand Up @@ -174,6 +174,7 @@ subroutine input_data
logical (kind=log_kind) :: tr_pond_lvl, tr_pond_topo
integer (kind=int_kind) :: numin, numax ! unit number limits
logical (kind=log_kind) :: lcdf64 ! deprecated, backwards compatibility
logical (kind=log_kind) :: orca_halogrid !deprecated

integer (kind=int_kind) :: rplvl, rptopo
real (kind=dbl_kind) :: Cf, ksno, puny, ice_ref_salinity, Tocnfrz
Expand Down Expand Up @@ -382,7 +383,7 @@ subroutine input_data
grid_atm = 'A' ! underlying atm forcing/coupling grid
grid_ocn = 'A' ! underlying atm forcing/coupling grid
gridcpl_file = 'unknown_gridcpl_file'
orca_halogrid = .false. ! orca haloed grid
orca_halogrid = .false. ! orca haloed grid - deprecated
bathymetry_file = 'unknown_bathymetry_file'
bathymetry_format = 'default'
use_bathymetry = .false.
Expand Down Expand Up @@ -1266,7 +1267,7 @@ subroutine input_data
endif
abort_list = trim(abort_list)//":1"
endif

if (history_format /= 'cdf1' .and. &
history_format /= 'cdf2' .and. &
history_format /= 'cdf5' .and. &
Expand Down Expand Up @@ -1829,6 +1830,20 @@ subroutine input_data
endif
endif

if (orca_halogrid) then
if (my_task == master_task) then
write(nu_diag,*) subname//' ERROR: orca_halogrid has been deprecated'
endif
abort_list = trim(abort_list)//":63"
endif

if (trim(grid_type) == 'cpom_grid') then
if (my_task == master_task) then
write(nu_diag,*) subname//" ERROR: grid_type = 'cpom_grid' has been deprecated"
endif
abort_list = trim(abort_list)//":64"
endif

ice_IOUnitsMinUnit = numin
ice_IOUnitsMaxUnit = numax

Expand Down Expand Up @@ -2579,7 +2594,6 @@ subroutine input_data
if (trim(kmt_type) == 'file') &
write(nu_diag,1031) ' kmt_file = ', trim(kmt_file)
endif
write(nu_diag,1011) ' orca_halogrid = ', orca_halogrid

write(nu_diag,1011) ' conserv_check = ', conserv_check

Expand Down
3 changes: 1 addition & 2 deletions cicecore/cicedyn/infrastructure/ice_domain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ module ice_domain
maskhalo_remap , & ! if true, use masked halo updates for transport
maskhalo_bound , & ! if true, use masked halo updates for bound_state
halo_dynbundle , & ! if true, bundle halo update in dynamics
landblockelim , & ! if true, land block elimination is on
orca_halogrid ! if true, input fields are haloed as defined by orca grid
landblockelim ! if true, land block elimination is on

!-----------------------------------------------------------------------
!
Expand Down
165 changes: 41 additions & 124 deletions cicecore/cicedyn/infrastructure/ice_read_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module ice_read_write
field_loc_noupdate, field_type_noupdate
use ice_communicate, only: my_task, master_task
use ice_broadcast, only: broadcast_scalar
use ice_domain, only: distrb_info, orca_halogrid
use ice_domain, only: distrb_info
use ice_domain_size, only: max_blocks, nx_global, ny_global, ncat
use ice_blocks, only: nx_block, ny_block, nghost
use ice_exit, only: abort_ice
Expand Down Expand Up @@ -1143,20 +1143,8 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &

integer (kind=int_kind) :: lnrec ! local value of nrec

real (kind=dbl_kind), dimension(:,:), allocatable :: &
work_g2

lnrec = nrec

if (orca_halogrid .and. .not. present(restart_ext)) then
if (my_task == master_task) then
allocate(work_g2(nx_global+2,ny_global+1))
else
allocate(work_g2(1,1)) ! to save memory
endif
work_g2(:,:) = c0
endif

nx = nx_global
ny = ny_global

Expand Down Expand Up @@ -1207,18 +1195,10 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
! Read global array
!--------------------------------------------------------------

if (orca_halogrid .and. .not. present(restart_ext)) then
status = nf90_get_var( fid, varid, work_g2, &
start=(/1,1,lnrec/), count=(/nx_global+2,ny_global+1,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
work_g1 = work_g2(2:nx_global+1,1:ny_global)
else
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,lnrec/), count=(/nx,ny,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
endif
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,lnrec/), count=(/nx,ny,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)

endif ! my_task = master_task

Expand Down Expand Up @@ -1272,8 +1252,6 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
! echmod: this should not be necessary if fill/missing are only on land
where (work > 1.0e+30_dbl_kind) work = c0

if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2)

#else
work = c0 ! to satisfy intent(out) attribute
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
Expand Down Expand Up @@ -1346,20 +1324,8 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &

integer (kind=int_kind) :: lnrec ! local value of nrec

real (kind=dbl_kind), dimension(:,:,:), allocatable :: &
work_g2

lnrec = nrec

if (orca_halogrid .and. .not. present(restart_ext)) then
if (my_task == master_task) then
allocate(work_g2(nx_global+2,ny_global+1,ncat))
else
allocate(work_g2(1,1,ncat)) ! to save memory
endif
work_g2(:,:,:) = c0
endif

nx = nx_global
ny = ny_global

Expand Down Expand Up @@ -1408,18 +1374,10 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &
! Read global array
!--------------------------------------------------------------

if (orca_halogrid .and. .not. present(restart_ext)) then
status = nf90_get_var( fid, varid, work_g2, &
start=(/1,1,1,lnrec/), count=(/nx_global+2,ny_global+1,ncat,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
work_g1 = work_g2(2:nx_global+1,1:ny_global,:)
else
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,1,lnrec/), count=(/nx,ny,ncat,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
endif
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,1,lnrec/), count=(/nx,ny,ncat,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)

endif ! my_task = master_task

Expand Down Expand Up @@ -1478,7 +1436,6 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &
endif

deallocate(work_g1)
if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2)

#else
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
Expand Down Expand Up @@ -1558,20 +1515,9 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, &
character(len=*), parameter :: subname = '(ice_read_nc_xyf)'

#ifdef USE_NETCDF
real (kind=dbl_kind), dimension(:,:,:), allocatable :: &
work_g2

lnrec = nrec

if (orca_halogrid .and. .not. present(restart_ext)) then
if (my_task == master_task) then
allocate(work_g2(nx_global+2,ny_global+1,nfreq))
else
allocate(work_g2(1,1,nfreq)) ! to save memory
endif
work_g2(:,:,:) = c0
endif

nx = nx_global
ny = ny_global

Expand Down Expand Up @@ -1620,18 +1566,10 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, &
! Read global array
!--------------------------------------------------------------

if (orca_halogrid .and. .not. present(restart_ext)) then
status = nf90_get_var( fid, varid, work_g2, &
start=(/1,1,1,lnrec/), count=(/nx_global+2,ny_global+1,nfreq,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
work_g1 = work_g2(2:nx_global+1,1:ny_global,:)
else
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,1,lnrec/), count=(/nx,ny,nfreq,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
endif
status = nf90_get_var( fid, varid, work_g1, &
start=(/1,1,1,lnrec/), count=(/nx,ny,nfreq,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)

endif ! my_task = master_task

Expand Down Expand Up @@ -1693,7 +1631,6 @@ subroutine ice_read_nc_xyf(fid, nrec, varname, work, diag, &
where (work > 1.0e+30_dbl_kind) work = c0

deallocate(work_g1)
if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2)

#else
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
Expand Down Expand Up @@ -2501,17 +2438,6 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag)
! character (char_len) :: &
! dimname ! dimension name
!
real (kind=dbl_kind), dimension(:,:), allocatable :: &
work_g3

if (orca_halogrid) then
if (my_task == master_task) then
allocate(work_g3(nx_global+2,ny_global+1))
else
allocate(work_g3(1,1)) ! to save memory
endif
work_g3(:,:) = c0
endif

work_g(:,:) = c0

Expand All @@ -2529,42 +2455,35 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag)
! Read global array
!--------------------------------------------------------------

if (orca_halogrid) then
status = nf90_get_var( fid, varid, work_g3, &
start=(/1,1,nrec/), count=(/nx_global+2,ny_global+1,1/))
call ice_check_nc(status, subname//' ERROR: Cannot get variable '//trim(varname), &
file=__FILE__, line=__LINE__)
work_g=work_g3(2:nx_global+1,1:ny_global)
else
! 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__)
! 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

!-------------------------------------------------------------------
Expand All @@ -2587,8 +2506,6 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag)
write(nu_diag,*) subname,' min, max, sum = ', amin, amax, asum, trim(varname)
endif

if (orca_halogrid) deallocate(work_g3)

#else
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
file=__FILE__, line=__LINE__)
Expand Down
1 change: 1 addition & 0 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
myear = (idate/10000) ! integer year of basedate
mmonth= (idate-myear*10000)/100 ! integer month of basedate
mday = idate-myear*10000-mmonth*100 ! day of month of basedate
msec = start_tod ! start from basedate

if (my_task == master_task) then
write(nu_diag,*) trim(subname),' curr_ymd = ',curr_ymd
Expand Down
1 change: 0 additions & 1 deletion configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
nilyr = 7
nslyr = 1
nblyr = 1
orca_halogrid = .false.
/

&tracer_nml
Expand Down
14 changes: 5 additions & 9 deletions configuration/scripts/tests/base_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ smoke gx3 1x4 debug,diag1,run2day
smoke gx3 4x1 debug,diag1,run5day
restart gx3 8x2 debug
restart gx3 8x2 debug,gx3nc
smoke gx3 8x2 diag24,run1year,medium
smoke gx3 8x2 diag24,run1year,long
smoke gx3 7x2 diag1,bigdiag,run1day,diagpt1
decomp gx3 4x2x25x29x5 none
smoke gx3 4x2 diag1,run5day smoke_gx3_8x2_diag1_run5day
Expand All @@ -14,21 +14,17 @@ smoke gx3 1x8 diag1,run5day,evp1d
restart gx1 40x4 droundrobin,medium
restart tx1 40x4 dsectrobin,medium
restart tx1 40x4 dsectrobin,medium,jra55do
restart gx3 4x4 short
restart gx3 4x4 medium
restart gx3 4x4 gx3nc,short
restart gx3 10x4 maskhalo,short
restart gx3 10x4 maskhalo,medium
restart gx3 6x2 alt01
restart gx3 8x2 alt02
restart gx3 4x2 alt03
restart gx3 12x2 alt03,maskhalo,droundrobin
restart gx3 4x4 alt04
restart gx3 4x4 alt05,short
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
Expand Down Expand Up @@ -80,7 +76,7 @@ smoke gx3 4x1 snwitdrdg,snwgrain,icdefault,debug
smoke gx3 4x1 snw30percent,icdefault,debug
restart gx3 8x2 snwitdrdg,icdefault,snwgrain
restart gx3 4x4 gx3ncarbulk,iobinary,medium
restart gx3 4x4 cdf64,histall,precision8,short
restart gx3 4x4 cdf64,histall,precision8,medium
smoke gx3 30x1 bgcz,histall
smoke gx3 14x2 fsd12,histall
smoke gx3 4x1 dynpicard
Expand Down
Loading

0 comments on commit d0f8a34

Please sign in to comment.