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

UFS-dev PR#42 #374

Merged
merged 3 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
branch = main
[submodule "ccpp-physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = main
#url = https://github.com/NCAR/ccpp-physics
#branch = main
url = https://github.com/grantfirl/ccpp-physics
branch = ufs-dev-PR42
[submodule "CMakeModules"]
path = CMakeModules
url = https://github.com/noaa-emc/CMakeModules
Expand Down
2 changes: 1 addition & 1 deletion ccpp/physics
53 changes: 51 additions & 2 deletions scm/src/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: pgr (:) => null() !< surface pressure (Pa) real
real (kind=kind_phys), pointer :: ugrs (:,:) => null() !< u component of layer wind
real (kind=kind_phys), pointer :: vgrs (:,:) => null() !< v component of layer wind
real (kind=kind_phys), pointer :: wgrs (:,:) => null() !< w component of layer wind
real (kind=kind_phys), pointer :: vvl (:,:) => null() !< layer mean vertical velocity in pa/sec
real (kind=kind_phys), pointer :: tgrs (:,:) => null() !< model layer mean temperature in k
real (kind=kind_phys), pointer :: qgrs (:,:,:) => null() !< layer mean tracer concentration
Expand Down Expand Up @@ -1452,6 +1453,9 @@ module GFS_typedefs
real(kind=kind_phys) :: rhcmax ! maximum critical relative humidity, replaces rhc_max in physcons.F90
real(kind=kind_phys) :: huge !< huge fill value

!--- lightning threat and diagsnostics
logical :: lightning_threat !< report lightning threat indices

contains
procedure :: init => control_initialize
procedure :: init_chemistry => control_chemistry_initialize
Expand Down Expand Up @@ -1972,6 +1976,11 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: aux2d(:,:) => null() !< auxiliary 2d arrays in output (for debugging)
real (kind=kind_phys), pointer :: aux3d(:,:,:)=> null() !< auxiliary 2d arrays in output (for debugging)

!--- Lightning threat indices
real (kind=kind_phys), pointer :: ltg1_max(:) => null() !
real (kind=kind_phys), pointer :: ltg2_max(:) => null() !
real (kind=kind_phys), pointer :: ltg3_max(:) => null() !

contains
procedure :: create => diag_create
procedure :: rad_zero => diag_rad_zero
Expand Down Expand Up @@ -2031,13 +2040,20 @@ subroutine statein_create (Statein, IM, Model)
allocate (Statein%pgr (IM))
allocate (Statein%ugrs (IM,Model%levs))
allocate (Statein%vgrs (IM,Model%levs))
if(Model%lightning_threat) then
allocate (Statein%wgrs (IM,Model%levs))
endif
allocate (Statein%qgrs (IM,Model%levs,Model%ntrac))

Statein%qgrs = clear_val
Statein%pgr = clear_val
Statein%ugrs = clear_val
Statein%vgrs = clear_val

if(Model%lightning_threat) then
Statein%wgrs = clear_val
endif

!--- soil state variables - for soil SPPT - sfc-perts, mgehne
allocate (Statein%smc (IM,Model%lsoil))
allocate (Statein%stc (IM,Model%lsoil))
Expand Down Expand Up @@ -3514,6 +3530,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logical :: mix_chem = .false. ! tracer mixing option by MYNN PBL
logical :: fire_turb = .false. ! enh vertmix option by MYNN PBL

!-- Lightning threat index
logical :: lightning_threat = .false.

!--- aerosol scavenging factors
integer, parameter :: max_scav_factors = 183
character(len=40) :: fscav_aero(max_scav_factors)
Expand Down Expand Up @@ -3658,7 +3677,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
addsmoke_flag, fire_turb, mix_chem, &
!--- (DFI) time ranges with radar-prescribed microphysics tendencies
! and (maybe) convection suppression
fh_dfi_radar, radar_tten_limits, do_cap_suppress
fh_dfi_radar, radar_tten_limits, do_cap_suppress, &
!--- GSL lightning threat indices
lightning_threat

!--- other parameters
integer :: nctp = 0 !< number of cloud types in CS scheme
Expand Down Expand Up @@ -3732,6 +3753,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%flag_for_scnv_generic_tend = .true.
Model%flag_for_dcnv_generic_tend = .true.

Model%lightning_threat = lightning_threat

Model%fh_dfi_radar = fh_dfi_radar
Model%num_dfi_radar = 0
Model%dfi_radar_max_intervals = dfi_radar_max_intervals ! module-level parameter, top of file
Expand Down Expand Up @@ -5081,6 +5104,13 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%restart = restart
Model%lsm_cold_start = .not. restart
Model%hydrostatic = hydrostatic

if(Model%hydrostatic .and. Model%lightning_threat) then
write(0,*) 'Turning off lightning threat index for hydrostatic run.'
Model%lightning_threat = .false.
lightning_threat = .false.
endif

Model%jdat(1:8) = jdat(1:8)
allocate(Model%si(Model%levs+1))
!--- Define sigma level for radiation initialization
Expand Down Expand Up @@ -5853,6 +5883,7 @@ subroutine control_print(Model)
print *, ' thermodyn_id : ', Model%thermodyn_id
print *, ' sfcpress_id : ', Model%sfcpress_id
print *, ' gen_coord_hybrid : ', Model%gen_coord_hybrid
print *, ' hydrostatic : ', Model%hydrostatic
print *, ' '
print *, 'grid extent parameters'
print *, ' isc : ', Model%isc
Expand Down Expand Up @@ -6359,7 +6390,9 @@ subroutine control_print(Model)
print *, ' first_time_step : ', Model%first_time_step
print *, ' restart : ', Model%restart
print *, ' lsm_cold_start : ', Model%lsm_cold_start
print *, ' hydrostatic : ', Model%hydrostatic
print *, ' '
print *, 'lightning threat indexes'
print *, ' lightning_threat : ', Model%lightning_threat
endif

end subroutine control_print
Expand Down Expand Up @@ -6952,6 +6985,15 @@ subroutine diag_create (Diag, IM, Model)
Diag%old_pgr = clear_val
endif

if(Model%lightning_threat) then
allocate (Diag%ltg1_max(IM))
allocate (Diag%ltg2_max(IM))
allocate (Diag%ltg3_max(IM))
Diag%ltg1_max = zero
Diag%ltg2_max = zero
Diag%ltg3_max = zero
endif

!--- Radiation
allocate (Diag%fluxr (IM,Model%nfxr))
allocate (Diag%topfsw (IM))
Expand Down Expand Up @@ -7516,6 +7558,13 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center)
Diag%tsnowp = zero
endif

! GSL lightning threat indexes
if(Model%lightning_threat) then
Diag%ltg1_max = zero
Diag%ltg2_max = zero
Diag%ltg3_max = zero
endif

end subroutine diag_phys_zero

end module GFS_typedefs
41 changes: 41 additions & 0 deletions scm/src/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[wgrs]
standard_name = unsmoothed_nonhydrostatic_upward_air_velocity
long_name = unsmoothed non-hydrostatic upward air velocity
units = m s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (do_lightning_threat_index_calculations)
[vvl]
standard_name = lagrangian_tendency_of_air_pressure
long_name = layer mean vertical velocity
Expand Down Expand Up @@ -6097,6 +6105,12 @@
units = flag
dimensions = ()
type = logical
[lightning_threat]
standard_name = do_lightning_threat_index_calculations
long_name = enables the lightning threat index calculations
units = flag
dimensions = ()
type = logical
[ipt]
standard_name = index_of_horizontal_gridpoint_for_debug_output
long_name = horizontal index for point used for diagnostic printout
Expand Down Expand Up @@ -8891,6 +8905,33 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[ltg1_max]
standard_name = lightning_threat_index_1
long_name = lightning threat index 1
units = flashes 5 min-1
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
active = (do_lightning_threat_index_calculations)
[ltg2_max]
standard_name = lightning_threat_index_2
long_name = lightning threat index 2
units = flashes 5 min-1
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
active = (do_lightning_threat_index_calculations)
[ltg3_max]
standard_name = lightning_threat_index_3
long_name = lightning threat index 3
units = flashes 5 min-1
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
intent = inout
active = (do_lightning_threat_index_calculations)

########################################################################
[ccpp-table-properties]
Expand Down