Skip to content

Commit

Permalink
add coordinate trop_pref
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Apr 10, 2024
1 parent 3b235e4 commit f3000de
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/physics/cam/cospsimulator_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ subroutine cospsimulator_intr_init()
'T_COSP', flag_xyfill=.true., fill_value=R_UNDEF)
call addfld ('RH_COSP', (/ 'lev'/), 'I','percent', &
'RH_COSP', flag_xyfill=.true., fill_value=R_UNDEF)

call addfld ('TAU_067', (/'cosp_scol','lev '/), 'I','1', &
'Subcolumn 0.67micron optical depth', flag_xyfill=.true., fill_value=R_UNDEF)
call addfld ('EMISS_11', (/'cosp_scol','lev '/), 'I','1', &
Expand Down
25 changes: 23 additions & 2 deletions src/physics/cam/ref_pres.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ module ref_pres
!
!--------------------------------------------------------------------------

use shr_kind_mod, only: r8=>shr_kind_r8
use ppgrid, only: pver, pverp
use shr_kind_mod, only: r8=>shr_kind_r8
use ppgrid, only: pver, pverp
use cam_history_support, only: add_vert_coord
use cam_logfile, only: iulog
use error_messages, only: alloc_err

implicit none
public
Expand Down Expand Up @@ -49,6 +52,10 @@ module ref_pres
logical, protected :: do_molec_diff = .false.
integer, protected :: nbot_molec = 0

! Data for the trop_pref coordinate. It is the target of a pointer in a hist_coord_t
! object in the cam_history_support module. It is associated by the call to add_vert_coord.
real(r8), private, allocatable, target :: trop_pref(:)

!====================================================================================
contains
!====================================================================================
Expand Down Expand Up @@ -111,6 +118,11 @@ subroutine ref_pres_init(pref_edge_in, pref_mid_in, num_pr_lev_in)
real(r8), intent(in) :: pref_edge_in(:) ! reference pressure at layer edges (Pa)
real(r8), intent(in) :: pref_mid_in(:) ! reference pressure at layer midpoints (Pa)
integer, intent(in) :: num_pr_lev_in ! number of top levels using pure pressure representation

! local variables
integer :: nlev
integer :: istat
character(len=*), parameter :: sub = 'ref_pres_init'
!---------------------------------------------------------------------------

pref_edge = pref_edge_in
Expand All @@ -137,6 +149,15 @@ subroutine ref_pres_init(pref_edge_in, pref_mid_in, num_pr_lev_in)
top=.false.)
end if

! Add vertical coordinate to history file for use with outputs that are only
! computed in the subdomain bounded by the top of troposphere clouds.
nlev = pver - trop_cloud_top_lev + 1
allocate(trop_pref(nlev), stat=istat)
call alloc_err(istat, sub, 'trop_pref', nlev)
trop_pref = pref_mid(trop_cloud_top_lev:)*0.01_r8 ! convert Pa to hPa
call add_vert_coord('trop_pref', nlev, 'troposphere reference pressures', &
'hPa', trop_pref, positive='down')

end subroutine ref_pres_init

!====================================================================================
Expand Down
6 changes: 5 additions & 1 deletion src/utils/hycoef.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ module hycoef
! interfaces p(k) = hyai(k)*ps0 + hybi(k)*ps
! midpoints p(k) = hyam(k)*ps0 + hybm(k)*ps
!
! Note: Module data with a target attribute are targets of pointers in hist_coord_t
! objects in the cam_history_support module. They are associated by the calls
! to add_hist_coord and add_vert_coord
!
!-----------------------------------------------------------------------

real(r8), public, target :: hyai(plevp) ! ps0 component of hybrid coordinate - interfaces
Expand All @@ -41,7 +45,7 @@ module hycoef
real(r8), public, protected :: ps0 = 1.0e5_r8 ! Base state surface pressure (pascals)
real(r8), public, protected :: psr = 1.0e5_r8 ! Reference surface pressure (pascals)
#endif
real(r8), target :: alev(plev) ! level values (pascals) for 'lev' coord
real(r8), target :: alev(plev) ! level values (hPa) for 'lev' coord
real(r8), target :: ailev(plevp) ! interface level values for 'ilev' coord

integer, public :: nprlev ! number of pure pressure levels at top
Expand Down

0 comments on commit f3000de

Please sign in to comment.