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

cam6_4_030: fix psl values sent to coupler in cam7 #1128

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
66 changes: 66 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,71 @@
===============================================================

Tag name:
Originator(s): eaton
Date:
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:

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:

derecho/nvhpc/aux_cam:

izumi/nag/aux_cam:

izumi/gnu/aux_cam:

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_020
Originator(s): fvitt
Date: 14 Aug 2024
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 @@ -2504,7 +2508,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 @@ -2613,6 +2619,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 @@ -2890,6 +2898,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
Loading