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.
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
Data table
| series | α [deg] | cl |
|---|---|---|
| cl | -2 | 0.0185712 |
| cl | -1 | 0.148671 |
| cl | 0 | 0.282053 |
| cl | 1 | 0.41544 |
| cl | 2 | 0.544452 |
| cl | 3 | 0.666028 |
| cl | 4 | 0.773825 |
| adjoint tangents | -2.35 | -0.0268269 |
| adjoint tangents | -1.65 | 0.0639692 |
| adjoint tangents | — | — |
| adjoint tangents | -1.35 | 0.102697 |
| adjoint tangents | -0.65 | 0.194645 |
| adjoint tangents | — | — |
| adjoint tangents | -0.35 | 0.234873 |
| adjoint tangents | 0.35 | 0.329232 |
| adjoint tangents | — | — |
| adjoint tangents | 0.65 | 0.369435 |
| adjoint tangents | 1.35 | 0.461446 |
| adjoint tangents | — | — |
| adjoint tangents | 1.65 | 0.500347 |
| adjoint tangents | 2.35 | 0.588558 |
| adjoint tangents | — | — |
| adjoint tangents | 2.65 | 0.625372 |
| adjoint tangents | 3.35 | 0.706685 |
| adjoint tangents | — | — |
| adjoint tangents | 3.65 | 0.734292 |
| adjoint tangents | 4.35 | 0.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 at that point. They line up with the curve: the gradient is the gradient of the function being evaluated.
| α [deg] | cl | cd | cm | dcl/dα [1/rad] | dcl/dα [1/deg] | Newton steps | converged |
|---|---|---|---|---|---|---|---|
| -2 | 0.0185712 | 0.00100944 | -0.0572344 | 7.43176 | 0.129709 | 14 | yes |
| -1 | 0.148671 | 8.9199e-04 | -0.0583837 | 7.52605 | 0.131354 | 6 | yes |
| 0 | 0.282053 | 9.2904e-04 | -0.0601193 | 7.72338 | 0.134798 | 6 | yes |
| 1 | 0.41544 | 0.00102287 | -0.0618284 | 7.53123 | 0.131445 | 6 | yes |
| 2 | 0.544452 | 0.00117546 | -0.0626012 | 7.22024 | 0.126017 | 6 | yes |
| 3 | 0.666028 | 0.00142276 | -0.061664 | 6.65559 | 0.116162 | 6 | yes |
| 4 | 0.773825 | 0.00180472 | -0.0575159 | 6.47169 | 0.112952 | 6 | yes |
gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build
How it was run#
- 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]
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"]
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"]
The first point starts from the free stream; the others are warm starts.
Data table
| α [deg] | steps |
|---|---|
| -2.0 | 14 |
| -1.0 | 6 |
| 0.0 | 6 |
| 1.0 | 6 |
| 2.0 | 6 |
| 3.0 | 6 |
| 4.0 | 6 |
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.