Gyredocs
Depth Practice
API

Gyre/User Guide

Cases

In one minuteA case specification is one document describing mesh, flow conditions, discretization, solver controls and reference quantities. Presets cover common configurations; dotted-path overrides adapt them; the same document works in the CLI, the API, pipelines and agent tools.

Written at L2 Practice goes to L3 Mechanics 3237 words Markdown

Presets#

preset description elements DOF model
naca0012_euler Inviscid subsonic flow over a NACA 0012 aerofoil (M=0.5, alpha=2 deg). 256 9,216 Euler, 2-D
naca0012_laminar Laminar flow over a NACA 0012 aerofoil (M=0.5, alpha=1 deg, Re=5000). 480 17,280 Navier–Stokes, 2-D
naca2412_euler Inviscid flow over a cambered NACA 2412 aerofoil (M=0.4, alpha=1 deg). 256 9,216 Euler, 2-D
naca0012_transonic Transonic inviscid flow over a NACA 0012 aerofoil (M=0.8, alpha=1.25 deg) with sensor-based shock capturing. 1024 36,864 Euler, 2-D
naca0012_euler_3d Spanwise-periodic 3-D extrusion of the inviscid NACA 0012 case (hexahedra): exercises the 3-D operators, solver and adjoint; coefficients per unit span. 192 25,920 Euler, 3-D
cylinder_re40 Steady separated laminar flow past a circular cylinder (Re_D=40, M=0.2). 240 15,360 Navier–Stokes, 2-D
sphere_euler Inviscid subsonic flow past a sphere (M=0.2) on a cubed-sphere mesh of curved hexahedra: a genuinely 3-D, unstructured-topology case whose exact solution has no drag and no entropy rise. 216 29,160 Euler, 3-D
sphere_re100 Steady laminar flow past a sphere (Re_D=100, M=0.2): 3-D Navier-Stokes with a closed recirculation bubble; drag referred to the frontal area. 576 77,760 Navier–Stokes, 3-D
flat_plate_sa Turbulent flat plate at zero pressure gradient (M=0.2, Re=5e6 per unit length) with the Spalart-Allmaras model: the NASA Turbulence Modeling Resource verification case on a coarse wall-resolved mesh. 150 6,750 Navier–Stokes, 2-D
bump_euler Inviscid subsonic channel flow over a smooth Gaussian bump (M=0.5): the exact solution is isentropic, so the entropy error measures accuracy. 48 3,072 Euler, 2-D

Anatomy of a specification#

yaml
name: my_aerofoil
mesh:
  generator: airfoil_omesh
  geometry_order: 4
  params: {code: "2412", n_surf: 48, n_radial: 12, r_far: 50.0, first_cell: 0.02}
flow:
  mach: 0.4
  alpha_deg: 1.0
  reynolds: null          # null = inviscid; a number switches on Navier–Stokes
discretization:
  order: 3                # polynomial degree p (accuracy p + 1); viscous cases need p >= 1
  surface_flux: roe
solver:
  levels: auto            # p-multigrid: p, p//2, …, 0
  tol_rel: 1.0e-10
reference:                # optional: normalisation of the force and moment coefficients
  moment_center: [0.25, 0.0]

The mesh comes from one of the built-in generators or, with generator: file, from a mesh file.

Any field can be overridden by its dotted path — on the command line (--set flow.mach=0.6), in a job request ("overrides": {"flow.mach": 0.6}) or in a pipeline stage. Unknown paths are rejected (by the service with a hint); values are validated against the schema.

A --set value is read as JSON (numbers, true/false, null, lists); anything else is text. A number or true/false given for a field that holds text stays text, so --set mesh.params.code=2412 is the string "2412"; a quoted JSON string ('"2412"') is always a string.

generator parameters (defaults) boundary groups
airfoil_omesh code (“0012”) or coordinates (list of [x, y] in Selig order, unit chord), n_surf (48, even), n_radial (16), r_far (30), first_cell (0.02), wall_blend (0.6), nz (0), span (1) wall, farfield
annulus n_theta (required), n_r (required), r_inner (0.5), r_outer (20), ratio (1.25), nz (0), span (1) wall, farfield
bump_channel nx (required), ny (required), height (0.0625), sigma (25), x_lim ([-1.5, 1.5]), y_top (0.8), beta_x (0), ratio_y (1) inflow, outflow, wall, top
flat_plate nx (12), ny (10), h_wall (5e-5), nx_up (3), dx_le (0.02), length (2), upstream (0.33), height (1), nz (0), span (1) inflow, outflow, wall, top, symmetry
sphere_shell n (4), n_r (4), r_inner (0.5), r_outer (10), ratio (1.4), axes ([1, 1, 1]), orientation (“mixed”), bc (none) wall, farfield
box nel (required), lo (zeros), hi (ones), periodic (false), warp (0), bc (none) xmin … zmax
file path (a Gmsh .msh or Gyre .npz file), scale (1) the physical groups of the file

file reads an external mesh; mesh.geometry_order then has no effect, because the file carries its own degree. Formats, the Gmsh recipe, the checks and the service’s mesh store are described under Mesh files.

coordinates replaces the NACA section by a spline fit of arbitrary aerofoil data (trailing edge → upper surface → leading edge → lower surface → trailing edge). nz > 0 extrudes an aerofoil, cylinder or flat-plate section into a spanwise-periodic 3-D mesh of hexahedra (at least three elements across the span). first_cell is the height of the first cell at the wall in chords, measured along the grid line; wall_blend scales the tangent with which the grid lines leave the wall, in units of the line length.

An extruded mesh has the boundary groups of its section and no boundary across the span, and its force coefficients are per unit span (the default reference.area is span). With nz and span the turbulent preset flat_plate_sa becomes a 3-D case with six conserved variables; the wall distance of the turbulence model is that of the section in every spanwise plane. An extruded case with viscous terms or with shock capturing is not the same discrete problem as its section, though. The default penalty of the viscous scheme, which the artificial viscosity of shock capturing uses as well, is the number of faces of an element, 6 for hexahedra and 4 for quadrilaterals (penalty parameter), so the two solutions differ as two discretizations of one flow do, not by round-off. And at any penalty the scheme leaves a viscous extruded solution with a small spanwise velocity that changes sign across the mid-plane of every element. It is driven by the jumps of the in-plane velocity between elements: inside an element the viscous stress is built from the gradient lifted from all faces, on a spanwise face from the local gradient alone.

What the parameters without a description above mean:

generator parameter meaning
annulus n_theta, n_r elements around the circle and in the radial direction (positive integers)
r_inner, r_outer radii of the wall circle and of the far-field circle
ratio geometric growth of the radial element size from the wall outwards
nz, span 0 for a 2-D section, or at least 3 elements across a spanwise-periodic extrusion of width span
bump_channel nx, ny elements along and across the channel
height, sigma the lower wall is y=height⋅e−sigma x2y = \texttt{height}\cdot e^{-\texttt{sigma}\,x^2}
x_lim, y_top the channel extends over x_lim (an increasing pair) and up to y_top
beta_x strength of the tanh clustering of the elements in xx (0: uniform)
ratio_y geometric growth of the element height from the lower wall (1: uniform)
flat_plate nx, nx_up, ny elements along the plate, upstream of its leading edge, and across the domain
h_wall, dx_le height of the first element at the wall and length of the first element at the leading edge; both grow geometrically away from there
length, upstream, height the plate occupies 0≤x≤0 \le x \le length of the lower boundary; the domain starts upstream ahead of it (group symmetry) and is height high
nz, span 0 for the 2-D section, or at least 3 elements across a spanwise-periodic extrusion of width span
sphere_shell n, n_r each of the six blocks of the cubed sphere has n × n × n_r hexahedra (6n2nr6 n^2 n_r in total)
r_inner, r_outer radius of the body and of the spherical far-field boundary
ratio geometric growth of the radial element size from the wall outwards
axes semi-axes of the body relative to r_inner: [1, 1, 1] is a sphere, anything else an ellipsoid
orientation mixed rotates the local axes of the blocks against each other (all eight relative face orientations occur); aligned keeps the radial direction as the third local axis
bc renames the two groups, e.g. {wall: body}
box nel elements per direction: a list of 2 or 3 positive integers, which also sets the dimension
lo, hi opposite corners, one number per direction
periodic true/false, or one per direction
warp amplitude, as a fraction of the box size, of a smooth interior distortion that leaves the boundary planes in place (curvilinear verification meshes)
bc mapping from block sides to boundary-group names, to rename the default groups xmin … zmax

params are validated against the generator: an unknown, missing or mistyped parameter is a validation error (422 from the service). pg is not a parameter (set mesh.geometry_order), code must be a quoted 4-digit string, nz is 0 or at least 3, and span is positive.

Defaults follow the generator and the flow model: walls are slip_wall for inviscid and noslip_adiabatic for viscous cases; outer boundaries are farfield; the bump channel and the flat plate use total_inlet / pressure_outlet (the plate also symmetry ahead of its leading edge and farfield on top). A box and a mesh file have no defaults: give a condition for every non-periodic side of the box, and for every boundary group of the file. A missing one is reported when the case is built, not by validation of the specification alone; the service does report it for a mesh file, at POST /cases/validate and on submission, because it reads the stored mesh. A condition for a group the mesh does not have is an error. Override per group:

yaml
discretization:
  boundaries: {wall: noslip_isothermal}
flow:
  reynolds: 500
  extra: {t_wall: 1.2}

Available: farfield, slip_wall, symmetry, slip_wall_mirror, noslip_adiabatic, noslip_isothermal, pressure_outlet, total_inlet (formulation).

flow.extra holds boundary data and one model switch, all as plain numbers: t_wall, p_back, pt_in, tt_in (ratios to the free-stream static values) and suth, the non-dimensional Sutherland temperature S/T∞S/T_\infty — when present, the viscosity follows Sutherland’s law instead of being constant (governing equations).

Three conditions read data from flow.extra: noslip_isothermal needs t_wall, pressure_outlet needs p_back, and total_inlet needs pt_in and tt_in. The bump channel and the flat plate supply defaults: the isentropic total conditions of flow.mach for pt_in and tt_in, and p_back = 1. Elsewhere a missing entry is a validation error that names the boundary group, the condition and the key.

field default meaning
mach 0.5 free-stream Mach number
alpha_deg 0 angle of attack in degrees
beta_deg 0 sideslip angle in degrees (3-D only); the free stream points along (cos⁡αcos⁡β, sin⁡αcos⁡β, sin⁡β)(\cos\alpha\cos\beta,\ \sin\alpha\cos\beta,\ \sin\beta)
reynolds none Reynolds number formed with the unit length of the mesh; null or absent means inviscid (Euler)
turbulence none sa adds the negative Spalart–Allmaras model (formulation); it needs reynolds
prandtl, gamma 0.72, 1.4 Prandtl number and ratio of specific heats

With turbulence: sa two more entries of flow.extra are read: chi_inf, the free-stream ratio ν~/ν\tilde\nu/\nu (default 3), and prt, the turbulent Prandtl number (default 0.9). Mach number, angles, Reynolds number and these model data are differentiable inputs of the discipline.

The reference section sets what the force and moment coefficients are normalised with. The defaults suit the generators (unit chord, quarter-chord moment point); a mesh file usually needs its own.

field default meaning
area 1 in 2-D; the span of a spanwise-extruded generator mesh in 3-D; the frontal area of the body of a sphere_shell mesh reference area (a length in 2-D)
length 1 reference length of the moment coefficient
moment_center [0.25, 0.0, 0.0] point about which the moment is taken (two or three coordinates)
groups every wall group of the mesh wall boundary groups over which the force, moment and heat-flux coefficients are integrated: the loads of one component, e.g. groups: [wing] on a mesh whose walls are wing and fuselage. Their derivatives and error estimates follow. The nodal loads f_surface and the displacement x_surface always cover all walls
components none named components of the walls, each a list of wall groups: components: {wing: [wing], tail: [htail, vtail]}. Every force, moment and heat-flux coefficient is then also an output per component, cd_wing, cl_tail, …, from the same solve. Each is an output like any other: it can be named in gradients.of, error_estimate and adapt.output. Names consist of letters and digits

A wall group is a boundary group with a wall condition (slip_wall, symmetry, slip_wall_mirror, noslip_adiabatic, noslip_isothermal). Without groups the coefficients are integrated over all of them; groups restricts them to the named ones. The coefficients of a component cover the groups of that component in either case.

field default choices and when to change them
order 2 polynomial degree pp, 0 to 8 (design accuracy p+1p+1); viscous cases need p≥1p \ge 1
two_point_flux ranocha volume flux. ranocha and chandrashekar are entropy conservative (keep one of them for production); kennedy_gruber preserves kinetic energy only; central is the unsplit form, for comparisons
surface_flux roe interface flux. roe and hllc are the classical solvers; es_roe has the same wave-by-wave dissipation as roe and, like the more dissipative llf, a proven entropy inequality when the volume flux is entropy conservative
shock_capturing false sensor-based artificial viscosity; switch on for flows with shocks
av_coef 1 scale of that viscosity, in (0,10](0, 10]
field default range meaning
levels auto list of degrees, auto, single p-multigrid degrees fine→coarse; auto is p,⌊p/2⌋,…,0p, \lfloor p/2\rfloor, \dots, 0; single for block Jacobi only
tol_rel 1e-10 (0,1)(0, 1) residual reduction, relative to the residual of the free stream, at which the solve counts as converged
max_steps 150 1 to 5000 limit on nonlinear (pseudo-time) steps
cfl0 5 >0> 0 pseudo-time CFL number of the first step of a cold start
cfl_growth 10 ≥1\ge 1 largest factor by which the CFL number may grow after an accepted step
cfl_shrink 1 (0,1](0, 1] factor applied to the CFL number after an accepted step that the line search shortened to a quarter or less (1: the CFL number is held)
lin_tol 1e-2 (0,1)(0, 1) relative tolerance of each linear solve (the forcing term of the inexact Newton iteration)
krylov_dim 40 5 to 400 size of the GMRES basis between restarts; memory grows with it
restarts 2 1 to 50 GMRES cycles per linear solve, so at most krylov_dim × restarts iterations
smoother jacobi jacobi, gmres, line multigrid smoother: damped block Jacobi, block-Jacobi-preconditioned GMRES, or line Jacobi (exact solves along lines of strongly coupled elements, for wall-resolved meshes; block Jacobi where the mesh has no such lines)
precond_precision double double, single precision in which the blocks of the smoother are assembled, stored and applied. single halves their memory, which is what bounds a 3-D problem on one device; the residual, its Jacobian products, the Krylov vectors and every inverse stay in double precision, so the answers do not change (measured)
precond_lag 1 1 to 50 assemble the blocks of the smoother every this many nonlinear steps and reuse them in between; the linear systems stay exact, only their preconditioner ages

Which of these to change when a solve does not converge: Troubleshooting.

POST /api/v1/cases/validate (or the agent tool validate_case) resolves a case without solving it and returns the element count, degrees of freedom, block size and the device the service would choose. The digest in the response identifies the exact specification; a job with the same specification and the same requests is served from the result cache as long as the code is unchanged. For a case on a mesh file the digest and the cache key cover the contents of the file, not its name.

Full schema#

CaseSpec — Complete, serialisable description of a steady flow analysis.

field type default description
name string case (max length 80, pattern ^[A-Za-z0-9_.-]+$)
description string
mesh MeshSpec *required*
flow FlowSpec
discretization DiscretizationSpec
solver SolverSpec
reference ReferenceSpec

MeshSpec — Built-in mesh generator and its parameters, or a mesh file (generator: file).

field type default description
generator airfoil_omesh | annulus | bump_channel | flat_plate | sphere_shell | box | file *required* Name of the built-in mesh generator, or ‘file’ for an external mesh (params: path, optional scale; Gmsh .msh 2.2/4.1 ASCII or Gyre .npz).
params mapping Keyword arguments of the generator (e.g. n_surf, n_radial, r_far, code); unknown, missing or mistyped arguments are validation errors.
geometry_order integer 4 Polynomial degree of the curved elements (generators only: a mesh file carries its own degree). (≥ 1, ≤ 8)

FlowSpec — Free-stream / reference flow conditions (all differentiable inputs).

field type default description
mach number 0.5 Free-stream Mach number. (> 0.0, < 5.0)
alpha_deg number 0.0 Angle of attack in degrees. (≥ -90.0, ≤ 90.0)
beta_deg number 0.0 Sideslip angle in degrees (3-D only; ignored in 2-D). Free-stream direction: (cos a cos b, sin a cos b, sin b). (≥ -90.0, ≤ 90.0)
reynolds number or null None Reynolds number (unit reference length); null means inviscid.
prandtl number 0.72 (> 0.0)
gamma number 1.4 (> 1.0)
turbulence none | sa none Turbulence closure: ‘none’ (laminar or inviscid) or ‘sa’ (negative Spalart-Allmaras RANS model; requires reynolds).
extra mapping Additional boundary data: p_back, pt_in, tt_in, t_wall, suth; with turbulence ‘sa’ also chi_inf (free-stream nu_tilde/nu, default 3) and prt (turbulent Prandtl number, default 0.9).

DiscretizationSpec — Spatial discretization.

field type default description
order integer 2 Solution polynomial degree p (accuracy p+1); viscous cases need p >= 1. (≥ 0, ≤ 8)
two_point_flux ranocha | chandrashekar | kennedy_gruber | central ranocha
surface_flux roe | es_roe | hllc | llf roe Interface flux: ‘roe’ and ‘hllc’ are the classical solvers; ‘es_roe’ (matrix dissipation in entropy variables) and ‘llf’ (scalar dissipation) are entropy stable with an entropy-conservative two_point_flux.
shock_capturing boolean False Sensor-based artificial viscosity for flows with shocks.
av_coef number 1.0 Artificial-viscosity scale (multiples of h/p * (|u|+c)). (> 0.0, ≤ 10.0)
boundaries mapping Boundary group -> condition; defaults are chosen per generator.

SolverSpec — Nonlinear and linear solver controls.

field type default description
levels list of integer or auto | single auto p-multigrid degrees fine->coarse, ‘auto’ (p, p//2, …, 0) or ‘single’.
tol_rel number 1e-10 (> 0.0, < 1.0)
max_steps integer 150 (≥ 1, ≤ 5000)
cfl0 number 5.0 (> 0.0)
cfl_growth number 10.0 (≥ 1.0)
cfl_shrink number 1.0 Factor applied to the CFL number after a step that the line search shortened to a quarter or less (1: hold the CFL). (> 0.0, ≤ 1.0)
lin_tol number 0.01 (> 0.0, < 1.0)
krylov_dim integer 40 (≥ 5, ≤ 400)
restarts integer 2 (≥ 1, ≤ 50)
smoother jacobi | gmres | line jacobi Smoother of the p-multigrid levels: damped block Jacobi, block-Jacobi GMRES, or line Jacobi (block-tridiagonal solves along lines of strongly coupled elements of an anisotropic mesh; block Jacobi where the mesh has none).
precond_lag integer 1 Assemble the blocks of the smoother every this many nonlinear steps (1: every step). In between, the last blocks are reused. (≥ 1, ≤ 50)
precond_precision double | single double Precision in which the blocks of the smoother are assembled, stored and applied. ‘single’ halves their memory, which is what bounds the size of a 3-D problem on one device; the residual, its Jacobian products, the Krylov vectors and the inverses stay in double precision, so the solution is unchanged and only the iteration count can differ.

ReferenceSpec — Reference quantities of the force and moment coefficients.

field type default description
area number or null None Reference area (length in 2-D). Default: 1 in 2-D, the span of a spanwise-extruded generator mesh in 3-D, the frontal area of the body of a sphere_shell mesh.
length number 1.0 Reference length of the moment coefficient. (> 0.0)
moment_center list of number Point about which the moment is taken.
groups list of string or null None Wall boundary groups over which the force, moment and heat-flux coefficients are integrated (the loads of one component). Default: every wall group of the mesh. The nodal load field f_surface and the surface displacement x_surface always cover all walls.
components mapping or null None Named components of the walls, each a list of wall boundary groups. Every force, moment and heat-flux coefficient is then also an output per component, named _ (cd_wing, cl_tail, …), from the same solve and with its own derivatives. Names are letters and digits.

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