Fluent automation

It is often required to do certain tasks over and over again. It becomes boring and time-consuming very soon, so a solution has to be found. Fluent offers journals and scheme programming to overcome this. Neither has good documentation, but the former is integrated into the user interface and can be used very easily. The latter has much more flexibility however.

Most information was obtained from automation links mentioned in the simulation link page, and trying out on Fluent. This page assumes a basic knowledge of scheme and it's use in Fluent.

To start Fluent with a specific setup, but without starting the simulation run, remove the line that contains (do-simulation) at the end of complete-simulation.scm. You can then start fluent and experiment a bit before running the simulation. Remember: when runsim.pl is not present, you can start it by executing from the directory with the fluent files:

    fluent 2d -i complete-simulation.scm

Why this complication?

You may wonder why all those scheme programs are used. I don't like to do repetitive tasks, that's what computers are for. When creating a new mesh for simulations, all settings had to be entered manually again. GUI journals can be used, but aren't really human-readable. And when a small thing changes, everything has to be redone.

With this automation, one can easily modify mesh-parameters (using Gambit journals) and run simulations on slightly different meshes for investigating design changes. For example: grid convergence (different grid sizes), and water jet with different angles.

Some notes on the implementation

A general remark: I wanted to get result as fasts as possible, not write maintainable and readable code, sorry :( I hope these comments can help you on the way, but I fear that you really need to understand it before use.

Movie creation

As explained in animation, the standard Fluent movie creation facility is terrible. Also, I encountered a (palette-related) bug when using overlays to show multiple graphs on top of each other. That's why the movie creation program got somewhat more complicated than strictly needed.

At every timestep, the scheme function disp-save is called. It first calls disp for showing the contour-plot (pressure, velocity, etc.). It saves the output to a file. Then it calls disp-phase-boundary and pastes it on top of the contour-plot. So we get a contour-plot with a visible water-air boundary. It then is saved for later. At the end of the simulation movie-finish can be called to create the final movie of these images.

The size of the output movie is dependent on the size of the window (window 0 usually). As a simulation with a certain geometry usually needs a certain, sensible window size, sometimes in the scheme code a command cx-graphics-layout is called. This sets the window size. To set it, use "File-> Save Layout" and copy the first line of the file ~/.cxlayout (unix).
Not only that, also the font size is dependent on the window size, in an unspecified way. That's why the movie creation program needs to know some dimensions, see comments in create-movie.scm.