---
title: Order selection
summary: Output-driven order selection raises the polynomial degree until the estimated error of an output meets a tolerance. The study checks the selection rule itself, compares the estimate with solutions two degrees higher, and cross-checks every continued level against an independent solve.
section: verification
order: 10
level: 2
study: order_selection
keywords: [order selection, p-enrichment, error estimate, tolerance, adaptive order]
---
<!-- gyre docs: expanded Markdown of verification/order-selection.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: Output-driven order selection** (study `order_selection`): **PASSED**, 13 of 13 checks passed, 364.4 s.

The polynomial degree of the inviscid bump-channel case (12 x 4 elements) is raised from p = 1, each level continued from the one below, until the adjoint-based estimate of the error of the drag coefficient meets a tolerance. The checks are those of the contract: when the result says the tolerance is met, the estimated error of the selected degree is within it and that of every lower degree is not; a tighter tolerance never selects a lower degree; a tolerance that cannot be met within the allowed degrees is reported as not met. The estimate itself is compared with the difference to an independent solution two degrees higher, and every level with an independent solve at its degree.

| Check | Value | Expected | Result |
|---|---|---|---|
| independent solves from the free stream at p = 1 to 5: converged | 5 of 5 | all | pass |
| tolerance 0.02: met, and \|estimated error\| at the selected degree p = 1 | 0.0113855 | <= 0.02 | pass |
| tolerance 0.008: met, and \|estimated error\| at the selected degree p = 2 | 0.00518866 | <= 0.008 | pass |
| tolerance 0.008: smallest \|estimated error\| of the degrees below the selected one | 0.0113855 | > 0.008 (the lowest sufficient degree is selected) | pass |
| tolerance 0.001: met, and \|estimated error\| at the selected degree p = 3 | 7.7704e-05 | <= 0.001 | pass |
| tolerance 0.001: smallest \|estimated error\| of the degrees below the selected one | 0.00518866 | > 0.001 (the lowest sufficient degree is selected) | pass |
| selected degrees for tolerances 0.02, 0.008, 0.001 | 1, 2, 3 | non-decreasing as the tolerance is tightened | pass |
| tolerance 1e-06 with at most degree 2: reported as not met, \|estimated error\| at degree 2 | 0.00518866 | > 1e-06, met = false, degree = 2 | pass |
| cd of a degree reached by continuation versus an independent solve from the free stream (largest difference) | 8.4228e-15 | < 1e-10 (both converged to a relative residual of 1e-12) | pass |
| Newton steps of a level continued from the degree below, relative to a solve from the free stream (largest) | 0.6 | < 1 | pass |
| p = 1: \|cd − cd at p + 2\| / \|estimated error\| | 1.54466 | 0.4 … 2.5 (regression bound, not a guarantee of the estimator; the ratios measured in this run are in the notes) | pass |
| p = 2: \|cd − cd at p + 2\| / \|estimated error\| | 1.0857 | 0.4 … 2.5 (regression bound, not a guarantee of the estimator; the ratios measured in this run are in the notes) | pass |
| p = 3: \|cd − cd at p + 2\| / \|estimated error\| | 1.59032 | 0.4 … 2.5 (regression bound, not a guarantee of the estimator; the ratios measured in this run are in the notes) | pass |

Run notes: Measured in this run: tolerances 0.02, 0.008, 0.001 selected degrees 1, 2, 3. The difference to the solution two degrees higher was 1.09 to 1.59 times the estimated error (degrees 1 to 3); the estimate predicts the output one degree higher, so a ratio of one is not expected exactly. Levels continued from the degree below needed at most 0.60 of the Newton steps of a solve from the free stream. The exact drag of this inviscid subsonic flow is zero.

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:46:30-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: [order_selection.json](../data/verification/order_selection.json).

The test case is the inviscid bump channel on 12 × 4 elements, the case of the
[output-error study](output-error.md). The exact drag of this subsonic inviscid flow is zero,
so the drag coefficient is pure discretization error. The degree is raised from $p = 1$ for a
series of tolerances on the drag coefficient, each level continued from the one below.

**Chart: Estimated and actual error of the drag coefficient by degree** (Output-driven order selection). Line chart of error of cd against polynomial degree p, y axis log; 5 series. The table holds the plotted data. Horizontal lines are the tolerances; the selected degree is the first whose estimated error lies below the line.

| series | polynomial degree p | error of cd |
|---|---|---|
| \|estimated error\| | 1 | 0.0113855 |
| \|estimated error\| | 2 | 0.00518866 |
| \|estimated error\| | 3 | 7.7704e-05 |
| \|cd − cd at p + 2\| | 1 | 0.0175867 |
| \|cd − cd at p + 2\| | 2 | 0.00563334 |
| \|cd − cd at p + 2\| | 3 | 1.2357e-04 |
| tolerance 0.02 | 1 | 0.02 |
| tolerance 0.02 | 3 | 0.02 |
| tolerance 0.008 | 1 | 0.008 |
| tolerance 0.008 | 3 | 0.008 |
| tolerance 0.001 | 1 | 0.001 |
| tolerance 0.001 | 3 | 0.001 |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:46:30-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: [order_selection.json](../data/verification/order_selection.json).

<!-- begin level 2 (Practice) -->
**[L2 Practice] What the checks establish**

* **The rule.** When the result says the tolerance is met, the estimated error at the selected
  degree is within the tolerance and that of every lower degree is not: the lowest sufficient
  degree is selected.
* **Monotonicity.** A tighter tolerance never selects a lower degree.
* **Honest failure.** A tolerance that cannot be met within the allowed degrees is reported as
  not met, with the highest allowed degree and its estimate.
* **Continuation changes cost, not the answer.** The drag of every degree reached by
  continuation must equal that of an independent solve from the free stream at the same degree
  to solver tolerance, and a continued level must need fewer Newton steps than the solve from
  the free stream.

<!-- end level 2 -->

**Table: Levels of each selection** (Output-driven order selection)

| tolerance | p | DOF | cd | \|estimated error\| | \|cd − cd at p + 2\| | actual / estimated | Newton steps | outcome |
|---|---|---|---|---|---|---|---|---|
| 0.02 | 1 | 768 | 0.0177275 | 0.0113855 | 0.0175867 | 1.54466 | 9 | selected |
| 0.008 | 1 | 768 | 0.0177275 | 0.0113855 | 0.0175867 | 1.54466 | 9 | error above the tolerance |
| 0.008 | 2 | 1728 | 0.00569478 | 0.00518866 | 0.00563334 | 1.0857 | 6 | selected |
| 0.001 | 1 | 768 | 0.0177275 | 0.0113855 | 0.0175867 | 1.54466 | 9 | error above the tolerance |
| 0.001 | 2 | 1728 | 0.00569478 | 0.00518866 | 0.00563334 | 1.0857 | 6 | error above the tolerance |
| 0.001 | 3 | 3072 | 1.4077e-04 | 7.7704e-05 | 1.2357e-04 | 1.59032 | 6 | selected |
| 1.0000e-06 | 1 | 768 | 0.0177275 | 0.0113855 | 0.0175867 | 1.54466 | 9 | error above the tolerance |
| 1.0000e-06 | 2 | 1728 | 0.00569478 | 0.00518866 | 0.00563334 | 1.0857 | 6 | last allowed degree, tolerance not met |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:46:30-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: [order_selection.json](../data/verification/order_selection.json).

<!-- begin level 2 (Practice) -->
**[L2 Practice] The estimate against an independent solution**

For each degree the table compares the estimated error with the difference to an independent
solution two degrees higher. The estimate predicts the output one degree higher, and the
comparison is with two degrees higher, so a ratio of exactly one is not expected. The check
accepts ratios between 0.4 and 2.5. That interval is a regression bound around the ratios
measured when the study was introduced; it is not a guarantee of the estimator. The ratios of
the run are in the notes under the status.

<!-- end level 2 -->

**Table: Independent solves from the free stream** (Output-driven order selection)

| p | DOF | cd | Newton steps |
|---|---|---|---|
| 1 | 768 | 0.0177275 | 9 |
| 2 | 1728 | 0.00569478 | 10 |
| 3 | 3072 | 1.4077e-04 | 10 |
| 4 | 4800 | 6.1441e-05 | 11 |
| 5 | 6912 | 1.7195e-05 | 11 |

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T11:46:30-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: [order_selection.json](../data/verification/order_selection.json).

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] What this study does not prove**

* **One case, one output.** A smooth subsonic flow on a mesh that resolves the geometry is
  where p-enrichment works best. Nothing here covers a singular or shocked flow, where the
  estimate relative to the next degree captures less of the true error.
* **Estimated, not true, error.** The selection rule is checked against the estimate. That the
  true error is within the tolerance is not asserted; the comparison with degree $p + 2$ shows
  how far the two were apart in this run.
* **The retry path.** A degree that fails from the interpolated solution is tried again with
  the full continuation and from the free stream. The study has no check on that path; it is
  covered by unit tests in `tests/test_adapt.py`.
* **No statement about cost in general.** The Newton-step ratio is measured on this case.

<!-- end level 3 -->

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] Reproduce it**

```bash
gyre verify --only order_selection
gyre run bump_euler --set discretization.order=1 --target-error cd=1e-3 --max-order 4
```

The quick suite uses three tolerances; `--suite full` adds a fourth, tighter one and with it one
more degree. Usage of order selection is described in
[Gradients and error estimates](../guide/gradients.md#letting-the-error-estimate-choose-the-order),
its limits in [Output error estimation](../theory/error-estimation.md).

<!-- end level 3 -->
