@@ -29,7 +29,7 @@ module cam_comp
2929 use physics_types, only: phys_state, phys_tend
3030 use physics_types, only: dtime_phys
3131 use physics_types, only: calday
32- use physics_types, only: is_first_timestep
32+ use physics_types, only: is_first_timestep, nstep
3333 use dyn_comp, only: dyn_import_t, dyn_export_t
3434
3535 use perf_mod, only: t_barrierf, t_startf, t_stopf
@@ -149,12 +149,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
149149 character (len= cx) :: errmsg
150150 !- ----------------------------------------------------------------------
151151
152- dtime_phys = 0.0_r8
153- call mark_as_initialized(' timestep_for_physics' )
154-
155- is_first_timestep = .true.
156- call mark_as_initialized(' is_first_timestep' )
157-
158152 call init_pio_subsystem()
159153
160154 ! Initializations using data passed from coupler.
@@ -170,12 +164,20 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
170164
171165 call cam_ctrl_set_orbit(eccen, obliqr, lambm0, mvelpp)
172166
173-
174167 call timemgr_init( &
175168 dtime, calendar, start_ymd, start_tod, ref_ymd, &
176169 ref_tod, stop_ymd, stop_tod, curr_ymd, curr_tod, &
177170 perpetual_run, perpetual_ymd, initial_run_in)
178171
172+ dtime_phys = 0.0_r8
173+ call mark_as_initialized(' timestep_for_physics' )
174+
175+ is_first_timestep = .true.
176+ call mark_as_initialized(' is_first_timestep' )
177+
178+ nstep = get_nstep()
179+ call mark_as_initialized(' current_timestep_number' )
180+
179181 ! Get current fractional calendar day. Needs to be updated at every timestep.
180182 calday = get_curr_calday()
181183 call mark_as_initialized(' fractional_calendar_days_on_end_of_current_timestep' )
@@ -269,6 +271,7 @@ subroutine cam_timestep_init()
269271
270272 ! Update timestep flags in physics state
271273 is_first_timestep = is_first_step()
274+ nstep = get_nstep()
272275
273276 !- ---------------------------------------------------------
274277 ! First phase of dynamics (at least couple from dynamics to physics)
@@ -516,10 +519,6 @@ subroutine cam_final(cam_out, cam_in)
516519 type (cam_out_t), pointer :: cam_out ! Output from CAM to surface
517520 type (cam_in_t), pointer :: cam_in ! Input from merged surface to CAM
518521
519- !
520- ! Local variable
521- !
522- integer :: nstep ! Current timestep number.
523522 !- ----------------------------------------------------------------------
524523
525524 call phys_final()
@@ -542,7 +541,6 @@ subroutine cam_final(cam_out, cam_in)
542541 call shr_sys_flush( iulog ) ! Flush all output to the CAM log file
543542
544543 if (masterproc) then
545- nstep = get_nstep()
546544 write (iulog,9300 ) nstep-1 ,nstep
5475459300 format (// ' Number of completed timesteps:' ,i6,/ ,' Time step ' ,i6, &
548546 ' partially done to provide convectively adjusted and ' , &
0 commit comments