Skip to content
Merged
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
13 changes: 13 additions & 0 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
'ccpp/physics/physics/module_mp_radar.F90',
'ccpp/physics/physics/module_mp_thompson.F90',
'ccpp/physics/physics/module_mp_thompson_make_number_concentrations.F90',
'ccpp/physics/physics/module_MP_FER_HIRES.F90',
'ccpp/physics/physics/module_bl_mynn.F90',
'ccpp/physics/physics/module_sf_mynn.F90',
'ccpp/physics/physics/module_SF_JSFC.F90',
Expand Down Expand Up @@ -231,9 +232,14 @@
'ccpp/physics/physics/sfc_nst.f' : ['physics'],
'ccpp/physics/physics/sfc_ocean.F' : ['physics'],
'ccpp/physics/physics/sfc_sice.f' : ['physics'],
'ccpp/physics/physics/mp_fer_hires.F90' : ['physics'],
'ccpp/physics/physics/gmtb_scm_sfc_flux_spec.F90' : ['physics'],
}

# Default build dir, relative to current working directory,
# if not specified as command-line argument
DEFAULT_BUILD_DIR = 'scm/bin'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making all these changes by looking at my poorly/not-at-all documented modifications!


# Auto-generated makefile/cmakefile snippets that contain all schemes
SCHEMES_MAKEFILE = 'ccpp/physics/CCPP_SCHEMES.mk'
SCHEMES_CMAKEFILE = 'ccpp/physics/CCPP_SCHEMES.cmake'
Expand Down Expand Up @@ -316,6 +322,13 @@
'tendency_of_ice_friendly_aerosols_at_surface',
],
},
'mp_fer_hires' : {
'mp_fer_hires_init' : [
'fraction_of_ice_water_cloud',
'fraction_of_rain_water_cloud',
'rime_factor',
],
},
#'subroutine_name_1' : 'all',
#'subroutine_name_2' : 'none',
#'subroutine_name_2' : [ 'var1', 'var3'],
Expand Down
136 changes: 128 additions & 8 deletions scm/src/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ module GFS_typedefs
integer :: imp_physics_zhao_carr = 99 !< choice of Zhao-Carr microphysics scheme
integer :: imp_physics_zhao_carr_pdf = 98 !< choice of Zhao-Carr microphysics scheme with PDF clouds
integer :: imp_physics_mg = 10 !< choice of Morrison-Gettelman microphysics scheme
integer :: imp_physics_fer_hires = 15 !< choice of Ferrier-Aligo microphysics scheme
!--- Z-C microphysical parameters
real(kind=kind_phys) :: psautco(2) !< [in] auto conversion coeff from ice to snow
real(kind=kind_phys) :: prautco(2) !< [in] auto conversion coeff from cloud to rain
Expand Down Expand Up @@ -677,6 +678,7 @@ module GFS_typedefs
integer :: lsoil_lsm !< number of soil layers internal to land surface model
integer :: lsnow_lsm !< maximum number of snow layers internal to land surface model
integer :: lsnow_lsm_lbound!< lower bound for snow arrays, depending on lsnow_lsm
logical :: rdlai
integer :: ivegsrc !< ivegsrc = 0 => USGS,
!< ivegsrc = 1 => IGBP (20 category)
!< ivegsrc = 2 => UMD (13 category)
Expand Down Expand Up @@ -714,6 +716,8 @@ module GFS_typedefs
logical :: moist_adj !< flag for moist convective adjustment
logical :: cscnv !< flag for Chikira-Sugiyama convection
logical :: cal_pre !< flag controls precip type algorithm
real(kind=kind_phys) :: rhgrd !< fer_hires microphysics only
logical :: spec_adv !< flag for individual cloud species advected
logical :: do_aw !< AW scale-aware option in cs convection
logical :: do_awdd !< AW scale-aware option in cs convection
logical :: flx_form !< AW scale-aware option in cs convection
Expand Down Expand Up @@ -911,6 +915,7 @@ module GFS_typedefs
integer :: ntrac !< number of tracers
integer :: ntracp1 !< number of tracers plus one
integer :: ntqv !< tracer index for water vapor (specific humidity)
integer :: nqrimef !< tracer index for mass weighted rime factor
integer :: ntoz !< tracer index for ozone mixing ratio
integer :: ntcw !< tracer index for cloud condensate (or liquid water)
integer :: ntiw !< tracer index for ice water
Expand Down Expand Up @@ -1393,6 +1398,9 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: det_mf (:,:) => null() !< instantaneous convective detrainment mass flux
real (kind=kind_phys), pointer :: cldcov (:,:) => null() !< instantaneous 3D cloud fraction

!--- F-A MP scheme
real (kind=kind_phys), pointer :: TRAIN (:,:) => null() !< accumulated stratiform T tendency (K s-1)

!--- MP quantities for 3D diagnositics
real (kind=kind_phys), pointer :: refl_10cm(:,:) => null() !< instantaneous refl_10cm
!
Expand Down Expand Up @@ -1810,7 +1818,22 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: dudt_mtb(:,:) => null() !< daily aver u-wind tend due to mountain blocking drag
real (kind=kind_phys), pointer :: dudt_ogw(:,:) => null() !< daily aver u-wind tend due to orographic gravity wave drag
real (kind=kind_phys), pointer :: dudt_tms(:,:) => null() !< daily aver u-wind tend due to TMS
!

!-- HWRF physics: dry mixing ratios
real (kind=kind_phys), pointer :: qv_r(:,:) => null() !<
real (kind=kind_phys), pointer :: qc_r(:,:) => null() !<
real (kind=kind_phys), pointer :: qi_r(:,:) => null() !<
real (kind=kind_phys), pointer :: qr_r(:,:) => null() !<
real (kind=kind_phys), pointer :: qs_r(:,:) => null() !<
real (kind=kind_phys), pointer :: qg_r(:,:) => null() !<


!-- Ferrier-Aligo MP scheme
real (kind=kind_phys), pointer :: f_rain (:,:) => null() !<
real (kind=kind_phys), pointer :: f_ice (:,:) => null() !<
real (kind=kind_phys), pointer :: f_rimef (:,:) => null() !<
real (kind=kind_phys), pointer :: cwm (:,:) => null() !<


contains
procedure :: create => interstitial_create !< allocate array data
Expand Down Expand Up @@ -2194,6 +2217,11 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%tsnow = clear_val
Sfcprop%snowfallac = clear_val
Sfcprop%acsnow = clear_val
!
if (Model%rdlai) then
allocate (Sfcprop%xlaixy (IM))
Sfcprop%xlaixy = clear_val
end if
end if
if (Model%do_mynnsfclay) then
! For MYNN surface layer scheme
Expand Down Expand Up @@ -2599,7 +2627,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
real(kind=kind_phys) :: wminco(2) = (/1.0d-5,1.0d-5/) !< [in] water and ice minimum threshold for Zhao
!---Max hourly
real(kind=kind_phys) :: avg_max_length = 3600. !< reset value in seconds for max hourly.

!--- Ferrier-Aligo microphysical parameters
real(kind=kind_phys) :: rhgrd = 0.98 !< fer_hires microphysics only
logical :: spec_adv = .true. !< Individual cloud species advected
!--- M-G microphysical parameters
integer :: fprcp = 0 !< no prognostic rain and snow (MG)
integer :: pdfflag = 4 !< pdf flag for MG macro physics
Expand Down Expand Up @@ -2646,6 +2676,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: lsoil = 4 !< number of soil layers
integer :: lsoil_lsm = -1 !< number of soil layers internal to land surface model; -1 use lsoil
integer :: lsnow_lsm = 3 !< maximum number of snow layers internal to land surface model
logical :: rdlai = .false.
integer :: ivegsrc = 2 !< ivegsrc = 0 => USGS,
!< ivegsrc = 1 => IGBP (20 category)
!< ivegsrc = 2 => UMD (13 category)
Expand Down Expand Up @@ -2918,7 +2949,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
!--- max hourly
avg_max_length, &
!--- land/surface model control
lsm, lsoil, lsoil_lsm, lsnow_lsm, nmtvr, ivegsrc, use_ufo, &
lsm, lsoil, lsoil_lsm, lsnow_lsm, rdlai, &
nmtvr, ivegsrc, use_ufo, &
! Noah MP options
iopt_dveg,iopt_crs,iopt_btr,iopt_run,iopt_sfc, iopt_frz, &
iopt_inf, iopt_rad,iopt_alb,iopt_snf,iopt_tbot,iopt_stc, &
Expand All @@ -2940,6 +2972,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
do_sppt, do_shum, do_skeb, do_sfcperts, &
!--- Rayleigh friction
prslrd0, ral_ts, ldiag_ugwp, do_ugwp, do_tofd, &
! --- Ferrier-Aligo
spec_adv, rhgrd, &
!--- mass flux deep convection
clam_deep, c0s_deep, c1_deep, betal_deep, &
betas_deep, evfact_deep, evfactl_deep, pgcon_deep, &
Expand Down Expand Up @@ -3171,6 +3205,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%ltaerosol = ltaerosol
Model%lradar = lradar
Model%ttendlim = ttendlim
!--- F-A MP parameters
Model%rhgrd = rhgrd
Model%spec_adv = spec_adv

!--- gfdl MP parameters
Model%lgfdlmprad = lgfdlmprad

Expand All @@ -3182,6 +3220,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
write(0,*) 'Logic error: RUC LSM cannot be used with surface data cycling at this point (fhcyc>0)'
stop
end if
! Flag to read leaf area index from input files (initial conditions)
Model%rdlai = rdlai
if (Model%rdlai .and. .not. Model%lsm == Model%lsm_ruc) then
write(0,*) 'Logic error: rdlai = .true. only works with RUC LSM'
stop
end if
! Set surface layers for CCPP physics
if (lsoil_lsm==-1) then
Model%lsoil_lsm = lsoil
Expand Down Expand Up @@ -3423,6 +3467,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%ntsnc = get_tracer_index(Model%tracer_names, 'snow_nc', Model%me, Model%master, Model%debug)
Model%ntgnc = get_tracer_index(Model%tracer_names, 'graupel_nc', Model%me, Model%master, Model%debug)
Model%ntke = get_tracer_index(Model%tracer_names, 'sgs_tke', Model%me, Model%master, Model%debug)
Model%nqrimef = get_tracer_index(Model%tracer_names, 'q_rimef', Model%me, Model%master, Model%debug)
Model%ntwa = get_tracer_index(Model%tracer_names, 'liq_aero', Model%me, Model%master, Model%debug)
Model%ntia = get_tracer_index(Model%tracer_names, 'ice_aero', Model%me, Model%master, Model%debug)
Model%ntchm = 0
Expand Down Expand Up @@ -3795,9 +3840,19 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%ncnd = 1
if (Model%me == Model%master) print *,'Using Zhao/Carr/Sundqvist Microphysics with PDF Cloud'

else if (Model%imp_physics == 5) then ! F-A goes here
print *,' Ferrier Microphysics scheme has been deprecated - job aborted'
stop
else if (Model%imp_physics == Model%imp_physics_fer_hires) then ! Ferrier-Aligo scheme
Model%npdf3d = 0
Model%num_p3d = 3
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
Model%ncnd = 5
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
if (Model%me == Model%master) print *,' Using Ferrier-Aligo MP scheme', &
' microphysics', &
' lradar =',Model%lradar

elseif (Model%imp_physics == Model%imp_physics_wsm6) then !WSM6 microphysics
Model%npdf3d = 0
Expand Down Expand Up @@ -4099,9 +4154,17 @@ subroutine control_print(Model)
print *, ' '
endif

if (Model%imp_physics == Model%imp_physics_fer_hires) then
print *, ' Ferrier-Aligo microphysical parameters'
print *, ' spec_adv : ', Model%spec_adv
print *, ' rhgrd : ', Model%rhgrd
print *, ' '
endif

print *, 'land/surface model parameters'
print *, ' lsm : ', Model%lsm
print *, ' lsoil : ', Model%lsoil
print *, ' rdlai : ', Model%rdlai
print *, ' lsoil_lsm : ', Model%lsoil_lsm
print *, ' lsnow_lsm : ', Model%lsnow_lsm
print *, ' ivegsrc : ', Model%ivegsrc
Expand Down Expand Up @@ -4253,6 +4316,7 @@ subroutine control_print(Model)
print *, ' tracer_names : ', Model%tracer_names
print *, ' ntrac : ', Model%ntrac
print *, ' ntqv : ', Model%ntqv
print *, ' nqrimef : ', Model%nqrimef
print *, ' ntoz : ', Model%ntoz
print *, ' ntcw : ', Model%ntcw
print *, ' ntiw : ', Model%ntiw
Expand Down Expand Up @@ -4758,6 +4822,11 @@ subroutine diag_create (Diag, IM, Model)
allocate (Diag%shum_wts(IM,Model%levs))
allocate (Diag%zmtnblck(IM))

! F-A MP scheme
if (Model%imp_physics == Model%imp_physics_fer_hires) then
allocate (Diag%TRAIN (IM,Model%levs))
end if

allocate (Diag%ca_out (IM))
allocate (Diag%ca_deep (IM))
allocate (Diag%ca_turb (IM))
Expand Down Expand Up @@ -5046,6 +5115,11 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center)
Diag%sppt_wts = zero
Diag%shum_wts = zero
Diag%zmtnblck = zero

if (Model%imp_physics == Model%imp_physics_fer_hires) then
Diag%TRAIN = zero
end if

Diag%totprcpb = zero
Diag%cnvprcpb = zero
Diag%toticeb = zero
Expand Down Expand Up @@ -5536,6 +5610,21 @@ subroutine interstitial_create (Interstitial, IM, Model)
allocate (Interstitial%cnv_ndrop (IM,Model%levs))
allocate (Interstitial%cnv_nice (IM,Model%levs))
end if
if (Model%imp_physics == Model%imp_physics_fer_hires) then
!--- if HWRF physics?
allocate (Interstitial%qv_r (IM,Model%levs))
allocate (Interstitial%qc_r (IM,Model%levs))
allocate (Interstitial%qi_r (IM,Model%levs))
allocate (Interstitial%qr_r (IM,Model%levs))
allocate (Interstitial%qs_r (IM,Model%levs))
allocate (Interstitial%qg_r (IM,Model%levs))

!--- Ferrier-Aligo MP scheme
allocate (Interstitial%f_ice (IM,Model%levs))
allocate (Interstitial%f_rain (IM,Model%levs))
allocate (Interstitial%f_rimef (IM,Model%levs))
allocate (Interstitial%cwm (IM,Model%levs))
end if
if (Model%do_shoc) then
if (.not. associated(Interstitial%qrn)) allocate (Interstitial%qrn (IM,Model%levs))
if (.not. associated(Interstitial%qsnw)) allocate (Interstitial%qsnw (IM,Model%levs))
Expand Down Expand Up @@ -5580,7 +5669,7 @@ subroutine interstitial_create (Interstitial, IM, Model)
Interstitial%phys_hydrostatic = .true.
!
! Reset all other variables
call Interstitial%rad_reset ()
call Interstitial%rad_reset (Model)
call Interstitial%phys_reset (Model)
!
end subroutine interstitial_create
Expand Down Expand Up @@ -5659,6 +5748,8 @@ subroutine interstitial_setup_tracers(Interstitial, Model)
endif
elseif (Model%imp_physics == Model%imp_physics_gfdl) then
Interstitial%ntiwx = 3
elseif (Model%imp_physics == Model%imp_physics_fer_hires) then
Interstitial%ntiwx = 3 ! total ice or total condensate
elseif (Model%imp_physics == Model%imp_physics_mg) then
Interstitial%ntiwx = 3
else
Expand Down Expand Up @@ -5734,11 +5825,12 @@ subroutine interstitial_setup_tracers(Interstitial, Model)

end subroutine interstitial_setup_tracers

subroutine interstitial_rad_reset (Interstitial)
subroutine interstitial_rad_reset (Interstitial, Model)
!
implicit none
!
class(GFS_interstitial_type) :: Interstitial
type(GFS_control_type), intent(in) :: Model
!
Interstitial%aerodp = clear_val
Interstitial%alb1d = clear_val
Expand Down Expand Up @@ -5775,6 +5867,22 @@ subroutine interstitial_rad_reset (Interstitial)
Interstitial%tlyr = clear_val
Interstitial%tsfa = clear_val
Interstitial%tsfg = clear_val

! F-A scheme
if (Model%imp_physics == Model%imp_physics_fer_hires ) then
Interstitial%qv_r = clear_val
Interstitial%qc_r = clear_val
Interstitial%qi_r = clear_val
Interstitial%qr_r = clear_val
Interstitial%qs_r = clear_val
Interstitial%qg_r = clear_val
if(Model%spec_adv) then
Interstitial%f_ice = clear_val
Interstitial%f_rain = clear_val
Interstitial%f_rimef = clear_val
Interstitial%cwm = clear_val
end if
end if
!
end subroutine interstitial_rad_reset

Expand Down Expand Up @@ -6025,6 +6133,12 @@ subroutine interstitial_phys_reset (Interstitial, Model)
Interstitial%cnv_ndrop = clear_val
Interstitial%cnv_nice = clear_val
end if
if (Model%imp_physics == Model%imp_physics_fer_hires .and. Model%spec_adv) then
Interstitial%f_ice = clear_val
Interstitial%f_rain = clear_val
Interstitial%f_rimef = clear_val
Interstitial%cwm = clear_val
end if
if (Model%do_shoc) then
Interstitial%qrn = clear_val
Interstitial%qsnw = clear_val
Expand Down Expand Up @@ -6340,6 +6454,12 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno)
write (0,*) 'sum(Interstitial%icemp ) = ', sum(Interstitial%icemp )
write (0,*) 'sum(Interstitial%rainmp ) = ', sum(Interstitial%rainmp )
write (0,*) 'sum(Interstitial%snowmp ) = ', sum(Interstitial%snowmp )
else if (Model%imp_physics == Model%imp_physics_fer_hires) then
write (0,*) 'Interstitial_print: values specific to F-A microphysics'
write (0,*) 'sum(Interstitial%f_ice ) = ', sum(Interstitial%f_ice )
write (0,*) 'sum(Interstitial%f_rain ) = ', sum(Interstitial%f_rain )
write (0,*) 'sum(Interstitial%f_rimef ) = ', sum(Interstitial%f_rimef )
write (0,*) 'sum(Interstitial%cwm ) = ', sum(Interstitial%cwm )
else if (Model%imp_physics == Model%imp_physics_mg) then
write (0,*) 'Interstitial_print: values specific to MG microphysics'
write (0,*) 'sum(Interstitial%ncgl ) = ', sum(Interstitial%ncgl )
Expand Down
Loading