WRF
WRF copied to clipboard
Missing file during initialization of module_wind_mav does not raise error
Bug description During the initialization of the new Ma&Archer wind farm parametrization, even if the layout file of the wind turbines (windturbines-ll_txt) is missing, the simulation starts and executes. However, the simulation runs without including the wind turbines. No warning or errors are raised.
To Reproduce Steps to reproduce the behavior:
- WRF version: 4.6.1 (commit d66e442fccc04111067e29274c9f9eaccc3cef28)
- Use compiler and version: gfortran 11.4.0
- Use namelist options windfarm_opt = 0 , 0 , 2 , windfarm_ij = 2,
Expected behavior An error should be raised if windturbines-ll.txt is missing
Proposed solution: Include a check in initialization function of module_wind_mav to check if the file windturbine-ll.txt can be opened. Stops otherwise.
Proposed Patch:
diff --git a/phys/module_wind_mav.F b/phys/module_wind_mav.F
index ab779fda..96b1af5e 100644
--- a/phys/module_wind_mav.F
+++ b/phys/module_wind_mav.F
@@ -1826,8 +1826,17 @@ end subroutine shell_sort_1D
open(71,file='windturbines-xy.txt',form='formatted',status='old',iostat=ios)
else if (config_flags%windfarm_ij == 2) then
open(71,file='windturbines-ll.txt',form='formatted',status='old',iostat=ios)
+ else
+ write(,) 'Error: windfarm_ij = ', config_flags%windfarm_ij
+ stop
end if
-
+
+ write(,) 'Open file windturbines-ll.txt. IOSTAT =', ios
+ if (ios /= 0) then
+ write(,) 'Error: Unable to open file windturbines-ll.txt. IOSTAT =', ios
+ stop
+ end if
+
nt = 0
do
read(71, *, iostat=ios)