Skip to content

Commit

Permalink
Merge pull request #1128 from brian-eaton/psl
Browse files Browse the repository at this point in the history
cam6_4_030: fix psl values sent to coupler in cam7
  • Loading branch information
cacraigucar authored Sep 6, 2024
2 parents 665aae9 + 688faa5 commit 06d91f7
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 38 deletions.
85 changes: 85 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@

===============================================================

Tag name: cam6_4_030
Originator(s): eaton, cacraig
Date: Sept 6, 2024
One-line Summary: fix psl values sent to coupler in cam7
Github PR URL: https://github.com/ESCOMP/CAM/pull/1128

Purpose of changes (include the issue number and title text for each relevant GitHub issue):

. Fix issue #1116 - Test SMS_Ld2.ne30pg3_t232.BMT1850.derecho_gnu.allactive-defaultio Fails
- The cam7 version of tphysbc has a call to cpslec added in front of the
call to cam_export so that psl is set consistent with the state sent to
the coupler.

. Fix issue #805 - cplsec.F90 needs to be in a module.
- Add subroutine cpslec to a new module, src/utils/cam_diagnostic_utils.F90

Describe any changes made to build system: none

Describe any changes made to the namelist: none

List any changes to the defaults for the boundary datasets: none

Describe any substantial timing or memory changes: none

Code reviewed by: cacraig

List all files eliminated:

src/physics/cam/cpslec.F90
. subroutine cpslec moved to new module

List all files added and what they do:

src/utils/cam_diagnostic_utils.F90
. subroutine cpslec added to this new module

List all existing files that have been modified, and describe the changes:

src/physics/cam/cam_diagnostics.F90
. add access to cpslec from cam_diagnostic_utils module

src/physics/cam7/physpkg.F90
. add calculation of psl to tphysbc right in front of call to cam_export

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:
FAIL SMS_D_Ln9_P1280x1.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s RUN time=77
PEND SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s
- pre-existing failures -- need fix in CLM external

FAIL ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s COMPARE_base_rest
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856

ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details:
ERP_Ld3.ne30pg3_ne30pg3_mg17.FCts4MTHIST.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details:
ERS_Ld3.f10_f10_mg37.F1850.derecho_intel.cam-outfrq1d_14dec_ghg_cam7 (Overall: DIFF) details:
SMS_D_Ln9.ne30pg3_ne30pg3_mg17.FMTHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mg17.FCLTHIST.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details:
- CPL history file has difference in the atmImp_Sa_pslv field for CAM7 runs

derecho/nvhpc/aux_cam:
ERS_Ln9_G4-a100-openacc.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_mg3_default (Overall: DIFF) details:
- CPL history file has difference in the atmImp_Sa_pslv field for CAM7 runs

izumi/nag/aux_cam:
FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae
- pre-existing failure - issue #670

izumi/gnu/aux_cam: all BFB

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers: BFB in F compsets. Answers will change
in B compsets.

===============================================================
===============================================================

Tag name: cam6_4_029
Expand Down
11 changes: 6 additions & 5 deletions src/physics/cam/cam_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,12 @@ subroutine diag_phys_writeout_dry(state, pbuf, p_surf_t)
! Purpose: output dry physics diagnostics
!
!-----------------------------------------------------------------------
use physconst, only: gravit, rga, rair, cappa
use time_manager, only: get_nstep
use interpolate_data, only: vertinterp
use tidal_diag, only: tidal_diag_write
use air_composition, only: cpairv, rairv
use physconst, only: gravit, rga, rair, cappa
use time_manager, only: get_nstep
use interpolate_data, only: vertinterp
use tidal_diag, only: tidal_diag_write
use air_composition, only: cpairv, rairv
use cam_diagnostic_utils, only: cpslec
!-----------------------------------------------------------------------
!
! Arguments
Expand Down
12 changes: 11 additions & 1 deletion src/physics/cam7/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ module physpkg
integer :: dqcore_idx = 0 ! dqcore index in physics buffer
integer :: cmfmczm_idx = 0 ! Zhang-McFarlane convective mass fluxes
integer :: rliqbc_idx = 0 ! tphysbc reserve liquid
integer :: psl_idx = 0

!=======================================================================
contains
!=======================================================================
Expand Down Expand Up @@ -1037,6 +1039,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
dtcore_idx = pbuf_get_index('DTCORE')
dqcore_idx = pbuf_get_index('DQCORE')

psl_idx = pbuf_get_index('PSL')

end subroutine phys_init

!
Expand Down Expand Up @@ -2502,7 +2506,9 @@ subroutine tphysbc (ztodt, state, &
use physics_types, only: physics_update, &
physics_state_check, &
dyn_te_idx
use cam_diagnostics, only: diag_conv_tend_ini, diag_conv, diag_export, diag_state_b4_phys_write
use physconst, only: rair, gravit
use cam_diagnostics, only: diag_conv_tend_ini, diag_export, diag_state_b4_phys_write
use cam_diagnostic_utils, only: cpslec
use cam_history, only: outfld
use constituents, only: qmin
use air_composition, only: thermodynamic_active_species_liq_num,thermodynamic_active_species_liq_idx
Expand Down Expand Up @@ -2611,6 +2617,8 @@ subroutine tphysbc (ztodt, state, &
type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes
real(r8) :: zero_tracers(pcols,pcnst)

real(r8), pointer :: psl(:) ! Sea Level Pressure

logical :: lq(pcnst)

!-----------------------------------------------------------------------
Expand Down Expand Up @@ -2888,6 +2896,8 @@ subroutine tphysbc (ztodt, state, &

! Save atmospheric fields to force surface models
call t_startf('cam_export')
call pbuf_get_field(pbuf, psl_idx, psl)
call cpslec(ncol, state%pmid, state%phis, state%ps, state%t, psl, gravit, rair)
call cam_export (state,cam_out,pbuf)
call t_stopf('cam_export')

Expand Down
68 changes: 36 additions & 32 deletions src/physics/cam/cpslec.F90 → src/utils/cam_diagnostic_utils.F90
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
module cam_diagnostic_utils

subroutine cpslec (ncol, pmid, phis, ps, t, psl, gravit, rair)
! Collection of routines used for diagnostic calculations.

use shr_kind_mod, only: r8 => shr_kind_r8
use ppgrid, only: pcols, pver


implicit none
private
save

public :: &
cpslec ! compute sea level pressure

!===============================================================================
contains
!===============================================================================

subroutine cpslec(ncol, pmid, phis, ps, t, psl, gravit, rair)

!-----------------------------------------------------------------------
!
! Purpose:
! Hybrid coord version: Compute sea level pressure for a latitude line
! Compute sea level pressure.
!
! Method:
! CCM2 hybrid coord version using ECMWF formulation
! Algorithm: See section 3.1.b in NCAR NT-396 "Vertical
! Uses ECMWF formulation Algorithm: See section 3.1.b in NCAR NT-396 "Vertical
! Interpolation and Truncation of Model-Coordinate Data
!
! Author: Stolen from the Processor by Erik Kluzek
!
!-----------------------------------------------------------------------
!
! $Id$
! $Author$
!
!-----------------------------------------------------------------------

use shr_kind_mod, only: r8 => shr_kind_r8
use ppgrid, only: pcols, pver

implicit none

!-----------------------------Arguments---------------------------------
!-----------------------------Arguments---------------------------------
integer , intent(in) :: ncol ! longitude dimension

real(r8), intent(in) :: pmid(pcols,pver) ! Atmospheric pressure (pascals)
Expand All @@ -36,21 +39,19 @@ subroutine cpslec (ncol, pmid, phis, ps, t, psl, gravit, rair)
real(r8), intent(in) :: rair ! gas constant for dry air

real(r8), intent(out):: psl(pcols) ! Sea level pressures (pascals)
!-----------------------------------------------------------------------

!-----------------------------Parameters--------------------------------
!-----------------------------Parameters--------------------------------
real(r8), parameter :: xlapse = 6.5e-3_r8 ! Temperature lapse rate (K/m)
!-----------------------------------------------------------------------

!-----------------------------Local Variables---------------------------
integer i ! Loop index
real(r8) alpha ! Temperature lapse rate in terms of pressure ratio (unitless)
real(r8) Tstar ! Computed surface temperature
real(r8) TT0 ! Computed temperature at sea-level
real(r8) alph ! Power to raise P/Ps to get rate of increase of T with pressure
real(r8) beta ! alpha*phis/(R*T) term used in approximation of PSL
!-----------------------------------------------------------------------
!
!-----------------------------Local Variables---------------------------
integer :: i ! Loop index
real(r8) :: alpha ! Temperature lapse rate in terms of pressure ratio (unitless)
real(r8) :: Tstar ! Computed surface temperature
real(r8) :: TT0 ! Computed temperature at sea-level
real(r8) :: alph ! Power to raise P/Ps to get rate of increase of T with pressure
real(r8) :: beta ! alpha*phis/(R*T) term used in approximation of PSL
!-----------------------------------------------------------------------

alpha = rair*xlapse/gravit
do i=1,ncol
if ( abs(phis(i)/gravit) < 1.e-4_r8 )then
Expand All @@ -77,5 +78,8 @@ subroutine cpslec (ncol, pmid, phis, ps, t, psl, gravit, rair)
end if
enddo

return
end subroutine cpslec

!===============================================================================

end module cam_diagnostic_utils

0 comments on commit 06d91f7

Please sign in to comment.