You are on page 1of 30

Tank Flushing

1. Introduction
This workshop teaches skills in the use of multiphase modeling, transient flow modeling, generating
images, and preparing animations.

Skills you will learn include:

• Setting up a 2-phase simulation

• Using tools (Patch) to control initialization

• Preparing a transient animation

• Using Solution Controls to modify the problem definition (turn off the valve)

2. Prerequisites
This tutorial assumes that you are already familiar with the ANSYS Workbench interface and its project
workflow. This tutorial also assumes that you have completed the first workshop and that you are famil-
iar with the ANSYS Fluent tree and ribbon structure. Some steps in the setup and solution procedure
will not be shown explicitly.

3. Problem Description
In this workshop, you will model the filling and emptying of a water tank. The transient problem is
solved as a multiphase (air/water) simulation, using the volume of fluid (VOF) multiphase model.

An initial water level is set in the tank. The water supply is turned on for the first second of the simulation
and then shut off for the rest of the simulation. The water level rises until water flows out the U-tube,
generating a siphoning effect, which effectively empties the tank.

4. Setup and Solution


4.1. Starting Fluent and Loading a Mesh
1. Copy the file tankflush.msh.gz to your working folder.

2. Start ANSYS Fluent.

Note

This workshop shows how to set up the simulation in standalone Fluent. You can also
set up the simulation in Workbench as shown in the other workshops.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 1
Tank Flushing

3. In the Fluent Launcher dialog box, select 3D under Dimension.

4. Enable Double Precision under Options.

5. Ensure that Display Mesh After Reading is enabled under Display Options.

6. Click OK to open ANSYS Fluent.

Note

IF HPC licenses are available, you can select Parallel under Processing Options and
enter the number of processes.

7. Load the mesh, tankflush.msh.gz.

File → Read → Mesh...

4.2. Setting Up Domain


1. Scale the mesh.

Setting Up Domain → Mesh → Transform → Scale...

a. In the Scale Mesh dialog box, select cm from the Mesh Was Created In drop-down list.

b. Select cm from the View Length Unit In drop-down list.

c. Click Scale.

d. Close the Scale Mesh dialog box.

2. Check the mesh.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
2 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

Setting Up Domain → Mesh → Check

Note

Ensure that the minimum volume is not negative as ANSYS Fluent cannot begin a calcu-
lation when this is the case.

3. Orient the view.

Viewing → Display → Views...

a. In the Views dialog box, select front from the list of Views.

b. Click Apply.

c. Click Auto Scale and then close the Views dialog box.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 3
Tank Flushing

Note

The view can also be oriented by clicking on the +Z axis on the triad, in the lower right

corner of the graphics window. Then click the Fit to Window icon in the graphics
toolbar.

4.3. Setting Up Physics


In the steps that follow, you will select a solver and specify physical models, material properties, and
zone conditions for your simulation using the Setting Up Physics ribbon tab.

1. In the Solver group of the Setting Up Physics ribbon tab, select Transient from the Time group.

Setting Up Physics → Solver

2. Enable the realizable - turbulence model.

Setting Up Physics → Models → Viscous...

a. In the Viscous Model dialog box, select k-epsilon from the Model list.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
4 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

b. Select Realizable from the k-epsilon Model group.

c. Retain the other default settings, and click OK to accept the model and close the Viscous Model
dialog box.

3. Enable the Volume of Fluid multiphase model.

Setting Up Physics → Models → Multiphase...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 5
Tank Flushing

a. In the Multiphase Model dialog box, select Volume of Fluid from the Model list.

b. Ensure that Number of Eulerian Phases is set to 2.

c. Ensure that Explicit is selected from the Formulation group box under Volume Fraction Parameters.

d. In the Interface Modeling group box, ensure that the Type is set to Sharp.

Note

In some applications, sharp resolution of the interface might not be necessary in


all fluid zones. In such cases, using Dispersed Interface Modeling or a combination
of Sharp and Dispersed modeling, can help to make the simulation more robust.
In this application though, you want to achieve sharp resolution of the air-water
interfaces, so choose Sharp under Interface Modeling.

e. Enable Implicit Body Force from the Body Force Formulation group box.

f. Click OK to set and close the Multiphase Model dialog box.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
6 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

4. Add water to the list of materials.

Setting Up Physics → Materials → Create/Edit...

a. In the Create/Edit Materials dialog box, click Fluent Database....

i. From the list of Fluent Fluid Materials, select water-liquid (h2o<l>).

ii. Click Copy and then Close.

b. Close the Create/Edit Materials dialog box.

5. Define the phases.

Setting Up Physics → Phases → List/Show All...

a. In the Phases dialog box, select phase-1 - Primary Phase and click Edit....

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 7
Tank Flushing

i. In the Primary Phase dialog box, select water-liquid from the Phase Material drop-down list.

ii. Enter water for Name.

iii. Click OK to set and close the Primary Phase dialog box.

b. In the Phases dialog box, select phase-2 - Secondary Phase and click Edit....

i. In the Secondary Phase dialog box, enter air for Name.

ii. Ensure that air is selected from the Phase Material drop-down list.

iii. Click OK to set and close the Secondary Phase dialog box.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
8 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

c. Click Interaction... to define phase interactions.

i. In the Phase Interaction dialog box, click the Surface Tension tab.

ii. In the Surface Tension tab, enable Surface Tension Force Modeling.

iii. Select constant under the Surface Tension Coefficients (n/m) drop-down list.

iv. Enter 0.072 for Surface Tension Coefficients (n/m).

v. Click OK to set and close the Phase Interaction dialog box.

d. Close the Phases dialog box.

6. Set the operating conditions.

Setting Up Physics → Solver → Operating Conditions...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 9
Tank Flushing

a. In the Operating Conditions dialog box, enable Gravity.

b. In the Gravitational Acceleration group, enter -9.81 for Y (m/s2).

c. Enable Specified Operating Density in the Variable-Density Parameters group box.

d. Retain the default value of 1.225 for Operating Density (kg/m3).

Note

The operating density should be set to the density of the lightest fluid in the domain
when using the VOF model, or else an erroneous hydrostatic pressure distribution
will occur.

e. Click OK to close the Operating Conditions dialog box.

7. Set the boundary conditions from the tree.

a. Set the boundary condition for the inlet mixture phase from the tree.

Setup → Boundary Conditions → inlet (mass-flow-inlet) Edit...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
10 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

i. In the Mass-Flow Inlet dialog box, select Normal to Boundary from the Direction Specification
Method drop down list.

ii. In the Turbulence group, from the Specification Method drop-down list, select Intensity and
Hydraulic Diameter.

iii. Retain the default of 5 for Turbulent Intensity.

iv. Enter 2.1 for Hydraulic Diameter (cm).

v. Click OK to close the Mass-Flow Inlet dialog box.

b. Set the boundary condition for the inlet water phase, from the tree.

Setup → Boundary Conditions → inlet (mass-flow-inlet) → water Edit...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 11
Tank Flushing

i. In the Mass-Flow Inlet dialog box, retain the selection of Mass Flow Rate from the Mass Flow
Specification Method drop down list.

ii. Enter 0.2 for Mass Flow Rate (kg/s).

iii. Click OK to close the Mass-Flow Inlet dialog box.

c. Similarly, set the Mass Flow Rate for inlet air phase to 0.

Setup → Boundary Conditions → inlet (mass-flow-inlet) → air Edit...

d. Set the boundary condition for the outlet mixture phase from the tree.

Setup → Boundary Conditions → outlet (pressure-outlet) Edit...

i. In the Turbulence group, from the Specification Method drop-down list, select Intensity and
Hydraulic Diameter.

ii. Retain the default of 5 for Turbulent Intensity.

iii. Enter 12.5 for Backflow Hydraulic Diameter (cm).

iv. Click OK to close the Pressure Outlet dialog box.

e. Set the boundary condition for the outlet air phase from the tree.

Setup → Boundary Conditions → outlet (pressure-outlet) → air Edit...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
12 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

i. Enter 1 for Backflow Volume Fraction in the Multiphase tab.

ii. Click OK to close the Pressure Outlet dialog box.

f. Copy the outlet boundary conditions to ambient.

Setup → Boundary Conditions → outlet (pressure-outlet) Copy...

i. In the Copy Conditions dialog box, retain the selection of outlet from the From Boundary
Zone list.

ii. Retain selection of mixture from the Phase drop-down list.

iii. Select ambient from the To Boundary Zones list.

iv. Click Copy.

Note

Click OK in the Question dialog box to confirm.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 13
Tank Flushing

v. Select air from the Phase drop-down list.

vi. Ensure that ambient is selected from the To Boundary Zones list, and click Copy.

Note

The Copy Conditions dialog box is a quick way of transferring common settings
from one boundary to another. To Boundary Zones automatically displays
boundaries of the same type as the From Boundary Zone selection.

vii. Close the Copy Conditions dialog box.

4.4. Solving
In the steps that follow, you will set up and run the calculation using the Solving ribbon tab.

1. Define the solution methods.

Solving → Solution → Methods...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
14 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

a. In the Solution Methods task page, select PISO from the Scheme drop-down list in the Pressure-
Velocity Coupling group.

b. Retain the default settings for the rest.

2. Set the under-relaxation factors.

Solving → Controls → Controls...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 15
Tank Flushing

a. In the Solution Controls task page, enter 0.3 for Momentum in the Under-Relaxation Factors
group.

b. Enter 0.5 for Turbulent Kinetic Energy and Turbulent Dissipation Rate.

3. Initialize the flow field using the Initialization group of the Solving ribbon tab.

Solving → Initialization → Options...

This opens the Solution Initialization task page.

Note

Initially, the tank is filled to a level of 6 cm with water. Here you will first initialize the
flow solution, then create an adaption register and use the register to define the initial
location of the liquid surface.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
16 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

a. In the Solution Initialization task page, retain the default selection of Standard from the Initializ-
ation Methods group box.

b. Select inlet from the Compute from drop-down lists.

c. Enter 1 for air Volume Fraction in the Initial Values group.

d. Click Initialize.

Note

This will instruct the solver to fill the tank with air. The next step is to partially fill the
tank with water, resulting in the proper initial condition.

4. Define the region of the domain to be filled with liquid.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 17
Tank Flushing

Setting Up Domain → Adapt → Mark/Adapt Cells → Region...

a. In the Region Adaption dialog box, enter -2.8 and 30 for X min (cm) and X Max (cm), respectively,
in the group of Input Coordinates.

b. Enter -1 and 6 for Y min (cm) and Y Max (cm), respectively.

c. Enter -1 and 1 for Z min (cm) and Z Max (cm), respectively.

d. Click Mark.

Note

A message appears in the Fluent console informing you that 3716 cells have been
marked.

e. To view the marked cells, click Manage....

i. In the Manage Adaption Registers dialog box, select hexahedron-r0 from the list of Registers.

ii. Click Options....

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
18 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

A. In the Adaption Display Options dialog box, enable Draw Mesh and Filled under Options.

B. Enable Wireframe in the Refine and Coarsen group boxes.

C. Click OK.

iii. In the Manage Adaption Registers dialog box, click Display.

The marked cells will be displayed in the graphics window, showing the liquid distribution
at time = 0.

Note

You may need to zoom in (use the Fit to Window icon ) because the
mesh was scaled since it was first displayed.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 19
Tank Flushing

iv. Close the Manage Adaption Registers and the Mesh Display dialog box.

f. Close the Region Adaption dialog box.

5. Patch the initial solution into the adaption register.

Solving → Initialization → Patch...

a. In the Patch dialog box, select air from the Phase drop-down list.

b. Select Volume Fraction from the Variable list.

Note

The specialized Volume Fraction Patch Options are not necessary for this problem.

c. Retain 0 for Value.

d. Select hexahedron-r0 from the list of Registers to Patch.

e. Click Patch and close the Patch dialog box.

6. Check the initial contours.

Postprocessing → Graphics → Contours → Edit...

a. To add a new graphics window to display the contours, right-click the existing tab at the top of the
graphics window and select New Window.

b. In the Contours dialog box, enable Filled.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
20 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

c. Select Phases... and Volume Fraction from the Contours of drop-down lists.

Note

In multiphase problems, it is recommended to display contours of volume fraction


to confirm the correct initial condition before beginning to iterate.

d. Retain the selection of water from the Phase drop-down list.

e. Select sym1 from the list of Surfaces.

f. Click Display.

7. Change the display colors and lighting.

Viewing → Graphics → Colormap...

a. In the Colormap dialog box, enter 10 for Colormap Size.

b. Select gray from the Currently Defined drop-down list.

c. Click Apply.

d. Close the Colormap dialog box.

e. Disable lighting.

Viewing → Display → Lighting

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 21
Tank Flushing

8. Close the Contours dialog box.

9. Define calculation activities.

In this step you will define activities that Fluent will perform during the calculation. These activities
are as follows:

• To autosave case and data files.

• To turn off the supply of water after t = 1 second. (Mass flow rate boundary condition will be
changed to zero).

a. Autosave case and data files.

Solving → Activities → Autosave...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
22 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

i. In the Autosave dialog box, enter 25 for Save Data File Every (Time Steps).

ii. Enter tankflush.gz for File Name.

Note

The File Name entry only appears in standalone Fluent. If you are using
Workbench, it uses its own internal naming convention.

iii. Retain the selection of time-step from the Append File Name with drop-down list.

Note

Including .gz in the file name tells Fluent to compress the data files produced
by Autosave. The time-step will be appended to the file name such that the
resulting names will be tankflush-0025.dat.gz, tankflush-
0050.dat.gz, and so on.

iv. Click OK to set and close the Autosave dialog box.

b. Define a command to modify the boundary condition after 1 second.

Solving → Activities → Create → Execute Commands

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 23
Tank Flushing

i. In the Execute Commands dialog box, enter 1 for Defined Commands.

ii. Enable Active for command-1.

iii. Enter 100 under Every for command-1.

iv. Select Time Step from the When drop-down list for command-1.

v. Enter define boundary-conditions mass-flow-inlet inlet water yes no


0 for Command.

vi. Click OK.

c. Add an animation sequence to save images every other timestep.

Solving → Activities → Create → Solution Animations

i. In the Solution Animation dialog box, enter 1 for Animation Sequence.

ii. Enter 2 for Every.

iii. Select Time Step from the When drop-down list.

iv. Click Define... to open the Animation Sequence dialog box.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
24 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

A. In the Animation Sequence dialog box, enter 2 for Window and click Set next to it.

B. Select Contours from the Display Type list.

I. In the Contours dialog box that opens, ensure that Filled is enabled.

II. Ensure that Phases... and Volume Fraction are selected from the Contours of drop-
down lists.

III. Select air from the Phase drop-down list.

IV. Select sym1 from the list of Surfaces.

V. Click Display and close the Contours dialog box.

C. Click OK to close the Animation Sequence dialog box.

v. Click OK to close the Solution Animation dialog box.

10. Edit the residuals monitor.

Solving → Reports → Residuals...

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 25
Tank Flushing

a. In the Residual Monitors dialog box, enter 100 for Iterations to Plot.

Note

This will make the residuals scroll across the plot, making it easier to see the current
time step.

b. Click OK to close the Residual Monitors dialog box.

11. Save the case and data files to your working folder (tank-flush-init.cas/dat.gz).

File → Write → Case & Data...

Note

For multiphase problems, saving files with the initial condition is good practice because
if something goes wrong and you need to restart, you can skip the patching step and
just reload the initial data file.

12. Start the calculation.

Solving → Run Calculation

a. In the Run Calculation task page, enter 0.01 for Time Step Size (s).

b. Enter 350 for No. of Time Steps.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
26 of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution

c. Click Calculate.

Note

Do not click on any option in the Calculate dialog box that appears.

4.5. Displaying Results in ANSYS Fluent


1. Check the animation.

Postprocessing → Animation → Solution Playback...

a. In the Playback dialog box, click the play button to review the animation.

b. You can select MPEG from the Write/Record drop-down list and click Write to save the animation.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 27
Tank Flushing

The Animation Playback tool can also be used to generate a sequence of picture frames.

Note

If you are running Fluent in Workbench, the .mpeg file from the animation sequence
is written in the Workbench project directory.

a. To locate the file in Workbench, select Files in the Workbench View menu.

View → Files

b. Locate the file sequence-1.mpeg in the list of Files.

c. Right-click on sequence-1.mpeg and select Open Containing Folder from the


context menu.

d. The folder which opens shows the file sequence-1.mpeg. The .mpeg file can be
played in Windows Media Player or similar programs.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
28 of ANSYS, Inc. and its subsidiaries and affiliates.
Further Improvements

c. Close the Playback dialog box after checking the animation.

2. Exit Fluent.

File → Close Fluent

5. Summary
In this workshop you were interested in how long it would take to completely empty the tank. This
workshop has shown the basic steps that are applied in VOF simulations, which are:

• Defining phases and phase interaction.

• Setting boundary conditions per phase and solver settings.

• Running a transient simulation while writing intermediate data files and animation data.

• Post-processing the results.

6. Further Improvements
There are many ways the simulation in this tutorial could be extended. You will first reload the saved
initial case and data files.

• Switching to different discretization schemes for the volume fraction.

Solving → Solution → Methods...

You can use Compressive or Modified HRIC

• Modifying the time step size.

– Reduce the Time Step Size by a factor of 2 or 5.

Solving → Run Calculation

– In the Run Calculation task page, select Variable from Time Stepping Method. This will ensure that the
Time Step Size corresponds to a predetermined value for the Global Courant Number in the region of
the phase interface. (Click Settings... under Time Stepping Method. )

Note

Courant number of 2 means that the phase interface is passing only two cells per time
step.

• If HPC licenses are available, try running the calculation using different numbers of parallel processes and
compare the solution time.

Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 29
Release 17.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
30 of ANSYS, Inc. and its subsidiaries and affiliates.

You might also like