Skip to content

Commit

Permalink
Wire up dynamics-physics coupling
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanchihwang committed Sep 30, 2024
1 parent 936306e commit e048618
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/dynamics/mpas/stepon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ module stepon
! Modules from CAM-SIMA.
use camsrfexch, only: cam_out_t
use dyn_comp, only: dyn_import_t, dyn_export_t, dyn_run
use dyn_coupling, only: dynamics_to_physics_coupling, physics_to_dynamics_coupling
use physics_types, only: physics_state, physics_tend
use runtime_obj, only: runtime_options
use time_manager, only: get_step_size

! Modules from CESM Share.
use shr_kind_mod, only: kind_r8 => shr_kind_r8
! Modules from CCPP.
use ccpp_kinds, only: kind_phys

implicit none

Expand All @@ -27,29 +29,36 @@ end subroutine stepon_init

! Called by `cam_timestep_init` in `src/control/cam_comp.F90`.
subroutine stepon_timestep_init(dtime_phys, cam_runtime_opts, phys_state, phys_tend, dyn_in, dyn_out)
real(kind_r8), intent(out) :: dtime_phys
real(kind_phys), intent(out) :: dtime_phys
type(runtime_options), intent(in) :: cam_runtime_opts
type(physics_state), intent(inout) :: phys_state
type(physics_tend), intent(inout) :: phys_tend
type(physics_state), intent(in) :: phys_state
type(physics_tend), intent(in) :: phys_tend
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out

! Set timestep for physics.
dtime_phys = real(get_step_size(), kind_phys)

call dynamics_to_physics_coupling()
end subroutine stepon_timestep_init

! Called by `cam_run2` in `src/control/cam_comp.F90`.
subroutine stepon_run2(cam_runtime_opts, phys_state, phys_tend, dyn_in, dyn_out)
type(runtime_options), intent(in) :: cam_runtime_opts
type(physics_state), intent(inout) :: phys_state
type(physics_tend), intent(inout) :: phys_tend
type(physics_state), intent(in) :: phys_state
type(physics_tend), intent(in) :: phys_tend
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out

call physics_to_dynamics_coupling()
end subroutine stepon_run2

! Called by `cam_run3` in `src/control/cam_comp.F90`.
subroutine stepon_run3(dtime_phys, cam_runtime_opts, cam_out, phys_state, dyn_in, dyn_out)
real(kind_r8), intent(in) :: dtime_phys
real(kind_phys), intent(in) :: dtime_phys
type(runtime_options), intent(in) :: cam_runtime_opts
type(cam_out_t), intent(inout) :: cam_out
type(physics_state), intent(inout) :: phys_state
type(cam_out_t), intent(in) :: cam_out
type(physics_state), intent(in) :: phys_state
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out

Expand Down

0 comments on commit e048618

Please sign in to comment.