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

Lightning threat indexes #628

Merged
merged 61 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b0dfe47
add IFI to post
SamuelTrahanNOAA Jul 28, 2022
192ebf2
merge develop
SamuelTrahanNOAA Jan 26, 2023
f7ae784
lightning threat indexes
SamuelTrahanNOAA Jan 31, 2023
ee65cd9
pass w to model & fixes to ccpp/physics changes
SamuelTrahanNOAA Feb 1, 2023
4b37bbe
allocate w
SamuelTrahanNOAA Feb 1, 2023
e3f9813
revise a debug print
SamuelTrahanNOAA Feb 1, 2023
a00f7c1
point to latest develop upp
SamuelTrahanNOAA Feb 3, 2023
333583e
wrong vars & units
SamuelTrahanNOAA Feb 10, 2023
709c6ee
lightning: remove msft and tweak print statements
SamuelTrahanNOAA Feb 10, 2023
fe74f87
send lightning threat indexes to post
SamuelTrahanNOAA Feb 16, 2023
18fe34e
update upp; still not quite working
SamuelTrahanNOAA Feb 21, 2023
bdb47b7
missing _
SamuelTrahanNOAA Feb 23, 2023
0081bbb
upp: remove 444 ltng and add 704
SamuelTrahanNOAA Feb 23, 2023
c74b805
remove unneeded changes from upp
SamuelTrahanNOAA Feb 23, 2023
8c601f4
update to top of upp develop
SamuelTrahanNOAA Feb 27, 2023
5dfb655
merge upstream ccpp/physics
SamuelTrahanNOAA Feb 27, 2023
58878de
merge upstream develop
SamuelTrahanNOAA Feb 27, 2023
8552337
put clim limits back in
SamuelTrahanNOAA Feb 27, 2023
c5adbcb
remove unintended changes in ccpp/physics
SamuelTrahanNOAA Feb 27, 2023
6e745ad
remove stray line from upp
SamuelTrahanNOAA Feb 27, 2023
db19f89
bug fix in upp build system
SamuelTrahanNOAA Feb 28, 2023
0b64525
bug fix in upp to fix segfault with inline post in some circumstances
SamuelTrahanNOAA Feb 28, 2023
0226999
bug fix to SURFCE.f to prevent crash of inline post
SamuelTrahanNOAA Feb 28, 2023
fac289f
fix bug in compile_upp.sh
SamuelTrahanNOAA Feb 28, 2023
b31758a
ccpp/physics: fill ltg*_max with 0 when model is hydrostatic
SamuelTrahanNOAA Feb 28, 2023
2f263d3
atmos_cubed_sphere: only send w to model in non-hydrostatic mode, and…
SamuelTrahanNOAA Feb 28, 2023
4b63f2d
disable lightning_threat when hydrostatic, and initialize wgrs
SamuelTrahanNOAA Feb 28, 2023
7caa2dc
turn off lightning_threat by default since it allocates wgrs and pass…
SamuelTrahanNOAA Feb 28, 2023
1f0c80e
missing `active = (lightning_threat_indices_enabled)` for wgrd
SamuelTrahanNOAA Feb 28, 2023
733c5b1
missing three more active = lines
SamuelTrahanNOAA Feb 28, 2023
0ea09c7
rearrange things to make gnu compiler happy
SamuelTrahanNOAA Mar 1, 2023
1c5dbcb
merge upstream upp
SamuelTrahanNOAA Mar 2, 2023
3755152
updates from review of upp
SamuelTrahanNOAA Mar 2, 2023
ee5e3e7
resolve reviewer comments in ccpp/physics
SamuelTrahanNOAA Mar 6, 2023
9052a13
resolve reviewer comments in lightning code variable names
SamuelTrahanNOAA Mar 6, 2023
602063e
update prints to indicate hydrostatic does not change during integration
SamuelTrahanNOAA Mar 6, 2023
9e4818e
update to top of develop upp
SamuelTrahanNOAA Mar 6, 2023
f057e87
update variable name elsewhere
SamuelTrahanNOAA Mar 6, 2023
c0e0d85
UPP submodule: correct ifi load on acorn
SamuelTrahanNOAA Mar 7, 2023
ea8b35a
update upp branch name
SamuelTrahanNOAA Mar 7, 2023
e9cf11d
upp: update latest fv3lam txt and merge develop
SamuelTrahanNOAA Mar 8, 2023
60d9163
Merge remote-tracking branch 'upstream/develop' into ifi
SamuelTrahanNOAA Mar 8, 2023
6c15c83
remove stray file
SamuelTrahanNOAA Mar 14, 2023
431521a
point to develop UPP
SamuelTrahanNOAA Mar 14, 2023
876aa91
remove unneeded initialization of ltg*_max in post_fv3
SamuelTrahanNOAA Mar 14, 2023
9fe2b1e
remove unneeded hydrostatic check from maximum_hourly_diagnostics
SamuelTrahanNOAA Mar 14, 2023
cdbbc43
Merge remote-tracking branch 'upstream/develop' into lightning
SamuelTrahanNOAA Mar 14, 2023
260f802
typo in gitignore
SamuelTrahanNOAA Mar 15, 2023
2287446
merge ufs/dev into ccpp-physics
SamuelTrahanNOAA Mar 16, 2023
c07bacd
Merge remote-tracking branch 'upstream/develop' into lightning
SamuelTrahanNOAA Mar 16, 2023
84cb6f4
Merge remote-tracking branch 'sam/ifi' into lightning
SamuelTrahanNOAA Mar 17, 2023
5adbc7d
update to top of upp;
SamuelTrahanNOAA Mar 17, 2023
1de9dae
fix out-of-bounds access in upp calslr_roebbr
SamuelTrahanNOAA Mar 22, 2023
0ac9ccc
update author information
SamuelTrahanNOAA Mar 22, 2023
6ff0a72
update upp to develop and correct author date
SamuelTrahanNOAA Mar 22, 2023
9f29f47
fix another out-of-bounds access and move a message to stdout
SamuelTrahanNOAA Mar 22, 2023
b13397c
fix similar bug in SURFCE.f
SamuelTrahanNOAA Mar 22, 2023
23ae618
point to develop upp
SamuelTrahanNOAA Mar 22, 2023
c637b4b
point to ufs/dev ccpp/physics
SamuelTrahanNOAA Mar 23, 2023
36c4d48
point to ufs/dev ccpp/physics in .gitmodules
SamuelTrahanNOAA Mar 23, 2023
7e600b9
point to dev/emc version of atmos_cubed_sphere[
SamuelTrahanNOAA Mar 24, 2023
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
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[submodule "atmos_cubed_sphere"]
path = atmos_cubed_sphere
url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere
branch = dev/emc
url = https://github.com/SamuelTrahanNOAA/GFDL_atmos_cubed_sphere
branch = lightning
jkbk2004 marked this conversation as resolved.
Show resolved Hide resolved
[submodule "ccpp/framework"]
path = ccpp/framework
url = https://github.com/NCAR/ccpp-framework
branch = main
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/ufs-community/ccpp-physics
branch = ufs/dev
url = https://github.com/SamuelTrahanNOAA/ccpp-physics
branch = lightning
[submodule "upp"]
path = upp
url = https://github.com/NOAA-EMC/UPP
Expand Down
2 changes: 1 addition & 1 deletion atmos_cubed_sphere
53 changes: 51 additions & 2 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,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
SamuelTrahanNOAA marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -1456,6 +1457,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 @@ -1976,6 +1980,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 @@ -2054,13 +2063,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 @@ -3533,6 +3549,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 @@ -3676,7 +3695,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 @@ -3750,6 +3771,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 @@ -5079,6 +5102,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
SamuelTrahanNOAA marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -5852,6 +5882,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 @@ -6354,7 +6385,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 @@ -6948,6 +6981,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 @@ -7512,6 +7554,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 ccpp/data/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 @@ -6062,6 +6070,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 @@ -8856,6 +8870,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
35 changes: 35 additions & 0 deletions ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4247,6 +4247,41 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop
enddo
enddo

if(Model%lightning_threat) then
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ltg1_max'
ExtDiag(idx)%desc = 'Max Lightning Threat 1'
ExtDiag(idx)%unit = 'flashes/(5 min)'
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%ltg1_max
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ltg2_max'
ExtDiag(idx)%desc = 'Max Lightning Threat 2'
ExtDiag(idx)%unit = 'flashes/(5 min)'
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%ltg2_max
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = 'ltg3_max'
ExtDiag(idx)%desc = 'Max Lightning Threat 3'
ExtDiag(idx)%unit = 'flashes/(5 min)'
ExtDiag(idx)%mod_name = 'gfs_sfc'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%ltg3_max
enddo
endif

! Cloud effective radii from Microphysics
if (Model%imp_physics == Model%imp_physics_thompson .or. Model%imp_physics == Model%imp_physics_fer_hires .or. &
Model%imp_physics == Model%imp_physics_nssl ) then
Expand Down
2 changes: 1 addition & 1 deletion ccpp/physics
42 changes: 39 additions & 3 deletions io/post_fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
use vrbls3d, only: t, q, uh, vh, wh, alpint, dpres, zint, zmid, o3, &
qqr, qqs, cwm, qqi, qqw, qqg, omga, cfr, pmid, &
q2, rlwtt, rswtt, tcucn, tcucns, train, el_pbl, &
pint, exch_h, ref_10cm, qqni, qqnr, qqnwfa, qqnifa
pint, exch_h, ref_10cm, qqni, qqnr, qqnwfa, &
qqnifa
use vrbls2d, only: f, pd, sigt4, fis, pblh, ustar, z0, ths, qs, twbs,&
qwbs, avgcprate, cprate, avgprec, prec, lspa, sno,&
cldefi, th10, q10, tshltr, pshltr, albase, &
Expand Down Expand Up @@ -528,7 +529,8 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
refdm10c_max, u10max, v10max, wspd10max, sfcuxi, &
sfcvxi, t10m, t10avg, psfcavg, akhsavg, akmsavg, &
albedo, tg, prate_max, pwat, snow_acm, snow_bkt, &
acgraup, graup_bucket, acfrain, frzrn_bucket
acgraup, graup_bucket, acfrain, frzrn_bucket, &
ltg1_max, ltg2_max, ltg3_max
use soil, only: sldpth, sh2o, smc, stc
use masks, only: lmv, lmh, htm, vtm, gdlat, gdlon, dx, dy, hbm2, sm, sice
use ctlblk_mod, only: im, jm, lm, lp1, jsta, jend, jsta_2l, jend_2u, jsta_m,jend_m, &
Expand Down Expand Up @@ -732,7 +734,8 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
! snow phase change heat flux, snopcx
! GFS does not use total momentum flux,sfcuvx
!$omp parallel do default(none),private(i,j),shared(jsta,jend,im,spval,ista,iend), &
!$omp& shared(acfrcv,ncfrcv,acfrst,ncfrst,bgroff,rswin,rswinc,rswout,snopcx,sfcuvx)
!$omp& shared(acfrcv,ncfrcv,acfrst,ncfrst,bgroff,rswin,rswinc,rswout,snopcx,sfcuvx,&
!$omp& ltg1_max,ltg2_max,ltg3_max)
do j=jsta,jend
do i=ista,iend
acfrcv(i,j) = spval
Expand Down Expand Up @@ -1038,6 +1041,39 @@ subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
enddo
endif

! Lightning threat index 1
if(trim(fieldname)=='ltg1_max') then
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,ltg1_max,arrayr42d,fillValue,spval)
do j=jsta,jend
do i=ista, iend
ltg1_max(i,j)=arrayr42d(i,j)
if(abs(arrayr42d(i,j)-fillValue) < small) ltg1_max(i,j)=spval
enddo
enddo
endif

! Lightning threat index 2
if(trim(fieldname)=='ltg2_max') then
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,ltg2_max,arrayr42d,fillValue,spval)
do j=jsta,jend
do i=ista, iend
ltg2_max(i,j)=arrayr42d(i,j)
if(abs(arrayr42d(i,j)-fillValue) < small) ltg2_max(i,j)=spval
enddo
enddo
endif

! Lightning threat index 3
if(trim(fieldname)=='ltg3_max') then
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,ltg3_max,arrayr42d,fillValue,spval)
do j=jsta,jend
do i=ista, iend
ltg3_max(i,j)=arrayr42d(i,j)
if(abs(arrayr42d(i,j)-fillValue) < small) ltg3_max(i,j)=spval
enddo
enddo
endif

! frictional velocity
if(trim(fieldname)=='fricv') then
!$omp parallel do default(none) private(i,j) shared(jsta,jend,ista,iend,ustar,arrayr42d,fillValue,spval)
Expand Down
Loading