WRF icon indicating copy to clipboard operation
WRF copied to clipboard

windfarm_opt=1 issue with MPI

Open sael9740 opened this issue 1 year ago • 1 comments

While working with the wind farm code phys/module_wind_fitch.F I noticed that the variable stc2 variable is initialized for rank 0 but not broadcast to the other ranks:

https://github.com/wrf-model/WRF/blob/21c72141142fc6c8d203d2bf79f1990e45a0aef8/phys/module_wind_fitch.F#L506-L529

I confirmed that stc2 was not initialized correctly for the other ranks (in my case they had all zero values in this array).

Tracking this variable I found that the only place it is used is here in the dragcof routine:

https://github.com/wrf-model/WRF/blob/21c72141142fc6c8d203d2bf79f1990e45a0aef8/phys/module_wind_fitch.F#L307-L308

Therefore tkecof would end up being 0 for all ranks except for rank 0 if the condition on line 307 was met. This seems like an issue that could have easily been overlooked but I'm sure that the developer intended to broadcast stc2 after it was initialized by rank 0.

sael9740 avatar May 10 '23 21:05 sael9740

Hi sael9740,

Nice detective work! I have stumbled across this effect as well (in my case, stc2 was not set to 0 but some other random value causing my model to crash under stormy conditions. I could imagine that if it's set to 0 or no is maybe related to the compiler/compiler flags). I made a PR request about this.

Marc

MarcImberger avatar Dec 20 '23 09:12 MarcImberger