Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,7 @@ sub write_filepath
print $fh "$camsrcdir/src/atmos_phys/schemes/vertical_diffusion\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/holtslag_boville\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/bretherton_park\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/uw_shallow\n";

# Dynamics package and test utilities
print $fh "$camsrcdir/src/dynamics/$dyn\n";
Expand Down
104 changes: 58 additions & 46 deletions src/physics/cam/convect_shallow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module convect_shallow
! 'off' = No shallow convection

character(len=16) :: shallow_scheme ! Default set in phys_control.F90, use namelist to change
character(len=16) :: microp_scheme ! Microphysics scheme
logical :: history_amwg ! output the variables used by the AMWG diag package
logical :: history_budget ! Output tendencies and state variables for CAM4 T, qv, ql, qi
integer :: history_budget_histfile_num ! output history file number for budget fields
Expand Down Expand Up @@ -86,7 +85,7 @@ subroutine convect_shallow_register
use physics_buffer, only : pbuf_add_field, dtype_r8, dyn_time_lvls
use phys_control, only: use_gw_convect_sh

call phys_getopts( shallow_scheme_out = shallow_scheme, microp_scheme_out = microp_scheme)
call phys_getopts( shallow_scheme_out = shallow_scheme )

call pbuf_add_field('ICWMRSH', 'physpkg' ,dtype_r8,(/pcols,pver/), icwmrsh_idx )
call pbuf_add_field('RPRDSH', 'physpkg' ,dtype_r8,(/pcols,pver/), rprdsh_idx )
Expand Down Expand Up @@ -266,7 +265,7 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
write(iulog,*) 'ERROR: shallow convection scheme ', shallow_scheme, ' is incompatible with eddy scheme ', eddy_scheme
call endrun( 'convect_shallow_init: shallow_scheme and eddy_scheme are incompatible' )
endif
call init_uwshcu( r8, latvap, cpair, latice, zvir, rair, gravit, mwh2o/mwdry )
call init_uwshcu( r8, latvap, cpair, latice, zvir, rair, gravit, mwh2o, mwdry )

tke_idx = pbuf_get_index('tke')

Expand Down Expand Up @@ -320,15 +319,13 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &

use constituents, only : pcnst, cnst_get_ind, cnst_get_type_byind
use hk_conv, only : cmfmca_cam
use uwshcu, only : compute_uwshcu_inv

use uwshcu, only: uwshcu_cam

use time_manager, only : get_nstep
use wv_saturation, only : qsat
use physconst, only : latice, latvap, rhoh2o, tmelt, gravit

use spmd_utils, only : iam
implicit none

! ---------------------- !
! Input-Output Arguments !
! ---------------------- !
Expand All @@ -355,13 +352,10 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
! --------------- !
integer :: i, k, m
integer :: n, x
integer :: ilon ! Global longitude index of a column
integer :: ilat ! Global latitude index of a column
integer :: lchnk ! Chunk identifier
integer :: ncol ! Number of atmospheric columns
integer :: nstep ! Current time step index
integer :: ixcldice, ixcldliq ! Constituent indices for cloud liquid and ice water.
integer :: ixnumice, ixnumliq ! Constituent indices for cloud liquid and ice number concentration

real(r8), pointer :: precc(:) ! Shallow convective precipitation (rain+snow) rate at surface [ m/s ]
real(r8), pointer :: snow(:) ! Shallow convective snow rate at surface [ m/s ]
Expand All @@ -381,9 +375,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
real(r8) :: ntsnprd(pcols,pver) ! Net snow production in layer
real(r8) :: tend_s_snwprd(pcols,pver) ! Heating rate of snow production
real(r8) :: tend_s_snwevmlt(pcols,pver) ! Heating rate of evap/melting of snow
real(r8) :: slflx(pcols,pverp) ! Shallow convective liquid water static energy flux
real(r8) :: qtflx(pcols,pverp) ! Shallow convective total water flux
real(r8) :: cmfdqs(pcols, pver) ! Shallow convective snow production
real(r8) :: zero(pcols) ! Array of zeros
real(r8) :: cbmf(pcols) ! Shallow cloud base mass flux [ kg/s/m2 ]
real(r8) :: freqsh(pcols) ! Frequency of shallow convection occurence
Expand Down Expand Up @@ -506,10 +497,7 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
ptend_loc%q = 0._r8
ptend_loc%s = 0._r8
rprdsh = 0._r8
cmfdqs = 0._r8
precc = 0._r8
slflx = 0._r8
qtflx = 0._r8
icwmr = 0._r8
rliq2 = 0._r8
qc2 = 0._r8
Expand Down Expand Up @@ -545,37 +533,73 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
lq(:) = .TRUE.
call physics_ptend_init( ptend_loc, state%psetcols, 'UWSHCU', ls=.true., lu=.true., lv=.true., lq=lq )

! pbuf field setup:
! cush - convective scale height (inout)
call pbuf_get_field(pbuf, cush_idx, cush ,(/1,itim_old/), (/pcols,1/))
! tke - in [m2 s-2]
call pbuf_get_field(pbuf, tke_idx, tke)


! shallow convective precip (rain + snow) flux (out from uwshcu)
call pbuf_get_field(pbuf, sh_flxprc_idx, flxprec)
! shallow convective snow flux (out from uwshcu)
call pbuf_get_field(pbuf, sh_flxsnw_idx, flxsnow)
! shallow convective (entrainment)/(entrainment+detrainment) ratio (out from uwshcu)
call pbuf_get_field(pbuf, sh_e_ed_ratio_idx, sh_e_ed_ratio)

call compute_uwshcu_inv( pcols , pver , ncol , pcnst , ztodt , &
state%pint, state%zi, state%pmid , state%zm , state%pdel , &
state%u , state%v , state%q(:,:,1) , state%q(:,:,ixcldliq), state%q(:,:,ixcldice), &
state%t , state%s , state%q(:,:,:) , &
tke , cld , concld , pblh , cush , &
cmfmc2 , slflx , qtflx , &
flxprec, flxsnow, &
ptend_loc%q(:,:,1) , ptend_loc%q(:,:,ixcldliq), ptend_loc%q(:,:,ixcldice), &
ptend_loc%s , ptend_loc%u , ptend_loc%v , ptend_tracer , &
rprdsh , cmfdqs , precc , snow , &
evapcsh , shfrc , iccmr_UW , icwmr_UW , &
icimr_UW , cbmf , qc2 , rliq2 , &
cnt2 , cnb2 , lchnk , state%pdeldry , &
sh_e_ed_ratio )
call uwshcu_cam( &
pcols = pcols, &
ncol = ncol, &
pver = pver, &
ncnst = pcnst, &
dt = ztodt, &
ps0_inv = state%pint, &
zs0_inv = state%zi, &
p0_inv = state%pmid, &
z0_inv = state%zm, &
dp0_inv = state%pdel, &
u0_inv = state%u, &
v0_inv = state%v, &
qv0_inv = state%q(:,:,1), &
ql0_inv = state%q(:,:,ixcldliq), &
qi0_inv = state%q(:,:,ixcldice), &
t0_inv = state%t, &
s0_inv = state%s, &
tr0_inv = state%q(:,:,:), &
tke_inv = tke, &
pblh = pblh, &
cush = cush, &
umf_inv = cmfmc2, &
slflx_inv = cmfsl, &
qtflx_inv = cmflq, &
flxprc1_inv = flxprec, &
flxsnow1_inv = flxsnow, &
sten_inv = ptend_loc%s, &
uten_inv = ptend_loc%u, &
vten_inv = ptend_loc%v, &
trten_inv = ptend_tracer, &
cmfdqr = rprdsh, &
precip = precc, &
snow = snow, &
evapc_inv = evapcsh, &
rliq = rliq2, &
cufrc_inv = shfrc, &
qcu_inv = iccmr_UW, &
qlu_inv = icwmr_UW, &
qiu_inv = icimr_UW, &
cbmf = cbmf, &
qc_inv = qc2, &
cnt_inv = cnt2, &
cnb_inv = cnb2, &
lchnk = lchnk, &
dpdry0_inv = state%pdeldry, &
sh_e_ed_ratio = sh_e_ed_ratio)

! --------------------------------------------------------------------- !
! Here, 'rprdsh = qrten', 'cmfdqs = qsten' both in unit of [ kg/kg/s ] !
! In addition, define 'icwmr' which includes both liquid and ice. !
! --------------------------------------------------------------------- !

icwmr(:ncol,:) = iccmr_UW(:ncol,:)
rprdsh(:ncol,:) = rprdsh(:ncol,:) + cmfdqs(:ncol,:)
do m = 4, pcnst
do m = 1, pcnst
ptend_loc%q(:ncol,:pver,m) = ptend_tracer(:ncol,:pver,m)
enddo

Expand Down Expand Up @@ -604,13 +628,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
! enddo
! enddo

! ------------------------------------------------- !
! Convective fluxes of 'sl' and 'qt' in energy unit !
! ------------------------------------------------- !

cmfsl(:ncol,:) = slflx(:ncol,:)
cmflq(:ncol,:) = qtflx(:ncol,:) * latvap

call outfld( 'PRECSH' , precc , pcols, lchnk )

end select
Expand Down Expand Up @@ -672,11 +689,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , &
! Output new partition of cloud condensate variables, as well as precipitation !
! ---------------------------------------------------------------------------- !

if( microp_scheme == 'MG' ) then
call cnst_get_ind( 'NUMLIQ', ixnumliq )
call cnst_get_ind( 'NUMICE', ixnumice )
endif

ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair

call outfld( 'ICWMRSH ', icwmr , pcols , lchnk )
Expand Down
3 changes: 0 additions & 3 deletions src/physics/cam/macrop_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ subroutine macrop_driver_tend( &
cappa = cappa, &
gravit = gravit, &
rair = rair, &
tmelt = tmelt, &
pref = pref, &
lapse_rate = lapse_rate, &
top_lev_cloudphys = trop_cloud_top_lev, & ! CAM5 macrophysics.
Expand All @@ -871,8 +870,6 @@ subroutine macrop_driver_tend( &
q = state_loc%q(:ncol,:,1), & ! note: assumes wv is at index 1.
cldice = state_loc%q(:ncol,:,ixcldice), &
phis = state_loc%phis(:ncol), &
shallowcu = shallowcu(:ncol,:), &
deepcu = deepcu(:ncol,:), &
concld = concld(:ncol,:), &
landfrac = landfrac(:ncol), &
ocnfrac = ocnfrac(:ncol), &
Expand Down
8 changes: 0 additions & 8 deletions src/physics/cam/rk_stratiform_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ subroutine rk_stratiform_cam_tend( &
cappa = cappa, &
gravit = gravit, &
rair = rair, &
tmelt = tmelt, &
pref = pref, &
lapse_rate = lapse_rate, &
top_lev_cloudphys = 1, & ! CAM4 macrophysics.
Expand All @@ -906,8 +905,6 @@ subroutine rk_stratiform_cam_tend( &
q = state1%q(:ncol,:,ixq), &
cldice = state1%q(:ncol,:,ixcldice), &
phis = state1%phis(:ncol), &
shallowcu = shallowcu(:ncol,:), &
deepcu = deepcu(:ncol,:), &
concld = concld(:ncol,:), &
landfrac = landfrac(:ncol), &
ocnfrac = ocnfrac(:ncol), &
Expand Down Expand Up @@ -950,8 +947,6 @@ subroutine rk_stratiform_cam_tend( &
q_wv = state1%q(:ncol,:,ixq), &
cldice = state1%q(:ncol,:,ixcldice), &
phis = state1%phis(:ncol), &
shallowcu = shallowcu(:ncol,:), &
deepcu = deepcu(:ncol,:), &
concld = concld(:ncol,:), &
landfrac = landfrac(:ncol), &
ocnfrac = ocnfrac(:ncol), &
Expand Down Expand Up @@ -1291,7 +1286,6 @@ subroutine rk_stratiform_cam_tend( &
cappa = cappa, &
gravit = gravit, &
rair = rair, &
tmelt = tmelt, &
pref = pref, &
lapse_rate = lapse_rate, &
top_lev_cloudphys = 1, & ! CAM4 macrophysics.
Expand All @@ -1302,8 +1296,6 @@ subroutine rk_stratiform_cam_tend( &
q = state1%q(:ncol,:,ixq), &
cldice = state1%q(:ncol,:,ixcldice), &
phis = state1%phis(:ncol), &
shallowcu = shallowcu(:ncol,:), &
deepcu = deepcu(:ncol,:), &
concld = concld(:ncol,:), &
landfrac = landfrac(:ncol), &
ocnfrac = ocnfrac(:ncol), &
Expand Down
Loading
Loading