Gyredocs
Depth Practice
API

Gyre/Verification

Turbulence closure

In one minuteThe Spalart–Allmaras RANS closure is verified in four steps: a manufactured solution for the order of accuracy of the coupled system, exactness of its linearisation including the wall distance, the turbulent flat plate of the NASA Turbulence Modeling Resource for the model itself, and adjoint derivatives against finite differences.

Written at L2 Practice goes to L3 Mechanics 4271 words Markdown

A turbulence model adds an equation whose terms are stiff, non-conservative and singular at the wall. Each of the four studies below isolates one way in which that can go wrong: the discretization of the new terms, their derivatives, the model as implemented against two established codes, and the total derivatives an optimizer would consume. The formulation is described under Turbulence closure.

Order of accuracy#

PassedManufactured solutions: RANS with the Spalart-Allmaras model9 of 9 checks passed · 455.8 s · quick suite

Steady manufactured solution of the compressible RANS equations coupled to the negative Spalart-Allmaras model on the unit box (M = 0.5, Re = 1000, nu_tilde / nu = 8 (1 + 0.4 sin), a smooth positive manufactured wall distance between 0.1 and 0.8), Dirichlet data from the exact state on all sides. The forcing is generated by automatic differentiation of the same flux and source kernels the solver uses (turbulence.manufactured_source). Errors: L2 norm of the mean-flow conserved variables, and of rho nu_tilde scaled by Re. The solve starts from the nodal values of the exact solution and removes the truncation-error residual with p-multigrid Newton-Krylov. The eddy viscosity of the manufactured state is 4.7 times the molecular one, so the mean flow sees an effective Reynolds number of about 175: between the diffusion- and the convection-dominated regimes of the laminar manufactured solutions, where the state converges at a rate between p and p + 1. The laminar manufactured solution with the same mean state is therefore solved at that Reynolds number on the same meshes, and the checks require the guaranteed rate p of both equations and that the model changes neither the order nor the size of the mean-flow error.

  • p = 1: order of the mean-flow state (finest pair)1.914expected >= 0.75 (guaranteed rate p = 1, tolerance 0.25; design rate 2)pass
  • p = 1: order of nu_tilde (finest pair)2.202expected >= 0.75 (guaranteed rate p = 1, tolerance 0.25; design rate 2)pass
  • p = 1: mean-flow order with the model minus the laminar order at the effective Reynolds number0.006866expected > -0.15pass
  • p = 1: mean-flow error with the model over the laminar error at the effective Reynolds number (finest mesh)1.024expected 0.5 .. 1.5pass
  • p = 2: order of the mean-flow state (finest pair)2.477expected >= 1.75 (guaranteed rate p = 2, tolerance 0.25; design rate 3)pass
  • p = 2: order of nu_tilde (finest pair)2.612expected >= 1.75 (guaranteed rate p = 2, tolerance 0.25; design rate 3)pass
  • p = 2: mean-flow order with the model minus the laminar order at the effective Reynolds number-0.07206expected > -0.15pass
  • p = 2: mean-flow error with the model over the laminar error at the effective Reynolds number (finest mesh)1.148expected 0.5 .. 1.5pass
  • every model term is active at the domain centre (smallest |term| Re)0.00169expected > 1e-3pass

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

RANS-SA manufactured solutionManufactured solutions: RANS with the Spalart-Allmaras model
Data table
hmean flow, p = 1nu_tilde Re, p = 1laminar at the effective Re, p = 1mean flow, p = 2nu_tilde Re, p = 2laminar at the effective Re, p = 2
0.250.07840610.4885790.07669580.005083490.03635210.00493946
0.1250.02234370.1063040.02170828.6746e-040.004247427.9429e-04
0.06250.005927560.02310040.005786441.5584e-046.9494e-041.3574e-04

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

Errors on the finest mesh and observed orders (finest pair)Manufactured solutions: RANS with the Spalart-Allmaras model
pmean-flow errorordernu_tilde error x Reorderlaminar error at the effective Reorder
10.005927561.914360.02310042.202210.005786441.90749
21.5584e-042.476766.9494e-042.611631.3574e-042.54882

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

A smooth manufactured state of the coupled system (mean flow and ν~\tilde\nu) on the unit square, with a manufactured, strictly positive wall-distance field so that production, destruction and the gradient terms are all active. The forcing is generated by automatic differentiation of the kernels the solver itself uses, and the steady problem is solved with the implicit solver on three meshes per degree. The second table lists the size of each model term of the manufactured state, to show that none of them is negligible in the test.

Model terms of the manufactured state at (0.5, 0.5), times ReManufactured solutions: RANS with the Spalart-Allmaras model
termvalue
production0.00168964
destruction2.22251
cb20.0839335
density_gradient-0.0667243
eddy viscosity / molecular viscosity7.20704

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

The mean flow and the turbulence variable are measured separately, the latter scaled by the Reynolds number so that both are of order one. The study requires the rate that the laminar manufactured solutions establish for this discretization (order of accuracy); the observed orders are reported next to it.

Exact linearisation#

PassedExact linearization with the Spalart-Allmaras model20 of 20 checks passed · 158.6 s · quick suite

Jacobian-vector products of the weak RANS-SA residual from automatic differentiation against central differences (best of three step sizes), the dot-product identity of tangent and adjoint products, the element-diagonal blocks from the split-argument residual against the dense Jacobian (2-D), and the derivative with respect to the geometry nodes, which includes the wall distance. States are random perturbations of the free stream with nu_tilde / nu between -2 and 12, so both branches of the model and its limiters are differentiated; every boundary-condition type appears.

  • 2-D ring, adiabatic wall, far field: JVP vs central difference4.13e-10expected < 1e-6pass
  • 2-D ring, adiabatic wall, far field: JVP vs central difference, turbulence row3.95e-09expected < 1e-6pass
  • 2-D ring, adiabatic wall, far field: <v,Ju> = <J^T v,u>7.51e-15expected < 1e-12pass
  • 2-D ring, adiabatic wall, far field: shape derivative of the residual vs central difference1.66e-10expected < 1e-6pass
  • 2-D ring, adiabatic wall, far field: derivative of the wall distance w.r.t. the nodes1.45e-09expected < 1e-6pass
  • 2-D ring, adiabatic wall, far field: share of nodes on the negative branch0.1759expected 0.05 .. 0.5pass
  • 2-D ring, adiabatic wall, far field: block inverse times dense diagonal block9.06e-14expected < 1e-8pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: JVP vs central difference2.06e-10expected < 1e-6pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: JVP vs central difference, turbulence row1.38e-09expected < 1e-6pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: <v,Ju> = <J^T v,u>2.33e-14expected < 1e-12pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: shape derivative of the residual vs central difference7.91e-11expected < 1e-6pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: derivative of the wall distance w.r.t. the nodes3.73e-10expected < 1e-6pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: share of nodes on the negative branch0.2099expected 0.05 .. 0.5pass
  • 2-D channel: isothermal wall, inlet, outlet, slip wall: block inverse times dense diagonal block8.23e-13expected < 1e-8pass
  • 3-D box: adiabatic wall, far field, symmetry: JVP vs central difference2.66e-10expected < 1e-6pass
  • 3-D box: adiabatic wall, far field, symmetry: JVP vs central difference, turbulence row6.48e-09expected < 1e-6pass
  • 3-D box: adiabatic wall, far field, symmetry: <v,Ju> = <J^T v,u>1.77e-14expected < 1e-12pass
  • 3-D box: adiabatic wall, far field, symmetry: shape derivative of the residual vs central difference6.76e-11expected < 1e-6pass
  • 3-D box: adiabatic wall, far field, symmetry: derivative of the wall distance w.r.t. the nodes4.21e-10expected < 1e-6pass
  • 3-D box: adiabatic wall, far field, symmetry: share of nodes on the negative branch0.1296expected 0.05 .. 0.5pass

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

Relative defectsExact linearization with the Spalart-Allmaras model
configurationpDOFnegative nu_tilde shareJVP - FDJVP - FD (turbulence row)dot productblock inverseshape derivativewall distance
2-D ring, adiabatic wall, far field25400.1759264.1315e-103.9495e-097.5077e-159.0650e-141.6640e-101.4456e-09
2-D channel: isothermal wall, inlet, outlet, slip wall24050.2098772.0567e-101.3754e-092.3291e-148.2334e-137.9132e-113.7334e-10
3-D box: adiabatic wall, far field, symmetry212960.129632.6557e-106.4804e-091.7685e-14—6.7631e-114.2069e-10

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

Random states with ν~/ν\tilde\nu/\nu between −2-2 and 1212 put a share of the nodes on the negative branch of the model (column 4), so both branches and the limiters are differentiated. The Jacobian-vector product from automatic differentiation is compared with a central difference of the residual, for all equations and for the turbulence equation alone; the dot-product identity ties the adjoint product to the tangent product; the block inverses of the preconditioner are multiplied with the diagonal blocks of a dense Jacobian (2-D). The last two columns differentiate with respect to the mesh nodes: the residual, and the wall distance by itself.

The wall distance is a minimum over the wall, and the solver stores the minimiser as interpolation weights on wall nodes instead of recomputing it when the geometry moves. The check moves the nodes, recomputes the closest points from scratch, and compares the difference quotient with the derivative of the stored representation. Agreement to the accuracy of the finite difference confirms the envelope argument of the theory page on these meshes.

Turbulent flat plate#

PassedTurbulent flat plate (NASA TMR) with the Spalart-Allmaras model8 of 8 checks passed · 162.1 s · quick suite

Zero-pressure-gradient turbulent flat plate of the NASA Turbulence Modeling Resource (2D Zero Pressure Gradient Flat Plate Verification Case: M = 0.2, Re = 5e6 per unit length, plate from x = 0 to 2, symmetry upstream to x = -0.33, far field at y = 1, total-pressure inflow, pressure outflow, adiabatic wall, free-stream nu_tilde = 3 nu). Each run starts from the uniform free stream and is converged nine orders by the pseudo-transient Newton-Krylov solver. The skin friction, taken from the numerical wall flux of the residual, is compared with the TMR's SA results on its finest grid (545 x 385 points; file FlatPlate/SA/cf_plate.dat, mean of CFL3D and FUN3D, which differ by less than 0.1 % at the stations used; at x = 0.97008 their grid-converged value is cf = 2.705513e-03). The meshes here are far coarser: the coarse mesh has 15 x 10 elements with a first element height of 5e-05. The comparison is with the reference model implementation (standard SA with the ft2 term; this code solves SA-neg, identical for positive nu_tilde), not with experiment.

  • coarse mesh, p = 1: converged from the free stream (residual drop)8.21e-10expected <= 1e-9pass
  • coarse mesh, p = 1: Newton steps33expected <= 100 (cap 150)pass
  • coarse mesh, p = 2: converged from the free stream (residual drop)2.31e-11expected <= 1e-9pass
  • coarse mesh, p = 2: Newton steps34expected <= 100 (cap 150)pass
  • p = 2: |cf / cf_TMR - 1| at x = 0.970.001656expected < 0.02pass
  • p = 2: largest |cf / cf_TMR - 1| over the stations x >= 0.50.02153expected < 0.04pass
  • p = 1: largest |cf / cf_TMR - 1| over the stations x >= 0.50.09989expected < 0.15pass
  • raising the degree from 1 to 2 reduces the largest difference (ratio)0.2155expected < 0.5pass

Run notes The leading-edge region (x < 0.3) is the least resolved: the first element on the plate is 0.02 long. Negative nu_tilde occurs at the edge of the boundary layer, where the negative branch of the model takes over; it is reported, not clipped. Not covered: a mesh-converged result, the velocity profile in wall units, other Reynolds numbers.

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

Skin friction along the plateTurbulent flat plate (NASA TMR) with the Spalart-Allmaras model
Data table
seriesxcf
coarse mesh, p = 10.020.00491592
coarse mesh, p = 10.020.00499258
coarse mesh, p = 10.04694190.0047353
coarse mesh, p = 10.04694190.00447534
coarse mesh, p = 10.08323530.0045294
coarse mesh, p = 10.08323530.00422098
coarse mesh, p = 10.1321260.00410448
coarse mesh, p = 10.1321260.00384376
coarse mesh, p = 10.1979870.00392741
coarse mesh, p = 10.1979870.0037168
coarse mesh, p = 10.2867070.00369003
coarse mesh, p = 10.2867070.00355616
coarse mesh, p = 10.4062220.003343
coarse mesh, p = 10.4062220.00325364
coarse mesh, p = 10.5672210.00316472
coarse mesh, p = 10.5672210.00307648
coarse mesh, p = 10.7841010.00309139
coarse mesh, p = 10.7841010.00303047
coarse mesh, p = 11.076260.00293727
coarse mesh, p = 11.076260.00291624
coarse mesh, p = 11.469830.00273476
coarse mesh, p = 11.469830.00271152
coarse mesh, p = 120.0026595
coarse mesh, p = 20.020.00452362
coarse mesh, p = 20.020.00457282
coarse mesh, p = 20.0334710.00429405
coarse mesh, p = 20.04694190.00410478
coarse mesh, p = 20.04694190.00410667
coarse mesh, p = 20.06508860.00385725
coarse mesh, p = 20.08323530.00367193
coarse mesh, p = 20.08323530.0036691
coarse mesh, p = 20.1076810.00359358
coarse mesh, p = 20.1321260.00352584
coarse mesh, p = 20.1321260.00352445
coarse mesh, p = 20.1650560.00347637
coarse mesh, p = 20.1979870.00339196
coarse mesh, p = 20.1979870.00339568
coarse mesh, p = 20.2423470.00327457
coarse mesh, p = 20.2867070.0031657
coarse mesh, p = 20.2867070.0031628
coarse mesh, p = 20.3464650.00309734
coarse mesh, p = 20.4062220.00303715
coarse mesh, p = 20.4062220.00303692
coarse mesh, p = 20.4867220.00299737
coarse mesh, p = 20.5672210.00294754
coarse mesh, p = 20.5672210.00294702
coarse mesh, p = 20.6756610.00288963
coarse mesh, p = 20.7841010.00280593
coarse mesh, p = 20.7841010.0028098
coarse mesh, p = 20.9301810.00272065
coarse mesh, p = 21.076260.00265873
coarse mesh, p = 21.076260.00265545
coarse mesh, p = 21.273040.00261528
coarse mesh, p = 21.469830.00257447
coarse mesh, p = 21.469830.00257404
coarse mesh, p = 21.734910.00254306
coarse mesh, p = 220.00250226
NASA TMR, SA, CFL3D 545 x 3850.1005730.00379176
NASA TMR, SA, CFL3D 545 x 3850.1999710.00341813
NASA TMR, SA, CFL3D 545 x 3850.2998410.00321455
NASA TMR, SA, CFL3D 545 x 3850.501510.0029769
NASA TMR, SA, CFL3D 545 x 3850.7472810.00280852
NASA TMR, SA, CFL3D 545 x 3850.9700840.00270562
NASA TMR, SA, CFL3D 545 x 3851.248230.00261128
NASA TMR, SA, CFL3D 545 x 3851.495240.00254679
NASA TMR, SA, CFL3D 545 x 3851.752990.00249255
NASA TMR, SA, CFL3D 545 x 3851.903340.00246638

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

RunsTurbulent flat plate (NASA TMR) with the Spalart-Allmaras model
runelementsunknownsy+ of the first node off the wall (x = 0.97)Newton stepsresidual dropcf(x = 0.97)difference to TMR at x = 0.97 [%]largest difference, x >= 0.5 [%]cd (one wetted side, reference length 1)max nu_tilde / numin nu_tilde / nunodes with nu_tilde < 0 [%]
coarse mesh, p = 115030009.63577338.2135e-100.002971149.817949.98850.00628466327.141-3.164990.166667
coarse mesh, p = 215067504.59367342.3071e-110.00270103-0.1656492.152810.00575365386.72-42.55091.55556

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

Zero-pressure-gradient flat plate at M=0.2M = 0.2 and Re=5×106\mathit{Re} = 5\times10^6 per unit length, on the domain of the NASA Turbulence Modeling Resource. The reference is the skin friction that two independent codes, CFL3D and FUN3D, obtain with the same model on the finest grid of that resource (545 × 385 points); their values agree with each other to four digits, so the comparison tests the implementation of the model, not the model. Gyre runs the case on a mesh of a few hundred elements whose first element is thin enough for the polynomial inside it to resolve the sublayer; the table reports y+y^+ of the first solution node off the wall.

Skin friction at the TMR stationsTurbulent flat plate (NASA TMR) with the Spalart-Allmaras model
runxcfcf TMRdifference [%]
coarse mesh, p = 10.1005730.004179670.0037900910.2788
coarse mesh, p = 10.1999710.00371620.00341728.75013
coarse mesh, p = 10.2998410.003532740.003213969.91855
coarse mesh, p = 10.501510.003201010.002976597.53952
coarse mesh, p = 10.7472810.003088860.002808359.9885
coarse mesh, p = 10.9700840.002971140.002705519.81794
coarse mesh, p = 11.248230.002836940.00261128.64499
coarse mesh, p = 11.495240.002709030.002546696.37439
coarse mesh, p = 11.752990.002683740.002492227.68478
coarse mesh, p = 11.903340.002668980.00246528.26632
coarse mesh, p = 20.1005730.003614730.00379009-4.62671
coarse mesh, p = 20.1999710.003390.0034172-0.795826
coarse mesh, p = 20.2998410.003147960.00321396-2.05354
coarse mesh, p = 20.501510.002988990.002976590.416487
coarse mesh, p = 20.7472810.00283730.002808351.03093
coarse mesh, p = 20.9700840.002701030.00270551-0.165649
coarse mesh, p = 21.248230.002620380.00261120.351467
coarse mesh, p = 21.495240.00257150.002546690.973867
coarse mesh, p = 21.752990.002540590.002492221.94095
coarse mesh, p = 21.903340.002518270.00246522.15281

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

  • The check is made at the station where the resource reports grid convergence (x=0.97x = 0.97) and over the stations of the downstream three quarters of the plate. Near the leading edge the coarse streamwise mesh and the numerical transition of the model dominate, and the difference is larger; the chart shows the whole plate.
  • The solution contains nodes with negative ν~\tilde\nu at the edge of the boundary layer (last columns of the run table): the situation the negative branch of the model exists for.
  • This is one attached boundary layer on one mesh family. It says nothing about separated flow, pressure gradients, curvature or three-dimensional boundary layers.
Residual history (weighted norm, relative to the free stream)Turbulent flat plate (NASA TMR) with the Spalart-Allmaras model
Data table
seriesNewton step|R| / |R0|
coarse mesh, p = 101
coarse mesh, p = 114.89573
coarse mesh, p = 125.41247
coarse mesh, p = 132.23355
coarse mesh, p = 140.336976
coarse mesh, p = 150.171881
coarse mesh, p = 160.140768
coarse mesh, p = 170.103329
coarse mesh, p = 180.0703721
coarse mesh, p = 190.0457075
coarse mesh, p = 1100.0326526
coarse mesh, p = 1110.0279033
coarse mesh, p = 1120.0236092
coarse mesh, p = 1130.0230931
coarse mesh, p = 1140.0149979
coarse mesh, p = 1150.0166568
coarse mesh, p = 1160.0146755
coarse mesh, p = 1170.0113993
coarse mesh, p = 1180.0106557
coarse mesh, p = 1190.0128619
coarse mesh, p = 1200.0119742
coarse mesh, p = 1210.0149637
coarse mesh, p = 1220.0206963
coarse mesh, p = 1230.0181075
coarse mesh, p = 1240.0196957
coarse mesh, p = 1250.0110184
coarse mesh, p = 1260.00441607
coarse mesh, p = 1279.9709e-04
coarse mesh, p = 1289.7204e-05
coarse mesh, p = 1298.2838e-06
coarse mesh, p = 1305.1405e-07
coarse mesh, p = 1316.4240e-08
coarse mesh, p = 1325.8135e-09
coarse mesh, p = 1338.2135e-10
coarse mesh, p = 201
coarse mesh, p = 216.25644
coarse mesh, p = 223.41048
coarse mesh, p = 230.488431
coarse mesh, p = 240.580143
coarse mesh, p = 250.392395
coarse mesh, p = 260.209359
coarse mesh, p = 270.100348
coarse mesh, p = 280.0499584
coarse mesh, p = 290.0350756
coarse mesh, p = 2100.0269743
coarse mesh, p = 2110.023996
coarse mesh, p = 2120.0244786
coarse mesh, p = 2130.0185963
coarse mesh, p = 2140.015646
coarse mesh, p = 2150.0126737
coarse mesh, p = 2160.00959785
coarse mesh, p = 2170.0088486
coarse mesh, p = 2180.00828078
coarse mesh, p = 2190.00937068
coarse mesh, p = 2200.0107984
coarse mesh, p = 2210.0125768
coarse mesh, p = 2220.0180937
coarse mesh, p = 2230.0159537
coarse mesh, p = 2240.0167172
coarse mesh, p = 2250.0137778
coarse mesh, p = 2260.0157868
coarse mesh, p = 2270.0104857
coarse mesh, p = 2280.00516797
coarse mesh, p = 2290.00191466
coarse mesh, p = 2303.0095e-04
coarse mesh, p = 2311.2303e-05
coarse mesh, p = 2322.1421e-07
coarse mesh, p = 2332.6006e-09
coarse mesh, p = 2342.3071e-11

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

Three dimensions#

PassedThree-dimensional consistency with the Spalart-Allmaras model10 of 10 checks passed · 675.1 s · quick suite

The turbulent flat plate of the preset flat_plate_sa (M = 0.2, Re = 5e6, degree 2, first cell 5e-5 high) is solved on its 2-D section and on a spanwise-periodic extrusion of that section into hexahedra (3 across a span of 3), both from the free stream with line Jacobi as the smoother of the p-multigrid levels 2-1-0. A correct 3-D implementation of the RANS equations (viscous and turbulent fluxes, the source terms of the model, the wall distance, the boundary conditions, the line smoother, force integration and the discrete adjoint) must give the drag of the section per unit span, its skin friction and the adjoint derivative of the drag. Section and extrusion have the same in-plane equations only at the same BR2 penalty, whose default is the number of faces of an element (4 for quadrilaterals, 6 for hexahedra): the section is therefore solved with 6, the default of the extrusion, and once more with its own default, which is reported without a check. Three kinds of statement are checked. Before the 3-D solve, the solution of the section is extruded and put into the 3-D residual: the equations the section has must be satisfied as well as the section satisfies them (below 1e-8 of the free-stream residual; the flow solves stop at a drop of 1e-9), which tests the 3-D operator without the 3-D solver. The spanwise momentum equation is not satisfied by the extruded solution, for the reason given in the notes, so that the 3-D solution has a small spanwise velocity that alternates within each element: it must leave the layers identical and mirror-symmetric and exert no net spanwise force (round-off only: below 1e-8). Being odd across the mid-plane of an element, it cannot change the mean over the span at first order: drag, mean skin friction and the derivative must agree with the section to 1e-6. The size of the spanwise velocity itself is reported, not checked.

  • the three flow solves converged from the free streamyesexpected truepass
  • the solution of the section, extruded, in the 3-D discretization: residual of the equations of the section, relative to the residual of the free stream6.84e-10expected < 1e-8pass
  • drag coefficient per unit span: |3-D - 2-D| / |2-D|5.23e-09expected < 1e-6pass
  • skin friction at x = 0.97008, mean over the span: |3-D - 2-D| / |2-D|3.86e-09expected < 1e-6pass
  • transposed solves reached their tolerance of 1e-10 (section and extrusion)yesexpected truepass
  • adjoint derivative of the drag with respect to the Mach number: |3-D - 2-D| / |2-D|2.42e-11expected < 1e-6pass
  • the spanwise layers repeat each other: largest difference of the state between a layer and the first7.69e-12expected < 1e-8pass
  • every layer is symmetric about its mid-plane (spanwise momentum odd, the other variables even): largest defect1.08e-11expected < 1e-8pass
  • no net spanwise force: |cs|3.08e-19expected < 1e-8pass
  • lines of the extrusion: those of the section in each spanwise layer (elements in lines)393expected = 3 x 131, in 3 x 18 linespass

Run notes The 3-D solution is not exactly uniform along the span: its spanwise momentum reaches 6.9e-07 and the in-plane variables differ by up to 7.4e-07 between spanwise nodes (table 'span'). This is a property of the BR2 scheme, not of the extrusion: the viscous flux inside an element is evaluated with the gradient lifted from all its faces, the flux through a face with the local gradient and the lifting of that face alone. Where the in-plane velocity jumps across in-plane faces, the two differ in the normal stress on the spanwise faces, which leaves a residual in the spanwise momentum equation of every element (table 'span': the extruded solution of the section). It changes sign across the mid-plane of the element, which is why the layers repeat each other and there is no net spanwise force; how little the mean over the span is affected is what the comparison with the section shows. With the default penalty of quadrilaterals (4) the section gives cd = 5.753647e-03 and cf = 2.701031e-03 at the station; the extrusion, whose default is 6, differs from these by 0.26 % and 0.16 %. That is a difference between two discretizations on a mesh of 150 elements, not an error of the 3-D implementation, and it is why the comparison is made at equal penalty. The extruded mesh has 54 lines holding 393 of its 450 elements (the longest 12 elements, 3 colours); 72900 unknowns in blocks of 162. An extrusion has only faces whose two sides use the same local axes, and the flow has no spanwise component to speak of: the study does not exercise the face-orientation tables, the two further components of the vorticity in the model or a flow that varies along the span.

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

2-D section versus 3-D extrusionThree-dimensional consistency with the Spalart-Allmaras model
quantity2-D section, penalty 63-D extrusion (per unit span)relative difference2-D section, default penaltyrelative difference of the extrusion to it
drag coefficient cd0.005768710.005768715.2271e-090.005753650.00261786
skin friction cf at x = 0.97008 (mean over the span)0.002705430.002705433.8640e-090.002701030.00162879
d cd / d Mach (adjoint)-0.0499672-0.04996722.4161e-11-0.04987360.00187671

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

The flat plate is solved on its two-dimensional section and on a spanwise-periodic extrusion of that section into hexahedra (mesh.params.nz, span). Everything the model adds runs through the three-dimensional code path there: the turbulent fluxes and source terms, the wall distance, the boundary conditions, the line smoother on a wall-resolved mesh of hexahedra, the force integration and the discrete adjoint. The drag per unit span, the skin friction at the reference station and the adjoint derivative of the drag with respect to the Mach number must be those of the section.

Section and extrusion have the same in-plane equations only at the same BR2 penalty, whose default is the number of faces of an element: four for quadrilaterals, six for hexahedra. The comparison is therefore made with the section at penalty six; the last two columns of the table show the section at its own default, which differs by the amount two discretizations differ on this coarse mesh.

The 3-D solution along the span (reported, not checked)Three-dimensional consistency with the Spalart-Allmaras model
quantityvalue
residual of the extruded solution of the section: its own equations / free stream6.8406e-10
residual of the extruded solution of the section: spanwise momentum / free stream2.0127e-08
largest spanwise momentum |rho w| of the 3-D solution (free stream: rho u = 1)6.9476e-07
largest difference between spanwise nodes, in-plane variables7.4299e-07
skin friction at x = 0.97008: largest |cf / mean - 1| over the spanwise node lines2.4340e-09
3-D state, mean over the span, against the section (in-plane variables)1.6715e-08
3-D state against the section, node for node (in-plane variables)4.9774e-07
side-force coefficient cs3.0839e-19

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

The solution of the section, extruded, satisfies the in-plane equations of the three-dimensional discretization as well as the section satisfies its own, which is checked before the three-dimensional solve and tests the operator without the solver. It does not satisfy the spanwise momentum equation exactly. In the BR2 scheme the viscous flux inside an element uses the gradient lifted from all its faces, the flux through a face the local gradient and the lifting of that face alone; where the in-plane velocity jumps across in-plane faces, the two differ in the normal stress on the spanwise faces. The converged three-dimensional solution therefore carries a small spanwise momentum that changes sign across the mid-plane of every element: the layers repeat each other, every layer is symmetric about its mid-plane and there is no net spanwise force, which are the three structural checks of the study. The table reports its size.

Problem sizes and solver statisticsThree-dimensional consistency with the Spalart-Allmaras model
casedimelementsunknownsBR2 penaltyreference areaNewton stepsKrylov iterationsresidual dropKrylov iterations of the adjoint solveresidual reduction of the adjoint solve
2-D section2150675061322487.4716e-10576.8090e-11
3-D extrusion34507290063322495.3546e-10708.6562e-11
2-D section, default penalty2150675041342671.5218e-11586.1890e-11

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

Lines of the meshesThree-dimensional consistency with the Spalart-Allmaras model
caselineselements in lineselementslongest linecolours
2-D section18131150123
3-D extrusion54393450123
2-D section, default penalty18131150123

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

An extrusion has only faces whose two sides use the same local axes, and the flow has no spanwise component to speak of: the face-orientation tables, the two further components of the vorticity in the model and a flow that varies along the span are not exercised here. The orientation tables are covered for laminar flow on the sphere; a turbulent flow that is three-dimensional in itself has not been run.

Adjoint derivatives#

PassedAdjoint gradients with the Spalart-Allmaras model6 of 6 checks passed · 119 s · quick suite

Total derivatives of the drag coefficient of the turbulent flat plate (NASA TMR conditions, M = 0.2, Re = 5e6, coarse mesh of 150 elements, p = 1, 3000 unknowns, cd = 6.284664e-03) from one discrete-adjoint solve of the coupled RANS-SA system, against central differences of re-converged solutions. Inputs: Mach number, Reynolds number, angle of the inflow, free-stream nu_tilde / nu, and a wall-normal bump of the plate surface (a shape derivative, which includes the sensitivity of the wall distance).

  • dcd/dmach: adjoint vs central difference (rel.)5.41e-09expected < 1e-5pass
  • dcd/dre: adjoint vs central difference (rel.)4.01e-09expected < 1e-5pass
  • dcd/dalpha: adjoint vs central difference (rel.)6.55e-11expected < 1e-5pass
  • dcd/dchi_inf: adjoint vs central difference (rel., best of 3 steps)3.18e-08expected < 1e-5pass
  • dcd/dshape (wall bump, directional): adjoint vs central difference (rel.)1.79e-08expected < 1e-5pass
  • adjoint linear solve reached its tolerance (residual reduction)9.21e-11expected < 1e-10pass

Run notes The mesh is wall resolved, with element aspect ratios of the order of 1000 at the wall. Element-block Jacobi does not see that anisotropy: as the only preconditioner it left the adjoint solve short of its tolerance (see the comment in the study); the piecewise-constant coarse level of the p-multigrid hierarchy is what makes it converge. There is no line-implicit or incomplete-factorisation preconditioner.

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

Adjoint and finite-difference derivativesAdjoint gradients with the Spalart-Allmaras model
derivativeadjointcentral differencesteprelative difference
dcd/dmach-0.0566437-0.05664371.0000e-055.4084e-09
dcd/dre-2.4900e-10-2.4900e-10504.0069e-09
dcd/dalpha-83.2169-83.21691.0000e-056.5461e-11
dcd/dchi_inf7.2791e-067.2791e-060.0013.1754e-08
dcd/dshape (wall bump, directional)0.007575660.007575661.0000e-061.7934e-08

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

Total derivatives of the drag coefficient of the turbulent plate with respect to the flow parameters, the model data and a displacement of the wall, from one adjoint solve each, against central differences of flows re-converged to the round-off floor. The shape derivative includes the change of the wall distance; the finite difference recomputes the distance for the displaced wall.

Solver statisticsAdjoint gradients with the Spalart-Allmaras model
quantityvalue
Newton steps of the baseline solve37
Krylov iterations of the baseline solve971
Krylov iterations of the adjoint solve149
residual reduction of the adjoint solve9.2074e-11
multigrid levels (polynomial degrees)1, 0

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

The mesh has element aspect ratios of the order of a thousand at the wall. With element-block Jacobi as the only preconditioner the adjoint solve of this case stopped short of its tolerance after 960 Krylov iterations, and since a stalled linear solve is an error and not a number (discipline contract), the study would have ended there. It runs with two multigrid levels, the solution degree and the piecewise-constant degree zero; the table shows what the solve then takes. This is a statement about iteration counts on one small case, not about cost.

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