Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pio and netcdf error checks #927

Merged
merged 35 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ba848b9
add gadi standalone setup
anton-seaice Dec 5, 2023
3551dbd
updates for cice standalone on gadi
anton-seaice Dec 5, 2023
4f871cb
fixes
anton-seaice Dec 5, 2023
8c728e5
this builds now for pio2 but is messy
anton-seaice Dec 6, 2023
5d95777
testing
anton-seaice Dec 11, 2023
028a376
Update test-cice.yml
anton-seaice Dec 11, 2023
7f38886
workflows
anton-seaice Dec 11, 2023
7a2c072
workflows
anton-seaice Dec 11, 2023
50f0656
workflows
anton-seaice Dec 11, 2023
2a7b25b
cice.settings?
anton-seaice Dec 11, 2023
3ea282c
Update test-cice.yml
anton-seaice Dec 11, 2023
eddf67b
Update test-cice.yml
anton-seaice Dec 11, 2023
851bdbd
Parallel IO on MacOS Conda:
anton-seaice Nov 30, 2023
2c78c32
simple netcdf4
anton-seaice Dec 1, 2023
ba4e795
pio error handling
anton-seaice Dec 14, 2023
d8227b1
tidy up io error handling
anton-seaice Dec 18, 2023
f3c96aa
tidy up io error handling
anton-seaice Dec 19, 2023
6b55fc2
tidyup
anton-seaice Dec 19, 2023
73576fc
Merge branch 'ESCOMP:main' into io_error
anton-seaice Jan 8, 2024
47446cf
Merge branch 'io_error' of https://github.com/ACCESS-NRI/CICE into io…
apcraig Jan 11, 2024
dc14ce9
Update pio and netcdf error checking
apcraig Jan 13, 2024
10da928
- Update some ERROR statements, reduce some line lengths
apcraig Jan 15, 2024
e1b071a
Update git workflow script
apcraig Jan 15, 2024
85e09a7
Update git workflow script
apcraig Jan 15, 2024
22a9aa5
Update git workflow script
apcraig Jan 15, 2024
ac9afc3
Update git workflow script
apcraig Jan 15, 2024
b8779d9
update conda_macos for compilation with parallelio
apcraig Jan 15, 2024
fa2d619
error messages cleanup
anton-seaice Jan 16, 2024
a39b881
Update error messages
apcraig Jan 16, 2024
5268d5c
typo in ice_pio
anton-seaice Jan 16, 2024
a2d2c13
Merge pull request #114 from anton-seaice/ioerrchk3
apcraig Jan 16, 2024
a4a4930
update uvm comment
apcraig Jan 18, 2024
9c4038c
Updates based on reviews
apcraig Jan 19, 2024
75e9b81
Update documentation
apcraig Jan 19, 2024
b8e6b0a
Update documentation
apcraig Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!
! The following variables are currently hard-wired as snapshots
! (instantaneous rather than time-averages):
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! frz_onset, hisnap, aisnap
!
! Options for histfreq: '1','h','d','m','y','x', where x means that
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
!
! The following variables are currently hard-wired as snapshots
! (instantaneous rather than time-averages):
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! frz_onset, hisnap, aisnap
!
! Options for histfreq: '1','h','d','m','y','x', where x means that
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ subroutine deformations (nx_block, ny_block, &
tarear ! 1/tarea

real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
vort , & ! vorticity (1/s)
vort , & ! vorticity (1/s)
shear , & ! strain rate II component (1/s)
divu , & ! strain rate I component, velocity divergence (1/s)
rdg_conv , & ! convergence term for ridging (1/s)
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/dynamics/ice_transport_remap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ subroutine construct_fields (nx_block, ny_block, &

! center of mass (mxav,myav) for each cell

mxav(i,j) = mx(i,j)*xxav / mm(i,j)
mxav(i,j) = mx(i,j)*xxav / mm(i,j)
myav(i,j) = my(i,j)*yyav / mm(i,j)

enddo
Expand Down
10 changes: 9 additions & 1 deletion cicecore/cicedyn/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module ice_forcing
daymo, days_per_year, compute_days_between
use ice_fileunits, only: nu_diag, nu_forcing
use ice_exit, only: abort_ice
use ice_read_write, only: ice_open, ice_read, &
use ice_read_write, only: ice_open, ice_read, ice_check_nc, &
ice_get_ncvarsize, ice_read_vec_nc, &
ice_open_nc, ice_read_nc, ice_close_nc
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_readwrite, &
Expand Down Expand Up @@ -3701,11 +3701,15 @@ subroutine ocn_data_ncar_init

! status = nf90_inq_dimid(fid,'nlon',dimid)
status = nf90_inq_dimid(fid,'ni',dimid)
call ice_check_nc(status, subname//'ERROR: inq dimid ni', file=__FILE__, line=__LINE__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want "ERROR: " in these messages, in some places we have them and in some places we dont.

The error messages from the netcdf library seem clear that its an error ...
https://github.com/Unidata/netcdf-c/blob/498930982d771aa2ae1600d2199ec824a68184fe/libdispatch/derror.c#L104

status = nf90_inquire_dimension(fid,dimid,len=nlon)
call ice_check_nc(status, subname//'ERROR: inq dim ni', file=__FILE__, line=__LINE__)

! status = nf90_inq_dimid(fid,'nlat',dimid)
status = nf90_inq_dimid(fid,'nj',dimid)
call ice_check_nc(status, subname//'ERROR: inq dimid nj', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlat)
call ice_check_nc(status, subname//'ERROR: inq dim nj', file=__FILE__, line=__LINE__)

if( nlon .ne. nx_global ) then
call abort_ice (error_message=subname//'ice: ocn frc file nlon ne nx_global', &
Expand Down Expand Up @@ -3862,11 +3866,15 @@ subroutine ocn_data_ncar_init_3D

! status = nf90_inq_dimid(fid,'nlon',dimid)
status = nf90_inq_dimid(fid,'ni',dimid)
call ice_check_nc(status, subname//'ERROR: inq dimid ni', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlon)
call ice_check_nc(status, subname//'ERROR: inq dim ni', file=__FILE__, line=__LINE__)

! status = nf90_inq_dimid(fid,'nlat',dimid)
status = nf90_inq_dimid(fid,'nj',dimid)
call ice_check_nc(status, subname//'ERROR: inq dimid nj', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlat)
call ice_check_nc(status, subname//'ERROR: inq dim nj', file=__FILE__, line=__LINE__)

if( nlon .ne. nx_global ) then
call abort_ice (error_message=subname//'ice: ocn frc file nlon ne nx_global', &
Expand Down
63 changes: 34 additions & 29 deletions cicecore/cicedyn/infrastructure/ice_domain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ subroutine init_domain_blocks
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: domain_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
trim(nml_filename), file=__FILE__, line=__LINE__)
endif

call goto_nml(nu_nml,trim(nml_name),nml_error)
Expand Down Expand Up @@ -242,7 +241,7 @@ subroutine init_domain_blocks
!***
!*** domain size zero or negative
!***
call abort_ice(subname//'ERROR: Invalid domain: size < 1') ! no domain
call abort_ice(subname//'ERROR: Invalid domain: size < 1', file=__FILE__, line=__LINE__) ! no domain
else if (nprocs /= get_num_procs()) then
!***
!*** input nprocs does not match system (eg MPI) request
Expand All @@ -251,13 +250,13 @@ subroutine init_domain_blocks
nprocs = get_num_procs()
#else
write(nu_diag,*) subname,'ERROR: nprocs, get_num_procs = ',nprocs,get_num_procs()
call abort_ice(subname//'ERROR: Input nprocs not same as system request')
call abort_ice(subname//'ERROR: Input nprocs not same as system request', file=__FILE__, line=__LINE__)
#endif
else if (nghost < 1) then
!***
!*** must have at least 1 layer of ghost cells
!***
call abort_ice(subname//'ERROR: Not enough ghost cells allocated')
call abort_ice(subname//'ERROR: Not enough ghost cells allocated', file=__FILE__, line=__LINE__)
endif

!----------------------------------------------------------------------
Expand Down Expand Up @@ -385,7 +384,7 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
file=__FILE__, line=__LINE__)

if (trim(ns_boundary_type) == 'closed') then
call abort_ice(subname//'ERROR: ns_boundary_type = closed not supported')
call abort_ice(subname//'ERROR: ns_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
allocate(nocn(nblocks_tot))
nocn = 0
do n=1,nblocks_tot
Expand Down Expand Up @@ -418,13 +417,13 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif
if (nocn(n) > 0) then
write(nu_diag,*) subname,'ns closed, Not enough land cells along ns edge'
call abort_ice(subname//'ERROR: Not enough land cells along ns edge for ns closed')
call abort_ice(subname//'ERROR: Not enough land cells along ns edge for ns closed', file=__FILE__, line=__LINE__)
endif
enddo
deallocate(nocn)
endif
if (trim(ew_boundary_type) == 'closed') then
call abort_ice(subname//'ERROR: ew_boundary_type = closed not supported')
call abort_ice(subname//'ERROR: ew_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
allocate(nocn(nblocks_tot))
nocn = 0
do n=1,nblocks_tot
Expand Down Expand Up @@ -457,7 +456,7 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif
if (nocn(n) > 0) then
write(nu_diag,*) subname,'ew closed, Not enough land cells along ew edge'
call abort_ice(subname//'ERROR: Not enough land cells along ew edge for ew closed')
call abort_ice(subname//'ERROR: Not enough land cells along ew edge for ew closed', file=__FILE__, line=__LINE__)
endif
enddo
deallocate(nocn)
Expand Down Expand Up @@ -487,11 +486,20 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
#ifdef USE_NETCDF
status = nf90_open(distribution_wght_file, NF90_NOWRITE, fid)
if (status /= nf90_noerr) then
call abort_ice (subname//'ERROR: Cannot open '//trim(distribution_wght_file))
call abort_ice(subname//'ERROR: Cannot open '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
endif
status = nf90_inq_varid(fid, 'wght', varid)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot find wght '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
endif
status = nf90_get_var(fid, varid, wght)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot get wght '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
endif
status = nf90_close(fid)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot close '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
endif
write(nu_diag,*) 'read ',trim(distribution_wght_file),minval(wght),maxval(wght)
#else
call abort_ice(subname//'ERROR: USE_NETCDF cpp not defined', &
Expand Down Expand Up @@ -581,11 +589,11 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
allocate(work_per_block(nblocks_tot))

where (nocn > 1)
work_per_block = nocn/work_unit + 2
work_per_block = nocn/work_unit + 2
elsewhere (nocn == 1)
work_per_block = nocn/work_unit + 1
work_per_block = nocn/work_unit + 1
elsewhere
work_per_block = 0
work_per_block = 0
end where
if (my_task == master_task) then
write(nu_diag,*) 'ice_domain work_unit, max_work_unit = ',work_unit, max_work_unit
Expand Down Expand Up @@ -701,10 +709,10 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
nblocks_max = 0
tblocks_tmp = 0
do n=0,distrb_info%nprocs - 1
nblocks_tmp = nblocks
call broadcast_scalar(nblocks_tmp, n)
nblocks_max = max(nblocks_max,nblocks_tmp)
tblocks_tmp = tblocks_tmp + nblocks_tmp
nblocks_tmp = nblocks
call broadcast_scalar(nblocks_tmp, n)
nblocks_max = max(nblocks_max,nblocks_tmp)
tblocks_tmp = tblocks_tmp + nblocks_tmp
end do

if (my_task == master_task) then
Expand All @@ -713,19 +721,16 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif

if (nblocks_max > max_blocks) then
write(outstring,*) &
'ERROR: num blocks exceed max: increase max to', nblocks_max
call abort_ice(subname//trim(outstring), &
file=__FILE__, line=__LINE__)
write(outstring,*) 'ERROR: num blocks exceed max: increase max to', nblocks_max
call abort_ice(subname//trim(outstring), file=__FILE__, line=__LINE__)
else if (nblocks_max < max_blocks) then
write(outstring,*) &
'WARNING: ice no. blocks too large: decrease max to', nblocks_max
if (my_task == master_task) then
write(nu_diag,*) ' ********WARNING***********'
write(nu_diag,*) subname,trim(outstring)
write(nu_diag,*) ' **************************'
write(nu_diag,*) ' '
endif
write(outstring,*) 'WARNING: ice no. blocks too large: decrease max to', nblocks_max
if (my_task == master_task) then
write(nu_diag,*) ' ********WARNING***********'
write(nu_diag,*) subname,trim(outstring)
write(nu_diag,*) ' **************************'
write(nu_diag,*) ' '
endif
endif

!----------------------------------------------------------------------
Expand Down
Loading
Loading