Application Note: Time Travel
Engineers often find themselves wondering how long fluid has been in a particular location in their models. For example, hydraulics engineers frequently design collection tanks that require that fluid spend a certain minimum time in the tank in order for some process such as water purification to take place.
In version 8.0, a new variable name "Residence Time" was added that
tracks the amount of time fluid has spent in the model. Initializing a scalar
in the domain to 0.0 (the default) and setting iresdt to the index of that scalar
activates Residence Time. Then a zero default value for sclbc on incoming flow
boundaries will initialize the residence time of incoming fluid to zero. Since
scalar quantities are advected with the fluid, adding the time-step size to this
scalar at each time step gives the time each fluid particle has been in the computational
An example of this provided in the two images shown here. In the first images, incoming flow at the left boundary streams across the top of liquid in a compartment with little mixing, resulting a long residence time (red color) for liquid in the compartment. In the second image a baffle induces some mixing, however, two recirculation regions develop where the residence time is still high.
Other types of time intervals can be modeling in a similar way. For instance, instead of the elapsed time, the time at which a fluid particle enters the computational region could be assigned to the scalar. Scalar agents can also record the time that a computational element in a filling simulation is half filled, which gives a convenient way to make three-dimensional plots of the free-surface configuration at any time during filling (see ifill1 and ifill2 in scalar input).
Time travel is fun and easy when you make use of the customizing that can be done with scalar variables. Have a good trip.