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_065: ZM CCPP'ization round 4 (completes CCPP conversion of ZM) #1218

Merged
merged 23 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
812d476
Remove unused variables
cacraigucar May 17, 2024
600b8b6
Remove DIFZM as it is not used
cacraigucar May 22, 2024
61fa56c
Remove DIFZM output
cacraigucar May 23, 2024
4a5cdb5
Move limcnv calculation into ZM layer
cacraigucar May 29, 2024
2713176
Add constituent hooks for ccpp compatability
cacraigucar Jun 18, 2024
3504c51
Remove the 'use' statements
cacraigucar Jul 19, 2024
a6b5db5
Bug fixes to get cleanup3 to run in CAM
cacraigucar Aug 2, 2024
1e78173
Fixes after the atmos_phys merge
cacraigucar Aug 5, 2024
d0bc1a9
Remove zm_org logic per Rich Neale's advice
cacraigucar Aug 23, 2024
49bfd2a
Updated calling lists for zm routines
cacraigucar Sep 19, 2024
5e2d45a
Merge tag 'cam6_4_047' into cam_zm_cleanup4
cacraigucar Dec 16, 2024
0fdf1cc
Add diagnostic messages
cacraigucar Dec 18, 2024
0623736
Eliminate final whitespace which snuck in file
cacraigucar Jan 3, 2025
6f63133
Address reviewer comments
cacraigucar Jan 6, 2025
e900c71
Use Fotran unit handling
cacraigucar Jan 22, 2025
9947b25
Merge remote-tracking branch 'refs/remotes/origin/cam_zm_cleanup4' in…
cacraigucar Jan 22, 2025
fe947be
Merge tag 'cam6_4_056' into cam_zm_cleanup4
cacraigucar Jan 24, 2025
1180831
Update atmos_phys tag
cacraigucar Jan 29, 2025
85b14f3
remove unnecessary directory for configure to use
cacraigucar Feb 10, 2025
3ab5a5d
Address reviewer comments
cacraigucar Feb 10, 2025
94072d1
Update comments
cacraigucar Feb 10, 2025
1034b26
Merge tag 'cam6_4_064' into cam_zm_cleanup4
cacraigucar Feb 10, 2025
79aee2f
Updated ChangeLog for cam6_4_065
cacraigucar Feb 11, 2025
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: 0 additions & 1 deletion bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,6 @@ if (!$simple_phys) {
add_default($nl, 'zmconv_c0_ocn');
add_default($nl, 'zmconv_ke');
add_default($nl, 'zmconv_ke_lnd');
add_default($nl, 'zmconv_org');
add_default($nl, 'zmconv_num_cin');
add_default($nl, 'zmconv_dmpdz');
add_default($nl, 'zmconv_tiedke_add');
Expand Down
3 changes: 3 additions & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,9 @@ sub write_filepath
print $fh "$camsrcdir/src/atmos_phys/schemes/dry_adiabatic_adjust\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/utilities\n";

print $fh "$camsrcdir/src/atmos_phys/schemes/to_be_ccppized\n";
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
print $fh "$camsrcdir/src/atmos_phys/schemes/cloud_fraction\n";

nusbaume marked this conversation as resolved.
Show resolved Hide resolved
# Dynamics package and test utilities
print $fh "$camsrcdir/src/dynamics/$dyn\n";
if($dyn eq 'se') {
Expand Down
3 changes: 0 additions & 3 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2910,9 +2910,6 @@
<zmconv_ke hgrid="256x512" > 5.0E-6 </zmconv_ke>
<zmconv_ke hgrid="512x1024" > 5.0E-6 </zmconv_ke>

<zmconv_org > .false. </zmconv_org>
<zmconv_org zmconv_org="1" > .true. </zmconv_org>

<zmconv_num_cin > 5 </zmconv_num_cin>
<zmconv_num_cin phys="cam6" > 1 </zmconv_num_cin>
<zmconv_num_cin phys="cam7" > 1 </zmconv_num_cin>
Expand Down
7 changes: 0 additions & 7 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3257,13 +3257,6 @@ Tunable evaporation efficiency in ZM deep convection scheme.
Default: set by build-namelist
</entry>

<entry id="zmconv_org" type="logical" category="conv"
group="zmconv_nl" valid_values="" >
Include organization parameterization in ZM. This value is set to true automatically
if -zmconv_org is set in configure.
Default: .false., unless -zmconv_org set in configure
</entry>

<entry id="zmconv_num_cin" type="integer" category="conv"
group="zmconv_nl" valid_values="" >
The number of negative buoyancy regions that are allowed before the convection top and CAPE calculations are completed.
Expand Down
152 changes: 39 additions & 113 deletions src/physics/cam/cloud_fraction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module cloud_fraction

use shr_kind_mod, only: r8 => shr_kind_r8
use ppgrid, only: pcols, pver, pverp
use ref_pres, only: pref_mid
use ref_pres, only: pref_mid
use spmd_utils, only: masterproc
use cam_logfile, only: iulog
use cam_abortutils, only: endrun
Expand All @@ -22,7 +22,6 @@ module cloud_fraction
cldfrc_init, &! Inititialization of cloud_fraction run-time parameters
cldfrc_getparams, &! public access of tuning parameters
cldfrc, &! Computation of cloud fraction
cldfrc_fice, &! Calculate fraction of condensate in ice phase (radiation partitioning)
dp1, &! parameter for deep convection cloud fraction needed in clubb_intr
dp2 ! parameter for deep convection cloud fraction needed in clubb_intr

Expand All @@ -32,9 +31,9 @@ module cloud_fraction
! Top level
integer :: top_lev = 1

! Physics buffer indices
integer :: sh_frac_idx = 0
integer :: dp_frac_idx = 0
! Physics buffer indices
integer :: sh_frac_idx = 0
integer :: dp_frac_idx = 0

! Namelist variables
logical :: cldfrc_freeze_dry ! switch for Vavrus correction
Expand Down Expand Up @@ -154,8 +153,8 @@ subroutine cldfrc_register

!-----------------------------------------------------------------------

call pbuf_add_field('SH_FRAC', 'physpkg', dtype_r8, (/pcols,pver/), sh_frac_idx)
call pbuf_add_field('DP_FRAC', 'physpkg', dtype_r8, (/pcols,pver/), dp_frac_idx)
call pbuf_add_field('SH_FRAC', 'physpkg', dtype_r8, (/pcols,pver/), sh_frac_idx)
call pbuf_add_field('DP_FRAC', 'physpkg', dtype_r8, (/pcols,pver/), dp_frac_idx)

end subroutine cldfrc_register

Expand Down Expand Up @@ -215,7 +214,7 @@ subroutine cldfrc_init
inversion_cld_off = .false.
endif

if ( masterproc ) then
if ( masterproc ) then
write(iulog,*)'tuning parameters cldfrc_init: inversion_cld_off',inversion_cld_off
write(iulog,*)'tuning parameters cldfrc_init: dp1',dp1,'dp2',dp2,'sh1',sh1,'sh2',sh2
if (shallow_scheme .ne. 'UW' .or. shallow_scheme .eq. 'SPCAM_m2005' ) then
Expand Down Expand Up @@ -249,38 +248,38 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
cmfmc ,cmfmc2 ,landfrac,snowh ,concld ,cldst , &
ts ,sst ,ps ,zdu ,ocnfrac ,&
rhu00 ,cldice ,icecldf ,liqcldf ,relhum ,dindex )
!-----------------------------------------------------------------------
!
! Purpose:
! Compute cloud fraction
!
!
! Method:
!-----------------------------------------------------------------------
!
! Purpose:
! Compute cloud fraction
!
!
! Method:
! This calculate cloud fraction using a relative humidity threshold
! The threshold depends upon pressure, and upon the presence or absence
! of convection as defined by a reasonably large vertical mass flux
! The threshold depends upon pressure, and upon the presence or absence
! of convection as defined by a reasonably large vertical mass flux
! entering that layer from below.
!
!
! Author: Many. Last modified by Jim McCaa
!
!
!-----------------------------------------------------------------------
use cam_history, only: outfld
use physconst, only: cappa, gravit, rair, tmelt
use wv_saturation, only: qsat, qsat_water, svp_ice_vect
use phys_grid, only: get_rlat_all_p, get_rlon_all_p


!RBN - Need this to write shallow,deep fraction to phys buffer.
!PJR - we should probably make seperate modules for determining convective
! clouds and make this one just responsible for relative humidity clouds

use physics_buffer, only: physics_buffer_desc, pbuf_get_field

! Arguments
integer, intent(in) :: lchnk ! chunk identifier
integer, intent(in) :: ncol ! number of atmospheric columns
integer, intent(in) :: dindex ! 0 or 1 to perturb rh

type(physics_buffer_desc), pointer :: pbuf(:)
real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures
real(r8), intent(in) :: temp(pcols,pver) ! temperature
Expand All @@ -307,7 +306,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
real(r8), intent(out) :: clc(pcols) ! column convective cloud amount
real(r8), intent(out) :: cldst(pcols,pver) ! cloud fraction
real(r8), intent(out) :: rhu00(pcols,pver) ! RH threshold for cloud
real(r8), intent(out) :: relhum(pcols,pver) ! RH
real(r8), intent(out) :: relhum(pcols,pver) ! RH
real(r8), intent(out) :: icecldf(pcols,pver) ! ice cloud fraction
real(r8), intent(out) :: liqcldf(pcols,pver) ! liquid cloud fraction (combined into cloud)

Expand Down Expand Up @@ -376,7 +375,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
! The idea is that the RH limits for condensation are strict only for
! water saturation
!
! Ice clouds are formed by explicit parameterization of ice nucleation.
! Ice clouds are formed by explicit parameterization of ice nucleation.
! Closure for ice cloud fraction is done on available cloud ice, such that
! the in-cloud ice content matches an empirical fit
! thus, icecldf = min(cldice/icicval,1) where icicval = f(temp,cldice,numice)
Expand All @@ -385,17 +384,17 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
! No dA/dt term for ice?
!
! There are three co-existing cloud types: convective, inversion related low-level
! stratocumulus, and layered cloud (based on relative humidity). Layered and
! stratocumulus clouds do not compete with convective cloud for which one creates
! the most cloud. They contribute collectively to the total grid-box average cloud
! amount. This is reflected in the way in which the total cloud amount is evaluated
! stratocumulus, and layered cloud (based on relative humidity). Layered and
! stratocumulus clouds do not compete with convective cloud for which one creates
! the most cloud. They contribute collectively to the total grid-box average cloud
! amount. This is reflected in the way in which the total cloud amount is evaluated
! (a sum as opposed to a logical "or" operation)
!
!==================================================================================
! set defaults for rhu00
rhu00(:,:) = 2.0_r8
! define rh perturbation in order to estimate rhdfda
rhpert = 0.01_r8
rhpert = 0.01_r8

!set Wang and Sassen IWC paramters
a=26.87_r8
Expand Down Expand Up @@ -460,15 +459,15 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &

!
! Estimate of local convective cloud cover based on convective mass flux
! Modify local large-scale relative humidity to account for presence of
! Modify local large-scale relative humidity to account for presence of
! convective cloud when evaluating relative humidity based layered cloud amount
!
concld(:ncol,top_lev:pver) = 0.0_r8
!
! cloud mass flux in SI units of kg/m2/s; should produce typical numbers of 20%
! shallow and deep convective cloudiness are evaluated separately (since processes
! are evaluated separately) and summed
!
!
#ifndef PERGRO
do k=top_lev,pver
do i=1,ncol
Expand All @@ -488,7 +487,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
! ****** Compute layer cloudiness ******
!
!====================================================================
! Begin the evaluation of layered cloud amount based on (modified) RH
! Begin the evaluation of layered cloud amount based on (modified) RH
!====================================================================
!
numkcld = pver
Expand Down Expand Up @@ -517,7 +516,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
! SJV: decrease cloud amount if very low water vapor content
! (thus very cold): "freeze dry"
if (cldfrc_freeze_dry) then
rhcloud(i,k) = rhcloud(i,k)*max(0.15_r8,min(1.0_r8,q(i,k)/0.0030_r8))
rhcloud(i,k) = rhcloud(i,k)*max(0.15_r8,min(1.0_r8,q(i,k)/0.0030_r8))
endif

else if ( pmid(i,k).lt.premit ) then
Expand All @@ -537,7 +536,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
! linear rh threshold transition between thresholds for low & high cloud
!
rhwght = (premib-(max(pmid(i,k),premit)))/(premib-premit)

if (land(i) .and. (snowh(i) <= 0.000001_r8)) then
rhlim = rhminh*rhwght + (rhminl - rhminl_adj_land)*(1.0_r8-rhwght)
else
Expand Down Expand Up @@ -591,7 +590,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &

!--------ICE CLOUD OPTION 3--------Wood & Field 2000 (JAS)
! eq 6: cloud fraction = 1 - exp (-K * qc/qsati)

icecldf(i,k)=1._r8 - exp(-Kc*cldice(i,k)/(qs(i,k)*(esi(i,k)/esl(i,k))))
icecldf(i,k)=max(0._r8,min(icecldf(i,k),1._r8))
else
Expand Down Expand Up @@ -634,7 +633,7 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
cloud(i,k) = rhcloud(i,k)
end if
end do
end do
end do
!
! Add in the marine strat
! MARINE STRATUS SHOULD BE A SPECIAL CASE OF LAYERED CLOUD
Expand All @@ -644,20 +643,20 @@ subroutine cldfrc(lchnk ,ncol , pbuf, &
!===================================================================================
!
! SOME OBSERVATIONS ABOUT THE FOLLOWING SECTION OF CODE (missed in earlier look)
! K700 IS SET AS A CONSTANT BASED ON HYBRID COORDINATE: IT DOES NOT DEPEND ON
! LOCAL PRESSURE; THERE IS NO PRESSURE RAMP => LOOKS LEVEL DEPENDENT AND
! K700 IS SET AS A CONSTANT BASED ON HYBRID COORDINATE: IT DOES NOT DEPEND ON
! LOCAL PRESSURE; THERE IS NO PRESSURE RAMP => LOOKS LEVEL DEPENDENT AND
! DISCONTINUOUS IN SPACE (I.E., STRATUS WILL END SUDDENLY WITH NO TRANSITION)
!
! IT APPEARS THAT STRAT IS EVALUATED ACCORDING TO KLEIN AND HARTMANN; HOWEVER,
! THE ACTUAL STRATUS AMOUNT (CLDST) APPEARS TO DEPEND DIRECTLY ON THE RH BELOW
! THE STRONGEST PART OF THE LOW LEVEL INVERSION.
! THE STRONGEST PART OF THE LOW LEVEL INVERSION.
!PJR answers: 1) the rh limitation is a physical/mathematical limitation
! cant have more cloud than there is RH
! allowed the cloud to exist two layers below the inversion
! because the numerics frequently make 50% relative humidity
! in level below the inversion which would allow no cloud
! 2) since the cloud is only allowed over ocean, it should
! be very insensitive to surface pressure (except due to
! be very insensitive to surface pressure (except due to
! spectral ringing, which also causes so many other problems
! I didnt worry about it.
!
Expand Down Expand Up @@ -738,77 +737,4 @@ end subroutine cldfrc

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

subroutine cldfrc_fice(ncol, t, fice, fsnow)
!
! Compute the fraction of the total cloud water which is in ice phase.
! The fraction depends on temperature only.
! This is the form that was used for radiation, the code came from cldefr originally
!
! Author: B. A. Boville Sept 10, 2002
! modified: PJR 3/13/03 (added fsnow to ascribe snow production for convection )
!-----------------------------------------------------------------------
use physconst, only: tmelt

! Arguments
integer, intent(in) :: ncol ! number of active columns
real(r8), intent(in) :: t(:,:) ! temperature

real(r8), intent(out) :: fice(:,:) ! Fractional ice content within cloud
real(r8), intent(out) :: fsnow(:,:) ! Fractional snow content for convection

! Local variables
real(r8) :: tmax_fice ! max temperature for cloud ice formation
real(r8) :: tmin_fice ! min temperature for cloud ice formation
real(r8) :: tmax_fsnow ! max temperature for transition to convective snow
real(r8) :: tmin_fsnow ! min temperature for transition to convective snow

integer :: i,k ! loop indexes

!-----------------------------------------------------------------------

tmax_fice = tmelt - 10._r8 ! max temperature for cloud ice formation
tmin_fice = tmax_fice - 30._r8 ! min temperature for cloud ice formation
tmax_fsnow = tmelt ! max temperature for transition to convective snow
tmin_fsnow = tmelt - 5._r8 ! min temperature for transition to convective snow

fice(:,:top_lev-1) = 0._r8
fsnow(:,:top_lev-1) = 0._r8

! Define fractional amount of cloud that is ice
do k=top_lev,pver
do i=1,ncol

! If warmer than tmax then water phase
if (t(i,k) > tmax_fice) then
fice(i,k) = 0.0_r8

! If colder than tmin then ice phase
else if (t(i,k) < tmin_fice) then
fice(i,k) = 1.0_r8

! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
else
fice(i,k) =(tmax_fice - t(i,k)) / (tmax_fice - tmin_fice)
end if

! snow fraction partitioning

! If warmer than tmax then water phase
if (t(i,k) > tmax_fsnow) then
fsnow(i,k) = 0.0_r8

! If colder than tmin then ice phase
else if (t(i,k) < tmin_fsnow) then
fsnow(i,k) = 1.0_r8

! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
else
fsnow(i,k) =(tmax_fsnow - t(i,k)) / (tmax_fsnow - tmin_fsnow)
end if

end do
end do

end subroutine cldfrc_fice

end module cloud_fraction
Loading
Loading