Automating Fluent Setup Using Journal Files

Many users don’t realize that Fluent contains a number of ways to automate their setup process for large, complicated models.  If you have a number of repetitive tasks within the same model, or if you’re applying similar settings to different models where replacing the mesh or using a settings file is problematic (such as the case of drastically different boundary zone lists), then a Journal file might accelerate your setup process.

First, let’s cover the basics.  A journal file is essentially a collection of TUI and/or Scheme commands that you’ll supply to Fluent in lieu of using the GUI.  TUI commands are those that are native to the Text User Interface and are typically of the form “/menu1 submenu1 submenu2 …. command response1 response2 …”.  Each item in the TUI command is either answering a question from the program or choosing an item from a list, so their format is rigid and depends on the models you have enabled.  Scheme commands on the other hand often give you direct access to a particular item and can be used for advanced techniques like looping and storing variables.  Scheme commands are always surrounded by parentheses “()”, and while many of the specialized Scheme commands within Fluent are undocumented, Scheme itself is a general programming language that can be learned, like C.

The primary way to create a journal file is to manually use the TUI to set up a particular object, write down the sequence of responses that gave you what you wanted, and then modify the inputs for how you will use them in the future.  For example, let’s say you had a large number of inlets that have nothing in common (such that the Copy feature in Fluent wouldn’t be useful).  Manually using the TUI, you might find that the command to set up your 1 m/s, 350 K, 0.1 m hydraulic diameter, 23% oxygen, 77% nitrogen velocity-inlet is:

“/define boundary-conditions velocity-inlet inlet1 n n y y n 1 n 0 n 350 n n n y 5 0.1 n n 0 n 0.23”

You can then duplicate that line and modify the boundary name and input values as appropriate for other inlets, and feed it back to Fluent via a file (File > Read > Journal).  However, if you try to reuse this command in a model that doesn’t have energy enabled, a 2-equation turbulence model enabled, or the specific ordering of species that this example did, you’ll get different behavior or even an error.  This is the primary limitation with TUI commands.

However, there is another way to get the commands to setup an object for modification.  You can record a journal (File > Write > Start Journal), at which point Fluent will keep track of everything you do in the GUI to play back later using Scheme “cx-gui-do” commands.  These commands work by actually instructing the GUI to repeat what had been done previously using your mouse.  The downside here is twofold.  First, setup for a single object is now spread through several lines of code, and Scheme commands are notoriously opaque, so it may be difficult find everything you need to modify.  Second, these commands are actually controlling the GUI when replayed, so it is very easy to accidentally interact with the GUI live and disrupt the journal file.

Lastly, some more experienced users will use journal files to control the solving behavior of a model in addition to the setup.  For example, a journal file could be used to tell the model to iterate for 100 iterations, then switch to transient, and then solve for 500 time steps.  However, Fluent within Workbench doesn’t support using journals for solving.  Instead, it is recommended to use the Automatically Initialize and Modify Case tool found on the Calculation Activities branch.  This allows you to incorporate these solution commands into the case settings so that you can still have a multi-configuration Fluent run while using some of the Workbench features like Parameters and Remote Solve Manager (RSM).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s