Skip to content

Commit

Permalink
Add new IO namelist controls,
Browse files Browse the repository at this point in the history
history_iotasks
history_root
history_stride
history_rearranger
restart_iotasks
restart_root
restart_stride
restart_rearranger

Update documentation
  • Loading branch information
apcraig committed Jan 25, 2024
1 parent 9804049 commit f15d7c8
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 85 deletions.
11 changes: 7 additions & 4 deletions cicecore/cicedyn/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ module ice_history_shared
history_dir , & ! directory name for history file
incond_dir ! directory for snapshot initial conditions

character (len=char_len_long), public :: &
pointer_file ! input pointer file for restarts

character (len=char_len), public :: &
version_name

character (len=char_len), public :: &
history_format
history_format , & ! history format, cdf1, cdf2, cdf5, etc
history_rearranger ! history file rearranger, box or subset for pio

character (len=char_len), public :: &
hist_suffix(max_nstrm) ! appended to 'h' in filename when not 'x'

integer (kind=int_kind), public :: &
history_iotasks , & ! iotasks, root, stride defines io pes for pio
history_root , & ! iotasks, root, stride defines io pes for pio
history_stride ! iotasks, root, stride defines io pes for pio

!---------------------------------------------------------------
! Instructions for adding a field: (search for 'example')
! Here or in ice_history_[process].F90:
Expand Down
118 changes: 76 additions & 42 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,36 @@ module ice_init
subroutine input_data

use ice_broadcast, only: broadcast_scalar, broadcast_array
use ice_diagnostics, only: 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_diagnostics, only: &
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_size, only: ncat, nilyr, nslyr, nblyr, nfsd, nfreq, &
n_iso, n_aero, n_zaero, n_algae, &
n_doc, n_dic, n_don, n_fed, n_fep, &
max_nstrm
use ice_calendar, only: year_init, month_init, day_init, sec_init, &
istep0, histfreq, histfreq_n, histfreq_base, &
dumpfreq, dumpfreq_n, diagfreq, dumpfreq_base, &
npt, dt, ndtd, days_per_year, use_leap_years, &
write_ic, dump_last, npt_unit
use ice_domain_size, only: &
ncat, nilyr, nslyr, nblyr, nfsd, nfreq, &
n_iso, n_aero, n_zaero, n_algae, &
n_doc, n_dic, n_don, n_fed, n_fep, &
max_nstrm
use ice_calendar, only: &
year_init, month_init, day_init, sec_init, &
istep0, histfreq, histfreq_n, histfreq_base, &
dumpfreq, dumpfreq_n, diagfreq, dumpfreq_base, &
npt, dt, ndtd, days_per_year, use_leap_years, &
write_ic, dump_last, npt_unit
use ice_arrays_column, only: oceanmixed_ice
use ice_restart_column, only: restart_age, restart_FY, restart_lvl, &
use ice_restart_column, only: &
restart_age, restart_FY, restart_lvl, &
restart_pond_lvl, restart_pond_topo, restart_aero, &
restart_fsd, restart_iso, restart_snow
use ice_restart_shared, only: &
restart, restart_ext, restart_coszen, restart_dir, restart_file, pointer_file, &
runid, runtype, use_restart_time, restart_format
use ice_history_shared, only: hist_avg, history_dir, history_file, hist_suffix, &
incond_dir, incond_file, version_name, &
history_precision, history_format, hist_time_axis
runid, runtype, use_restart_time, restart_format, &
restart_rearranger, restart_iotasks, restart_root, restart_stride
use ice_history_shared, only: &
hist_avg, history_dir, history_file, hist_suffix, &
incond_dir, incond_file, version_name, &
history_precision, history_format, hist_time_axis, &
history_rearranger, history_iotasks, history_root, history_stride
use ice_flux, only: update_ocn_f, cpl_frazil, l_mpond_fresh
use ice_flux, only: default_season
use ice_flux_bgc, only: cpl_bgc
Expand All @@ -97,29 +104,31 @@ subroutine input_data
snw_tau_fname, snw_kappa_fname, snw_drdt0_fname, &
snw_rhos_fname, snw_Tgrd_fname, snw_T_fname
use ice_arrays_column, only: bgc_data_dir, fe_data_type
use ice_grid, only: grid_file, gridcpl_file, kmt_file, &
bathymetry_file, use_bathymetry, &
bathymetry_format, kmt_type, &
grid_type, grid_format, &
grid_ice, grid_ice_thrm, grid_ice_dynu, grid_ice_dynv, &
grid_ocn, grid_ocn_thrm, grid_ocn_dynu, grid_ocn_dynv, &
grid_atm, grid_atm_thrm, grid_atm_dynu, grid_atm_dynv, &
dxrect, dyrect, dxscale, dyscale, scale_dxdy, &
lonrefrect, latrefrect, save_ghte_ghtn
use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, &
evp_algorithm, visc_method, &
seabed_stress, seabed_stress_method, &
k1, k2, alphab, threshold_hw, Ktens, &
e_yieldcurve, e_plasticpot, coriolis, &
ssh_stress, kridge, brlx, arlx, &
deltaminEVP, deltaminVP, capping, &
elasticDamp

use ice_dyn_vp, only: maxits_nonlin, precond, dim_fgmres, dim_pgmres, maxits_fgmres, &
maxits_pgmres, monitor_nonlin, monitor_fgmres, &
monitor_pgmres, reltol_nonlin, reltol_fgmres, reltol_pgmres, &
algo_nonlin, fpfunc_andacc, dim_andacc, reltol_andacc, &
damping_andacc, start_andacc, use_mean_vrel, ortho_type
use ice_grid, only: &
grid_file, gridcpl_file, kmt_file, &
bathymetry_file, use_bathymetry, &
bathymetry_format, kmt_type, &
grid_type, grid_format, &
grid_ice, grid_ice_thrm, grid_ice_dynu, grid_ice_dynv, &
grid_ocn, grid_ocn_thrm, grid_ocn_dynu, grid_ocn_dynv, &
grid_atm, grid_atm_thrm, grid_atm_dynu, grid_atm_dynv, &
dxrect, dyrect, dxscale, dyscale, scale_dxdy, &
lonrefrect, latrefrect, save_ghte_ghtn
use ice_dyn_shared, only: &
ndte, kdyn, revised_evp, yield_curve, &
evp_algorithm, visc_method, &
seabed_stress, seabed_stress_method, &
k1, k2, alphab, threshold_hw, Ktens, &
e_yieldcurve, e_plasticpot, coriolis, &
ssh_stress, kridge, brlx, arlx, &
deltaminEVP, deltaminVP, capping, &
elasticDamp
use ice_dyn_vp, only: &
maxits_nonlin, precond, dim_fgmres, dim_pgmres, maxits_fgmres, &
maxits_pgmres, monitor_nonlin, monitor_fgmres, &
monitor_pgmres, reltol_nonlin, reltol_fgmres, reltol_pgmres, &
algo_nonlin, fpfunc_andacc, dim_andacc, reltol_andacc, &
damping_andacc, start_andacc, use_mean_vrel, ortho_type
use ice_transport_driver, only: advection, conserv_check
use ice_restoring, only: restore_ice
use ice_timers, only: timer_stats
Expand Down Expand Up @@ -184,12 +193,14 @@ subroutine input_data
runtype, runid, bfbflag, numax, &
ice_ic, restart, restart_dir, restart_file, &
restart_ext, use_restart_time, restart_format, lcdf64, &
restart_root, restart_stride, restart_iotasks, restart_rearranger, &
pointer_file, dumpfreq, dumpfreq_n, dump_last, &
diagfreq, diag_type, diag_file, history_format,&
history_root, history_stride, history_iotasks, history_rearranger, &
hist_time_axis, &
print_global, print_points, latpnt, lonpnt, &
debug_forcing, histfreq, histfreq_n, hist_avg, &
hist_suffix, &
hist_suffix, &
history_dir, history_file, history_precision, cpl_bgc, &
histfreq_base, dumpfreq_base, timer_stats, memory_stats, &
conserv_check, debug_model, debug_model_step, &
Expand Down Expand Up @@ -328,8 +339,11 @@ subroutine input_data
hist_avg(:) = .true. ! if true, write time-averages (not snapshots)
hist_suffix(:) = 'x' ! appended to 'history_file' in filename when not 'x'
history_format = 'cdf2'! history file format
history_root = -99 ! history iotasks, root, stride sets pes for pio
history_stride = -99 ! history iotasks, root, stride sets pes for pio
history_iotasks = -99 ! history iotasks, root, stride sets pes for pio
history_rearranger = 'default' ! history rearranger for pio
hist_time_axis = 'end' ! History file time axis averaging interval position

history_dir = './' ! write to executable dir for default
history_file = 'iceh' ! history file name prefix
history_precision = 4 ! precision of history files
Expand All @@ -349,6 +363,10 @@ subroutine input_data
restart_coszen = .false. ! if true, read/write coszen
pointer_file = 'ice.restart_file'
restart_format = 'cdf2' ! restart file format
restart_root = -99 ! restart iotasks, root, stride sets pes for pio
restart_stride = -99 ! restart iotasks, root, stride sets pes for pio
restart_iotasks = -99 ! restart iotasks, root, stride sets pes for pio
restart_rearranger = 'default' ! restart rearranger for pio
lcdf64 = .false. ! 64 bit offset for netCDF
ice_ic = 'default' ! latitude and sst-dependent
grid_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
Expand Down Expand Up @@ -923,6 +941,10 @@ subroutine input_data
call broadcast_scalar(history_file, master_task)
call broadcast_scalar(history_precision, master_task)
call broadcast_scalar(history_format, master_task)
call broadcast_scalar(history_iotasks, master_task)
call broadcast_scalar(history_root, master_task)
call broadcast_scalar(history_stride, master_task)
call broadcast_scalar(history_rearranger, master_task)
call broadcast_scalar(hist_time_axis, master_task)
call broadcast_scalar(write_ic, master_task)
call broadcast_scalar(cpl_bgc, master_task)
Expand All @@ -936,6 +958,10 @@ subroutine input_data
call broadcast_scalar(restart_coszen, master_task)
call broadcast_scalar(use_restart_time, master_task)
call broadcast_scalar(restart_format, master_task)
call broadcast_scalar(restart_iotasks, master_task)
call broadcast_scalar(restart_root, master_task)
call broadcast_scalar(restart_stride, master_task)
call broadcast_scalar(restart_rearranger, master_task)
call broadcast_scalar(lcdf64, master_task)
call broadcast_scalar(pointer_file, master_task)
call broadcast_scalar(ice_ic, master_task)
Expand Down Expand Up @@ -2469,6 +2495,10 @@ subroutine input_data
write(nu_diag,1031) ' history_file = ', trim(history_file)
write(nu_diag,1021) ' history_precision= ', history_precision
write(nu_diag,1031) ' history_format = ', trim(history_format)
write(nu_diag,1031) ' history_rearranger = ', trim(history_rearranger)
write(nu_diag,1021) ' history_iotasks = ', history_iotasks
write(nu_diag,1021) ' history_root = ', history_root
write(nu_diag,1021) ' history_stride = ', history_stride
write(nu_diag,1031) ' hist_time_axis = ', trim(hist_time_axis)
if (write_ic) then
write(nu_diag,1039) ' Initial condition will be written in ', &
Expand All @@ -2484,6 +2514,10 @@ subroutine input_data
write(nu_diag,1011) ' restart_coszen = ', restart_coszen
write(nu_diag,1031) ' restart_format = ', trim(restart_format)
! write(nu_diag,1011) ' lcdf64 = ', lcdf64 ! deprecated
write(nu_diag,1031) ' restart_rearranger = ', trim(restart_rearranger)
write(nu_diag,1021) ' restart_iotasks = ', restart_iotasks
write(nu_diag,1021) ' restart_root = ', restart_root
write(nu_diag,1021) ' restart_stride = ', restart_stride
write(nu_diag,1031) ' restart_file = ', trim(restart_file)
write(nu_diag,1031) ' pointer_file = ', trim(pointer_file)
write(nu_diag,1011) ' use_restart_time = ', use_restart_time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ subroutine ice_write_hist (ns)

integer (kind=int_kind) :: lprecision

logical (kind=log_kind), save :: first_call = .true.

character(len=*), parameter :: subname = '(ice_write_hist)'

call icepack_query_parameters(secday_out=secday)
Expand All @@ -168,7 +170,8 @@ subroutine ice_write_hist (ns)
! create file
File%fh=-1
call ice_pio_init(mode='write', filename=trim(filename), File=File, &
clobber=.true., fformat=trim(history_format))
clobber=.true., fformat=trim(history_format), rearr=trim(history_rearranger), &
iotasks=history_iotasks, root=history_root, stride=history_stride, debug=first_call)

call ice_pio_initdecomp(iodesc=iodesc2d, precision=history_precision)
call ice_pio_initdecomp(ndim3=ncat_hist, iodesc=iodesc3dc, precision=history_precision)
Expand Down Expand Up @@ -1334,6 +1337,8 @@ subroutine ice_write_hist (ns)
write(nu_diag,*) 'Finished writing ',trim(ncfile(ns))
endif

first_call = .false.

end subroutine ice_write_hist

!=======================================================================
Expand Down
Loading

0 comments on commit f15d7c8

Please sign in to comment.