Transonic flow over the RAE 2822 airfoil using the CLI

A 2D RANS case run from the command line with a packaged input file; results read in ParaView

Run a RAE 2822 transonic airfoil analysis with Wake CFD Solver from the CLI and compare surface pressure with AGARD Case 6 data.

This tutorial includes:

Tutorial features

This tutorial uses the command-line solver: you read and edit the input file in a text editor, run wake_2d_mixed in a terminal, and open the results in ParaView. Wake CFD Desktop is not used.

In this tutorial you will learn about:

  • running a steady 2D compressible RANS case from a single input file,
  • the few settings a transonic case needs beyond the solver defaults (a slope limiter, an adaptive CFL),
  • stopping a run when the lift and drag have settled instead of after a fixed number of iterations,
  • opening the flow field and the airfoil surface in ParaView and plotting the surface pressure against wind-tunnel data.
Component Feature Details
Interface Command line wake_2d_mixed with an input file (deck); --validate before the run
Input file Analysis 2D, steady
Flow model Navier–Stokes, compressible, Spalart–Allmaras turbulence model
Material Ideal gas, constant viscosity chosen for the Reynolds number
Boundary conditions No-slip wall (airfoil), farfield
Numerical method Density-based solver defaults + Venkatakrishnan–Wang limiter
Run control Adaptive CFL, monitor-based stop (CL, CD)
Outputs Volume field, airfoil surface, force history
ParaView Views Mesh, Mach number contour
Charts Residual and lift history, surface pressure coefficient against experiment

Overview of the problem to solve

The RAE 2822 is a supercritical airfoil section. At the conditions of AGARD AR-138 Case 6 the flow over the upper surface accelerates past the speed of sound and returns to subsonic speed through a shock wave at about 55 % of the chord. The case is a standard check for transonic RANS solvers because the shock position depends on the turbulence model, the numerical dissipation and the wall resolution together.

Quantity Value
Freestream Mach number 0.729
Angle of attack 2.31°
Reynolds number (chord) \(6.5 \times 10^{6}\)
Freestream pressure, temperature 101,325 Pa, 288.15 K
Chord 1 m

The Mach number and angle of attack are the free-air values of the experiment: the wind-tunnel values (Mach 0.725, 2.92°) corrected for the tunnel walls. The surface pressure measured in the tunnel is the reference for this tutorial.

The mesh is the RAE 2822 turbulent mesh distributed with the SU2 test cases: 13,937 nodes, quadrilaterals in the boundary layer and triangles outside, 192 edges on the airfoil, and a circular farfield 100 chords from the airfoil.

Mesh of the full RAE 2822 domain, a circle of triangles refined toward the airfoil at its center
Figure 1: The computational domain: a circle of radius 100 chords around the airfoil
Close view of the RAE 2822 mesh, structured quadrilateral layers around the airfoil surrounded by triangles
Figure 2: The mesh near the airfoil: quadrilateral layers on the wall, triangles outside

Before you begin

You need:

  • the Wake CFD 2D solver, wake_2d_mixed (wake_2d_mixed.exe on Windows) — see Installation;
  • ParaView 5.10 or later to view the results;
  • the tutorial files listed below.
File Contents
rae2822_sa_defaults.jsonc The input file (deck) of this tutorial
_mesh/mesh_RAE2822_turb.su2 The mesh, in SU2 format
rae2822_case6_cp_exp.csv Measured surface pressure coefficient, AGARD AR-138 Case 6 (x_c, Cp_exp)
paraview_cp.py Optional: the ParaView steps of the surface-pressure chart as a script

The files are in the tutorials/rae2822_transonic/ folder of the examples that come with the solver (shared/examples/ in the installation folder).

Setting up the working directory

Wake CFD writes its results next to the input file, so run the tutorial in a copy and keep the installed examples unchanged.

  1. Copy the whole rae2822_transonic folder to a working location, for example ~/wake-work/rae2822_transonic. Keep _mesh/ inside it: the deck refers to the mesh by a relative path.
  2. Open a terminal in that folder.

Reading the case

Open rae2822_sa_defaults.jsonc in a text editor. A deck is JSON with comments (//); each top-level block describes one part of the problem. This deck writes down the physics of the case and leaves almost every numerical setting at its default. The blocks are described below in the order they appear in the file.

Analysis and mesh

"analysis": { "time": "steady", "dimension": 2 },

"mesh": [
  { "file_name": "_mesh/mesh_RAE2822_turb.su2", "format": "su2" }
],
  • time: steady asks for a steady-state solution; dimension: 2 means the case is run with the 2D solver.
  • file_name is relative to the folder of the deck.
  • The mesh has two boundary markers, AIRFOIL and FARFIELD. The boundary conditions refer to them by these names.

Flow model and material

"models": {
  "type": "navier_stokes",
  "regime": "compressible",
  "turbulence": { "model": "sa" }
},

"materials": [
  {
    "name": "Air", "type": "pure",
    "eos": { "type": "ideal_gas", "gas_constant": 287.87 },
    "viscosity": { "type": "constant", "value": 4.6686e-5 },
    "conductivity": { "type": "constant_prandtl", "prandtl": 0.72 }
  }
],
  • navier_stokes with compressible selects the viscous density-based solver; sa is the Spalart–Allmaras turbulence model.
  • The ideal gas uses γ = 1.4 by default.
  • The viscosity is constant and chosen so that the Reynolds number matches the experiment: ρ = p / (R T) = 1.2215 kg/m³, U = 0.729 a = 248.43 m/s, μ = ρ U c / Re = \(4.6686 \times 10^{-5}\) Pa·s.

Reference values

"reference": {
  "density": 1.221523, "pressure": 101325.0,
  "temperature": 288.15, "velocity": 248.4272,
  "area": 1.0, "length_moment": [1.0, 1.0, 1.0],
  "origin_moment": [0.25, 0.0, 0.0]
},

Force coefficients and PressureCoefficient are normalized with q = ½ ρ U² of these values, the reference area (1 m² per unit span) and, for the moment, the reference length and the quarter-chord point.

Boundary conditions

"domains": [
  {
    "name": "fluid", "type": "fluid", "material": "Air",
    "boundaries": [
      { "name": "airfoil", "type": "wall",
        "momentum": "no_slip", "mesh_markers": ["AIRFOIL"] },
      { "name": "farfield", "type": "farfield",
        "mesh_markers": ["FARFIELD"],
        "mach": 0.729, "pressure": 101325.0, "temperature": 288.15,
        "direction": { "type": "angles", "angles": { "aoa": 2.31 } },
        "turbulence": { "nu_factor": 3.0 } }
    ]
  }
],
  • The airfoil is a no-slip wall, adiabatic by default.
  • The farfield gives the freestream state; aoa is the angle of attack in degrees.
  • nu_factor is the freestream value of the SA variable relative to the laminar viscosity; 3 is the usual choice for a fully turbulent external flow.

Numerical method

"numerical_method": {
  "advection": { "limiter": { "type": "venkatakrishnan_wang" } }
},

This is the only numerical setting in the deck. The default convective scheme (Roe, second order) has no slope limiter; at the shock the second-order reconstruction then overshoots, and on this mesh the run diverges after about 200 iterations. The Venkatakrishnan–Wang limiter keeps the reconstruction bounded near the shock and leaves it second order in smooth regions. See Further discussion.

Run control

"run_control": {
  "cfl": { "type": "adaptive" },
  "iteration": 10000,
  "convergence": { "type": "monitor", "fields": ["CL", "CD"] }
},
  • cfl.type: adaptive: the CFL number starts at 5 and grows to 100 while the implicit steps are solved well. The default policy, a constant CFL of 10, converges several times slower on steady airfoil cases.
  • iteration is required; here it is only an upper bound.
  • convergence.type: monitor stops the run when every listed monitor has settled: its range over the last 100 iterations is below \(10^{-5}\) (0.1 drag count). CL and CD are the monitors defined in monitoring.

Outputs

"outputs": {
  "volumes": [
    { "name": "flowfield", "file_name": "flow", "format": "vtu",
      "frequency": 0, "fields": ["default"] }
  ],
  "surfaces": [
    { "name": "airfoil_surface", "boundary_names": ["airfoil"],
      "file_name": "airfoil_surface", "format": "vtu",
      "frequency": 0,
      "fields": ["Pressure", "PressureCoefficient", "Mach", "Cf", "Yplus"] }
  ],
  "restart": {
    "enabled": true, "file_name": "restart_flow", "frequency": 0
  }
},

frequency: 0 writes a file once, at the end of the run.

  • volumes: the flow field, flow_<iteration>.pvtu.
  • surfaces: the listed fields on the airfoil, airfoil_surface_AIRFOIL_<iteration>.pvtu.
  • restart: restart_flow_<iteration>.wsol, to continue the run later.

Monitoring

"monitoring": {
  "history_files": [
    { "id": "main", "file_name": "history", "frequency": 1,
      "enabled": true }
  ],
  "console": { "frequency": 50 },
  "monitors": [
    { "name": "CL", "history_file": "main",
      "target": { "boundaries": ["airfoil"] },
      "function": "force_coefficient",
      "direction": [-0.0403061842, 0.9991873756, 0.0],
      "console": true },
    { "name": "CD", "history_file": "main",
      "target": { "boundaries": ["airfoil"] },
      "function": "force_coefficient",
      "direction": [0.9991873756, 0.0403061842, 0.0],
      "console": true },
    { "name": "CMz", "history_file": "main",
      "target": { "boundaries": ["airfoil"] },
      "function": "moment_coefficient",
      "axis": [0.0, 0.0, 1.0], "console": true }
  ]
}
  • The monitors are written every iteration to history.csv and every 50 iterations to the console.
  • A force coefficient is the force on the target boundaries along direction. The lift and drag directions here are for 2.31°: lift along (−sin α, cos α), drag along (cos α, sin α). If you change the angle of attack, change these vectors with it.

Obtaining the solution

  1. Check the deck without running it:

    wake_2d_mixed rae2822_sa_defaults.jsonc --validate

    It prints Validation passed. followed by the boundary values it read, and returns exit code 0. A typo in a key name or a missing mesh is reported here with its location in the file.

  2. Run the case:

    # Linux, one process
    wake_2d_mixed rae2822_sa_defaults.jsonc
    
    # Linux, four MPI processes
    mpiexec -n 4 wake_2d_mixed rae2822_sa_defaults.jsonc

    On Windows use wake_2d_mixed.exe. For MPI and GPU options see Running Wake CFD.

  3. Follow the console. Every 50 iterations the solver prints one line (the spacing between columns is reduced here to fit the page):

     Iter Wall/it Flow_Res Turb_NuTilde CFL_Avg       CL       CD      CMz
        0  0.0112   0.0000      -4.5004    5.00 0.130052 0.145420 0.052482
       50  0.0413  -1.1628      -3.1107  100.00 0.809132 0.017683 0.118442
      100  0.0346  -2.6104      -4.4878  100.00 0.748640 0.014015 0.097667
    Column Meaning
    Wall/it Wall-clock seconds per iteration
    Flow_Res Mean-flow residual in orders of magnitude below its value at the start (0 = start, −3 = a thousand times smaller)
    Turb_NuTilde Residual of the SA equation
    CFL_Avg Current CFL number — here it reaches the ceiling of 100 within 50 iterations
    CL, CD, CMz The monitors of the deck
  4. The run stops by itself when CL and CD have settled. The console names the monitor that settled last (least-settled monitor 'CL'), and the closing summary gives the reason:

    | Stop reason              |     Converged (monitor criteria) |
    | Iterations               |                              609 |

    The run takes 609 iterations, a few minutes on a few CPU cores.

The run folder rae2822_sa_defaults_001/ sits next to the deck; a second run of the same deck writes rae2822_sa_defaults_002/.

File Contents
flow_00000609.pvtu (+ one .vtu piece per MPI process) Flow field: Mach, Pressure, PressureCoefficient, Density, Temperature, Velocity, EddyViscosity, …
airfoil_surface_AIRFOIL_00000609.pvtu Airfoil surface: Pressure, PressureCoefficient, Mach, Cf, Yplus
history.csv CL, CD, CMz and their pressure and friction parts, every iteration
solver_residual_reduction.csv Residual reduction of each equation, every iteration
restart_flow_00000609.wsol Restart file
input.jsonc The deck as the solver read it, for the record

Viewing the results in ParaView

Convergence history

  1. In ParaView select File > Open, choose solver_residual_reduction.csv in the run folder and click Apply. ParaView shows the table in a spreadsheet view.

  2. Split the view, choose Line Chart View, and make the table visible in it (eye icon in the Pipeline Browser).

  3. In the Properties panel set:

    Property Value
    Use Index For X Axis (cleared)
    X Array Name Iteration
    Series Parameters only Flow_Reduction selected
  4. Repeat with history.csv and the series CL.

Line chart of the scaled mean-flow residual falling from 0 to about -6.5 over 609 iterations
Figure 3: Mean-flow residual: about 6.5 orders in 609 iterations
Line chart of the lift coefficient rising to about 0.81, then settling at 0.743
Figure 4: Lift coefficient: settled near 0.743 after about 150 iterations

The lift settles long before the residual stops falling. The run continues until CL and CD vary by less than the monitor tolerance over the last 100 iterations.

Mach number field

  1. Select File > Open, choose flow_00000609.pvtu and click Apply.
  2. In the toolbar choose Mach as the coloring variable.
  3. Click Set view direction to +Z and zoom to the airfoil.
  4. Optionally set a fixed color range (Rescale to Custom Data Range, 0 to 1.35) so that the sonic value 1 sits in the middle of the color map.
Mach number contour around the RAE 2822 airfoil, red supersonic pocket over the upper surface ending at a near-vertical shock
Figure 5: Mach number: the supersonic region on the upper surface ends in a shock near 55 % of the chord

The supersonic pocket over the upper surface and the shock that closes it are the features this case is about. The thin low-speed layer along the surface is the boundary layer, which thickens behind the shock.

Surface pressure coefficient against the experiment

The airfoil surface file holds PressureCoefficient at the 192 surface points. To plot it along the chord, the points must be in order along the surface; ParaView does that with three filters.

  1. Select File > Open, choose airfoil_surface_AIRFOIL_00000609.pvtu and click Apply.

  2. With it selected, apply the following filters in turn (Filters > Alphabetical), clicking Apply after each:

    Filter Settings Why
    Clean to Grid defaults Merges the points that neighboring MPI pieces share
    Extract Surface defaults Turns the result into lines
    Plot On Sorted Lines defaults Orders the points along the airfoil and opens a line chart
    Calculator Result Array Name minus_Cp, expression -PressureCoefficient Airfoil pressure is drawn with suction up; ParaView charts cannot reverse an axis
  3. In the line chart’s Properties, clear Use Index For X Axis, set X Array Name to Points_X (the chord is 1 m, so x is x/c), and select only minus_Cp under Series Parameters.

  4. Select File > Open, choose rae2822_case6_cp_exp.csv (from the tutorial folder) and click Apply.

  5. Apply a Calculator to it with Attribute Type Row Data, Result Array Name minus_Cp_exp, expression -Cp_exp.

  6. Show it in the same line chart: X Array Name x_c, series minus_Cp_exp only, Line Style None, Marker Style Circle.

Line chart of minus Cp against x over c: the computed curve follows the measured points on both surfaces, including the shock near x/c 0.55
Figure 6: Surface pressure coefficient: Wake CFD against AGARD AR-138 Case 6

The computed pressure follows the measurements on both surfaces: the suction peak at the leading edge, the plateau of the supersonic region, the shock at x/c ≈ 0.55 and the recovery behind it. The lift coefficient is 0.743, the same as the measured normal-force coefficient.

The same chart can be produced in one command with the script from the tutorial folder:

pvbatch paraview_cp.py rae2822_sa_defaults_001 cp.png

Further discussion

Why a limiter. Run the deck once without the numerical_method block. The solver warns repeatedly that MUSCL face states were rejected and fell back to first order, the residual climbs instead of falling, and the run stops after about 200 iterations with Stop reason: Diverged. Smooth subsonic cases, such as a low-speed airfoil, do not need the limiter; cases with shocks do.

Why an adaptive CFL. With the default constant CFL of 10 the same case needs several times as many iterations. The adaptive controller raises the CFL as long as each implicit step is solved well and lowers it when a step goes wrong, so it is a safe first choice for steady cases.

What to compare with the experiment. Compare the pressure distribution and the lift. The drag coefficient of this run (139 counts) is not directly comparable with the measured 127 counts: the measurement was taken at the uncorrected tunnel conditions, and on this comparatively coarse mesh the computed drag still falls as the mesh is refined.

Next steps.

  • Change the angle of attack: edit direction.angles.aoa and the CL and CD direction vectors together, and save the deck under a new name so that each run keeps its own folder.
  • Input reference for every block: Input-file structure.
  • Convergence and scheme choices: Recommended settings and troubleshooting.