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

Port finer-grained control over physics subroutines #7

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
21 changes: 17 additions & 4 deletions wrapper/lib/coupler_lib.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ module coupler_lib
update_atmos_model_dynamics, &
update_atmos_radiation_physics, &
update_atmos_model_state, &
atmos_data_type, atmos_model_restart
atmos_data_type, &
atmos_model_restart, &
update_atmos_pre_radiation, &
update_atmos_radiation, &
update_atmos_physics

!--- FMS old io
#ifdef use_deprecated_io
use fms_io_mod, only: fms_io_exit!< This can't be removed until fms_io is not used at all
Expand Down Expand Up @@ -194,12 +199,20 @@ subroutine do_dynamics() bind(c)
Time_atmos = Time_atmos + Time_step_atmos
call update_atmos_model_dynamics (Atm)
end subroutine do_dynamics

! substepped physics
subroutine do_pre_radiation() bind(c)
call update_atmos_pre_radiation (Atm)
end subroutine do_pre_radiation

subroutine do_radiation() bind(c)
call update_atmos_radiation (Atm)
end subroutine do_radiation

subroutine do_physics() bind(c)
call update_atmos_radiation_physics (Atm)
call update_atmos_model_state (Atm)
call update_atmos_physics (Atm)
end subroutine do_physics

subroutine compute_physics_subroutine() bind(c)
call update_atmos_radiation_physics (Atm)
end subroutine compute_physics_subroutine
Expand Down
3 changes: 3 additions & 0 deletions wrapper/shield/wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
initialize,
step,
step_dynamics,
step_radiation,
step_pre_radiation,
step_post_radiation_physics,
step_physics,
save_intermediate_restart_if_enabled,
save_fortran_restart,
Expand Down
22 changes: 22 additions & 0 deletions wrapper/templates/_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,28 @@ def _get_diagnostic_data(int idx):
return pace.util.Quantity(array, dims, units=units)


cdef extern:
void do_pre_radiation()
void do_radiation()
void do_physics()


def step_pre_radiation():
"""Do pre-radiation computations (e.g. time varying logic)"""
do_pre_radiation()


def step_radiation():
"""Compute Radiative transfer scheme"""
do_radiation()


def step_post_radiation_physics():
"""Compute Post-radiation physics (e.g. moist physics turbulence)"""
# TODO ensure that IPD_control.first_step is set in this routine
do_physics()


def transform_agrid_winds_to_dgrid_winds(ua, va):
"""Transform A-grid lat-lon winds to D-grid cubed-sphere winds.
This function wraps the cubed_a2d subroutine from the fortran model, making
Expand Down