Skip to content

Commit

Permalink
Add support for Stochastically Perturbed Parameterizations (SPP) in F…
Browse files Browse the repository at this point in the history
…V3 and add the FV3_RRFS_v1alpha SDF. (#454)

Adds the necessary code in fv3atm to allow for Stochastically Perturbed Parameterizations (SPP) in a set of RAP/HRRR-based physics parameterizations. Specific to the fv3atm repository, code in this PR defines the necessary variables associated with various SPP-related fields (e.g., logical to activate SPP, parameterization-specific SPP variables, etc.) that are then passed to ccpp-physics.
  • Loading branch information
JeffBeck-NOAA authored Feb 23, 2022
1 parent b3f98fe commit bc562d7
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 12 deletions.
6 changes: 3 additions & 3 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ subroutine update_atmos_radiation_physics (Atmos)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP timestep_init step failed')

if (GFS_Control%do_sppt .or. GFS_Control%do_shum .or. GFS_Control%do_skeb .or. &
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca ) then
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca .or. GFS_Control%do_spp) then
!--- call stochastic physics pattern generation / cellular automata
call stochastic_physics_wrapper(GFS_control, GFS_data, Atm_block, ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to stochastic_physics_wrapper failed')
Expand Down Expand Up @@ -698,7 +698,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP physics_init step failed')

if (GFS_Control%do_sppt .or. GFS_Control%do_shum .or. GFS_Control%do_skeb .or. &
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca) then
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca .or. GFS_Control%do_spp) then

!--- Initialize stochastic physics pattern generation / cellular automata for first time step
call stochastic_physics_wrapper(GFS_control, GFS_data, Atm_block, ierr)
Expand Down Expand Up @@ -964,7 +964,7 @@ subroutine atmos_model_end (Atmos)
! call write_stoch_restart_atm('RESTART/atm_stoch.res.nc')
endif
if (GFS_Control%do_sppt .or. GFS_Control%do_shum .or. GFS_Control%do_skeb .or. &
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca ) then
GFS_Control%lndp_type > 0 .or. GFS_Control%do_ca .or. GFS_Control%do_spp) then
if(restart_endfcst) then
call write_stoch_restart_atm('RESTART/atm_stoch.res.nc')
if (GFS_control%do_ca)then
Expand Down
52 changes: 51 additions & 1 deletion ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: skebu_wts (:,:) => null() !
real (kind=kind_phys), pointer :: skebv_wts (:,:) => null() !
real (kind=kind_phys), pointer :: sfc_wts (:,:) => null() ! mg, sfc-perts
real (kind=kind_phys), pointer :: spp_wts_pbl (:,:) => null() ! spp-pbl-perts
real (kind=kind_phys), pointer :: spp_wts_sfc (:,:) => null() ! spp-sfc-perts
real (kind=kind_phys), pointer :: spp_wts_mp (:,:) => null() ! spp-mp-perts
real (kind=kind_phys), pointer :: spp_wts_gwd (:,:) => null() ! spp-gwd-perts
real (kind=kind_phys), pointer :: spp_wts_rad (:,:) => null() ! spp-rad-perts

!--- aerosol surface emissions for Thompson microphysics
real (kind=kind_phys), pointer :: nwfa2d (:) => null() !< instantaneous water-friendly sfc aerosol source
Expand Down Expand Up @@ -1174,6 +1179,16 @@ module GFS_typedefs
! multiple patterns. It wasn't fully coded (and wouldn't have worked
! with nlndp>1, so I just dropped it). If we want to code it properly,
! we'd need to make this dim(6,5).
logical :: do_spp ! Overall flag to turn on SPP or not
integer :: spp_pbl
integer :: spp_sfc
integer :: spp_mp
integer :: spp_rad
integer :: spp_gwd
integer :: n_var_spp
character(len=3) , pointer :: spp_var_list(:) ! dimension here must match n_var_spp in stochy_nml_def
real(kind=kind_phys), pointer :: spp_prt_list(:) ! dimension here must match n_var_spp in stochy_nml_def

!--- tracer handling
character(len=32), pointer :: tracer_names(:) !< array of initialized tracers from dynamic core
integer :: ntrac !< number of tracers
Expand Down Expand Up @@ -2990,12 +3005,26 @@ subroutine coupling_create (Coupling, IM, Model)
Coupling%skebu_wts = clear_val
Coupling%skebv_wts = clear_val
endif

!--- stochastic land perturbation option
if (Model%lndp_type /= 0) then
allocate (Coupling%sfc_wts (IM,Model%n_var_lndp))
Coupling%sfc_wts = clear_val
endif

!--- stochastic spp perturbation option
if (Model%do_spp) then
allocate (Coupling%spp_wts_pbl (IM,Model%levs))
Coupling%spp_wts_pbl = clear_val
allocate (Coupling%spp_wts_sfc (IM,Model%levs))
Coupling%spp_wts_sfc = clear_val
allocate (Coupling%spp_wts_mp (IM,Model%levs))
Coupling%spp_wts_mp = clear_val
allocate (Coupling%spp_wts_gwd (IM,Model%levs))
Coupling%spp_wts_gwd = clear_val
allocate (Coupling%spp_wts_rad (IM,Model%levs))
Coupling%spp_wts_rad = clear_val
endif

!--- needed for Thompson's aerosol option
if(Model%imp_physics == Model%imp_physics_thompson .and. Model%ltaerosol) then
Expand Down Expand Up @@ -3558,6 +3587,13 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: lndp_type = 0
integer :: n_var_lndp = 0
logical :: lndp_each_step = .false.
integer :: n_var_spp = 0
integer :: spp_pbl = 0
integer :: spp_sfc = 0
integer :: spp_mp = 0
integer :: spp_rad = 0
integer :: spp_gwd = 0
logical :: do_spp = .false.

!--- aerosol scavenging factors
integer, parameter :: max_scav_factors = 25
Expand Down Expand Up @@ -3647,6 +3683,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, &
dlqf, rbcr, shoc_parm, psauras, prauras, wminras, &
do_sppt, do_shum, do_skeb, &
do_spp, n_var_spp, &
lndp_type, n_var_lndp, lndp_each_step, &
pert_mp,pert_clds,pert_radtend, &
!--- Rayleigh friction
Expand Down Expand Up @@ -4438,12 +4475,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%lndp_type = lndp_type
Model%n_var_lndp = n_var_lndp
Model%lndp_each_step = lndp_each_step
Model%do_spp = do_spp
Model%n_var_spp = n_var_spp

if (Model%lndp_type/=0) then
allocate(Model%lndp_var_list(Model%n_var_lndp))
allocate(Model%lndp_prt_list(Model%n_var_lndp))
Model%lndp_var_list(:) = ''
Model%lndp_prt_list(:) = clear_val
end if

if (Model%do_spp) then
allocate(Model%spp_var_list(Model%n_var_spp))
allocate(Model%spp_prt_list(Model%n_var_spp))
Model%spp_var_list(:) = ''
Model%spp_prt_list(:) = clear_val
end if

!--- cellular automata options
! force namelist constsitency
allocate(Model%vfact_ca(levs))
Expand Down Expand Up @@ -5873,6 +5921,8 @@ subroutine control_print(Model)
print *, ' lndp_type : ', Model%lndp_type
print *, ' n_var_lndp : ', Model%n_var_lndp
print *, ' lndp_each_step : ', Model%lndp_each_step
print *, ' do_spp : ', Model%do_spp
print *, ' n_var_spp : ', Model%n_var_spp
print *, ' '
print *, 'cellular automata'
print *, ' nca : ', Model%nca
Expand Down
98 changes: 97 additions & 1 deletion ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2244,10 +2244,50 @@
type = real
kind = kind_phys
active = (flag_for_stochastic_skeb_option)
[spp_wts_pbl]
standard_name = spp_weights_for_pbl_scheme
long_name = spp weights for pbl scheme
units = 1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_stochastically_perturbed_parameterizations)
[spp_wts_sfc]
standard_name = spp_weights_for_surface_layer_scheme
long_name = spp weights for surface layer scheme
units = 1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_stochastically_perturbed_parameterizations)
[spp_wts_mp]
standard_name = spp_weights_for_microphysics_scheme
long_name = spp weights for microphysics scheme
units = 1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_stochastically_perturbed_parameterizations)
[spp_wts_gwd]
standard_name = spp_weights_for_gravity_wave_drag_scheme
long_name = spp weights for gravity wave drag scheme
units = 1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_stochastically_perturbed_parameterizations)
[spp_wts_rad]
standard_name = spp_weights_for_radiation_scheme
long_name = spp weights for radiation scheme
units = 1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_stochastically_perturbed_parameterizations)
[sfc_wts]
standard_name = surface_stochastic_weights_from_coupled_process
long_name = weights for stochastic surface physics perturbation
units = none
units = 1
dimensions = (horizontal_loop_extent,number_of_perturbed_land_surface_variables)
type = real
kind = kind_phys
Expand Down Expand Up @@ -4610,6 +4650,12 @@
units = flag
dimensions = ()
type = logical
[do_spp]
standard_name = do_stochastically_perturbed_parameterizations
long_name = flag for stochastic spp option
units = flag
dimensions = ()
type = logical
[lndp_type]
standard_name = control_for_stochastic_land_surface_perturbation
long_name = index for stochastic land surface perturbations type
Expand Down Expand Up @@ -4638,6 +4684,56 @@
type = character
kind = len=3
active = (control_for_stochastic_land_surface_perturbation /= 0)
[n_var_spp]
standard_name = number_of_perturbed_spp_schemes
long_name = number of perturbed spp schemes
units = count
dimensions = ()
type = integer
[spp_prt_list]
standard_name =magnitude_of_spp_perturbations
long_name = magnitude of spp perturbations
units = 1
dimensions = (number_of_spp_schemes_perturbed)
type = real
kind = kind_phys
[spp_var_list]
standard_name = perturbed_spp_schemes
long_name = perturbed spp schemes
units = none
dimensions = (number_of_spp_schemes_perturbed)
type = character
kind = len=3
[spp_pbl]
standard_name = control_for_pbl_spp_perturbations
long_name = control for pbl spp perturbations
units = count
dimensions = ()
type = integer
[spp_sfc]
standard_name = control_for_surface_layer_spp_perturbations
long_name = control for surface layer spp perturbations
units = count
dimensions = ()
type = integer
[spp_mp]
standard_name = control_for_microphysics_spp_perturbations
long_name = control for microphysics spp perturbations
units = count
dimensions = ()
type = integer
[spp_rad]
standard_name = control_for_radiation_spp_perturbations
long_name = control for radiation spp perturbations
units = count
dimensions = ()
type = integer
[spp_gwd]
standard_name = control_for_gravity_wave_drag_spp_perturbations
long_name = control for gravity wave drag spp perturbations
units = count
dimensions = ()
type = integer
[ntrac]
standard_name = number_of_tracers
long_name = number of tracers
Expand Down
65 changes: 65 additions & 0 deletions ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2296,6 +2296,71 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
enddo
endif

if (Model%do_spp) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'spp_wts_pbl'
ExtDiag(idx)%desc = 'spp pbl perturbation wts'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%spp_wts_pbl(:,:)
enddo
endif

if (Model%do_spp) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'spp_wts_sfc'
ExtDiag(idx)%desc = 'spp sfc perturbation wts'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%spp_wts_sfc(:,:)
enddo
endif

if (Model%do_spp) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'spp_wts_mp'
ExtDiag(idx)%desc = 'spp mp perturbation wts'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%spp_wts_mp(:,:)
enddo
endif

if (Model%do_spp) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'spp_wts_gwd'
ExtDiag(idx)%desc = 'spp gwd perturbation wts'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%spp_wts_gwd(:,:)
enddo
endif

if (Model%do_spp) then
idx = idx + 1
ExtDiag(idx)%axes = 3
ExtDiag(idx)%name = 'spp_wts_rad'
ExtDiag(idx)%desc = 'spp rad perturbation wts'
ExtDiag(idx)%unit = 'm/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var3 => Coupling(nb)%spp_wts_rad(:,:)
enddo
endif

if (Model%lndp_type /= 0) then
idx = idx + 1
ExtDiag(idx)%axes = 2
Expand Down
Loading

0 comments on commit bc562d7

Please sign in to comment.