Skip to content

Conversation

@BarryHLynn
Copy link

@BarryHLynn BarryHLynn commented Nov 2, 2025

To add the Dynamic Lightning Scheme to the public version of WRF

New Feature

Lightning-Forecast Lightning Dynamic Lightning Scheme Cloud-to-ground-Lightning, Intracloud Lightning. (LPI code also updated to calculate 3d and 2d LPI)

Barry.H.Lynn@gmail.com; Barry.Lynn@Weather-It-Is.com (Weather It Is, LTD and Hebrew University of Jerusalem)

DESCRIPTION OF CHANGES:

Registry/registry.dyn_light
dyn_em/solve_em.F
phys/Makefile
phys/module_calc_lpi_new.F
phys/module_ltng_pe.F
phys/module_ltng_strokes.F
phys/module_microphysics_driver.F

Just added/modified these routines (based on already published work going back to 2010).

RELEASE NOTE: Include a stand-alone message suitable for the inclusion in the minor and annual releases. A publication citation is appropriate. This is the Dynamic Lightning Scheme based originally on this paper.

Lynn, B. H., 2017: The Usefulness and Economic Value of Total Lightning Forecasts Made with a Dynamic Lightning Scheme Coupled with Lightning Data Assimilation. Wea. Forecasting, 32, 645–663, https://doi.org/10.1175/WAF-D-16-0031.1.

@BarryHLynn BarryHLynn requested review from a team as code owners November 2, 2025 18:46
@BarryHLynn
Copy link
Author

I accidentally uploaded an abbreviated version of registry.sbm_light. I have uploaded the complete file and all should be well.

@dudhia
Copy link
Collaborator

dudhia commented Nov 3, 2025

OK. We had some automatic checks that failed and will let you know what they are later. This could be special compilation options for example.

@BarryHLynn
Copy link
Author

BarryHLynn commented Nov 3, 2025 via email

LOGICAL :: f_flux ! flag for computing averaged fluxes in cu_gd
REAL :: curr_secs, curr_secs2, curr_mins2
REAL(8) :: curr_secs_r8, curr_secs2_r8
REAL :: curr_secs, curr_secs2
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you should be making this change. The two lines in the code should be retained.


TYPE(WRFU_TimeInterval) :: tmpTimeInterval, tmpTimeInterval2
REAL :: real_time
REAL(8) :: real_time_r8
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same for this line, which should not be removed.

curr_secs2 = real_time(tmpTimeInterval2)
curr_secs_r8 = real_time_r8(tmpTimeInterval)
curr_secs2_r8 = real_time_r8(tmpTimeInterval2)
curr_mins2 = REAL( curr_secs2_r8 / 60.0d0 )
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same applies here.

, config_flags%use_adaptive_time_step &
, curr_secs, curr_mins2 &
, curr_secs &
, psim , psih , gz1oz0 &
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same applies here.

& ,P8W=p8w ,P=p_phy ,PI_PHY=pi_phy &
& ,RHO=grid%rho ,SPEC_ZONE=grid%spec_zone &
& ,SR=grid%sr ,TH=th_phy &
& ,ssat=grid%ssat, ssati=grid%ssati &
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too.

!======================
#endif
& ,XLAND=grid%xland,SNOWH=grid%SNOW,XICE=grid%XICE &
& ,XLAND=grid%xland,SNOWH=grid%SNOW & !PMA
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same here.

module_bl_mynnedmf_driver.o \
module_bl_mynn_common.o \
module_bl_mynn.o \
module_bl_mynn_wrapper.o \
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should not be changed in your PR.

module_mp_etanew.o \
module_mp_fer_hires.o \
module_mp_thompson.o \
module_mp_rcon.o \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should not be removed.

module_mp_wdm5.o \
module_mp_wdm6.o \
module_mp_wdm7.o \
module_mp_udm.o \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one too, should not be removed.

TARGETDIR = ./

$(LIBTARGET) :
(cd .. && ./tools/manage_externals/checkout_externals --externals ./arch/Externals.cfg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You definitely should not remove this line.

else \
echo No action required for MYNN-EDMF submodule ; \
fi

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should not remove these lines either.

,cldfra, cldfra_old, exch_h, nsource &
,qlsink, precr, preci, precs, precg &
,xland,snowh,xice,itimestep &
,xland,snowh,itimestep &
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should not change it here.

#endif
,qnwfa2d, qnifa2d, qnbca2d & ! for water/ice-friendly/black carbon aerosols
,qnocbb2d, qnbcbb2d & ! for biomass burning aerosols
,ssat,ssati &
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should not remove this line.

USE module_state_description, ONLY : &
KESSLERSCHEME, LINSCHEME, SBU_YLINSCHEME, WSM3SCHEME, WSM5SCHEME &
,WSM6SCHEME, ETAMPNEW, FER_MP_HIRES, THOMPSON, THOMPSONAERO, RCON_MP_SCHEME, THOMPSONGH, FAST_KHAIN_LYNN_SHPUND, MORR_TWO_MOMENT &
,WSM6SCHEME, ETAMPNEW, FER_MP_HIRES, THOMPSON, THOMPSONAERO, THOMPSONGH, FAST_KHAIN_LYNN_SHPUND, MORR_TWO_MOMENT &
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not change this line.

,GSFCGCESCHEME, WDM5SCHEME, WDM6SCHEME, NSSL_2MOM, MADWRF_MP &
,FER_MP_HIRES_ADVECT &
,WSM7SCHEME, WDM7SCHEME, UDMSCHEME &
,WSM7SCHEME, WDM7SCHEME &
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not change this line.

USE module_mp_wsm7
USE module_mp_etanew
USE module_mp_fer_hires
USE module_mp_rcon
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not remove this line.

USE module_mp_wdm5
USE module_mp_wdm6
USE module_mp_wdm7
USE module_mp_udm
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not remove this line.

! Optional
!
REAL, OPTIONAL, DIMENSION( ims:ime , kms:kme, jms:jme ) , INTENT(OUT) :: refl_10cm,ssat,ssati
REAL, OPTIONAL, DIMENSION( ims:ime , kms:kme, jms:jme ) , INTENT(OUT) :: refl_10cm
Copy link
Collaborator

Choose a reason for hiding this comment

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

should not change this line.

dbz = refl_10cm, &
ssat3d = ssat, &
ssati = ssati, &
nssl_ssat_output = config_flags%nssl_ssat_output, &
Copy link
Collaborator

Choose a reason for hiding this comment

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

should not remove these lines.

ENDIF
ELSE
CALL wrf_error_fatal ( 'arguments not present for calling rcon' )
ENDIF
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not remove these lines.

ELSE
CALL wrf_error_fatal ( 'arguments not present for calling udm')
ENDIF

Copy link
Collaborator

Choose a reason for hiding this comment

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

should not remove these lines.

@weiwangncar
Copy link
Collaborator

@BarryHLynn The general errors you made is to overwrite the current version of the code with the version you worked on. Doing so, you removed many new updates we made in the model (which I pointed out). Those changes are not part of the modification you intend to make, and should be removed / corrected for this PR.

@BarryHLynn
Copy link
Author

BarryHLynn commented Nov 20, 2025 via email

@dudhia
Copy link
Collaborator

dudhia commented Nov 20, 2025

In github one thing not to do is copy modules from another directory into the one you downloaded. You should only clone an existing recent release version and edit that directly.

@dudhia
Copy link
Collaborator

dudhia commented Dec 11, 2025 via email

@BarryHLynn
Copy link
Author

BarryHLynn commented Dec 11, 2025 via email

@dudhia
Copy link
Collaborator

dudhia commented Dec 11, 2025

Use this command to clone the code. Then you should not need to access the other repos when compiling offline.
git clone https://github.com/wrf-model/WRF.git --recurse-submodules

@BarryHLynn
Copy link
Author

BarryHLynn commented Dec 12, 2025 via email

@islas islas changed the base branch from master to develop December 12, 2025 23:57
@islas
Copy link
Collaborator

islas commented Dec 13, 2025

@BarryHLynn I've changed the target branch to develop as we never pull into master directly. This should have set at creation or at least been done at the very beginning of the pull request - I apologize. I don't think it has changed any of the diffs, but it may be best to double check to make sure the edits have remained true to what you intend to pull in.

Regarding the issues, it may be easier to provide guidance if you are able to post logs of your configuration and build output.

@BarryHLynn
Copy link
Author

BarryHLynn commented Dec 13, 2025 via email

@weiwangncar
Copy link
Collaborator

@BarryHLynn I've put a tar file of latest WRF code (WRF v4.7.1) on our server for you and it should contain all the files needed for compilation. Can you start from there?

@BarryHLynn
Copy link
Author

BarryHLynn commented Dec 15, 2025 via email

@BarryHLynn
Copy link
Author

BarryHLynn commented Dec 18, 2025 via email

@weiwangncar
Copy link
Collaborator

@BarryHLynn I've created a new PR (#2276) based on your github code. Please check to see the changes are correct. Please also help edit the PR message. In the message you should state what the new scheme can do, and how the option is activated, etc. If there is publication, add the reference.

@BarryHLynn
Copy link
Author

Hellow: I am unable to save my comments. Here they are again: To run the Dynamic Lightning Scheme add these parameters to the physics section of namelist.input

dyn_lightning_option = 1, 1, 1,
coul_pos = 0.000035, 0.000035,0.000035,
coul_neg = 0.000035, 0.000035,0.000035,
coul_neu = 0.000035, 0.000035,0.000035,

These are charging coefficients are set for
mp_physics = 28, 28,
and can be modified -- if needed -- for other microphysical schemes. For instance, if a scheme does not produce very much cloud water, these values might need to be raised.

One could also modify, j_pos, j_neg, and j_neu, which are threshold values for the breakdown field that control what magnitude of "electric potential energy" must build up to produce an event for each (see Registry/registry.dyn_light). But, this is not recommended as a first step.

The original paper is: Lynn, H. B., Y. Yair, C. Price, G. Kelman, and A. J. Clark, 2012: Predicting cloud-to-ground and intracloud lightning in weather forecast models. Wea. Forecasting, 27, 1470–1488. https://doi.org/10.1175/WAF-D-11-00144.1. Additional papers were published since then. One can also reference this paper: Stefano Federico, Rosa Claudia Torcasio, Jana Popova, Zbyněk Sokol, Lukáš Pop, Martina Lagasio, Barry H. Lynn, Silvia Puca, Stefano Dietrich,
Improving the lightning forecast with the WRF model and lightning data assimilation: Results of a two-seasons numerical experiment over Italy, Atmospheric Research, Volume 304, 2024, 107382, ISSN 0169-8095, https://doi.org/10.1016/j.atmosres.2024.107382.

@BarryHLynn
Copy link
Author

I should say: I was unable to save my comments... They are now saved. Thank you for your efforts to bring this scheme to the benefit of the modeling community (and public).

@weiwangncar
Copy link
Collaborator

@BarryHLynn Please see the questions posted in PR-2276.

@BarryHLynn
Copy link
Author

I believe I answered you in the email.

@dudhia
Copy link
Collaborator

dudhia commented Jan 29, 2026

Superseded by #2276
Closing.

@dudhia dudhia closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants