---
title: Lift polar with adjoint slopes
summary: A 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.
section: examples
order: 7
level: 2
study: example_polar
keywords: [polar, sweep, warm start, session, lift-curve slope, example]
---
<!-- gyre docs: expanded Markdown of examples/lift-polar.md (generated tables, verification numbers and chart data are written out). Base level of this page: L2 Practice; passages at another level are bracketed by 'begin level N' / 'end level N' comments and start with [LN Name]. Built from revision ceb1f4b0be. -->

**Verification status: Example: lift polar with adjoint slopes** (study `example_polar`): **PASSED**, 5 of 5 checks passed, 686.1 s.

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.

| Check | Value | Expected | Result |
|---|---|---|---|
| all points converged | yes | true | pass |
| positive lift at zero incidence (camber) | 0.282053 | > 0.15 | pass |
| adjoint slope vs small-step central difference at 4 deg (rel.) | 9.8573e-07 | < 1e-5 | pass |
| adjoint slope vs two-degree secants of the polar (worst, rel.) | 0.0127031 | < 0.03 | pass |
| warm starts: Newton steps after the first point (max) | 6 | < 14 | pass |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:58:34-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [example_polar.json](../data/verification/example_polar.json).

**Chart: Lift polar and adjoint tangents** (Example: lift polar with adjoint slopes). Line chart of cl against α [deg]; 2 series. The table holds the plotted data.

| 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 | — | — |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:58:34-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [example_polar.json](../data/verification/example_polar.json).

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 $\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.

**Table: Polar** (Example: lift polar with adjoint slopes)

| α [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 |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:58:34-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [example_polar.json](../data/verification/example_polar.json).

## How it was run

**[Alternative: Pipeline stage]**

```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]
```

**[Alternative: Session (Python client)]**

```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"]
```

**[Alternative: In-process]**

```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"]
```

**Chart: Nonlinear iterations per point** (Example: lift polar with adjoint slopes). Bar chart of Newton steps against α [deg], x axis category; 1 series. The table holds the plotted data. The first point starts from the free stream; the others are warm starts.

| α [deg] | steps |
|---|---|
| -2.0 | 14 |
| -1.0 | 6 |
| 0.0 | 6 |
| 1.0 | 6 |
| 2.0 | 6 |
| 3.0 | 6 |
| 4.0 | 6 |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:58:34-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [example_polar.json](../data/verification/example_polar.json).

<!-- begin level 2 (Practice) -->
**[L2 Practice] Warm starts**

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.

<!-- end level 2 -->
