Skip to content

Commit 2967809

Browse files
authored
Merge pull request #1304 from PeterHjortLauritzen/MPAS-pmid
cam6_4_092: MPAS dp_coupling bug fixes
2 parents 66d132b + 9780f9d commit 2967809

File tree

2 files changed

+73
-14
lines changed

2 files changed

+73
-14
lines changed

doc/ChangeLog

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
Tag name: cam6_4_092
2+
Originator(s): pel, cacraig
3+
Date: May 14, 2025
4+
One-line Summary: bugfixes in dp_coupling for MPAS
5+
Github PR URL: https://github.com/ESCOMP/CAM/pull/
6+
7+
This tag updates the following externals:
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
fix issue with mid-level pressure not being bounded by interface pressures in MPAS physics-dynamics coupling: https://github.com/ESCOMP/CAM/issues/1268
11+
fix Exner bug in MPAS physics-dynamics coupling: https://github.com/ESCOMP/CAM/issues/753
12+
13+
Describe any changes made to build system: N/A
14+
15+
Describe any changes made to the namelist: N/A
16+
17+
List any changes to the defaults for the boundary datasets: N/A
18+
19+
Describe any substantial timing or memory changes: N/A
20+
21+
Code reviewed by: nusbaume, kuanchihwang
22+
23+
List all files eliminated: N/A
24+
25+
List all files added and what they do: N/A
26+
27+
List all existing files that have been modified, and describe the changes:
28+
M src/dynamics/mpas/dp_coupling.F90
29+
- Changes as described above
30+
31+
If there were any failures reported from running test_driver.sh on any test
32+
platform, and checkin with these failures has been OK'd by the gatekeeper,
33+
then copy the lines from the td.*.status files for the failed tests to the
34+
appropriate machine below. All failed tests must be justified.
35+
36+
derecho/intel/aux_cam:
37+
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
38+
FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s SETUP
39+
- Pre-existing failures due to build-namelist error requiring CLM/CTSM external update
40+
41+
ERS_D_Ln9.mpasa480_mpasa480.F2000climo.derecho_intel.cam-outfrq9s_mpasa480_pertlim (Overall: DIFF) details:
42+
ERS_D_Ln9.mpasa480_mpasa480.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
43+
ERS_Ln9_P288x1.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details:
44+
- Answer changes due to MPAS changes
45+
46+
derecho/nvhpc/aux_cam: all BFB
47+
48+
izumi/nag/aux_cam: all BFB
49+
50+
izumi/gnu/aux_cam:
51+
ERS_D_Ln9.mpasa480_mpasa480.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
52+
ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
53+
- Answer changes due to MPAS changes
54+
155
===============================================================
256

357
Tag name: cam6_4_091
@@ -346,7 +400,7 @@ derecho/intel/aux_cam:
346400
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL)
347401
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF)
348402
SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF)
349-
- pre-existing failures due to HEMCO not having reproducible results (issues #1018 and #856)
403+
- pre-existing failures due to HEMCO not having reproducible results (issues #1018 and #856)
350404

351405
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
352406
- pre-existing failure due to build-namelist error requiring CLM/CTSM external update

src/dynamics/mpas/dp_coupling.F90

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module dp_coupling
88
use pmgrid, only: plev
99
use ppgrid, only: begchunk, endchunk, pcols, pver, pverp
1010
use constituents, only: pcnst, cnst_type
11-
use physconst, only: gravit, cappa, zvir
11+
use physconst, only: gravit, zvir
1212
use air_composition,only: cpairv
1313
use air_composition,only: dry_air_species_num
1414
use dyn_comp, only: dyn_export_t, dyn_import_t
@@ -458,7 +458,7 @@ subroutine derived_phys(phys_state, phys_tend, pbuf2d)
458458
use shr_vmath_mod, only: shr_vmath_log
459459
use phys_control, only: waccmx_is
460460
use cam_thermo, only: cam_thermo_dry_air_update, cam_thermo_water_update
461-
use air_composition, only: rairv, dry_air_species_num
461+
use air_composition, only: rairv, dry_air_species_num, cappav
462462
use qneg_module, only: qneg3
463463
use shr_const_mod, only: shr_const_rwv
464464
use constituents, only: qmin
@@ -475,8 +475,6 @@ subroutine derived_phys(phys_state, phys_tend, pbuf2d)
475475
real(r8) :: factor(pcols,pver)
476476
real(r8) :: zvirv(pcols,pver)
477477

478-
real(r8), parameter :: pref = 1.e5_r8 ! reference pressure (Pa)
479-
480478
type(physics_buffer_desc), pointer :: pbuf_chnk(:)
481479

482480
character(len=*), parameter :: subname = 'dp_coupling::derived_phys'
@@ -545,13 +543,6 @@ subroutine derived_phys(phys_state, phys_tend, pbuf2d)
545543
phys_state(lchnk)%lnpmid(:ncol,k), ncol)
546544
end do
547545

548-
do k = 1, pver
549-
phys_state(lchnk)%exner(:ncol,k) = (pref / phys_state(lchnk)%pmid(:ncol,k))**cappa
550-
end do
551-
552-
553-
554-
555546
if (dry_air_species_num>0) then
556547
!------------------------------------------------------------
557548
! Apply limiters to mixing ratios of major species
@@ -568,6 +559,10 @@ subroutine derived_phys(phys_state, phys_tend, pbuf2d)
568559
else
569560
zvirv(:,:) = zvir
570561
endif
562+
do k = 1, pver
563+
phys_state(lchnk)%exner(:ncol,k) = (phys_state(lchnk)%pint(:ncol,pverp) / phys_state(lchnk)%pmid(:ncol,k))**cappav(:ncol,k,lchnk)
564+
end do
565+
571566
!
572567
! update cp_dycore in module air_composition.
573568
! (note: at this point q is dry)
@@ -877,6 +872,8 @@ subroutine hydrostatic_pressure(nCells, nVertLevels, qsize, index_qv, zz, zgrid,
877872
real(r8), dimension(nVertLevels+1,nCells) :: pint ! hydrostatic pressure at interface
878873
real(r8) :: sum_water
879874
real(r8) :: pk,rhok,rhodryk,thetavk,kap1,kap2,tvk,tk
875+
real(r8), parameter :: epsilon = 0.05_r8
876+
real(r8) :: dp_epsilon, dpdry_epsilon
880877
!
881878
! For each column, integrate downward from model top to compute dry hydrostatic pressure at layer
882879
! midpoints and interfaces. The pressure averaged to layer midpoints should be consistent with
@@ -925,8 +922,16 @@ subroutine hydrostatic_pressure(nCells, nVertLevels, qsize, index_qv, zz, zgrid,
925922
pintdry(k,iCell) = pintdry(k+1,iCell)+dpdry(k)
926923
pmid(k,iCell) = dp(k) *rgas*tvk/(gravit*dz(k))
927924
pmiddry(k,iCell) = dpdry(k)*rgas*tk /(gravit*dz(k))
928-
end do
929-
end do
925+
!
926+
! PMID is not necessarily bounded by the hydrostatic interface pressure.
927+
! (has been found to be an issue at ~3.75km resolution in surface layer)
928+
!
929+
dp_epsilon = dp(k) * epsilon
930+
dpdry_epsilon = dpdry(k)*epsilon
931+
pmid (k, iCell) = max(min(pmid (k, iCell), pint (k, iCell) - dp_epsilon), pint (k + 1, iCell) + dp_epsilon)
932+
pmiddry(k, iCell) = max(min(pmiddry(k, iCell), pintdry(k, iCell) - dpdry_epsilon), pintdry(k + 1, iCell) + dpdry_epsilon)
933+
end do
934+
end do
930935
end subroutine hydrostatic_pressure
931936

932937
subroutine tot_energy_dyn(nCells, nVertLevels, qsize, index_qv, zz, zgrid, rho_zz, theta_m, q, ux,uy,outfld_name_suffix)

0 commit comments

Comments
 (0)