Skip to content

Impose range limits on mid-level pressure in MPAS dynamics-physics coupling #391

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

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
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
19 changes: 17 additions & 2 deletions src/dynamics/mpas/dyn_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ subroutine dynamics_to_physics_coupling()
! `*_int`: Variable is at layer interfaces.
! `*_mid`: Variable is at layer midpoints.
real(kind_r8), allocatable :: pd_int_col(:), & ! Dry hydrostatic air pressure (Pa).
pd_mid_col(:), & ! Dry hydrostatic air pressure (Pa).
pd_mid_col(:), & ! Dry non-hydrostatic air pressure (Pa).
p_int_col(:), & ! Full hydrostatic air pressure (Pa).
p_mid_col(:), & ! Full hydrostatic air pressure (Pa).
p_mid_col(:), & ! Full non-hydrostatic air pressure (Pa).
z_int_col(:) ! Geometric height (m).
real(kind_r8), allocatable :: dpd_col(:), & ! Dry air pressure difference (Pa) between layer interfaces.
dp_col(:), & ! Full air pressure difference (Pa) between layer interfaces.
Expand Down Expand Up @@ -203,6 +203,8 @@ subroutine update_shared_variables(i)

character(*), parameter :: subname = 'dyn_coupling::dynamics_to_physics_coupling::update_shared_variables'
integer :: k
! Proximity limit, in fraction, on how close `p{,d}_mid_col` is allowed to be around its surrounding `p{,d}_int_col`.
real(kind_r8), parameter :: p_int_mid_proximity_limit = 0.05_kind_r8

! The summation term of equation 5 in doi:10.1029/2017MS001257.
sigma_all_q_mid_col(:) = 1.0_kind_r8 + sum(scalars(is_water_species_index, :, i), 1)
Expand Down Expand Up @@ -248,6 +250,19 @@ subroutine update_shared_variables(i)
p_int_col(k) = p_int_col(k + 1) - dp_col(k)
end do

! `p{,d}_mid_col` is not guaranteed to be bounded by `p{,d}_int_col` because the former is non-hydrostatic
! while the latter is hydrostatic. In high-resolution simulations, the former could exceed the latter,
! leading to a model crash in physics.
! Impose range limits on `p{,d}_mid_col` so it is bounded by `p{,d}_int_col`.
pd_mid_col(:) = &
max(min(pd_mid_col, &
pd_int_col(1:pver) + dpd_col(:) * p_int_mid_proximity_limit), &
pd_int_col(2:pverp) - dpd_col(:) * p_int_mid_proximity_limit)
p_mid_col(:) = &
max(min(p_mid_col, &
p_int_col(1:pver) + dp_col(:) * p_int_mid_proximity_limit), &
p_int_col(2:pverp) - dp_col(:) * p_int_mid_proximity_limit)

! Compute momentum variables.

! By definition.
Expand Down