Skip to content

Commit

Permalink
Add is_first_timestep registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmielin committed Sep 16, 2024
1 parent 3239f16 commit c8fb4f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module cam_comp
use camsrfexch, only: cam_out_t, cam_in_t
use physics_types, only: phys_state, phys_tend
use physics_types, only: dtime_phys
use physics_types, only: is_first_timestep
use dyn_comp, only: dyn_import_t, dyn_export_t

use perf_mod, only: t_barrierf, t_startf, t_stopf
Expand Down Expand Up @@ -148,6 +149,9 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
dtime_phys = 0.0_r8
call mark_as_initialized('timestep_for_physics')

is_first_timestep = is_first_step()
call mark_as_initialized('is_first_timestep')

call init_pio_subsystem()

! Initializations using data passed from coupler.
Expand Down Expand Up @@ -254,6 +258,9 @@ subroutine cam_timestep_init()
use phys_comp, only: phys_timestep_init
use stepon, only: stepon_timestep_init

! Update timestep flags in physics state
is_first_timestep = is_first_step()

!----------------------------------------------------------
! First phase of dynamics (at least couple from dynamics to physics)
! Return time-step for physics from dynamics.
Expand Down
6 changes: 6 additions & 0 deletions src/data/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@
<dimensions>horizontal_dimension</dimensions>
<ic_file_input_names>tw_cur state_tw_cur</ic_file_input_names>
</variable>
<!-- Timestep properties -->
<variable local_name="is_first_timestep"
standard_name="is_first_timestep"
units="flag" type="logical" access="protected">
<long_name>flag indicating if is first timestep of initial run</long_name>
</variable>
<!-- State tendencies -->
<variable local_name="dTdt_total"
standard_name="tendency_of_air_temperature_due_to_model_physics"
Expand Down
5 changes: 3 additions & 2 deletions src/dynamics/se/dp_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,12 @@ subroutine derived_phys_dry(cam_runtime_opts, phys_state, phys_tend)
use geopotential_temp, only: geopotential_temp_run
use static_energy, only: update_dry_static_energy_run
use qneg, only: qneg_run
! use check_energy, only: check_energy_timestep_init
! use check_energy_chng, only: check_energy_chng_timestep_init
use hycoef, only: hyai, ps0
use shr_vmath_mod, only: shr_vmath_log
use shr_kind_mod, only: shr_kind_cx
use dyn_comp, only: ixo, ixo2, ixh, ixh2
use dyn_tests_utils, only: vc_dry_pressure

! arguments
type(runtime_options), intent(in) :: cam_runtime_opts ! Runtime settings object
Expand Down Expand Up @@ -855,7 +856,7 @@ subroutine derived_phys_dry(cam_runtime_opts, phys_state, phys_tend)
!Remove once check_energy scheme exists in CAMDEN:
#if 0
! Compute energy and water integrals of input state
call check_energy_timestep_init(phys_state, phys_tend, pbuf_chnk)
! call check_energy_chng_timestep_init(...)
#endif

end subroutine derived_phys_dry
Expand Down

0 comments on commit c8fb4f0

Please sign in to comment.