Skip to content

Commit

Permalink
Icepack interface for binary restarts (#148)
Browse files Browse the repository at this point in the history
* Icepack interface for binary restarts

* cleanup
  • Loading branch information
eclare108213 authored and apcraig committed Jun 13, 2018
1 parent 58246d3 commit 837b3bf
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 13 deletions.
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

0 comments on commit 837b3bf

Please sign in to comment.