Gyredocs
Depth Practice
API

Gyre/Examples

Lift polar with adjoint slopes

In one minuteA parameter sweep in one warm solver process, with the lift-curve slope from one adjoint solve at every point. Demonstrates warm starts and the consistency of gradients along a path.

Written at L2 Practice 441 words Markdown
PassedExample: lift polar with adjoint slopes5 of 5 checks passed · 686.1 s · quick suite

A warm-started sweep of the angle of attack for a NACA 2412 at Mach 0.4 in one solver process. At every point one adjoint solve gives the lift-curve slope, drawn as a tangent; the checks compare the slopes with a small-step central difference and with differences of neighbouring points.

  • all points convergedyesexpected truepass
  • positive lift at zero incidence (camber)0.2821expected > 0.15pass
  • adjoint slope vs small-step central difference at 4 deg (rel.)9.86e-07expected < 1e-5pass
  • adjoint slope vs two-degree secants of the polar (worst, rel.)0.0127expected < 0.03pass
  • warm starts: Newton steps after the first point (max)6expected < 14pass

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

Lift polar and adjoint tangentsExample: lift polar with adjoint slopes
Data table
seriesα [deg]cl
cl-20.0185712
cl-10.148671
cl00.282053
cl10.41544
cl20.544452
cl30.666028
cl40.773825
adjoint tangents-2.35-0.0268269
adjoint tangents-1.650.0639692
adjoint tangents——
adjoint tangents-1.350.102697
adjoint tangents-0.650.194645
adjoint tangents——
adjoint tangents-0.350.234873
adjoint tangents0.350.329232
adjoint tangents——
adjoint tangents0.650.369435
adjoint tangents1.350.461446
adjoint tangents——
adjoint tangents1.650.500347
adjoint tangents2.350.588558
adjoint tangents——
adjoint tangents2.650.625372
adjoint tangents3.350.706685
adjoint tangents——
adjoint tangents3.650.734292
adjoint tangents4.350.813358
adjoint tangents——

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

Each point is a converged flow over a NACA 2412 at Mach 0.4; the short segments are tangents whose slope is the adjoint derivative dcl/dα\mathrm dc_l/\mathrm d\alpha at that point. They line up with the curve: the gradient is the gradient of the function being evaluated.

PolarExample: lift polar with adjoint slopes
α [deg]clcdcmdcl/dα [1/rad]dcl/dα [1/deg]Newton stepsconverged
-20.01857120.00100944-0.05723447.431760.12970914yes
-10.1486718.9199e-04-0.05838377.526050.1313546yes
00.2820539.2904e-04-0.06011937.723380.1347986yes
10.415440.00102287-0.06182847.531230.1314456yes
20.5444520.00117546-0.06260127.220240.1260176yes
30.6660280.00142276-0.0616646.655590.1161626yes
40.7738250.00180472-0.05751596.471690.1129526yes

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

How it was run#

yaml
- id: polar
  uses: sweep
  with:
    case: naca2412_euler
    parameter: alpha_deg
    values: [-2, -1, 0, 1, 2, 3, 4]
    outputs: [cl, cd, cm]
    gradients_wrt: [alpha]
python
with GyreClient(URL).session("naca2412_euler") as flow:
    for a in (-2, -1, 0, 1, 2, 3, 4):
        out = flow.evaluate(alpha_deg=a)["outputs"]
        slope = flow.gradients(of=["cl"], wrt=["alpha_deg"])["cl"]["alpha_deg"]
python
flow = Case(preset("naca2412_euler")).discipline
for a in (-2, -1, 0, 1, 2, 3, 4):
    flow.set_inputs(alpha=math.radians(a))
    flow.solve()
    slope = flow.totals(of=("cl",), wrt=("alpha",))["derivatives"]["cl"]["alpha"]
Nonlinear iterations per pointExample: lift polar with adjoint slopes

The first point starts from the free stream; the others are warm starts.

Data table
α [deg]steps
-2.014
-1.06
0.06
1.06
2.06
3.06
4.06

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

The first point starts from a uniform free stream and ramps the pseudo-time step. Every later point starts from the previous converged flow directly in the Newton regime and converges to the same absolute residual level in a few iterations.

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