Skip to content

Commit 635fa21

Browse files
authored
Impose range limits on mid-level pressure in MPAS dynamics-physics coupling (#391)
### Tag name (required for release branches): None ### Originator(s): kuanchihwang ### Descriptions (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): This PR ports a bug fix from ESCOMP/CAM#1304 to CAM-SIMA. In MPAS dynamics-physics coupling, mid-level pressure is not bounded by interface pressure. In high-resolution simulations, the former could exceed the latter, leading to a model crash in physics. Therefore, impose range limits on mid-level pressure to ensure that it is bounded by interface pressure. Closes #388 ### Describe any changes made to the build system: None ### Describe any changes made to the namelist: None ### List any changes to the defaults for the input datasets (e.g., boundary datasets): None ### List all files eliminated and why: None ### List all files added and what they do: None ### List all existing files that have been modified, and describe the changes: ``` M src/dynamics/mpas/dyn_coupling.F90 * Limit mid-level pressure within the range of interface pressure * Remove debugging block * Correct code comments ``` ### Regression tests: No changes to any existing tests. All tests pass with respect to the last baseline, `sima0_06_000`.
1 parent e252454 commit 635fa21

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/dynamics/mpas/dyn_coupling.F90

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ subroutine dynamics_to_physics_coupling()
3434
! `*_int`: Variable is at layer interfaces.
3535
! `*_mid`: Variable is at layer midpoints.
3636
real(kind_r8), allocatable :: pd_int_col(:), & ! Dry hydrostatic air pressure (Pa).
37-
pd_mid_col(:), & ! Dry hydrostatic air pressure (Pa).
37+
pd_mid_col(:), & ! Dry non-hydrostatic air pressure (Pa).
3838
p_int_col(:), & ! Full hydrostatic air pressure (Pa).
39-
p_mid_col(:), & ! Full hydrostatic air pressure (Pa).
39+
p_mid_col(:), & ! Full non-hydrostatic air pressure (Pa).
4040
z_int_col(:) ! Geometric height (m).
4141
real(kind_r8), allocatable :: dpd_col(:), & ! Dry air pressure difference (Pa) between layer interfaces.
4242
dp_col(:), & ! Full air pressure difference (Pa) between layer interfaces.
@@ -203,6 +203,8 @@ subroutine update_shared_variables(i)
203203

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

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

253+
! `p{,d}_mid_col` is not guaranteed to be bounded by `p{,d}_int_col` because the former is non-hydrostatic
254+
! while the latter is hydrostatic. In high-resolution simulations, the former could exceed the latter,
255+
! leading to a model crash in physics.
256+
! Impose range limits on `p{,d}_mid_col` so it is bounded by `p{,d}_int_col`.
257+
pd_mid_col(:) = &
258+
max(min(pd_mid_col, &
259+
pd_int_col(1:pver) + dpd_col(:) * p_int_mid_proximity_limit), &
260+
pd_int_col(2:pverp) - dpd_col(:) * p_int_mid_proximity_limit)
261+
p_mid_col(:) = &
262+
max(min(p_mid_col, &
263+
p_int_col(1:pver) + dp_col(:) * p_int_mid_proximity_limit), &
264+
p_int_col(2:pverp) - dp_col(:) * p_int_mid_proximity_limit)
265+
251266
! Compute momentum variables.
252267

253268
! By definition.

0 commit comments

Comments
 (0)