Skip to content

Commit

Permalink
Final updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Nov 13, 2024
1 parent c05ed51 commit f7d8dbe
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 68 deletions.
6 changes: 4 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ physics/GWD/unified_ugwp* @md
physics/MP/Ferrier_Aligo/module_MP_FER_HIRES.* @ericaligo-NOAA @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/Ferrier_Aligo/mp_fer_hires.* @ericaligo-NOAA @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/GFDL_parse_tracers.F90 @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/gfdl_cloud_microphys.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/gfdl_cloud_microphys_mod.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/v1_2019/gfdl_cloud_microphys.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/v1_2019/gfdl_cloud_microphys_mod.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/v3_2022/gfdl_cloud_microphys_v3.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/v3_2022/gfdl_cloud_microphys_v3_mod.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/fv_sat_adj.* @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/GFDL/multi_gases.F90 @RuiyuSun @grantfirl @rhaesung @Qingfu-Liu @dustinswales
physics/MP/Morrison_Gettelman/aer_cloud.F @AnningCheng-NOAA @andrewgettelman @grantfirl @rhaesung @Qingfu-Liu @dustinswales
Expand Down
2 changes: 0 additions & 2 deletions physics/MP/GFDL/fv_sat_adj.F90
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ subroutine fv_sat_adj_init(do_sat_adj, kmp, nwat, ngas, rilist, cpilist, &
end if

if (is_initialized) return
! Set up scheme parameters
call cfg%setup(errmsg, errflg)

! generate es table (dt = 0.1 deg c)

Expand Down
100 changes: 69 additions & 31 deletions physics/MP/GFDL/module_gfdlmp_param.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,50 @@ module module_gfdlmp_param
use machine, only: kind_phys
implicit none

public :: cfg
private

! #######################################################################################
! Data container for GFDL MP runtime configurations information (i.e. Namelist)
! #######################################################################################
type ty_gfdlmp_config
real :: cld_min, tice, t_min, t_sub, mp_time, rh_inc, rh_inr, rh_ins, &
tau_r2g, tau_smlt, tau_g2r, tau_imlt, tau_i2s, tau_l2r, tau_v2l, tau_l2v, &
tau_g2v, tau_v2g, dw_land, dw_ocean, ccn_o, ccn_l, rthresh, sat_adj0, qc_crt, &
qi_lim, ql_mlt, ql_gen, qi_gen, ql0_max, qi0_max, qi0_crt, qr0_crt, qs0_crt, &
c_paut, c_psaci, c_piacr, c_cracw, c_pgacs, alin, clin, vi_fac, vs_fac, vg_fac, &
! GFDL MP Version 1 parameters.
real :: tau_g2r, tau_g2v, tau_v2g, qc_crt, qr0_crt, c_piacr, c_cracw, alin, clin
logical :: fast_sat_adj, use_ccn, use_ppm, mono_prof, mp_print, de_ice, sedi_transport

! GFDL MP common (v1/v3) parameters
real :: cld_min, tice, t_min, t_sub, mp_time, rh_inc, rh_inr, rh_ins, tau_r2g, &
tau_smlt, tau_imlt, tau_i2s, tau_l2r, tau_v2l, tau_l2v, dw_land, dw_ocean, &
ccn_o, ccn_l, rthresh, sat_adj0, qi_lim, ql_mlt, ql_gen, qi_gen, ql0_max, &
qi0_max, qi0_crt, qs0_crt, c_paut, c_psaci, c_pgacs, vi_fac, vs_fac, vg_fac, &
vr_fac, vi_max, vs_max, vg_max, vr_max, rewmin, rewmax, reimin, reimax, rermin, &
rermax, resmin, resmax, regmin, regmax, qs_mlt
logical :: const_vi, const_vs, const_vg, const_vr, fast_sat_adj, z_slope_liq, &
z_slope_ice, use_ccn, use_ppm, mono_prof, mp_print, do_hail, de_ice, &
sedi_transport, do_sedi_w, do_sedi_heat, prog_ccn, do_qa, rad_snow, rad_graupel,&
rad_rain, fix_negative, tintqs
logical :: const_vi, const_vs, const_vg, const_vr, z_slope_liq, z_slope_ice, do_hail,&
do_sedi_w, do_sedi_heat, prog_ccn, do_qa, rad_snow, rad_graupel, rad_rain, &
fix_negative, tintqs

! GFDL MP Version 3 parameters
integer :: reiflag, icloud_f, irain_f
real :: c_psacw, c_pracw, c_praci, c_pgacw, c_pgaci, c_pracs, c_psacr, c_pgacr, &
alinw, alini, alinr, alins, aling, alinh, blinw, blini, blinr, blins, bling, &
blinh, vw_fac, vw_max, tice_mlt, tau_gmlt, tau_wbf, tau_revp, is_fac, ss_fac, &
gs_fac, rh_fac_evap, rh_fac_cond, sed_fac, xr_a, xr_b, xr_c, te_err, tw_err, &
rh_thres, rhc_cevap, rhc_revap, f_dq_p, f_dq_m, fi2s_fac, fi2g_fac, fs2g_fac, &
n0w_sig, n0i_sig, n0r_sig, n0s_sig, n0g_sig, n0h_sig, n0w_exp, n0i_exp, n0r_exp,&
n0s_exp, n0g_exp, n0h_exp, muw, mui, mur, mus, mug, muh, beta, rewfac, reifac
logical :: const_vw, do_sedi_uv, do_sedi_melt, liq_ice_combine, snow_grauple_combine,&
use_rhc_cevap, use_rhc_revap, do_cld_adj, do_evap_timescale, do_cond_timescale, &
consv_checker, do_warm_rain_mp, do_wbf, do_psd_water_fall, do_psd_ice_fall, &
do_psd_water_num, do_psd_ice_num, do_new_acc_water, do_new_acc_ice, cp_heating, &
delay_cond_evap, do_subgrid_proc, fast_fr_mlt, fast_dep_sub
integer :: ntimes, nconds, inflag, igflag, ifflag, rewflag, rerflag, resflag, &
regflag, radr_flag, rads_flag, radg_flag, sedflag, vdiffflag
contains
procedure, public :: setup
procedure, public :: print_namelist_v1
generic, public :: register => register_gfdlmp_param
generic, public :: display => display_gfdlmp_param
! Internal procedures
procedure, private :: register_gfdlmp_param
procedure, private :: display_gfdlmp_param
end type ty_gfdlmp_config

type(ty_gfdlmp_config) :: cfg
Expand All @@ -33,18 +58,21 @@ module module_gfdlmp_param
! Reads in namelist if associated file fields are provided, otherwise, set parameters
! to their default values.
! #######################################################################################
subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, iostat)
subroutine register_gfdlmp_param(self, errmsg, errflg, unit, input_nml_file, fn_nml, &
version, iostat)
class(ty_gfdlmp_config), intent(inout) :: self
character(len = *), intent(in ), optional :: input_nml_file(:)
character(len = *), intent(in ), optional :: fn_nml
integer, intent(in ), optional :: unit
integer, intent(in ), optional :: version
integer, intent(out), optional :: iostat
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
character(len=*), intent(out), optional :: errmsg
integer, intent(out), optional :: errflg
logical :: exists

! #####################################################################################
! GFDL MP Version 1 parameters.
! #####################################################################################
real :: tau_g2r = 600. !< graupel melting to rain time scale (s)
real :: tau_g2v = 900. !< graupel sublimation time scale (s)
real :: tau_v2g = 21600. !< graupel deposition -- make it a slow process time scale (s)
Expand All @@ -63,7 +91,9 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
logical :: de_ice = .false. !< to prevent excessive build - up of cloud ice from external sources
logical :: sedi_transport = .true. !< transport of momentum in sedimentation

! #####################################################################################
! GFDL MP common (v1/v3) parameters
! #####################################################################################
real :: cld_min = 0.05 !< (v1/v3) minimum cloud fraction
real :: tice = 273.16 !< (DIF for v3) freezing temperature (K): ref: GFDL, GFS (DJS: V3=273.15)
real :: t_min = 178. !< (v1/v3) min temp to freeze - dry all water vapor
Expand Down Expand Up @@ -150,7 +180,9 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
!< 5: Wyser (1998)
!< 6: Sun and Rikus (1999), Sun (2001)
!< 7: effective radius
! #####################################################################################
! GFDL MP Version 3 parameters
! #####################################################################################
real :: c_psacw = 1.0 ! cloud water to snow accretion efficiency
real :: c_pracw = 0.8 ! cloud water to rain accretion efficiency
real :: c_praci = 1.0 ! cloud ice to rain accretion efficiency
Expand Down Expand Up @@ -312,8 +344,10 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
!< after the cloud ice radiative property's PSD is rebuilt,
!< this parameter should be 1.0.

! #######################################################################################
! V1 namelist
namelist / gfdl_cloud_microphysics_nml_v1 / &
! #######################################################################################
namelist / gfdl_cloud_microphysics_nml / &
mp_time, t_min, t_sub, tau_r2g, tau_smlt, tau_g2r, dw_land, dw_ocean, vi_fac, &
vr_fac, vs_fac, vg_fac, ql_mlt, do_qa, fix_negative, vi_max, vs_max, vg_max, &
vr_max, qs_mlt, qs0_crt, qi_gen, ql0_max, qi0_max, qi0_crt, qr0_crt, fast_sat_adj, &
Expand All @@ -324,8 +358,11 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
cld_min, use_ppm, mono_prof, do_sedi_heat, sedi_transport, do_sedi_w, de_ice, &
icloud_f, irain_f, mp_print, reiflag, rewmin, rewmax, reimin, reimax, rermin, &
rermax, resmin, resmax, regmin, regmax, tintqs, do_hail

! #######################################################################################
! V3 Namelist
namelist / gfdl_cloud_microphysics_nml_v3 / &
! #######################################################################################
namelist / gfdl_cloud_microphysics_v3_nml / &
t_min, t_sub, tau_r2g, tau_smlt, tau_gmlt, dw_land, dw_ocean, vw_fac, vi_fac, &
vr_fac, vs_fac, vg_fac, ql_mlt, do_qa, fix_negative, vw_max, vi_max, vs_max, &
vg_max, vr_max, qs_mlt, qs0_crt, ql0_max, qi0_max, qi0_crt, ifflag, rh_inc, rh_ins,&
Expand All @@ -348,11 +385,13 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
do_psd_ice_num, vdiffflag, rewfac, reifac, cp_heating, nconds, do_evap_timescale, &
delay_cond_evap, do_subgrid_proc, fast_fr_mlt, fast_dep_sub

! Make sure that all inputs to read appropriate NML are provided
! Make sure that all inputs to read appropriate NML are provided, if not use default
! parameters
if (present(unit) .and. present(iostat) .and. &
present(input_nml_file) .and. present(fn_nml) .and. &
present(version)) then

present(version) .and. present(errflg) .and. &
present(errmsg)) then

if ((version .ne. 1) .and. (version .ne. 3)) then
write (6, *) 'gfdl - mp :: invalid scheme version number'
errflg = 1
Expand All @@ -361,8 +400,8 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
endif

#ifdef INTERNAL_FILE_NML
if (version==1) read (input_nml_file, nml = gfdl_cloud_microphysics_nml_v1)
if (version==3) read (input_nml_file, nml = gfdl_cloud_microphysics_nml_v3)
if (version==1) read (input_nml_file, nml = gfdl_cloud_microphysics_nml)
if (version==3) read (input_nml_file, nml = gfdl_cloud_microphysics_v3_nml)
#else
inquire (file = trim (fn_nml), exist = exists)
if (.not. exists) then
Expand All @@ -374,13 +413,15 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
open (unit = unit, file = fn_nml, action = 'read' , status = 'old', iostat = iostat)
endif
rewind (unit)
if (version==1) read (unit, nml = gfdl_cloud_microphysics_nml_v1)
if (version==3) read (unit, nml = gfdl_cloud_microphysics_nml_v3)
if (version==1) read (unit, nml = gfdl_cloud_microphysics_nml)
if (version==3) read (unit, nml = gfdl_cloud_microphysics_v3_nml)
close (unit)
#endif
endif

!
! #####################################################################################
! Populate parameter type
! #####################################################################################
self%mp_time = mp_time
self%t_min = t_min
self%t_sub = t_sub
Expand Down Expand Up @@ -468,15 +509,12 @@ subroutine setup(self, errmsg, errflg, unit, input_nml_file, fn_nml, version, io
self%tintqs = tintqs
self%do_hail = do_hail

end subroutine setup
end subroutine register_gfdlmp_param

function print_namelist_v1(self) result(error_msg)
subroutine display_gfdlmp_param(self)
class(ty_gfdlmp_config), intent(in) :: self
character(len=128) :: error_msg

! Initialize error handling
error_msg=''

write(*,*) '---------- GFDL MP Configurations ----------'
write(*,*) 'self%mp_time = ',self%mp_time
write(*,*) 'self%t_min = ',self%t_min
write(*,*) 'self%t_sub = ',self%t_sub
Expand Down Expand Up @@ -564,6 +602,6 @@ function print_namelist_v1(self) result(error_msg)
write(*,*) 'self%tintqs = ',self%tintqs
write(*,*) 'self%do_hail = ',self%do_hail

end function print_namelist_v1
end subroutine display_gfdlmp_param
!
end module module_gfdlmp_param
19 changes: 14 additions & 5 deletions physics/MP/GFDL/v1_2019/gfdl_cloud_microphys_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3410,15 +3410,24 @@ subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, lo
errflg = 0
errmsg = ''

! -----------------------------------------------------------------------
! Read namelist
call cfg%setup(errmsg, errflg, unit = nlunit, input_nml_file = input_nml_file, &
fn_nml = fn_nml, version=1, iostat = ios)

! -----------------------------------------------------------------------
if (me == master) then
print*,'PRE NML'
call cfg%display()
endif
call cfg%register(errmsg = errmsg, errflg = errflg, unit = nlunit, &
input_nml_file = input_nml_file, fn_nml = fn_nml, version=1, &
iostat = ios)
if (me == master) then
print*,'POST NML'
call cfg%display()
endif
! write version number and namelist to log file
if (me == master) then
write (logunit, *) " ================================================================== "
write (logunit, *) "gfdl_cloud_microphys_mod"
!write (logunit, nml = gfdl_cloud_microphysics_nml)
write (logunit, *) "gfdl_cloud_microphysics_nml"
endif

!
Expand Down
39 changes: 11 additions & 28 deletions physics/MP/GFDL/v3_2022/gfdl_cloud_microphys_v3_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@ module gfdl_cloud_microphys_v3_mod
real, allocatable :: table0 (:), table1 (:), table2 (:), table3 (:), table4 (:)
real, allocatable :: des0 (:), des1 (:), des2 (:), des3 (:), des4 (:)

! -----------------------------------------------------------------------
! namelist
! To extend/modify namelist and/or default values, see ../module_gfdl_param.F90
! -----------------------------------------------------------------------
namelist / gfdl_mp_nml / cfg

contains

! =======================================================================
Expand Down Expand Up @@ -266,31 +260,20 @@ subroutine gfdl_cloud_microphys_v3_mod_init (me, master, nlunit, input_nml_file,
errflg = 0
errmsg = ''

#ifdef INTERNAL_FILE_NML
read (nml = gfdl_cloud_microphysics_nml, iostat = ios, unit = nlunit, iomsg = errmsg)
#else
inquire (file = trim (fn_nml), exist = exists)
if (.not. exists) then
write (6, *) 'gfdl - mp :: namelist file: ', trim (fn_nml), ' does not exist'
errflg = 1
errmsg = 'ERROR(gfdl_cloud_microphys_v3_mod_init): namelist file '//trim (fn_nml)//' does not exist'
return
else
open (unit = nlunit, file = fn_nml, action = 'read' , status = 'old', iostat = ios)
endif
rewind (nlunit)
read (nml = gfdl_mp_nml, iostat = ios, unit = nlunit, iomsg = errmsg)
close (nlunit)
#endif

! -----------------------------------------------------------------------
! Read namelist
! -----------------------------------------------------------------------
call cfg%register(errmsg = errmsg, errflg = errflg, unit = nlunit, &
input_nml_file = input_nml_file, fn_nml = fn_nml, version=3, &
iostat = ios)

! -----------------------------------------------------------------------
! write version number and namelist to log file
! -----------------------------------------------------------------------

write (logunit, *) " ================================================================== "
write (logunit, *) "gfdl_mp_mod"
write (logunit, nml = gfdl_mp_nml)
write (*, nml = gfdl_mp_nml)
if (me == master) then
write (logunit, *) " ================================================================== "
write (logunit, *) "gfdl_cloud_microphysics_nml_v3"
endif

! -----------------------------------------------------------------------
! initialize microphysics variables
Expand Down

0 comments on commit f7d8dbe

Please sign in to comment.