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

Icepack interface for binary restarts #148

Merged
merged 2 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 cicecore/cicedynB/general/ice_forcing_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ subroutine faero_optics
if (icepack_warnings_aborted()) call abort_ice(error_message="subname", &
file=__FILE__, line=__LINE__)

#ifdef ncdf
if (modal_aero) then
diag = .true. ! write diagnostic information
optics_file = &
Expand Down Expand Up @@ -886,6 +887,11 @@ subroutine faero_optics
enddo
enddo
endif ! modal_aero
#else
if (modal_aero) then
call abort_ice('faero_optics: netcdf required for modal_aero')
endif
#endif

end subroutine faero_optics

Expand Down
76 changes: 68 additions & 8 deletions cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
! SVN:$Id: ice_restart.F90 806 2014-07-31 19:00:00Z tcraig $
!=======================================================================

! Read and write ice model restart files using netCDF or binary
Expand All @@ -9,15 +8,21 @@
module ice_restart

use ice_broadcast
use ice_exit, only: abort_ice
use ice_fileunits
use ice_kinds_mod
use ice_restart_shared, only: &
restart, restart_ext, restart_dir, restart_file, pointer_file, &
runid, runtype, use_restart_time, restart_format, lenstr
use icepack_intfc, only: tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, &
tr_pond_topo, tr_pond_lvl, tr_brine, nbtrcr
use icepack_intfc, only: solve_zsal
use ice_fileunits, only: nu_diag, nu_rst_pointer
use ice_fileunits, only: nu_dump, nu_dump_eap, nu_dump_FY, nu_dump_age
use ice_fileunits, only: nu_dump_lvl, nu_dump_pond, nu_dump_hbrine
use ice_fileunits, only: nu_dump_bgc, nu_dump_aero, nu_dump_age
use ice_fileunits, only: nu_restart, nu_restart_eap, nu_restart_FY, nu_restart_age
use ice_fileunits, only: nu_restart_lvl, nu_restart_pond, nu_restart_hbrine
use ice_fileunits, only: nu_restart_bgc, nu_restart_aero, nu_restart_age
use ice_exit, only: abort_ice
use icepack_intfc, only: icepack_query_parameters
use icepack_intfc, only: icepack_query_tracer_numbers
use icepack_intfc, only: icepack_query_tracer_flags
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted

implicit none
Expand Down Expand Up @@ -45,11 +50,17 @@ subroutine init_restart_read(ice_ic)

! local variables

logical (kind=log_kind) :: &
solve_zsal, &
tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, &
tr_pond_topo, tr_pond_lvl, tr_brine

character(len=char_len_long) :: &
filename, filename0

integer (kind=int_kind) :: &
n, & ! loop indices
nbtrcr, & ! number of bgc tracers
iignore ! dummy variable

real (kind=real_kind) :: &
Expand All @@ -58,6 +69,18 @@ subroutine init_restart_read(ice_ic)
character(len=char_len_long) :: &
string1, string2

call icepack_query_parameters( &
solve_zsal_out=solve_zsal)
call icepack_query_tracer_numbers( &
nbtrcr_out=nbtrcr)
call icepack_query_tracer_flags( &
tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, &
tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, &
tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message="subname", &
file=__FILE__, line=__LINE__)

if (present(ice_ic)) then
filename = trim(ice_ic)
else
Expand Down Expand Up @@ -319,11 +342,29 @@ subroutine init_restart_write(filename_spec)

! local variables

logical (kind=log_kind) :: &
solve_zsal, &
tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, &
tr_pond_topo, tr_pond_lvl, tr_brine

integer (kind=int_kind) :: &
iyear, imonth, iday ! year, month, day
nbtrcr, & ! number of bgc tracers
iyear, imonth, iday ! year, month, day

character(len=char_len_long) :: filename

call icepack_query_parameters( &
solve_zsal_out=solve_zsal)
call icepack_query_tracer_numbers( &
nbtrcr_out=nbtrcr)
call icepack_query_tracer_flags( &
tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, &
tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, &
tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message="subname", &
file=__FILE__, line=__LINE__)

! construct path/file
if (present(filename_spec)) then
filename = trim(filename_spec)
Expand Down Expand Up @@ -682,7 +723,26 @@ subroutine final_restart()
use ice_calendar, only: istep1, time, time_forc
use ice_communicate, only: my_task, master_task

integer (kind=int_kind) :: status
logical (kind=log_kind) :: &
solve_zsal, &
tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, &
tr_pond_topo, tr_pond_lvl, tr_brine

integer (kind=int_kind) :: &
nbtrcr, & ! number of bgc tracers
status

call icepack_query_parameters( &
solve_zsal_out=solve_zsal)
call icepack_query_tracer_numbers( &
nbtrcr_out=nbtrcr)
call icepack_query_tracer_flags( &
tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, &
tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, &
tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message="subname", &
file=__FILE__, line=__LINE__)

if (my_task == master_task) then
close(nu_dump)
Expand Down
9 changes: 4 additions & 5 deletions cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
! SVN:$Id: ice_restart.F90 607 2013-03-29 15:49:42Z eclare $
!=======================================================================

! Read and write ice model restart files using netCDF or binary
Expand Down Expand Up @@ -134,10 +133,10 @@ subroutine init_restart_write(filename_spec)
tr_bgc_hum

integer (kind=int_kind) :: &
k, n, & ! index
nx, ny, & ! global array size
iyear, imonth, iday, & ! year, month, day
nbtrcr
k, n, & ! index
nx, ny, & ! global array size
iyear, imonth, iday, & ! year, month, day
nbtrcr ! number of bgc tracers

character(len=char_len_long) :: filename

Expand Down