sandialabs / NuMAD

Numerical Manufacturing And Design Tool (NuMAD) -- A design tool for wind and water turbine composite blades
http://numad.readthedocs.io/
Other
30 stars 19 forks source link

Potential bug in makeIECWind.m #20

Open DeepFriedDerp opened 1 year ago

DeepFriedDerp commented 1 year ago

in NuMAD/source/utilities/runIEC/makeIECWind.m, Line 10-13 if(~exist('wind','dir')) mkdir('wind'); end cd('wind')

The call to exist as it is written checks for any directory by the name of "wind" on the matlab path. If the user is running multiple batches of runIEC model simulations, then a scenario can easily arise where another model directory on the matlab path contains a "wind" subdirectory, and the necessary "wind" subdirectory is not successfully created in the target model directory.

A suggested hotfix is to replace line 10 in makeIECWind.m if(~exist('wind','dir')) with: if(~isfolder(‘wind’))

The isfolder function only looks for the directory 'wind' in the current directory, rather than scanning all directories and subdirectories on the MATLAB path, so it eliminates the chance of a false positive result within the if statement, and avoids the error outlined above.