Viscosity, also called inner friction, is one of the most important parameters to describe a fluid's characteristics. With this property it is possible to simulate different fluids by simply changing a single parameter, for example alcohol, water, milk, syrup, honey, mud, or even molten glass.
An important thing you have to know with viscosity is that it is temperature-dependent: a fluid's viscosity changes with increasing or decreasing temperature. Therefore, you will also find temperature data in viscosity tables. Normally, a temperature of 20°C is used to describe a fluid's viscosity, some tables also use 25°C. So, please be careful when you collect dynamic viscosity values from different sources. In order to simulate a substance at different temperatures you do not have to enter a temperature value, of course, but look for the appropriate viscosity value instead.
When you simulate natural substances, for example honey, crude oil, or syrup, please bear in mind that all viscosity values are just averages, because these fluids are not standardized. As natural products, the amount of ingredients slightly differs, but the values you can find in the relevant tables are very good starting points and work in most cases.
How to Adjust the Viscosity Solver
First, please note that the HyViscosity solver works completely differently from the viscosity you can find in RealFlow's standard particle system (“SPH”). Neither fluid types/parameters can be compared or interact with each other. It is also not possible to control SPH fluids with the settings and options of Hybrido's viscosity implementation.
Like any other of Hybrido's components, the HyViscosity solver provides a couple of settings to control its accuracy and prevent instabilities. In order to make these settings, you have the ability to make global or local settings. Global settings are always made under RealFlow's “Preferences” panel and the values you enter there are valid for every scene – just like defaults. If you want to define values for the currently loaded scene you can do this with the “Simulation Options” panel:
All changes made here will be stored with the scene, so you do not have to repeat everything once you reopen the project. But, when you create a new project the default values from the “Preferences” section will be used again.
Under Hybrido > Viscosity Solver you can see two entries:
MAX iterations
In most cases, the default setting is sufficient, but under some circumstances it can be necessary to increase this value, for example when you see a warning message. Normally you will not see any misbehaving particles and you can proceed with the simulation. We recommend creating an OpenGL preview to see if the fluid behaves correctly.
Accuracy
This value ranges between 0 and 1. With 0, the solver will quickly find a solution, but it will not be very accurate. A value of 1, on the other hand, will find a solution that is very close to the exact behaviour, but simulation time will increase. The default value of 0.2 represents a good balance between simulation speed and accuracy.
Besides these solver-based settings there is the actual “Viscosity” parameter. This parameter can be found under the Hybrido domain's following panel:
Node Params > Fluid Dynamics > Viscosity
Here you can enter the desired value to create different substances. The table below provides several viscosity values for various substances.
Another, important parameter is “Density”. If you want to simulate highly viscous substances like chocolate or honey you can also enter the fluid's appropriate density value to get a complete material definition. Please bear in mind that it is currently not possible in Hybrido to simulate fluids with different “Density” values, for example oil and water. In most cases, this parameter can be left untouched.
Variable Viscosity in Time
RealFlow's Hybrido solver also allows you to animate the “Viscosity” parameter to achieve very interesting effects. Animating this value is a matter of just a few clicks:
Shift the timeline slider to the first frame
Enter the desired value
Right-click on the value and choose “Add key”
Shift the timeline slider to the next frame
Repeat steps 2. and 3.
If you want to work on the curve, right-click on the value again, but this time choose “Open curve...” to launch RealFlow's “Curve Editor”. Alternatively it is also possible to use an expression to describe a curve. More about animation keys and expressions can be found here.
Variable Viscosity in Space
Another, very interesting method is to change viscosity in space. This feature makes it possible to create very nice melting effects or a behaviour similar to granular fluids. You can change the fluid's viscosity in specific areas of the fluid. These zones can be defined through the location of helper objects, e.g. a sphere or any other node. Inside the object, viscosity is variable and will soften (or harden) the fluid. If you do this with an animated object you will achieve the impression of gradually melting or freezing areas.
At the moment, space-dependent viscosity can only be achieved with the help of a graph. To get you off to a good start, we have created an example scene for you. This scene is part of your RealFlow package and can be found under:
Help > Demo scenes > graphs > hybrido_space_variable_viscosity
The graph itself can be displayed and edited here:
Layout > Simulation Flow
In the left part of the “Simulation Flow” window you can see a tree structure with several graphs. Simply click on a graph's name, e.g. “Create viscosity channel” and its layout will appear in an editor. Of course, the graphs are fully annotated and explained.