Modeling and Analysis between 5 Newtonian Fluids in OpenFOAM - Tutorial


Computational fluid dynamics modeling with OpenFOAM could be challenging for water resources engineers since OpenFOAM models all types of fluids like water, air, heat and electromagnetism. On a normal hydrological software, it is implicit that the physical properties or the empiric formulation matches water on the liquid phase at temperatures around 20°C; however in a CDF program as OpenFOAM we have to define that the fluid we are working with is water and this increases the level of complexity on the model conceptualization and analysis.

But there is a interesting face of this complex fluid formulation in OpenFOAM: we can model any fluid, fluid type and turbulence condition; that means that we can model fluids like oil, alcohol, beer, or glycerine just with their property definition. In this tutorial we model and compare the behavior of 5 Newtonian fluids: beer, benzene, glycerine, olive oil and water. All fluids have been simulated on the same geometry and timeframe and all simulation output have been integrated in one paraView session for the comparative analysis of the fluid performance. Fluids were modeled with the interFOAM solver on turbulent conditions with the k-epsilon schema.


What it is a Newtonian fluid?

A Newtonian fluid can be defined as a fluid where its viscosity remains constant independently from the shear stress applied for a constant temperature. On a Newtonian fluid the relation in between the shear stress and rate of deformation is linear at every point. Newtonian fluids are simplest fluid to be conceptualized on a numerical model; however the non-Newtonian fluids are relatively common. The term Newtonian was adopted after Isaac Newton who was the first that used a differential equation to describe the relation between the shear strain and the shear stress for these kind of fluids.


How to define a Newtonian fluid in OpenFOAM?

In order to define a fluid in OpenFOAM there are two required parameters: density (rho) and kinematic viscosity (nu). There parameters are inserted as a C++ dictionary on constant/transportProperties from the model file system. In OpenFOAM every fluid can be defined as Newtonian or non-Newtonian on the transportModel variable, then the nu and rho variables have to be defined. An example of this setup can be seen in this extract from the transportProperties file for air and water:

    transportModel  Newtonian;
    nu              9.15e-05;
    rho             910;

    transportModel  Newtonian;
    nu              1.568e-05;
    rho             1.177;


Numerical conceptualization

There has been a progressive approach on the spatial and temporal scales to define a model capable to show the viscosity effect on fluids. Model has slow water velocity and minimal elevation difference in order to increase the impact of rate of change. The final model configuration has a length of 1m, a width of 4 cm and a height of 1 cm; grid discretization on the x-axis and z-axis is 1 cm while on the y-axis is 0.125 cm. There is a constant inflow of 0.0001 m3/s at the initial saturated part of the model. The other fluid conceptualized on this model is air at 20°C. 

Model geometry. Vertical exageration: 5x

Model geometry. Vertical exageration: 5x

Five cases have been modeled, here is a table from the fluids, densities and kinematic viscosity:






This is an animation on the entire model scale showing the fluid surface from fluids that flow from left to right. Surfaces from benzene and water (blue) have a similar behaviour and move faster, then comes the beer surface (orange), olive oil (yellow) and finally glycerine (green).

Close up of the left model corner where all fluid surface development can be seen together with the water body (blue shadow).




Input files

Download the input files for this link here.

Saul Montoya

Saul Montoya es Ingeniero Civil graduado de la Pontificia Universidad Católica del Perú en Lima con estudios de postgrado en Manejo e Ingeniería de Recursos Hídricos (Programa WAREM) de la Universidad de Stuttgart con mención en Ingeniería de Aguas Subterráneas y Hidroinformática.

Smiley face

Subscribe to our free e-newsletter for tutorials, articles, webminars, courses and more.