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

Set 'idate0' and 'use_leap_years' in nuopc cap #936

Merged
merged 5 commits into from
Feb 28, 2024
Merged
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
25 changes: 20 additions & 5 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ module ice_comp_nuopc
use ice_domain_size , only : nx_global, ny_global
use ice_grid , only : grid_format, init_grid2
use ice_communicate , only : init_communicate, my_task, master_task, mpi_comm_ice
use ice_calendar , only : force_restart_now, write_ic, init_calendar
use ice_calendar , only : idate, mday, mmonth, myear, year_init
use ice_calendar , only : force_restart_now, write_ic
use ice_calendar , only : idate, idate0, mday, mmonth, myear, year_init, month_init, day_init
use ice_calendar , only : msec, dt, calendar, calendar_type, nextsw_cday, istep
use ice_calendar , only : ice_calendar_noleap, ice_calendar_gregorian
use ice_calendar , only : ice_calendar_noleap, ice_calendar_gregorian, use_leap_years
use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long
use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name
use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit
Expand Down Expand Up @@ -676,6 +676,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if(mastertask) write(nu_diag,*) trim(subname)//'WARNING: pio_typename from driver needs to be set for netcdf output to work'
end if



#else

! Read the cice namelist as part of the call to cice_init1
Expand Down Expand Up @@ -789,7 +791,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
call cice_init2()
call t_stopf ('cice_init2')
!---------------------------------------------------------------------------
! use EClock to reset calendar information on initial start
! use EClock to reset calendar information
!---------------------------------------------------------------------------

! - on initial run
Expand All @@ -805,7 +807,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ref_ymd /= start_ymd .or. ref_tod /= start_tod) then
if (my_task == master_task) then
write(nu_diag,*) trim(subname),': ref_ymd ',ref_ymd, ' must equal start_ymd ',start_ymd
write(nu_diag,*) trim(subname),': ref_ymd ',ref_tod, ' must equal start_ymd ',start_tod
write(nu_diag,*) trim(subname),': ref_tod',ref_tod, ' must equal start_tod ',start_tod
end if
end if

Expand Down Expand Up @@ -837,6 +839,19 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

end if

! - start time from ESMF clock. Used to set history time units
idate0 = start_ymd
year_init = (idate0/10000)
month_init= (idate0-year_init*10000)/100 ! integer month of basedate
day_init = idate0-year_init*10000-month_init*100

! - Set use_leap_years based on calendar (as some CICE calls use this instead of the calendar type)
if (calendar_type == ice_calendar_gregorian) then
use_leap_years = .true.
else
use_leap_years = .false. ! no_leap calendars
endif

call calendar() ! update calendar info

!----------------------------------------------------------------------------
Expand Down
Loading