Skip to content

Array out of bounds error in Thompson-aerosol aware scheme #2283

@csmill

Description

@csmill

In pull request #1834, the allocated middle dimensions of the lookup tables were changes from 9 to 1 for mp==8 and 28 in order to save memory when hail wasn't included (for example, the array called tmr_racg). However, On lines 2527 and onwards in module_mp_thompson.F onward, these arrays are accessed using a value of 5, which comes from idx_bg(k) which is set by idx_bg1 which is 5 when graupel is not included, leading to an out of bounds error.

This issue luckily seems not to crash the program when it is run normally, but as far as I can tell, it cannot be run in debug mode (configured with the -D option) without stopping.

Changing line 79 in module_mp_thompson.F to

      INTEGER, PARAMETER :: idx_bg1 = 1 ! index for rhog when mp=8 or 28

instead of = 5, prevents the model from crashing in debug mode.

It's fairly difficult for me to tell whether this "fix" has any unintended implications for the graupel-free versions of Thompson mp, aside from changing the value of rho_g.

I'm happy to give more details on my WRF config if needed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions