Skip to the content.

Have you ever had the problem of running a million (figuratively) CFD simulations ? I had this problem a few weeks ago. I was supposed to run a bunch of heat exchanger configurations with different speeds, temperatures and material properties. We are starting with FVM with ANSYS Fluent, but then are moving on to NEK5000. So the ANSYS workbench is not a good option. Plus I hate workbench. It can be confusing, and it deletes files for no good reason, and is rife with limitations. And it is not compatible with other solvers.

So I decided to write a journal file to create a template for changing stuff in the case file. And then use SED to replace stuff in the file, depending on what we want to run. The plan was to write a batch script to put this all together. But loops and functions are not very good in batch scripts. Enter MATLAB! (Open source buffs, read Octave!) So now I have a script and a journal file, that I edit, and it creates folders, names them, copies files to them and runs simulations in parallel. Keeping track of available memory and processing capacity, so as to never exceed 75%. Its not a software by any means, but I think its a start. And the pre-processing script creates Latex tables automatically that go in my document. Did I mention that Latex is awesome?

I have a case file called longeon13.cas, and that name shows up a lot in the scripts. So here is an explanation of files;

  1. preprocessing.m & pcase.m: pcase.m is the class that describes a CFD case. With all the properties and input parameters built in. And it can calculate non-dimensional numbers too. preprocessing.m is the script that uses pcase.m, calculates dimensionless numbers for any range of cases you want and output the result as a Latex table that goes straight into my document.

  2. longeon13.jou & longeon13.m: longeon13.jou is the journal file that can edit and run my CFD case in Fluent. Similar files can be made for NEK5000 as a .sh script. longeon13.m is the MATLAB script that runs multiple simulations, manages directories and all the rest.