Simulation notes

A collection of notes and tips that may be of use while working with Fluent.

Contents: Setting an initial condition | Creating an animation.

Setting an initial condition

It is often desired to start with a certain initial condition, like an initial wave in a tank. This can be done in several ways. As it took me quite a while to find it out, here is documented how it can be done. Most methods start with initializing the solution (Solve->Initialize->Initialize..., Init) and then patching a certain area (Solve->Initialize->Patch..., select the phase under Phase, choose Variable as Volume Fraction, put either 0 or 1 in the Value box, select what to patch (depends on method), and press the button Patch).


One can create different zones in Gambit. When patching in Fluent, select the desired zone in Zones to Patch.

Rectangular or circular areas

One can easily mark a rectangular or circular area using Adapt->Region.... Choose either Quad or Circle for 2D. Enter the Input Coordinates, and press Mark. In the Patch window, a new item just appeared. You can use that area to patch.

Using a function

sine_begin_condition.pngIt is often convenient to start with a sinusoidal wave as initial condition. That can be done using a custom field function (Define->Custom Field Functions...). Use the Grid X and Y coordinates to make function that is dependent on location. Make sure the function is smaller than zero where you want to patch the solution. Then use Adapt->Iso Value... to select the area. choose Custom Field Functions under Iso-Values of, and select the desired function in the box below (You can use the button Compute to see if you really get values below and above zero). Enter a positive number (higher than Max, when you pressed Compute) in the Iso-Max box, and keep Iso-Min on zero. Press the button Mark, and you'll have a new patch register in the Patch window.

Using a data-file

You can use an external program for initial conditions. I don't know how though.

Creating an animation

Fluent has a built-in method for creating simulations. This is very inconvenient, as it has to be setup everytime before running a simulation. It is mentioned below for completeness. We used another method with a scheme program.

Using custom scheme program

To simplify movie creation, a scheme program (see automation) was made that makes a movie out of a simulation. This file is called create-movie.scm and can be found in most fluent directories. It was designed for unix/linux, see portability notes inside the file for details on how to adapt it to your platform.

See complete-simulation.scm for an example on how to use it. Shortly:

  (define timestep 0.01)                 ;; time step for iterations
  (define iterations (/ 60 timestep))    ;; how many iterations to do (60 seconds real time)
  (define frame_every (/ 0.02 timestep)) ;; how many time steps per frame (50 frames per second)

  (define outputmovie "/tmp/output.avi")

  (load "create-movie.scm")

Then run the simulation, and finally run to obtain the movie:


Using standard Fluent functionality

  1. Display->Options: make sure "Double Buffering" is enabled.
  2. Define->Models->Solver: unsteady
  3. Solve->Animate->Define
    1. Increase "Animation Sequences", a new row will be enabled.
    2. Choose "Every"=1 and "When"="Time Step".
    3. Press "Define"
  4. Iterate ...
  5. Solve->Animate->Playback
    1. Play using the play button
    2. You should be able to save a movie (mpeg is easiest, but it didn't work for me; you can export images and convert them using an external tool, like ffmpeg or mencoder or, some frontend on windows).