Skip to content

Commit

Permalink
Merge pull request #45 from COSIMA/bugfix-38-use-restart-time
Browse files Browse the repository at this point in the history
Bugfix 38 use restart time
  • Loading branch information
nichannah authored Apr 15, 2020
2 parents e151c8b + 59ecdcc commit b19a09e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions drivers/auscom/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ subroutine cice_init(accessom2)

! Use accessom2 configuration
call input_data(accessom2%get_forcing_start_date_array(), &
accessom2%get_cur_exp_date_array(), &
accessom2%get_seconds_since_cur_exp_year(), &
accessom2%get_total_runtime_in_seconds(), &
accessom2%get_ice_ocean_timestep(), &
Expand Down
4 changes: 2 additions & 2 deletions io_netcdf/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ subroutine init_restart_write(filename_spec)

status = nf90_create(trim(filename), &
ior(NF90_CLASSIC_MODEL, NF90_HDF5), ncid)
if (status /= nf90_noerr) call abort_ice( &
'ice: Error creating restart ncfile '//trim(filename))
call assert(status == NF90_NOERR, &
'in init_restart_write on nf90_create '//trim(filename), status)

status = nf90_put_att(ncid,nf90_global,'istep1',istep1)
call assert(status == NF90_NOERR, &
Expand Down
22 changes: 19 additions & 3 deletions source/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module ice_init
!
! author Elizabeth C. Hunke, LANL

subroutine input_data(forcing_start_date, seconds_since_start_year, &
subroutine input_data(forcing_start_date, cur_exp_date, &
seconds_since_start_year, &
total_runtime_in_seconds, timestep, calendar_type)

use ice_age, only: restart_age
Expand Down Expand Up @@ -107,6 +108,7 @@ subroutine input_data(forcing_start_date, seconds_since_start_year, &
use shr_file_mod, only: shr_file_setIO
#endif
integer, dimension(6), optional, intent(in) :: forcing_start_date
integer, dimension(6), optional, intent(in) :: cur_exp_date
integer, optional, intent(in) :: seconds_since_start_year
integer, optional, intent(in) :: total_runtime_in_seconds, timestep
character(len=9), optional, intent(in) :: calendar_type
Expand Down Expand Up @@ -433,9 +435,23 @@ subroutine input_data(forcing_start_date, seconds_since_start_year, &
if (nml_error == 0) close(nu_nml)

! Overwrite some run details passed in as arguments
if (present(forcing_start_date)) then
year_init = forcing_start_date(1)

if (use_restart_time) then
! the initial year is set by the forcing start, the current
! experiment date is calculated using this and values in the
! restart file
if (present(forcing_start_date)) then
year_init = forcing_start_date(1)
endif
else
! the initial year is set to the current experiment year,
! the current experiment date is calculated using this and
! istep0 and npt below
if (present(cur_exp_date)) then
year_init = cur_exp_date(1)
endif
endif

if (present(timestep)) then
dt = timestep
endif
Expand Down

0 comments on commit b19a09e

Please sign in to comment.