@@ -29,6 +29,7 @@ module cam_comp
29
29
use physics_types, only: phys_state, phys_tend
30
30
use physics_types, only: dtime_phys
31
31
use physics_types, only: calday
32
+ use physics_types, only: is_first_timestep, nstep
32
33
use dyn_comp, only: dyn_import_t, dyn_export_t
33
34
34
35
use perf_mod, only: t_barrierf, t_startf, t_stopf
@@ -149,9 +150,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
149
150
character (len= cx) :: errmsg
150
151
!- ----------------------------------------------------------------------
151
152
152
- dtime_phys = 0.0_r8
153
- call mark_as_initialized(' timestep_for_physics' )
154
-
155
153
call init_pio_subsystem()
156
154
157
155
! Initializations using data passed from coupler.
@@ -167,12 +165,20 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
167
165
168
166
call cam_ctrl_set_orbit(eccen, obliqr, lambm0, mvelpp)
169
167
170
-
171
168
call timemgr_init( &
172
169
dtime, calendar, start_ymd, start_tod, ref_ymd, &
173
170
ref_tod, stop_ymd, stop_tod, curr_ymd, curr_tod, &
174
171
perpetual_run, perpetual_ymd, initial_run_in)
175
172
173
+ dtime_phys = 0.0_r8
174
+ call mark_as_initialized(' timestep_for_physics' )
175
+
176
+ is_first_timestep = .true.
177
+ call mark_as_initialized(' is_first_timestep' )
178
+
179
+ nstep = get_nstep()
180
+ call mark_as_initialized(' current_timestep_number' )
181
+
176
182
! Get current fractional calendar day. Needs to be updated at every timestep.
177
183
calday = get_curr_calday()
178
184
call mark_as_initialized(' fractional_calendar_days_on_end_of_current_timestep' )
@@ -268,6 +274,10 @@ subroutine cam_timestep_init()
268
274
use phys_comp, only: phys_timestep_init
269
275
use stepon, only: stepon_timestep_init
270
276
277
+ ! Update timestep flags in physics state
278
+ is_first_timestep = is_first_step()
279
+ nstep = get_nstep()
280
+
271
281
!- ---------------------------------------------------------
272
282
! First phase of dynamics (at least couple from dynamics to physics)
273
283
! Return time-step for physics from dynamics.
@@ -514,10 +524,6 @@ subroutine cam_final(cam_out, cam_in)
514
524
type (cam_out_t), pointer :: cam_out ! Output from CAM to surface
515
525
type (cam_in_t), pointer :: cam_in ! Input from merged surface to CAM
516
526
517
- !
518
- ! Local variable
519
- !
520
- integer :: nstep ! Current timestep number.
521
527
!- ----------------------------------------------------------------------
522
528
523
529
call phys_final()
@@ -540,7 +546,6 @@ subroutine cam_final(cam_out, cam_in)
540
546
call shr_sys_flush( iulog ) ! Flush all output to the CAM log file
541
547
542
548
if (masterproc) then
543
- nstep = get_nstep()
544
549
write (iulog,9300 ) nstep-1 ,nstep
545
550
9300 format (// ' Number of completed timesteps:' ,i6,/ ,' Time step ' ,i6, &
546
551
' partially done to provide convectively adjusted and ' , &
0 commit comments