Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Reason for choosing KISSVEC random number generator in RRTMG schemes (MPAS/WRF)

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
Post title: Reason for choosing KISSVEC random number generator in RRTMG schemes
Hi all,

I have a question about the choice of the default random number generator used in the RRTMG longwave and shortwave radiation scheme in both WRF and MPAS. There are two different random number generators implemented in RRTMG: The KISSVEC random number generator (RNG) and the Mersenne Twister RNG. The choice of which one to use is made within the scheme by the integer control variable “irng” in the files module_ra_rrtmg_lw.F and module_ra_rrtmg_sw.F. In MPAS 7.0 or WRF 3.9, “irng” is hard coded to 0, which automatically selects the KISSVEC RNG.

I have been investigating this in MPAS as part of a project studying the impact of wind farm wake effects and surface roughness changes on the atmosphere, which rely on 1:1 comparisons between test cases and control runs (with/without change). In these comparisons, I have seen rather large changes far away from my introduced change, and found one of the key factors in this to be related to the KISSVEC RNG. The KISSVEC RNG seeds for random number generation are effectively selected based on the pressure at the four lowest model levels (see around line 2391, similar in the shortwave radiation scheme module_ra_rrtmg_sw.F and WRF) and therefore depend on the model state. In my simulations, these pressure values change between the two runs, which means that the test case and control run will potentially use different random numbers for the stochastic cloud generator, introducing differences in the model runs solely caused by the selection of different random numbers. It is likely that this could also be related to the high sensitivity seen in WRF / MPAS simulations run on different platforms (CPUs, Compilers, and systems)

In investigating this, I found that the geos-chem model ( also uses RRTMG, but with the Mersenne Twister RNG. In MPAS, I implemented their constants and enabled the Mersenne Twister, which showed greatly reduced sensitivity of the model far from where the wind farm was introduced. This leads to my question of why WRF / MPAS is using the KISSVEC RNG and not the Mersenne Twister RNG?

Thanks a lot for your help and further clarification!

Unfortunately, the simple (and unsatisfying) answer is that MPAS seems to have inherited the choice of KISS over Mersenne twister from WRF, which in turn likely inherited this choice from CAM. I asked around our lab, and nobody seemed to have any insights as to why one PRNG over the other is being used. If in future I am able to get any clarification or insight, I'll be glad to follow-up here.

As a side note, thanks very much for an excellent post with detailed background information and a clear description of what you're seeing in the model!
First of all, thanks for the fast response! I am sure there was a good reason for choosing KISS in the first place. Nevertheless,it could be worth to mention/highlight the pressure field dependence of the RNG seeds in the RRTMG scheme as a consequence of this choice somewhere. It could be relevant information for users doing 1:1 model comparisons. One option could be a mention in the WRF/MPAS user guide or (ideally) an implementation as user option in the namelist addressing the control variable "irng". Right now, this effect is quite hidden and embedded deeply in the code. I did not perform any analysis with WRF on this topic, so I cannot comment on the effects/sensitivity there, but I could image that it might be of relevance for WRF users as well.