Chapter 21: Cavitation Around a Hydrofoil

21.1. Tutorial Features

In this tutorial you will learn about:

  • Modeling flow with cavitation.

  • Using vector reduction in CFD-Post to clarify a vector plot with many arrows.

  • Importing and exporting data along a polyline.

  • Plotting computed and experimental results.

Component

Feature

Details

CFX-Pre

User Mode

General mode

Analysis Type

Steady State

Fluid Type

General Fluid

Domain Type

Single Domain

Turbulence Model

k-Epsilon

Heat Transfer

Isothermal

Multiphase

 

Boundary Conditions

Inlet (Subsonic)

Outlet (Subsonic)

Symmetry Plane

Wall: No-Slip

Wall: Free-Slip

Timestep

Physical Time Scale

CFX-Solver Manager

Restart

 
CFD-Post

Plots

Contour

Line Locator

Polyline

Slice Plane

Streamline

Vector

Other

Chart Creation

Data Export

Printing

Title/Text

Variable Details View

21.2. Overview of the Problem to Solve

This example demonstrates cavitation in the flow of water around a hydrofoil. A two-dimensional solution is obtained by modeling a thin slice of the hydrofoil and using two symmetry boundary conditions.

In this tutorial, an initial solution with no cavitation is generated to provide an accurate initial guess for a full cavitation solution, which is generated afterwards.

If this is the first tutorial you are working with, it is important to review the following topics before beginning:

21.3. Preparing the Working Directory

  1. Create a working directory.

    Ansys CFX uses a working directory as the default location for loading and saving files for a particular session or project.

  2. Download the hydrofoil.zip file here .

  3. Unzip hydrofoil.zip to your working directory.

    Ensure that the following tutorial input files are in your working directory:

    • HydrofoilExperimentalCp.csv

    • HydrofoilGrid.def

  4. Set the working directory and start CFX-Pre.

    For details, see Setting the Working Directory and Starting Ansys CFX in Stand-alone Mode.

21.4. Simulating the Hydrofoil without Cavitation

This section describes the step-by-step definition of the flow physics in CFX-Pre.

21.4.1. Defining the Case Using CFX-Pre

  1. In CFX-Pre, select File > New Case.

  2. Select General and click OK.

  3. Select File > Save Case As.

  4. Under File name, type HydrofoilIni.

  5. Click Save.

21.4.1.1. Importing the Mesh

  1. Right-click Mesh and select Import Mesh > CFX-Solver Input.

    The Import Mesh dialog box appears.

  2. Configure the following setting(s):

    Setting

    Value

    File name

    HydrofoilGrid.def

  3. Click Open.

  4. Right-click a blank area in the viewer and select Predefined Camera > View From -Z.

21.4.1.2. Loading Materials

Since this tutorial uses Water Vapour at 25 C and Water at 25 C, you need to load these materials.

  1. In the Outline tree view, right-click Materials and select Import Library Data.

    The Select Library Data to Import dialog box is displayed.

  2. Expand Water Data.

  3. Select both Water Vapour at 25 C and Water at 25 C by holding Ctrl when selecting.

  4. Click OK.

21.4.1.3. Creating the Domain

The fluid domain used for this simulation contains liquid water and water vapor. The volume fractions are initially set so that the domain is filled entirely with liquid.

  1. Edit Case Options > General in the Outline tree view and ensure that Automatic Default Domain is turned on.

    A domain named Default Domain should now appear under the Simulation > Flow Analysis 1 branch.

  2. Double-click Default Domain.

  3. Under Fluid and Particle Definitions, delete Fluid 1 and create a new fluid definition called Liquid Water.

  4. Use the   button to create another fluid named Water Vapor.

  5. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Fluid and Particle Definitions

    Liquid Water

    Fluid and Particle Definitions

    > Liquid Water

    > Material

     

     

    Water at 25 C [a]

    Fluid and Particle Definitions

    Water Vapor

    Fluid and Particle Definitions

    > Water Vapor

    > Material

     

     

    Water Vapour at 25 C [a]

    Domain Models

    > Pressure

    > Reference Pressure

     

     

    0 [atm]

    Fluid Models

    Multiphase

    > Homogeneous Model

     

    (Selected)

    Heat Transfer

    > Option

     

    Isothermal

    Heat Transfer

    > Fluid Temperature

     

    300 [K]

    Turbulence

    > Option

     

    k-Epsilon

    1. These two fluids have consistent reference enthalpies.

  6. Click OK.

21.4.1.4. Creating the Boundaries

The simulation requires inlet, outlet, wall and symmetry plane boundaries. The regions for these boundaries were imported with the grid file.

21.4.1.4.1. Inlet Boundary
  1. Create a new boundary named Inlet.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Boundary Type

    Inlet

    Location

    IN

    Boundary Details

    Mass And Momentum

    > Normal Speed

     

    16.91 [m s^-1]

    Turbulence

    > Option

     

    Intensity and Length Scale

    Turbulence

    > Fractional Intensity

     

    0.03

    Turbulence

    > Eddy Length Scale

     

    0.0076 [m]

    Fluid Values

    Boundary Conditions

    Liquid Water

    Boundary Conditions

    > Liquid Water

    > Volume Fraction

    > Volume Fraction

     

     

     

    1

    Boundary Conditions

    Water Vapor

    Boundary Conditions

    > Water Vapor

    > Volume Fraction

    > Volume Fraction

     

     

     

    0

  3. Click OK.

21.4.1.4.2. Outlet Boundary
  1. Create a new boundary named Outlet.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Boundary Type

    Outlet

    Location

    OUT

    Boundary Details

    Mass And Momentum

    > Option

     

    Static Pressure

    Mass And Momentum

    > Relative Pressure

     

    51957 [Pa]

  3. Click OK.

21.4.1.4.3. Free Slip Wall Boundary
  1. Create a new boundary named SlipWalls.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Boundary Type

    Wall

    Location

    BOT, TOP

    Boundary Details

    Mass And Momentum

    > Option

     

    Free Slip Wall

  3. Click OK.

21.4.1.4.4. Symmetry Plane Boundaries
  1. Create a new boundary named Sym1.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Boundary Type

    Symmetry

    Location

    SYM1

  3. Click OK.

  1. Create a new boundary named Sym2.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Boundary Type

    Symmetry

    Location

    SYM2

  3. Click OK.

21.4.1.5. Setting Initial Values

  1. Click Global Initialization  .

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Global Settings

    Initial Conditions

    > Cartesian Velocity Components

    > Option

     

     

    Automatic with Value

    Initial Conditions

    > Cartesian Velocity Components

    > U

     

     

    16.91 [m s^-1]

    Initial Conditions

    > Cartesian Velocity Components

    > V

     

     

    0 [m s^-1]

    Initial Conditions

    > Cartesian Velocity Components

    > W

     

     

    0 [m s^-1]

    Fluid Settings

    Fluid Specific Initialization

    Liquid Water

    Fluid Specific Initialization

    > Liquid Water

    > Initial Conditions

    > Volume Fraction

    > Option

     

     

     

     

    Automatic with Value

    Fluid Specific Initialization

    > Liquid Water

    > Initial Conditions

    > Volume Fraction

    > Volume Fraction

     

     

     

     

    1

    Fluid Specific Initialization

    Water Vapor

    Fluid Specific Initialization

    > Water Vapor

    > Initial Conditions

    > Volume Fraction

    > Option

     

     

     

     

    Automatic with Value

    Fluid Specific Initialization

    > Water Vapor

    > Initial Conditions

    > Volume Fraction

    > Volume Fraction

     

     

     

     

    0

  3. Click OK.

21.4.1.6. Setting Solver Control

  1. Click Solver Control  .

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Convergence Control

    > Max. Iterations

     

    100

    Convergence Control

    > Fluid Timescale Control

    > Timescale Control

     

     

    Physical Timescale

    Convergence Control

    > Fluid Timescale Control

    > Physical Timescale

     

     

    0.01 [s]


    Note:  For the Convergence Criteria, an RMS value of at least 1e-05 is usually required for adequate convergence, but the default value is sufficient for demonstration purposes.


  3. Click OK.

21.4.1.7. Writing the CFX-Solver Input (.def) File

  1. Click Define Run  .

  2. Configure the following setting(s):

    Setting

    Value

    File name

    HydrofoilIni.def

  3. Click Save.

    CFX-Solver Manager automatically starts and, on the Define Run dialog box, Solver Input File is set.

  4. Quit CFX-Pre, saving the simulation (.cfx) file at your discretion.

21.4.2. Obtaining the Solution using CFX-Solver Manager

While the calculations proceed, you can see residual output for various equations in both the text area and the plot area. Use the tabs to switch between different plots (for example, Momentum and Mass, Turbulence Quantities, and so on) in the plot area. You can view residual plots for the fluid and solid domains separately by editing the workspace properties.

  1. Ensure that the Define Run dialog box is displayed.

  2. Click Start Run.

    CFX-Solver runs and attempts to obtain a solution. At the end of the run, a dialog box is displayed stating that the simulation has ended.

  3. Select Post-Process Results.

  4. If using stand-alone mode, select Shut down CFX-Solver Manager.

  5. Click OK.

21.4.3. Viewing the Results Using CFD-Post

21.4.3.1. Plotting Pressure Distribution Data

In this section, you will create a plot of the pressure coefficient distribution around the hydrofoil. The data will then be exported to a file for later comparison with data from the cavitating flow case, which will be run later in this tutorial.

  1. Right-click a blank area in the viewer and select Predefined Camera > View From -Z.

  2. Insert a new plane named Slice.

  3. Configure the following setting(s):

    Tab

    Setting

    Value

    Geometry

    Definition

    > Method

     

    XY Plane

    Definition

    > Z

     

    5e-5 [m]

    Render

    Show Faces

    (Cleared)

  4. Click Apply.

  5. Create a new polyline named Foil by selecting Insert > Location > Polyline from the main menu.

  6. Configure the following setting(s):

    Tab

    Setting

    Value

    Geometry

    Method

    Boundary Intersection

    Boundary List

    Default Domain Default

    Intersect With

    Slice

  7. Click Apply.

    Zoom in on the center of the hydrofoil (near the cavity) to confirm the polyline wraps around the hydrofoil.

  8. Define the following expressions, remembering to click Apply after entering each definition:

    Name

    Definition

    PCoef

    (Pressure-51957[Pa])/(0.5*996.2[kg m^-3]*16.91[m s^-1]^2)

    FoilChord

    (X-minVal(X)@Foil)/(maxVal(X)@Foil-minVal(X)@Foil) [a]

    1. This creates a normalized chord, measured in the X direction, ranging from 0 at the leading edge to 1 at the trailing edge of the hydrofoil.

  9. Create a new variable named Pressure Coefficient.

  10. Configure the following setting(s):

    Setting

    Value

    Method

    Expression

    Scalar

    (Selected)

    Expression

    PCoef

  11. Click Apply.

  12. Create a new variable named Chord.

  13. Configure the following setting(s):

    Setting

    Value

    Method

    Expression

    Scalar

    (Selected)

    Expression

    FoilChord

  14. Click Apply.


    Note:  Although the variables that were just created are only needed at points along the polyline, they exist throughout the domain.


Now that the variables Chord and Pressure Coefficient exist, they can be associated with the previously defined polyline (the locator) to form a chart line. This chart line will be added to the chart object, which is created next.

  1. Select Insert > Chart from the main menu.

  2. Set the name to Pressure Coefficient Distribution.

  3. Configure the following setting(s):

    Tab

    Setting

    Value

    General

    Title

    Pressure Coefficient Distribution

    Data Series

    Name

    Solver Cp

    Location

    Foil

    X Axis

    Data Selection

    > Variable

     

    Chord

    Axis Range

    > Determine ranges automatically

     

    (Cleared)

    Axis Range

    > Min

     

    0

    Axis Range

    > Max

     

    1

    Axis Labels

    > Use data for axis labels

     

    (Cleared)

    Axis Labels

    > Custom Label

     

    Normalized Chord Position

    Y Axis

    Data Selection

    > Variable

     

    Pressure Coefficient

    Axis Range

    > Determine Ranges Automatically

     

    (Cleared)

    Axis Range

    > Min

     

    -0.5

    Axis Range

    > Max

     

    0.4

    Axis Range

    > Invert Axis

     

    (Selected)

    Axis Labels

    > Use data for axis labels

     

    (Cleared)

    Axis Labels

    > Custom Label

     

    Pressure Coefficient

  4. Click Apply.

  5. The chart appears in the Chart Viewer.

21.4.3.2. Exporting Pressure Distribution Data

You will now export the chord and pressure coefficient data along the polyline. This data will be imported and used in a chart later in this tutorial for comparison with the results for when cavitation is present.

  1. Select File > Export > Export.

    The Export dialog box appears

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Options

    File

    NoCavCpData.csv

    Locations

    Foil

    Export Geometry Information

    (Selected) [a]

    Select Variables

    Chord, Pressure Coefficient

    1. This causes X, Y, Z data to be included in the export file.

  3. Click Save.

    The file NoCavCpData.csv will be written in the working directory.

21.4.3.3. Saving the Postprocessing State

If you are running CFD-Post in stand-alone mode, you will need to save the postprocessing state for use later in this tutorial, as follows:

  1. Select File > Save State As.

  2. Under File name type Cp_plot, then click Save.

In the next part of this tutorial, the solver will be run with cavitation turned on. Similar postprocessing follows, and the effect of cavitation on the pressure distribution around the hydrofoil will be illustrated in a chart.

21.5. Simulating the Hydrofoil with Cavitation

Earlier in this tutorial, you ran a simulation without cavitation. The solution from that simulation will serve as a starting point for the next simulation, which involves cavitation.

21.5.1. Defining the Case Using CFX-Pre

  1. Ensure that the following tutorial input file is in your working directory:

    • HydrofoilIni_001.res

  2. Set the working directory and start CFX-Pre if it is not already running.

    For details, see Setting the Working Directory and Starting Ansys CFX in Stand-alone Mode.

  3. Select File > Open Case.

  4. Select HydrofoilIni_001.res and click Open.

  5. Save the case as Hydrofoil.cfx.

21.5.1.1. Adding Cavitation

  1. Double-click Default Domain in the Outline tree view.

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Fluid Pair Models

    Fluid Pairs

    > Liquid Water | Water Vapor

    > Mass Transfer

    > Option

     

     

     

    Cavitation

    Fluid Pairs

    > Liquid Water | Water Vapor

    > Mass Transfer

    > Cavitation

    > Saturation Pressure

     

     

     

     

    (Selected)

    Fluid Pairs

    > Liquid Water | Water Vapor

    > Mass Transfer

    > Cavitation

    > Saturation Pressure

    > Saturation Pressure

     

     

     

     

     

    3574 [Pa] [a]

    1. Saturation pressure can also be set by creating homogeneous binary mixtures, which are not used in this tutorial.

  3. Click OK.

21.5.1.2. Modifying Solver Control

  1. Click Solver Control  .

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Basic Settings

    Convergence Control

    > Max. Iterations

     

    150 [a]

    1. This allows up to 150 further iterations, when run as a restart.

  3. Click OK.

21.5.1.3. Modifying Execution Control

  1. Click Execution Control  .

  2. Configure the following setting(s):

    Tab

    Setting

    Value

    Run Definition

    Input File Settings

    > Solver Input File

     

    Hydrofoil.def [a]

    1. You do not need to set the full path unless you are saving the solver file somewhere other than the working directory.

  3. Confirm that the rest of the execution control settings are set appropriately.

  4. Click OK.

21.5.1.4. Writing the CFX-Solver Input (.def) File

  1. Click Define Run  .

    CFX-Solver Manager automatically starts and, on the Define Run dialog box, Solver Input File and the execution control settings are set.

  2. If using stand-alone mode, quit CFX-Pre, saving the simulation (.cfx) file at your discretion.

21.5.2. Obtaining the Solution using CFX-Solver Manager

  1. Ensure the Define Run dialog box is displayed.

    Solver Input File should be set to Hydrofoil.def.

  2. Configure the following setting(s) for the initial values file:

    Tab

    Setting

    Value

    Initial Values

    Initial Values Specification

    Selected

    Initial Values Specification

    > Initial Values

     

    Initial Values 1

    Initial Values Specification

    > Initial Values

    > Initial Values 1 Settings

    > File Name [a]

     

     

     

    HydrofoilIni_001.res

    1. Click Browse   and select the file from the working directory.

    This is the solution from the starting-point run.

  3. Click Start Run.

    CFX-Solver runs and attempts to obtain a solution. At the end of the run, a dialog box is displayed stating that the simulation has ended.

  4. Select Post-Process Results.

  5. If using stand-alone mode, select Shut down CFX-Solver Manager.

  6. Click OK.

21.5.3. Viewing the Results Using CFD-Post

You will restore the state file saved earlier in this tutorial while preventing the first solution (which has no cavitation) from loading. This will cause the plot of pressure distribution to use data from the currently loaded solution (which has cavitation). Data from the first solution will be added to the chart object by importing NoCavCpData.csv (the file that was exported earlier). A file containing experimental data will also be imported and added to the plot. The resulting chart will show all three sets of data (solver data with cavitation, solver data without cavitation, and experimental data).


Note:  The experimental data is provided in HydrofoilExperimentalCp.csv which must be in your working directory before proceeding with this part of the tutorial.



Note:  If using Ansys Workbench, CFD-Post will already be in the state in which you left it in the first part of this tutorial. In this case, proceed to step 5 below.


  1. Select File > Load State.

  2. Clear Load results.

  3. Select Cp_plot.cst.

  4. Click Open.

  5. Click the Chart Viewer tab.

  6. Edit Report > Pressure Coefficient Distribution.

  7. Click the Data Series tab.

  8. Configure the following setting(s):

    Tab

    Setting

    Value

    Data Series

    Name

    Solver Cp - with cavitation

    This reflects the fact that the user-defined variable Pressure Coefficient is now based on the current results.

  9. Click Apply.

    You will now add the chart line from the first simulation.

  10. Create a new polyline named NoCavCpPolyline.

  11. Configure the following setting(s):

    Tab

    Setting

    Value

    Geometry

    File

    NoCavCpData.csv

  12. Click Apply.

    The data in the file is used to create a polyline with values of Pressure Coefficient and Chord stored at each point on it.

  13. Edit Report > Pressure Coefficient Distribution.

  14. Click the Data Series tab.

  15. Click New  .

  16. Select Series 2 from the list box.

  17. Configure the following setting(s):

    Tab

    Setting

    Value

    Data Series

    Name

    Solver Cp - no cavitation

    Location

    NoCavCpPolyline

    Custom Data Selection

    (Selected)

    X Axis

    > Variable

     

    Chord on NoCavCpPolyline

    Y Axis

    > Variable

     

    Pressure Coefficient on NoCavCpPolyline

  18. Click Apply.

    The chart line (containing data from the first solution) is created, added to the chart object, and displayed in the Chart Viewer.

    You will now add a chart line to show experimental results.

  19. Click New  .

  20. Configure the following setting(s):

    Tab

    Setting

    Value

    Data Series

    Name

    Experimental Cp - with cavitation

    Data Source

    > File

     

    (Selected)

    Data Source

    > File

     

    HydrofoilExperimentalCp.csv

    Line Display

    Line Display

    > Line Style

     

    Automatic

    Line Display

    > Symbols

     

    Rectangle

  21. Click Apply.

    The chart line (containing experimental data) is created, added to the chart object, and displayed in the Chart Viewer.

  22. If you want to save an image of the chart, select File > Save Picture from the main menu while the Chart Viewer is displayed. This will enable you to save the chart to an image file.

  23. When you are finished, close CFD-Post.