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

driver: icedrv_restart: Added option for restart files to be read/written in NetCDF format #427

Merged
merged 30 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
546f41b
Trial fix for netCDF start time problem
davidclemenssewall Jan 25, 2023
238481f
driver: icedrv_history: fix start time for NetCDF history output
davidclemenssewall Jan 26, 2023
e056016
driver: icedrv_history: fix start time for NetCDF History output
davidclemenssewall Jan 26, 2023
82e9024
Added restart_format variable to icedrv_restart_shared and to namelist.
davidclemenssewall Jan 30, 2023
d0d1cb2
need to also add new namelist to icepack_in
davidclemenssewall Jan 30, 2023
0c1c59e
Added error handling for incorrect restart format, should probably up…
davidclemenssewall Jan 30, 2023
7581c68
NetCDF restart file created, next need to populate fields
davidclemenssewall Jan 30, 2023
3e8254d
NetCDF Restart output is now populated
davidclemenssewall Jan 31, 2023
33ff29f
if block error handling in restartfile
davidclemenssewall Jan 31, 2023
51ace17
driver: icedrv_restart: enabled restart/ice_ic files to be written/re…
davidclemenssewall Jan 31, 2023
37cae79
modified set_nml.ionetcdf to default to netcdf restart files if we se…
davidclemenssewall Jan 31, 2023
9fd0b85
Fixed error in which some tracers were not being writting. NetCDF res…
davidclemenssewall Jan 31, 2023
7f42118
fixed istep1 = istep0 but and added test_suite for netcdf
davidclemenssewall Jan 31, 2023
971d640
removed bgc from the netcdf restart test suite
davidclemenssewall Jan 31, 2023
b167999
put netcdf functions into conditional compilation blocks
davidclemenssewall Jan 31, 2023
8b5edb1
Removed unused variables (sec0, h0, m0, s0) from icedrv_history
davidclemenssewall Feb 2, 2023
af8db80
Merge branch 'main' into restart_netcdf.
davidclemenssewall Feb 2, 2023
944b7ee
Removing unused variables in icedrv_history (after merging in from co…
davidclemenssewall Feb 2, 2023
48fb918
Changed history_cdf namelist to history_format and updated documentation
davidclemenssewall Feb 2, 2023
07e32c5
Fixed warning message if restart_format is incorrect
davidclemenssewall Feb 2, 2023
6ac56dc
halfway done reorganizing restartfile
davidclemenssewall Feb 2, 2023
c52cfa1
finished reorganization in restartfile, need to do dumpfile next
davidclemenssewall Feb 3, 2023
83f43bf
Halfway done editing dumpfile
davidclemenssewall Feb 3, 2023
434e6d5
finished editing dumpfile
davidclemenssewall Feb 3, 2023
9a7b67b
updated namelist settings and documentation. all tests pass
davidclemenssewall Feb 3, 2023
49f6f52
removed the netcdf_nobgc test suite
davidclemenssewall Feb 3, 2023
bcda743
Merge branch 'restart_netcdf' of https://github.com/davidclemenssewal…
apcraig Feb 6, 2023
04a029a
Fix minor issues found during testing
apcraig Feb 7, 2023
94207ab
Update history_format default
apcraig Feb 14, 2023
d2981d3
Merge pull request #1 from apcraig/restart_netcdf
davidclemenssewall Mar 1, 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ doc/build
# Ignore testsuite file/directories
testsuite*
caselist*

# Ignore compiled .mod files
*.mod

# Ignore test case directories (no consistent name so we'll just ignore conda)
conda_*
8 changes: 4 additions & 4 deletions configuration/driver/icedrv_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subroutine icedrv_run
use icedrv_forcing, only: get_forcing, get_wave_spec
use icedrv_forcing_bgc, only: faero_default, fiso_default, get_forcing_bgc
use icedrv_flux, only: init_flux_atm_ocn
use icedrv_history, only: history_cdf, history_close
use icedrv_history, only: history_format, history_close

logical (kind=log_kind) :: skl_bgc, z_tracers, tr_aero, tr_zaero, &
wave_spec, tr_fsd, tr_iso
Expand Down Expand Up @@ -63,7 +63,7 @@ subroutine icedrv_run
call calendar(time) ! at the end of the timestep

if (stop_now >= 1) then
if (history_cdf) call history_close()
if (history_format == 'nc') call history_close()
exit timeLoop
endif

Expand Down Expand Up @@ -101,7 +101,7 @@ subroutine ice_step
use icedrv_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags
use icedrv_flux, only: init_history_therm, init_history_bgc, &
daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd, init_history_dyn
use icedrv_history, only: history_cdf, history_write
use icedrv_history, only: history_format, history_write
use icedrv_restart, only: dumpfile, final_restart
use icedrv_restart_bgc, only: write_restart_bgc
use icedrv_step, only: prep_radiation, step_therm1, step_therm2, &
Expand Down Expand Up @@ -225,7 +225,7 @@ subroutine ice_step
if (tr_brine) call hbrine_diags
endif

if (history_cdf) then
if (history_format == 'nc') then
call history_write()
endif

Expand Down
9 changes: 3 additions & 6 deletions configuration/driver/icedrv_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module icedrv_history

! history output file info

logical (kind=log_kind), public :: history_cdf ! flag to turn on cdf history files
character (len=char_len), public :: &
history_format ! format of history files, only supported type is 'nc'

character (len=char_len_long) :: hist_file ! hist file name

Expand Down Expand Up @@ -68,11 +69,7 @@ subroutine history_write()
count1(1), count2(2), count3(3), count4(4), & ! cdf start/count arrays
varid, & ! cdf varid
status, & ! cdf status flag
iflag, & ! history file attributes
sec0, & ! number of seconds into the day at istep0
h0, & ! start hour
m0, & ! start minute
s0 ! start second
iflag ! history file attributes

character (len=8) :: &
cdate ! date string
Expand Down
28 changes: 21 additions & 7 deletions configuration/driver/icedrv_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ subroutine input_data
use icedrv_calendar, only: year_init, istep0
use icedrv_calendar, only: dumpfreq, diagfreq, dump_last
use icedrv_calendar, only: npt, dt, ndtd, days_per_year, use_leap_years
use icedrv_history, only: history_cdf
use icedrv_restart_shared, only: restart, restart_dir, restart_file
use icedrv_history, only: history_format
use icedrv_restart_shared, only: restart, restart_dir, restart_file, restart_format
use icedrv_flux, only: update_ocn_f, l_mpond_fresh, cpl_bgc
use icedrv_flux, only: default_season
use icedrv_forcing, only: precip_units, fyear_init, ycycle
Expand Down Expand Up @@ -133,8 +133,9 @@ subroutine input_data
days_per_year, use_leap_years, year_init, istep0, &
dt, npt, ndtd, dump_last, &
ice_ic, restart, restart_dir, restart_file, &
restart_format, &
dumpfreq, diagfreq, diag_file, cpl_bgc, &
conserv_check, history_cdf
conserv_check, history_format

namelist /grid_nml/ &
kcatbound
Expand Down Expand Up @@ -254,9 +255,10 @@ subroutine input_data
restart = .false. ! if true, read restart files for initialization
restart_dir = './' ! write to executable dir for default
restart_file = 'iced' ! restart file name prefix
history_cdf = .false. ! history netcdf file flag
ice_ic = 'default' ! initial conditions are specified in the code
! otherwise, the filename for reading restarts
restart_format = 'bin' ! default restart format is binary, other option 'nc'
history_format = 'none' ! if 'nc', write history files. Otherwise do nothing
ice_ic = 'default' ! initial conditions are specified in the code
! otherwise, the filename for reading restarts
ndtd = 1 ! dynamic time steps per thermodynamic time step
l_mpond_fresh = .false. ! logical switch for including meltpond freshwater
! flux feedback to ocean model
Expand Down Expand Up @@ -544,6 +546,16 @@ subroutine input_data
call icedrv_system_abort(file=__FILE__,line=__LINE__)
endif

if (restart_format /= 'bin' .and. restart_format /= 'nc') then
write (nu_diag,*) 'WARNING: restart_format value unknown '//trim(restart_format)
call icedrv_system_abort(file=__FILE__,line=__LINE__)
endif

if (history_format /= 'none' .and. history_format /= 'nc') then
write (nu_diag,*) 'WARNING: history_format value unknown '//trim(history_format)
call icedrv_system_abort(file=__FILE__,line=__LINE__)
endif

if (tr_aero .and. trim(shortwave) /= 'dEdd') then
write (nu_diag,*) 'WARNING: aerosols activated but dEdd'
write (nu_diag,*) 'WARNING: shortwave is not.'
Expand Down Expand Up @@ -645,7 +657,9 @@ subroutine input_data
trim(restart_dir)
write(nu_diag,*) ' restart_file = ', &
trim(restart_file)
write(nu_diag,1010) ' history_cdf = ', history_cdf
write(nu_diag,1030) ' restart_format = ', &
trim(restart_format)
write(nu_diag,1030) ' history_format = ', trim(history_format)
write(nu_diag,*) ' ice_ic = ', &
trim(ice_ic)
write(nu_diag,1010) ' conserv_check = ', conserv_check
Expand Down
Loading