Blog posts Volupe

Better initializations for VOF simulations with compressed gas in Simcenter STAR-CCM+

There are multiple ways to initialize a free surface flow for the Volume of Fluid (VOF) model, many of them well-described on the Siemens Support Center portal. But what if you have a case where you want to start your simulation with the light phase (often a gas) already in a compressed state and then allow it to expand? In this week’s blog post we will give you a couple of alternatives on how to achieve a correct pressure equilibrium state for your initial field in a case with a liquid and a compressed ideal gas.

Case example: A trip to the public bath

So, when could this type of problem occur? Let’s start by imagining an everyday situation. A family is on a day trip to the public bath and the 3-year-old boy in the family has brought his favorite yellow rubber duck. Now let’s also assume that the boy is a really good swimmer and he soon decides to bring his rubber duck to the bottom of the swimming pool. Since he’s really talented, he manages to keep the duck in an upright position all throughout the swim to the bottom. The father of the family, a peculiar fluid dynamicist, sees the son playing with the duck and starts to think that it would be nice to simulate the fluids inside the duck as it is brought up to the surface again, only to impress his colleagues at work. As soon as they get home, he starts to decompose the problem.

Rubber duck

He knows that while afloat in the pool the duck is completely air filled and in atmospheric pressure equilibrium. In the bottom of the duck there’s a hole connecting the inside of the duck to the ambient conditions. As his son brings the rubber duck to the bottom of the swimming pool the air caught inside the duck will be exerted to the hydrodynamic pressure caused by the surrounding water. As a result, the air inside the duck will be compressed and if the duck is pushed deep enough, water will start to seep in. The question is; how much? The answer to this question will indicate where to initialize the free surface inside the rubber duck and also what pressure is perceived by the air while at the bottom of the pool. He starts to crunch the numbers.

The father assumes that the swimming pool is five meters deep and that the water temperature is 27°C. He also assumes that the ambient air temperature is 22°C. In the meantime he has also asked a good friend to make a CAD model of the rubber duck that he can use in the simulation.

Rubber duck in swimming pool

Using the volume mesh of the duck he is able to get an estimate of the internal volume and, more importantly, the initial volume of air inside the rubber duck at atmospheric conditions. Now, using the ideal gas law he is able to calculate the mass of air inside the rubber duck before his son brings it down to the bottom of the pool. Knowing the mass and the pressure at the bottom of the pool he is then able to get an estimate of the density (and hence the volume) of the compressed air inside the duck. This way he can also estimate the amount of water that would have entrained the duck when it is sitting at the bottom of the pool. Based on this he should get a good guess of the initial free surface level inside the rubber duck for his simulation.

Initializing the free surface and getting the density right

As mentioned earlier, there are multiple ways of initializing the free surface (i.e. the volume fraction field). After some trial and error, the father comes to the conclusion that the free surface inside the duck should be positioned at -4.9714 meters. The most obvious approach is probably to explicitly position the rubber duck five meters below the water surface (in this case the global z=0 coordinate) so that the coordinates in the simulation resonate with the real case, and so he decides to do just that.

Arguably, the simplest way of initializing a free surface in a VOF simulation in SImcenter STAR-CCM+ is to use the VOF Waves model. An advantage with the VOF Wave model is also that the inherent volume fraction field function is mesh independent, in the sense that it can assign volume fractions between 0 and 1 in each cell. This is contrary to using a user-defined field function splitting a domain by coordinates and if-statements (which is a very common approach) with either 0 or 1 for the volume fraction. The latter approach is still valid, but it will give a free surface that may deviate slightly from the splitting coordinate, since it will fill entire cells with either 0 or 1 for the volume fraction. This also means that the exact free surface position will depend on the mesh discretization using this approach.

The father soon realizes that the big challenge in this case is getting the density of the compressed ideal gas correct from the beginning, which is really a question of getting a reasonable absolute pressure field already from scratch. After some pondering, the father concludes that he has at least two options for getting close.

Option 1 – Accounting for ambient gauge pressure using VOF Wave

Acknowledging the above, the father decides to use the VOF Waves functionality for the initialization. In the case of the rubber duck, there are two free surfaces to consider; the external swimming pool free surface (which exerts a gauge pressure on the duck internals) and the internal free surface inside the duck. Note that the water that surrounds the duck will not be included in the simulation, but the effect from it needs to be taken into account. This is handled through the pressure outlet boundary, which will be described later. The father starts with creating two Flat Vof Waves (naming them Inner and Outer) for the two free surfaces to be used for the initial field.

VOF Waves

The input for the inner free surface can be seen in the picture below. The Light Fluid Density is the compressed air density given by the ideal gas law under the given conditions. Similarly, the Heavy Fluid Density is the water density at 27°C. The Point On Water Level is the coordinate where the free surface will be positioned.

Settings for Flat VOF Wave Inner

Similarly, a Flat Vof Wave is setup also for the external free surface. The input for this can be seen in the picture below. In this case the Point On Water Level is set to [0.0, 0.0, 0.0] since the swimming pool surface is thought of as the z = 0 reference.

Settings for Flat VOF Wave Outer

Now there’s a set of field functions created related to the Flat Vof Waves which are readily available to use in the simulation. One of these is the Volume Fraction of Light Fluid of Flat Vof Wave Inner. There’s one also created for the outer wave, but the inner one is the one used to initialize the free surface inside the rubber duck (see picture below).

Volume Fraction initial condition for Option 1

Another type of field function given by the VOF Waves is the Hydrostatic Pressure of Heavy Fluid of Flat Vof Wave. As implied by the name, this function automatically returns the hydrostatic pressure in the heavy fluid based on the distance from the Point On Water Level given as input to the Flat Vof Wave. A useful feature of this field function is that it will continuously adapt, should the rubber duck move in the gravitational direction (relative to the free surface). For the outlet pressure boundary, the hydrostatic field function for the outer wave is selected, as this will apply the corresponding gauge pressure reflected by a surrounding water pillar of five meters.

Pressure Outlet boundary condition for Option 1. Assigning field function for hydrostatic gauge pressure.

The final step of the initialization is to get a proper description of the initial pressure field – and this is where it gets a bit tricky. The father cannot use the hydrostatic function of the outer wave since that assumes a five-meter pillar with only water. This would give a far too high pressure inside the compressed air. Similarly, he cannot use the hydrostatic function for the inner wave, since this function assumes a 0.0286 meter (i.e. 5 – 4.9714) water pillar that doesn’t take the external gauge pressure into account. This would give a far too low pressure inside the duck. So what can he do?

The answer is to make use of both VOF Wave hydrostatic functions, but splitting them with a user-defined function using an if-statement for the z-coordinate. The key here is to give the hydrostatic pressure in the air phase an additional gauge pressure from the surrounding water, based on the free surface level inside the rubber duck. For the hydrostatic pressure in the internal water he once again makes use of the Hydrostatic Pressure of Heavy Fluid of Flat Vof Wave Outer. The final expression for the field function (given the name init_pressure) reads as follows:

init_pressure field function definition

The scalar rho_water is a scalar parameter given the value 996.54, which is the fresh water density at 27°C. The function init_pressure is then used as input in the Initial Conditions (see picture below).

Initial pressure condition

Note that init_pressure returns the so-called working (or piezometric) pressure. The absolute pressure (which is key to get the air density correct) is retrieved automatically inside Simcenter STAR-CCM+ by adding the Reference Pressure (stated under Reference Values in the physics continuum) to the static pressure. The static pressure is the piezometric pressure plus hydrostatic pressure, i.e.

Static pressure definition

The general recommendation for VOF cases is usually to set the reference density, , to the lighter phase or 0 to avoid numerical instabilities. In this case we set it to 0 to achieve

Static pressure with zero reference density

For option 1, the Reference Pressure is simply kept at the default value of 101325 Pa (or 1 atm) with the assumption that the free surface in the swimming pool is at rest in atmospheric conditions.

Reference pressure for Option 1

Option 2 – Accounting for ambient gauge pressure using reference pressure

There is an alternative way to achieve the correct absolute pressure inside the rubber duck (i.e. accounting for an external water pillar) without creating a Flat Vof Wave for the surrounding water. Recall that the absolute pressure is the sum of the static pressure and reference pressure. Knowing this, we could offset the reference pressure with the hydrostatic pressure corresponding to a five meters water pillar. Let’s have a look at how the initial field would be set up using this approach.

As in Option 1, we use the Flat Vof Wave Inner to access field functions for the volume fraction and hydrostatic pressure inside the rubber duck. Since we will use the reference pressure to model the external hydrostatic gauge pressure we do not need the Flat Vof Wave Outer anymore.

The initial volume fraction is set identical to Option 1 (see picture below).

Volume fraction initial conditions for Option 2

Since we do no longer have a wave for the surrounding water, the pressure on the outlet boundary is set using the Hydrostatic Pressure of Heavy Fluid of Flat Vof Wave Inner. Note that this (absolute) pressure is currently too low.

Pressure Outlet boundary condition for Option 2. Assigning field function for hydrostatic gauge pressure.

The same thing goes for the initial condition for the pressure.

Initial pressure condition for Option 2

Now, to get the absolute pressures (and hence the compressed air density) in Option 2 to correspond to the more “realistic” setup of Option 1, we need to apply the offset for the reference pressure. For the sake of clarity, the father creates a scalar parameter called ref_pressure, which he defines as:

ref_pressure scalar parameter definition

He then applies this parameter to the Reference Pressure:

Reference pressure Option 2

Option 1 vs. Option 2: Comparing the initial fields

Now there are two setups done with the aim of getting the compressed air density, free surface level and absolute pressure field as close to the equilibrium state as possible at the bottom of the swimming pool. So, let’s compare the two. Below are some pictures of different field functions in the mid-plane.

Volume Fraction of water - Option 1 vs. Option 2

(Piezometric) Pressure - Option 1 vs. Option 2

Absolute Pressure - Option 1 vs. Option 2

Density - Option 1 vs. Option 2

As seen in the pictures above, the two options seem to generate seemingly identical fields except for one parameter; the (piezometric) pressure field.

So, how close are these initial guesses to pressure equilibrium? The father decides to run the cases at stationary conditions for a short while to validate the initial guesses. The results are presented below with plots for some interesting parameters.

Average Free Surface Position - Option 1 vs. Option 2

Total Water Mass - Option 1 vs. Option 2

Mass Flow Outlet - Option 1 vs. Option 2

Air Density - Option 1 vs. Option 2

At first glance, it may seem as if the system is quite unstable, but looking closer at the figures the variations are extremely small. For example the average free surface displacement for Option 2 is less than 10 microns. For Option 1 it is even less, closer to 2.5 microns during the first second. Overall Option 1 appears to be closest to the equilibrium state, but based on the small variations both options would most certainly make do for most industrial applications.  As a whole, the father is satisfied with the results and feels confident that he has a good starting point for a simulation of the duck rising through the water.

I hope that this everyday example has been useful to show how you can initialize a VOF simulation with an already compressed ideal gas in Simcenter STAR-CCM+. As mentioned before, you can also find more information on VOF initialization on the Siemens Support Center portal, e.g:

What is the best way to initialize VOF simulations? (siemens.com)

How to Initialize a VOF Simulation with Multiple Free Surface Heights (siemens.com)

As always you are welcome to send in any questions to support@volupe.com.

Author

Johan Bernander

Johan Bernander, M.Sc.

support@volupe.com

+46 702 95 18 31

 

 

More blog posts

en_USEnglish