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

Use optional chunksizes argument in register_restart_field calls #595

Merged
merged 35 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7fc66e1
Update .gitmodules
DusanJovic-NOAA Oct 5, 2022
42d75c0
Change the format of domain restart files to netcdf4 and set chunksizes
DusanJovic-NOAA Oct 5, 2022
6d9acb8
Update atmos_cubed_sphere
DusanJovic-NOAA Oct 20, 2022
de99eca
Merge branch 'develop' into restart_chunksizes
DusanJovic-NOAA Oct 20, 2022
9b7ca63
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Nov 15, 2022
289f91f
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Dec 6, 2022
5b92a46
Update atmos_cubed_sphere
DusanJovic-NOAA Dec 7, 2022
a1763d6
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Dec 7, 2022
ab423b8
Update atmos_cubed_sphere
DusanJovic-NOAA Dec 12, 2022
d1b57aa
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Dec 12, 2022
16aeba1
Update atmos_cubed_sphere
DusanJovic-NOAA Jan 20, 2023
41f0aa9
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Jan 20, 2023
6e965c2
Remove nc_format="netcdf4" argument when opening restart files
DusanJovic-NOAA Jan 26, 2023
0ed10c1
Update atmos_cubed_sphere
DusanJovic-NOAA Jan 26, 2023
134a6b2
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Jan 26, 2023
4ae414a
Set chunksize of zaxis and time axis to 1
DusanJovic-NOAA Feb 8, 2023
c508bb4
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Mar 1, 2023
5eff886
Merge branch 'develop' into restart_chunksizes
DusanJovic-NOAA Mar 22, 2023
8857367
Update atmos_cubed_sphere
DusanJovic-NOAA Apr 4, 2023
0475689
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Apr 4, 2023
12aeb13
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Apr 14, 2023
ad149c9
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Apr 20, 2023
fbd7b96
Update atmos_cubed_sphere
DusanJovic-NOAA May 17, 2023
30b3a58
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA May 17, 2023
85b58ef
Update atmos_cubed_sphere
DusanJovic-NOAA Jun 1, 2023
2bf0ec3
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Jun 1, 2023
d855722
Update atmos_cubed_sphere
DusanJovic-NOAA Jun 21, 2023
a3de100
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Jun 21, 2023
987e2f2
Update clm_lake and rrfs_sd modules to support chunksizes
DusanJovic-NOAA Jun 21, 2023
29efa94
Make quilting restart files identical to fms files
DusanJovic-NOAA Aug 1, 2023
c39a138
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Aug 28, 2023
8590c0e
Merge remote-tracking branch 'origin/develop' into restart_chunksizes
DusanJovic-NOAA Aug 29, 2023
3b318a6
Merge remote-tracking branch 'origin/develop' into fix_qr_tests
DusanJovic-NOAA Aug 29, 2023
a851c45
Merge remote-tracking branch 'origin/fix_qr_tests' into restart_chunk…
DusanJovic-NOAA Aug 29, 2023
490a05c
Update atmos_cubed_sphere and revert .gitmodules
DusanJovic-NOAA Aug 31, 2023
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 atmos_cubed_sphere
64 changes: 36 additions & 28 deletions io/fv3atm_clm_lake_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module fv3atm_clm_lake_io
use block_control_mod, only: block_control_type
use fms2_io_mod, only: FmsNetcdfDomainFile_t, register_axis, &
register_restart_field, write_data, &
register_variable_attribute, register_field
register_variable_attribute, register_field, get_dimension_size
use fv3atm_common_io, only: create_2d_field_and_add_to_bundle, &
create_3d_field_and_add_to_bundle

Expand Down Expand Up @@ -370,81 +370,89 @@ subroutine clm_lake_register_fields(clm_lake, Sfc_restart)
class(clm_lake_data_type) :: clm_lake
type(FmsNetcdfDomainFile_t) :: Sfc_restart

integer :: xaxis_1_chunk, yaxis_1_chunk
integer :: chunksizes2d(3), chunksizes3d(4)

call get_dimension_size(Sfc_restart, 'xaxis_1', xaxis_1_chunk)
call get_dimension_size(Sfc_restart, 'yaxis_1', yaxis_1_chunk)
chunksizes2d = (/xaxis_1_chunk, yaxis_1_chunk, 1/)
chunksizes3d = (/xaxis_1_chunk, yaxis_1_chunk, 1, 1/)

! Register 2D fields
call register_restart_field(Sfc_restart, 'T_snow', clm_lake%T_snow, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'T_ice', clm_lake%T_ice, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_snl2d', clm_lake%lake_snl2d, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_h2osno2d', clm_lake%lake_h2osno2d, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_tsfc', clm_lake%lake_tsfc, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_savedtke12d', clm_lake%lake_savedtke12d, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_sndpth2d', clm_lake%lake_sndpth2d, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'clm_lakedepth', clm_lake%clm_lakedepth, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'clm_lake_initialized', clm_lake%clm_lake_initialized, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)

! Register 3D fields
call register_restart_field(Sfc_restart, 'lake_z3d', clm_lake%lake_z3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'lake_dz3d', clm_lake%lake_dz3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_soil_watsat3d', clm_lake%lake_soil_watsat3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_csol3d', clm_lake%lake_csol3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_soil_tkmg3d', clm_lake%lake_soil_tkmg3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_soil_tkdry3d', clm_lake%lake_soil_tkdry3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_soil_tksatu3d', clm_lake%lake_soil_tksatu3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_snow_z3d', clm_lake%lake_snow_z3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_snow_dz3d', clm_lake%lake_snow_dz3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_snow_zi3d', clm_lake%lake_snow_zi3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil_clm_lake ', 'Time '/), is_optional=.true.)
'levsnowsoil_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_h2osoi_vol3d', clm_lake%lake_h2osoi_vol3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_h2osoi_liq3d', clm_lake%lake_h2osoi_liq3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_h2osoi_ice3d', clm_lake%lake_h2osoi_ice3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_t_soisno3d', clm_lake%lake_t_soisno3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsnowsoil1_clm_lake', 'Time '/), is_optional=.true.)
'levsnowsoil1_clm_lake', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_t_lake3d', clm_lake%lake_t_lake3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_icefrac3d', clm_lake%lake_icefrac3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levlake_clm_lake ', 'Time '/), is_optional=.true.)
'levlake_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_clay3d', clm_lake%lake_clay3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsoil_clm_lake ', 'Time '/), is_optional=.true.)
'levsoil_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
call register_restart_field(Sfc_restart,'lake_sand3d', clm_lake%lake_sand3d, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'levsoil_clm_lake ', 'Time '/), is_optional=.true.)
'levsoil_clm_lake ', 'Time '/), chunksizes=chunksizes3d, is_optional=.true.)
end subroutine clm_lake_register_fields

!>@ This is clm_lake%bundle_fields, and it is only used in the
Expand Down
9 changes: 6 additions & 3 deletions io/fv3atm_restart_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module fv3atm_restart_io_mod
register_axis, register_restart_field, &
register_variable_attribute, register_field, &
read_restart, write_restart, write_data, &
get_global_io_domain_indices
get_global_io_domain_indices, get_dimension_size
use mpp_domains_mod, only: domain2d
use fv3atm_common_io, only: create_2d_field_and_add_to_bundle, &
create_3d_field_and_add_to_bundle, copy_from_gfs_data
Expand Down Expand Up @@ -891,6 +891,7 @@ subroutine phys_restart_write (GFS_Restart, Atm_block, Model, fv_domain, timesta
character(7) :: indir='RESTART'
character(72) :: infile
logical :: amiopen, allocated_something
integer :: xaxis_1_chunk, yaxis_1_chunk

type(phy_data_type) :: phy
type(FmsNetcdfDomainFile_t) :: Phy_restart
Expand All @@ -917,13 +918,15 @@ subroutine phys_restart_write (GFS_Restart, Atm_block, Model, fv_domain, timesta
call get_global_io_domain_indices(Phy_restart, 'xaxis_1', is, ie, indices=buffer)
call write_data(Phy_restart, "xaxis_1", buffer)
deallocate(buffer)
call get_dimension_size(Phy_restart, 'xaxis_1', xaxis_1_chunk)

call register_axis(Phy_restart, 'yaxis_1', 'Y')
call register_field(Phy_restart, 'yaxis_1', 'double', (/'yaxis_1'/))
call register_variable_attribute(Phy_restart, 'yaxis_1', 'cartesian_axis', 'Y', str_len=1)
call get_global_io_domain_indices(Phy_restart, 'yaxis_1', is, ie, indices=buffer)
call write_data(Phy_restart, "yaxis_1", buffer)
deallocate(buffer)
call get_dimension_size(Phy_restart, 'yaxis_1', yaxis_1_chunk)

call register_axis(Phy_restart, 'zaxis_1', phy%npz)
call register_field(Phy_restart, 'zaxis_1', 'double', (/'zaxis_1'/))
Expand All @@ -946,12 +949,12 @@ subroutine phys_restart_write (GFS_Restart, Atm_block, Model, fv_domain, timesta
do num = 1,phy%nvar2d
var2_p => phy%var2(:,:,num)
call register_restart_field(Phy_restart, trim(GFS_Restart%name2d(num)), var2_p, dimensions=(/'xaxis_1','yaxis_1','Time '/),&
&is_optional=.true.)
& chunksizes=(/xaxis_1_chunk,yaxis_1_chunk,1/), is_optional=.true.)
enddo
do num = 1,phy%nvar3d
var3_p => phy%var3(:,:,:,num)
call register_restart_field(Phy_restart, trim(GFS_Restart%name3d(num)), var3_p, dimensions=(/'xaxis_1','yaxis_1','zaxis_1','Time '/),&
&is_optional=.true.)
& chunksizes=(/xaxis_1_chunk,yaxis_1_chunk,1,1/), is_optional=.true.)
enddo
nullify(var2_p)
nullify(var3_p)
Expand Down
23 changes: 16 additions & 7 deletions io/fv3atm_rrfs_sd_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module fv3atm_rrfs_sd_io
use block_control_mod, only: block_control_type
use fms2_io_mod, only: FmsNetcdfDomainFile_t, write_data, &
register_axis, register_restart_field, &
register_variable_attribute, register_field
register_variable_attribute, register_field, &
get_dimension_size
use GFS_typedefs, only: GFS_sfcprop_type, GFS_control_type, kind_phys
use fv3atm_common_io, only: get_nx_ny_from_atm, create_2d_field_and_add_to_bundle, &
create_3d_field_and_add_to_bundle
Expand Down Expand Up @@ -193,23 +194,31 @@ subroutine rrfs_sd_state_register_fields(data,Sfc_restart)
class(rrfs_sd_state_type) :: data
type(FmsNetcdfDomainFile_t) :: Sfc_restart

integer :: xaxis_1_chunk, yaxis_1_chunk
integer :: chunksizes2d(3), chunksizes3d(4)

call get_dimension_size(Sfc_restart, 'xaxis_1', xaxis_1_chunk)
call get_dimension_size(Sfc_restart, 'yaxis_1', yaxis_1_chunk)
chunksizes2d = (/xaxis_1_chunk, yaxis_1_chunk, 1/)
chunksizes3d = (/xaxis_1_chunk, yaxis_1_chunk, 1, 1/)

! Register 2D fields
call register_restart_field(Sfc_restart, 'emdust', data%emdust, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'emseas', data%emseas, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'emanoc', data%emanoc, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'fhist', data%fhist, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)
call register_restart_field(Sfc_restart, 'coef_bb_dc', data%coef_bb_dc, &
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), is_optional=.true.)
dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/), chunksizes=chunksizes2d, is_optional=.true.)

! Register 3D field
call register_restart_field(Sfc_restart, 'fire_in', data%fire_in, &
dimensions=(/'xaxis_1 ', 'yaxis_1 ', &
'fire_aux_data_levels', 'Time '/), &
is_optional=.true.)
chunksizes=chunksizes3d, is_optional=.true.)
end subroutine rrfs_sd_state_register_fields

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