Gyredocs
Depth Practice
API

Gyre/Examples

Turbulent flat plate

In one minuteA Reynolds-averaged case with the Spalart–Allmaras model — the zero-pressure-gradient flat plate at a Reynolds number of five million — showing how a turbulent case is specified, what its boundary layer looks like in wall units, and that its drag can be differentiated like any other output.

Written at L1 Essentials goes to L3 Mechanics 845 words Markdown
PassedExample: turbulent flat plate (Spalart-Allmaras)5 of 5 checks passed · 119.9 s · quick suite

The preset flat_plate_sa: zero-pressure-gradient flat plate at M = 0.2 and Re = 5e6 per unit length with the negative Spalart-Allmaras model, 150 elements of degree 2 (6750 unknowns), solved from the uniform free stream. Skin friction along the plate against the NASA Turbulence Modeling Resource reference (CFL3D and FUN3D, 545 x 385 grid), and the boundary-layer profile at x = 0.97 in wall units with the eddy viscosity across the layer.

  • converged from the free streamyesexpected truepass
  • cf at x = 0.97 against the TMR reference (relative difference)0.001656expected < 0.02pass
  • first solution node off the wall, y+4.594expected < 10pass
  • logarithmic layer, 40 <= y+ <= 200: largest relative difference of u+ to ln(y+) / 0.41 + 5.00.0026expected < 0.08 (a bound observed with margin on this mesh, not a property of the model)pass
  • eddy viscosity over molecular viscosity, largest value on the profile194.4expected > 50 (the layer is turbulent)pass

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

bash
gyre run flat_plate_sa -o runs/plate

The preset is the flat plate of the NASA Turbulence Modeling Resource at Mach 0.2 and Re=5×106\mathit{Re} = 5\times10^6 per unit length, on 150 elements of degree 2 whose first row is 5×10−55\times10^{-5} high. One line of the case switches the model on:

yaml
flow:
  mach: 0.2
  reynolds: 5.0e6
  turbulence: sa
OutputsExample: turbulent flat plate (Spalart-Allmaras)
cd (one side, reference length 1)cf at x = 0.97difference to TMR [%]y+ of the first nodelargest mu_t / musmallest nu_tilde / nulargest u+ difference in the log layer [%]largest u+ / y+ - 1 for y+ <= 3 [%]Newton stepsDOF
0.005753650.00270103-0.1656494.59367194.4030.001092410.259964—346750

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

Skin friction along the plateExample: turbulent flat plate (Spalart-Allmaras)
Data table
seriesxcf
Gyre, p = 20.020.00452362
Gyre, p = 20.020.00457282
Gyre, p = 20.0334710.00429405
Gyre, p = 20.04694190.00410478
Gyre, p = 20.04694190.00410667
Gyre, p = 20.06508860.00385725
Gyre, p = 20.08323530.00367193
Gyre, p = 20.08323530.0036691
Gyre, p = 20.1076810.00359358
Gyre, p = 20.1321260.00352584
Gyre, p = 20.1321260.00352445
Gyre, p = 20.1650560.00347637
Gyre, p = 20.1979870.00339196
Gyre, p = 20.1979870.00339568
Gyre, p = 20.2423470.00327457
Gyre, p = 20.2867070.0031657
Gyre, p = 20.2867070.0031628
Gyre, p = 20.3464650.00309734
Gyre, p = 20.4062220.00303715
Gyre, p = 20.4062220.00303692
Gyre, p = 20.4867220.00299737
Gyre, p = 20.5672210.00294754
Gyre, p = 20.5672210.00294702
Gyre, p = 20.6756610.00288963
Gyre, p = 20.7841010.00280593
Gyre, p = 20.7841010.0028098
Gyre, p = 20.9301810.00272065
Gyre, p = 21.076260.00265873
Gyre, p = 21.076260.00265545
Gyre, p = 21.273040.00261528
Gyre, p = 21.469830.00257447
Gyre, p = 21.469830.00257404
Gyre, p = 21.734910.00254306
Gyre, p = 220.00250226
TMR reference (CFL3D / FUN3D mean)0.1005730.00379009
TMR reference (CFL3D / FUN3D mean)0.1999710.0034172
TMR reference (CFL3D / FUN3D mean)0.2998410.00321396
TMR reference (CFL3D / FUN3D mean)0.501510.00297659
TMR reference (CFL3D / FUN3D mean)0.7472810.00280835
TMR reference (CFL3D / FUN3D mean)0.9700840.00270551
TMR reference (CFL3D / FUN3D mean)1.248230.0026112
TMR reference (CFL3D / FUN3D mean)1.495240.00254669
TMR reference (CFL3D / FUN3D mean)1.752990.00249222
TMR reference (CFL3D / FUN3D mean)1.903340.0024652

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

  • Skin friction. Downstream of the leading-edge region the curve follows the reference of the resource, computed with the same model on a grid of 545 × 385 points.
  • Law of the wall. In wall units the velocity profile leaves the sublayer line u+=y+u^+ = y^+ at the first nodes and follows the logarithmic law with the model’s von Kármán constant of 0.41 further out. Where two elements meet, the chart shows both nodal values: the small jumps between them are the discontinuous approximation, not an error of the plot.
  • Eddy viscosity. It is zero at the wall, several hundred times the molecular viscosity in the outer layer, and returns to the small free-stream value outside the boundary layer. At that edge ν~\tilde\nu undershoots below zero in a few nodes, which is what the negative branch of the model is for.
Velocity profile at x = 0.97 in wall unitsExample: turbulent flat plate (Spalart-Allmaras)

u_tau from the computed skin friction; first node at y+ = 4.59.

Data table
seriesy+u+
Gyre, p = 2 (solution nodes)4.593674.65382
Gyre, p = 2 (solution nodes)9.187348.53631
Gyre, p = 2 (solution nodes)9.187348.81174
Gyre, p = 2 (solution nodes)22.349912.2512
Gyre, p = 2 (solution nodes)35.512513.5829
Gyre, p = 2 (solution nodes)35.512513.7032
Gyre, p = 2 (solution nodes)73.228115.4443
Gyre, p = 2 (solution nodes)110.94416.4426
Gyre, p = 2 (solution nodes)110.94416.4885
Gyre, p = 2 (solution nodes)219.01318.2004
Gyre, p = 2 (solution nodes)327.08219.2646
Gyre, p = 2 (solution nodes)327.08219.3034
Gyre, p = 2 (solution nodes)636.7421.3076
Gyre, p = 2 (solution nodes)946.39822.6731
Gyre, p = 2 (solution nodes)946.39822.6859
Gyre, p = 2 (solution nodes)1833.6825.6229
Gyre, p = 2 (solution nodes)2720.9726.9992
Gyre, p = 2 (solution nodes)2720.9727.1728
Gyre, p = 2 (solution nodes)5263.3727.1772
u+ = y+0.3162280.316228
u+ = y+0.3981070.398107
u+ = y+0.5011870.501187
u+ = y+0.6309570.630957
u+ = y+0.7943280.794328
u+ = y+11
u+ = y+1.258931.25893
u+ = y+1.584891.58489
u+ = y+1.995261.99526
u+ = y+2.511892.51189
u+ = y+3.162283.16228
u+ = y+3.981073.98107
u+ = y+5.011875.01187
u+ = y+6.309576.30957
u+ = y+7.943287.94328
u+ = y+1010
u+ = ln(y+) / 0.41 + 5.012.589311.1777
u+ = ln(y+) / 0.41 + 5.015.848911.7393
u+ = ln(y+) / 0.41 + 5.019.952612.3009
u+ = ln(y+) / 0.41 + 5.025.118912.8625
u+ = ln(y+) / 0.41 + 5.031.622813.4241
u+ = ln(y+) / 0.41 + 5.039.810713.9857
u+ = ln(y+) / 0.41 + 5.050.118714.5473
u+ = ln(y+) / 0.41 + 5.063.095715.1089
u+ = ln(y+) / 0.41 + 5.079.432815.6705
u+ = ln(y+) / 0.41 + 5.010016.2321
u+ = ln(y+) / 0.41 + 5.0125.89316.7937
u+ = ln(y+) / 0.41 + 5.0158.48917.3553
u+ = ln(y+) / 0.41 + 5.0199.52617.9169
u+ = ln(y+) / 0.41 + 5.0251.18918.4785
u+ = ln(y+) / 0.41 + 5.0316.22819.0402
u+ = ln(y+) / 0.41 + 5.0398.10719.6018
u+ = ln(y+) / 0.41 + 5.0501.18720.1634
u+ = ln(y+) / 0.41 + 5.0630.95720.725
u+ = ln(y+) / 0.41 + 5.0794.32821.2866
u+ = ln(y+) / 0.41 + 5.0100021.8482
u+ = ln(y+) / 0.41 + 5.01258.9322.4098
u+ = ln(y+) / 0.41 + 5.01584.8922.9714
u+ = ln(y+) / 0.41 + 5.01995.2623.533
u+ = ln(y+) / 0.41 + 5.02511.8924.0946

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

Eddy viscosity across the layer at x = 0.97Example: turbulent flat plate (Spalart-Allmaras)

nu_tilde / nu below zero at the edge of the layer is the undershoot the negative branch of the model handles; there the eddy viscosity is zero.

Data table
y+mu_t / munu_tilde / nu
4.593670.02634111.7589
9.187340.2794853.23478
9.187340.2237673.04908
22.34996.011938.98167
35.512512.037513.7095
35.512512.368813.9867
73.228128.891429.3024
110.94442.496642.6921
110.94442.674242.8681
219.01379.733479.7896
327.082108.366108.396
327.082108.72108.75
636.74167.243167.255
946.398191.678191.687
946.398194.403194.413
1833.68168.421168.434
2720.9766.47866.5586
2720.9718.464519.3734
5263.370.2228253.04568

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

The model is integrated to the wall, so the first element must reach into the viscous sublayer: the table gives y+y^+ of the first solution node off the wall. With a high-order element the requirement is on the nodes inside the element, not on the element height, which is why 10 elements across the layer are enough here. To refine:

bash
gyre run flat_plate_sa --set mesh.params.nx=20 --set mesh.params.ny=12 --set mesh.params.h_wall=3e-5
gyre run flat_plate_sa --set discretization.order=3

The turbulence model is part of the differentiated residual, and so is the wall distance:

bash
gyre run flat_plate_sa --gradients --of cd --wrt mach,re,chi_inf

returns the total derivatives of the drag from one adjoint solve. They are verified against finite differences, including a displacement of the wall, under Turbulence closure.

Turbulent cases start from a uniform free stream with a small pseudo-time step and a moderate growth (cfl0: 1, cfl_growth: 3), and they keep the piecewise-constant multigrid level (levels: [2, 1, 0]): on a wall-resolved mesh the linear solves need it (why).

The line smoother (solver.smoother: line) cuts the Krylov iterations of linear solves to a tight tolerance to less than half on this mesh; the flow solve from the free stream does not get faster with it, and a single run with one adjoint solve is not where it pays (measured). It is meant for a case that is kept, in a session or a design loop, for many derivative evaluations at one flow state after another:

yaml
solver:
  levels: [2, 1, 0]
  smoother: line
  precond_lag: 2      # assemble the blocks every second step of a flow solve

gyre run prints, under the line of the case, how many lines the smoother found on the mesh, and gyre mesh info reports the same for a mesh file before anything is run.

    ↑ ↓ moveEnter open[ ] change depthResults show section and depth level