During a recent webinar I demonstrated performing a design of experiments (DOE) to do a simple flight envelope study of an unmanned air vehicle (UAV). I used Ansys Fluent 13 for the CFD model for the UAV and Phoenix Integration’s ModelCenter to automate the DOE process. Tecplot Chorus was also used later to visualize results and to do some response surface modeling (RSM).
I didn’t have time in the webinar to go over much detail on how to actual run the CFD model in an automated way so this post will go over those basics. There are actually at least 2 or 3 ways to do this automation and I will only cover one approach. Suggestions on other approaches are always welcome.
Before getting into the specific steps, the overall approach will be to create a Fluent journal (or macro) that will update parameters of interest in the Fluent model. The journal will then be run in batch mode.
Step 1. Parameterize the CFD model.
First off you have to identify what key parameters or variables in the model you are going to vary otherwise there is not much point in automating it.
For my model, I wanted to vary Mach, alpha (angle of attack), and beta (side-slip angle). Then I had to map them to the format that the CFD model required. Since Fluent wanted x, y, z components of the velocity vector and the magnitude of the velocity I did some simple math to convert:
x = 1.0
y = tan(alpha*pi/180.0)
z = –1.0*tan(beta*pi/180.0)
velocity = Mach*340.0
Step 2. Create a Fluent journal file.
You next need a Fluent journal file that you can use to update the parameters and then run the CFD solution. Update your .cas file so that the solution is ready to run. All that the journal will then need to do is update the key parameters and then run the solution.
To start recording go to File > Write > Start Journal
Then interactively go through the steps of modifying the key parameters and then running the solutions.
To stop recording go to File > Write > Stop Journal
Inside the Fluent journal file you can also just use Fluent commands rather than the recorded macro scripts. The Fluent command syntax may be easier to work with for users familiar with older versions of Fluent. It’s more concise than what you see with the recorded journal and I know I can be a bit picky myself about lots of extra fluff in anything I’m scripting. In fact for the webinar I tried out both methods and ended up using just Fluent commands instead of the recorded journal syntax.
Step 3. Create a batch file.
You now need a way to run the journal file automatically. Easiest for me was to use a batch command to run it:
fluent.exe 3d -wait -i fluent.jou
This assumes you have the location of fluent.exe in your path and that the name of your journal file is fluent.jou.
You can then save this command in a batch (.bat) file to run from a Windows command prompt.
Step 4. Putting it all together.
Now you need a way to actually vary the parameters in the journal file prior to each batch run. Obviously you could do this by hand but that would be pointless. This is the part I’m going to gloss over because in the webinar I showed how to do this using PHX ModelCenter and their QuickWrap component and DOE Tool. There are other software products that would allow you to do this or you could use your favorite scripting language such as Python. In your Python script you would need logic as to how you’re going to vary the parameters (the DOE design) as well as the logic for updating the parameters in the journal file and then running the batch command.
I hope this very brief overview is helpful. I’m happy to help fill in more of the details—feel free to make a comment or ask a question.