---
title: Outputs and functionals
summary: The definition, sign convention, normalisation and units of every output name a result can contain — force and moment coefficients, heat, the volume diagnostics, the surface load field and the surface distributions.
section: theory
order: 12
level: 2
audience: [MDO integrators, CFD practitioners]
keywords: [cl, cd, cm, cx, cy, heat, entropy_error, kinetic_energy, total_entropy, f_surface, cp, cf, sign convention, reference area]
---
<!-- gyre docs: expanded Markdown of theory/outputs-and-functionals.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. -->

Every quantity below is non-dimensional. The reference values are the free stream:
$\rho_\infty = |\mathbf u_\infty| = T_\infty = 1$, so the free-stream pressure is
$p_\infty = 1/(\gamma M_\infty^2)$ and the free-stream dynamic pressure is $\tfrac12$. Lengths
are in the unit of the mesh coordinates. The free-stream direction is
$(\cos\alpha, \sin\alpha)$ in the $x$–$y$ plane.

| Name | Kind | Exists for | Definition in one line |
|---|---|---|---|
| `cx`, `cy` | scalar | every case with a wall | force on the body along the mesh axes $x$, $y$, divided by $\tfrac12 S_\text{ref}$ |
| `cd`, `cl` | scalar | every case with a wall | the same force along and normal to the free stream |
| `cm` | scalar | every case with a wall | moment about `reference.moment_center`, nose-up positive, divided by $\tfrac12 S_\text{ref} L_\text{ref}$ |
| `cz`, `cs` | scalar | 3-D cases with a wall | force along the mesh axis $z$; side force in the wind axes |
| `cmx`, `cmy`, `cmz` | scalar | 3-D cases with a wall | rolling, yawing and pitching moment about `reference.moment_center`; `cmz` is the same output as `cm` |
| `heat` | scalar | viscous cases | heat flow rate from the walls into the fluid (not normalised) |
| `entropy_error` | scalar | every case | root-mean-square relative deviation of $p/\rho^\gamma$ from its free-stream value |
| `kinetic_energy` | scalar | every case | volume average of $\tfrac12\rho|\mathbf u|^2$ |
| `total_entropy` | scalar | every case | volume integral of the mathematical entropy $\eta$ |
| `f_surface` | field `(n_surface_nodes, dim)` | every case with a wall | consistent nodal loads on the wall geometry nodes |

Scalars can be differentiated with `totals`; the field `f_surface` through `adjoint_product`
and `tangent_product` ([gradients](../guide/gradients.md)).

## Forces and moments

<!-- begin level 2 (Practice) -->
**[L2 Practice] Definitions and signs**

Let $\Gamma_w$ be all boundary groups with a wall condition (`slip_wall`, `symmetry`,
`slip_wall_mirror`, `noslip_adiabatic`, `noslip_isothermal`) and $\mathbf n$ the unit normal
pointing out of the fluid, into the body. The force the fluid exerts on the body is the
momentum flux leaving the fluid through the wall,

$$
\mathbf F = \int_{\Gamma_w} \big( p\,\mathbf n - \boldsymbol\tau\,\mathbf n \big)\,\mathrm dS ,
$$

evaluated with the numerical boundary flux of the residual (see below). With
$S_\text{ref}$ = `reference.area` and $L_\text{ref}$ = `reference.length`:

$$
c_x = \frac{2F_x}{S_\text{ref}},\qquad c_y = \frac{2F_y}{S_\text{ref}},\qquad
c_d = c_x\cos\alpha + c_y\sin\alpha,\qquad
c_l = -c_x\sin\alpha + c_y\cos\alpha .
$$

`cx`, `cy` are in the **body (mesh) axes**; `cd`, `cl` are in the **wind axes** given by the
input `alpha`. Drag is positive downstream, lift positive towards $+y$ at $\alpha = 0$. The
factor 2 is $1/(\tfrac12\rho_\infty u_\infty^2)$.

The moment is taken about $\mathbf x_\text{ref}$ = `reference.moment_center`:

$$
c_m = -\frac{2}{S_\text{ref} L_\text{ref}} \int_{\Gamma_w}
\big[(x - x_\text{ref})\,\mathrm dF_y - (y - y_\text{ref})\,\mathrm dF_x\big] .
$$

The integral is the moment about the $z$ axis, counter-clockwise positive; the minus sign makes
`cm` **positive nose-up** for a body whose nose points towards $-x$ (flow from left to right).

Because `alpha` enters `cd` and `cl` explicitly, their derivatives with respect to `alpha`
contain the rotation of the axes as well as the change of the flow:
$\partial c_l/\partial\alpha|_\text{explicit} = -c_d$ and
$\partial c_d/\partial\alpha|_\text{explicit} = c_l$. The totals include both parts.

<!-- end level 2 -->

<!-- begin level 2 (Practice) -->
**[L2 Practice] Three dimensions: sideslip, side force and three moments**

In 3-D, $x$ points downstream, $y$ up and $z$ along the span ($z = x \times y$). The free
stream has an angle of attack $\alpha$ and a sideslip angle $\beta$ (input `beta`, radians;
`flow.beta_deg` in a case), and the wind axes are the right-handed triad

$$
\mathbf d = \begin{pmatrix}\cos\alpha\cos\beta\\ \sin\alpha\cos\beta\\ \sin\beta\end{pmatrix},\qquad
\mathbf e_L = \begin{pmatrix}-\sin\alpha\\ \cos\alpha\\ 0\end{pmatrix},\qquad
\mathbf e_S = \mathbf d\times\mathbf e_L = \begin{pmatrix}-\cos\alpha\sin\beta\\ -\sin\alpha\sin\beta\\ \cos\beta\end{pmatrix}.
$$

The force coefficients are the components of $2\mathbf F/S_\text{ref}$ along them, and along
the mesh axes:

| Name | Component |
|---|---|
| `cd`, `cl`, `cs` | along $\mathbf d$ (drag), $\mathbf e_L$ (lift), $\mathbf e_S$ (side force) |
| `cx`, `cy`, `cz` | along the mesh axes $x$, $y$, $z$ |

so `cs` equals `cz` at zero sideslip and the two-dimensional definitions are recovered for
$\beta = 0$. The moment about $\mathbf x_\text{ref}$ is the vector
$\mathbf M = \int_{\Gamma_w} (\mathbf x - \mathbf x_\text{ref}) \times \mathrm d\mathbf F$, and the
coefficients follow the aerodynamic sign convention, which in these axes is minus the
right-hand-rule moment for all three:

$$
c_{m,x} = -\frac{2 M_x}{S_\text{ref} L_\text{ref}}\ \text{(roll)},\qquad
c_{m,y} = -\frac{2 M_y}{S_\text{ref} L_\text{ref}}\ \text{(yaw)},\qquad
c_{m,z} = -\frac{2 M_z}{S_\text{ref} L_\text{ref}}\ \text{(pitch, nose-up positive)} .
$$

`cmz` and `cm` are the same output. For a spanwise-extruded mesh the default reference area
is the span, so the coefficients are per unit span; for a `sphere_shell` mesh it is the
frontal area of the body. As with `alpha`, the totals with respect to `beta` contain the
rotation of the wind axes. The 3-D outputs and their derivatives are verified in
[Three-dimensional flows](../verification/three-dimensional.md#adjoint-derivatives-in-3-d).

<!-- end level 2 -->

<!-- begin level 2 (Practice) -->
**[L2 Practice] Reference quantities**

| Field of the case | Default | Enters |
|---|---|---|
| `reference.area` | 1 in 2-D; the span for a spanwise-extruded generator mesh; the frontal area of the body for a `sphere_shell` mesh | all force and moment coefficients |
| `reference.length` | 1 | the moment coefficients only |
| `reference.moment_center` | `[0.25, 0, 0]` | the moment coefficients only |
| `reference.groups` | every wall group | which walls the force, moment and heat-flux integrals cover |
| `reference.components` | none | named sets of wall groups whose integrals are additional outputs, `cd_wing`, `cmz_tail`, … |

In 2-D the "area" is a length (the chord): the coefficients are per unit depth. The built-in
aerofoil generators produce a unit chord, so the defaults are the usual aerofoil convention
with the moment about the quarter-chord point. A mesh from a file has whatever size it was
drawn at: set all three ([mesh files](../guide/meshes.md)). By default the coefficients cover
**all** wall groups of the case. `reference.groups` restricts them to the named walls, which
gives the loads of one component of a configuration (and, case by case, of each of them);
the integrals of the selected groups add up to the integral over all walls, and their
adjoint derivatives and error estimates are those of the restricted integral. The nodal
load field and the surface displacement are the coupling interface and are not affected.

`reference.components` gives the breakdown from **one** solve: for every named component
the same integrals are taken over its groups and returned as `<coefficient>_<component>`,
normalised with the same reference area, length and moment point, so the outputs of
components that partition the walls add up to the plain coefficients. Each is a functional
of its own, built from the same numerical boundary fluxes, with its own adjoint: a drag
constraint on one component, or a bending-moment proxy of another, costs one transposed
solve like any other output.

<!-- end level 2 -->

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] Why the numerical boundary flux, and what that means for accuracy**

The force is not computed from interpolated pressure. It is the sum over wall face nodes of
the momentum components of the numerical boundary flux that the residual itself uses, times
the face quadrature weight and surface Jacobian (`functionals.SurfaceOps.face_forces`). For a
slip wall that flux is the wall pressure flux; for a no-slip wall it also contains the BR2
viscous traction. Two consequences: the forces are exactly the momentum the discrete scheme
loses through the wall (discrete conservation holds for them), and the functional is adjoint
consistent, which is what makes its error converge faster than the solution's and the
[error estimate](error-estimation.md) sharp.

<!-- end level 3 -->

## Heat

<!-- begin level 2 (Practice) -->
**[L2 Practice] Definition and sign**

`heat` exists when the case has a Reynolds number. It is minus the energy flux that leaves the
fluid through the wall faces,

$$
Q = -\int_{\Gamma_w} \mathbf F_E^{*}\cdot\mathbf n\,\mathrm dS ,
$$

again from the numerical boundary flux. On a no-slip wall the velocity is zero, so the energy
flux is the conductive heat flux alone and $Q$ is the **heat flow rate from the wall into the
fluid** (positive when the wall heats the fluid; zero up to discretization error on an
adiabatic wall). It is not divided by a reference quantity: its unit is
$\rho_\infty u_\infty^3 L^{d-1}$, per unit depth in 2-D. If the case also has slip walls they
are part of $\Gamma_w$, where the flux contributes $p\,\mathbf u\cdot\mathbf n$, which the slip
condition makes vanish.

<!-- end level 2 -->

## Volume diagnostics

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

With $V = \int_\Omega \mathrm dV$ and integrals evaluated by the Gauss–Lobatto quadrature of the
scheme:

$$
\texttt{entropy\_error} = \sqrt{\frac1V\int_\Omega \Big(\frac{s}{s_\infty} - 1\Big)^2 \mathrm dV},
\qquad s = \frac{p}{\rho^\gamma},
$$

$$
\texttt{kinetic\_energy} = \frac1V\int_\Omega \tfrac12\rho\,|\mathbf u|^2\,\mathrm dV,
\qquad
\texttt{total\_entropy} = \int_\Omega \eta\,\mathrm dV,\quad
\eta = -\frac{\rho\,(\ln p - \gamma\ln\rho)}{\gamma - 1}.
$$

* `entropy_error` is zero for an exact solution of a smooth inviscid flow from a uniform free
  stream (the entropy function $s$ is then constant), so for such cases it measures the
  spurious entropy the discretization produces and falls under refinement. With shocks,
  viscosity or heat transfer it contains physical entropy changes and is not an error.
* `kinetic_energy` equals $\tfrac12$ in the undisturbed free stream.
* `total_entropy` uses the [mathematical entropy](governing-equations.md) $\eta$, which has
  the opposite sign of the physical one and is **not** normalised by the volume. Its value is
  dominated by the size of the domain: for the free stream at Mach 0.5,
  $\eta_\infty = -\ln p_\infty/(\gamma - 1) \approx -2.62$ per unit area, and the O-mesh of
  the `naca0012_euler` preset reaches 50 chords, so the first run prints
  `total_entropy` $\approx -2.06\times10^{4}$. It is a diagnostic for unsteady entropy
  studies, of little use as a design output.

<!-- end level 2 -->

## Surface fields

<!-- begin level 2 (Practice) -->
**[L2 Practice] `f_surface`: nodal loads**

`f_surface` has one row per wall geometry node, in the order of `surface_coordinates()` and of
the input `x_surface`. Row $j$ is $\int_{\Gamma_w} N_j\,\mathrm d\mathbf F$ with $N_j$ the
geometry shape function of the node: the traction integrated against the basis in which a
displacement of the surface is interpolated. The loads are therefore

* **conservative**: they sum to the total force, `f_surface.sum(axis=0)` $= \mathbf F$, i.e.
  `2 * f_surface.sum(0) / reference.area` equals `(cx, cy)` (of all walls: the load field
  is not restricted by `reference.groups`);
* **work-consistent** with `x_surface`: the virtual work of a displacement field is the dot
  product of the two arrays.

They are forces on the structure (per unit depth in 2-D), not coefficients: no factor 2 and no
reference area.

<!-- end level 2 -->

<!-- begin level 2 (Practice) -->
**[L2 Practice] Surface distributions: `cp` and `cf`**

`result.json`, the session command `distributions` and `SurfaceOps.distributions` give, at the
wall face nodes, the coordinates `x` and

$$
c_p = 2\,(t_n - p_\infty), \qquad c_f = 2\,\mathbf t\cdot\mathbf s ,
$$

where $\mathbf t$ is the traction of the numerical boundary flux (momentum flux per unit
area), $t_n = \mathbf t\cdot\mathbf n$ its component along the normal that points into the
body, and $\mathbf s = (-n_y, n_x)$ the tangent obtained by rotating that normal by
$+90°$. On a slip wall $t_n$ is the wall pressure, so `cp` is the usual pressure coefficient
$(p - p_\infty)/(\tfrac12\rho_\infty u_\infty^2)$; on a no-slip wall it also contains the normal
viscous stress. `cf` is signed by the direction of $\mathbf s$, exists in 2-D only, and is
zero up to discretization error on a slip wall.

<!-- end level 2 -->

## Units of derivatives

<!-- begin level 2 (Practice) -->
**[L2 Practice] What a derivative is per**

| Input | Unit of the input | Note |
|---|---|---|
| `alpha` | radian | the only angle the in-process discipline knows |
| `alpha_deg` | degree | accepted by the CLI, jobs, sessions, sweeps; the derivative is per degree, i.e. the `alpha` derivative times $\pi/180$ |
| `mach`, `re`, `gamma`, `pr` | dimensionless | |
| `x_surface` | mesh length unit | displacement of each wall geometry node; the derivative has the shape of the input |

A derivative is returned under the name it was requested with, so `alpha` and `alpha_deg`
cannot be confused in a result — but they differ by a factor of about 57.3.

<!-- end level 2 -->
