uDALES / u-dales

uDALES: large-eddy-simulation software for urban flow, dispersion and microclimate modelling
https://udales.github.io/u-dales
GNU General Public License v3.0
54 stars 18 forks source link

Run write matlab script using iexpnr from shell script. #218

Closed madDipanjan closed 2 months ago

madDipanjan commented 2 months ago

This pull request allow running write_inputs.m on terminal with a simple run command being consistent with other uDALES tool calls.

u-dales/tools/write_inputs.sh experiment/

There is no need to edit or set any variables explicitly other than setting them once inside config.sh and namoptions file inside the case directory.

Partially resolves

194

198

dc2917 commented 2 months ago

What is the intended method to set expnr if not using the bash script and only the matlab script?

Yeah, I guess this requires having expnr defined globally before write_inputs.m is run. Given that write_inputs.m is run as a script, and so runs in the global scope anyway, it doesn't seem too problematic an approach?

This does make me slightly uneasy with the error message though, suggesting that expnr should be provided as an input argument, which doesn't make sense for a script.

madDipanjan commented 2 months ago

Since we wanted the write_inputs.m script to be not being edited by general/new users (as they will be running it using the shell script), we have gone with this approach where expnr gets passed as an input argument. This is also useful for running the script entirely from terminal.

Unfortunately, while running only the write_inputs.m matlab script one needs to source the EXPDIR and TOOLS path explicitly, and then run matlab -r "expnr=; write_inputs.m". Or for entire GUI mode, one needs to edit the lines 23 - 32 in write_inputs.m as we used to do to manually set things.

samoliverowens commented 2 months ago

Ok, it's not pretty but I guess no worse than before. Just make sure to add to the documentation because I do think it is use the GUI sometimes.