Shape the aircraft, then fly it
The aircraft is built from NURBS patches. The wing, the tailplane and the fin are each a sheet of control points, and the fuselage is a series of exact circular sections. Dragging a control point updates the surfaces, the mass, the centre of mass and the static margin at once, as previews computed in this page. The program reads the same control points and flies the aircraft as one rigid body.
Longitudinal static stability browser preview
The start and its trim browser preview
The program starts each flight from its trim, the state in which nothing accelerates (Guide, Part III). The page computes the same trim with its own copy of the strip model. The second group lists the loads of level flight at the stated thrust, which the trim removes.
Body axes: x forward, y to port and z up. A positive pitching moment M_y turns the nose down.
The flight
The aircraft starts in trim. Before the flight, the program solves an optimization for the pitch, the constant elevator deflection and the thrust at which nothing accelerates (Guide, Part III). The thrust entered here is where that search begins. Each control then moves once, as a smooth pulse about the trim. These values and the geometry of Design together form the setup.
Questions to explore
Each question sets up an experiment in one click, and its flight is recorded in this page. Open Results, and read the lines marked Notice and Ask yourself.
Start and air
Controls
March and skins
Results
One result is shown at a time, with the setup saved alongside it. A result is separate from the setup being edited in Design and Fly. Editing that setup never changes a result, and each result is drawn with its own saved geometry.
How the simulator works
The Guide has three parts, each a tab below: the geometry and the mass, the aerodynamics and the flight, and the equations as the program solves them. The panel on the left lists the sections of the open part. Its figures are of three kinds and each is marked. A browser preview is computed in this page from the current setup of Design and Fly, by the page's own copy of the model. A solver result is drawn from the result selected in Results, which the program computed on the machine. An illustration depends on neither.
What the model covers, and what it leaves out
- One rigid body. The aircraft has six degrees of freedom and nothing else: no part flexes, the control surfaces are not bodies of their own, and the point masses stay where they are placed, so no fuel is burnt.
- Quasi-steady strips. The load of each strip of a lifting surface follows from its velocity at that instant alone, by (4) and (5). There is no unsteady aerodynamics: no lag of the lift and no apparent mass.
- No stall. The lift coefficient is linear in sin α without limit, the profile drag coefficient is constant, and the induced drag takes a fixed efficiency e = 0.8.
- No interaction between the surfaces. The finite span enters only through each surface's own aspect ratio, in the lift slope of (4) and in the induced drag of (5). The wing's downwash and wake at the tail are not solved. Each strip of the tail sees the rigid body's velocity and nothing of the wing. The fuselage contributes a drag area, and no lift or moment.
- A plain engine and plain air. The thrust is constant and acts along the body's x at the engine. The air is still and of one density, and gravity is uniform at 9.81 m/s². There is no ground.
- Prescribed controls. Each control moves once, as the pulse (15), and adds aτδ to the lift coefficient of its surface, with τ = 0.15 for the ailerons and τ = 0.5 for the elevator and the rudder.
- A trimmed start, of three designs. The flight starts from its trim: the pitch of the start, a constant deflection of the elevator and the thrust, found so that nothing accelerates (17)–(19). The speed is stated, not found, and the angle of attack is not bounded. Results of the program before the trim started level at the thrust stated, out of balance.
These statements describe the model as the page's copy of it and the laws (13) and (14) state it: the load reads only the airspeed, the turning rate and the controls. For every result shown, Results compares the page's copy with the program's own record of the aircraft, and with its trim, or for a result without one, the power at the first instant.
Geometry and mass
The control points of Design are the whole description of the aircraft's shape. The mass, its centre and the inertia follow from them by integration.
The geometry is NURBS
Each patch is a tensor product of rational B-splines. A point of a sheet at the parameters (u, v) is
with P the control points, w their weights, and N, M the B-spline functions of uniform open knot vectors. Along the span a surface of n stations has the degree min(2, n − 1): two for the wing and the tailplane, and one for the fin, whose two stations leave room for a straight line only. Along the chord the degree is one, so that every section is a straight chord. The functions are never negative and sum to one, so a point of the surface is a weighted average of the control points. Figure 1 shows the weights along the wing's span.
The fuselage has the degree min(2, n − 1) along its n sections and two around each. A section is a circle of nine control points with weights 1 and √2/2. A circle is rational: no polynomial spline, all of whose weights are equal, can draw it exactly (Figure 2). Twist, taper, sweep and dihedral are nothing but the places of control points.
- Control point
- A point that pulls the surface toward itself (Figure 1). The surface passes through the end points and near the others. Its weight sets how strongly it pulls (Figure 2).
Mass, centre and inertia are integrals
Each skin has an areal density ρ_A. Gauss's rule on every cell of every patch gives
with dA. The integral is taken on the parameter square and carried to the surface by the map (1): Figure 3 shows the same Gauss points in both places. Moving a control point moves the points of the surface and their areas, which is why the centre of mass in the drawing moves as you drag.
The point masses (engine, pilot, fuel) are added at their places. The inertia (3) is taken about the centre of mass, so that the rotation and the translation of the rigid body separate.
Aerodynamics and flight
The air's load on the lifting surfaces, the motion it drives, and what the Design view and a run can and cannot say about stability.
The air's load, strip by strip
At each Gauss point u along the span, a strip has its quarter-chord point x, chord vector c, span tangent s and normal n. It moves at v; v_p is the part normal to the span, and
Here α is the angle of attack of the strip, and κ₀ is the wing's lift offset: a number added to sin α, positive for a cambered section, and zero for the tailplane and the fin. It is the entry the program calls zero_lift_angle, but it is not that angle. With the control neutral the lift of a wing strip vanishes at α = −asin κ₀, which is −2.01° for the default 0.035. The program's name is kept and the value is sent unchanged. Only the page's label and symbol differ.
Figure 4 shows one strip from its side: the angle of attack is the angle between the chord and the strip's own velocity, the lift is perpendicular to that velocity and the drag is along it.
The aspect ratio A of each surface comes from its own span and area. Because v includes ω × r, the loads that depend on the turning rate come out of the same integral: no stability derivative is typed in anywhere. Whether a motion dies away is then a property of a run, not an input. Summed along the span, the strips give the loading of Figure 5.
- Elevator, ailerons, rudder
- The controls of pitch, roll and yaw. Here each changes the lift coefficient of its surface by aτδ, on opposite sides for the ailerons.
The flight is a Lagrangian with virtual work
The aircraft is one rigid body: the displacement u of its centre of mass and the Euler parameters (η, ε) of its rotation. Gravity has a potential, but lift, drag and thrust have none, so they enter by the principle of Lagrange and d'Alembert:
Figure 6 draws these loads at the trimmed start of a flight. They balance there: their sum and their moment about the centre of mass vanish, which is what the trim (17)–(19) asks. The page finds the trim of its own copy of the model by the same three laws.
The airspeed and turning rate in the body's axes, and the load itself, are unknowns of their own, each with its law. The load's expression is therefore written once, as the laws (13) and (14), and the motion rows read it through F and M instead of repeating it (Figure 7). Written once is not evaluated once: at every instant Newton's method evaluates all the residuals, and their linearization, at each of its iterations, and a DIRK step does so at each of its stages.
The work of the load changes the energy E = T + V of the body:
where the load is the air's and the engine's together. The program does not solve for (7). After the march it evaluates both sides and reports how far apart they are, and Results plots them and their difference.
Longitudinal static stability
The Design view reports one measure of stability, and it is a static one. In the axes of the page, x forward, y to port and z up, a positive pitching moment M_y about the centre of mass turns the nose down. At one operating point, the speed of Fly with no turning rate and the controls neutral, the page changes the angle of attack by ±0.01 rad and takes the central differences of the normal force F_z and of M_y:
- Neutral point
- The point along x about which the aircraft's pitching moment does not change with the angle of attack.
- Static margin
- The distance from the neutral point forward to the centre of mass, divided by the wing's mean chord S/b (Figure 8). It is positive when the centre of mass lies ahead of the neutral point. Then, with the normal force growing with the angle of attack, ∂M_y/∂α > 0 in these axes: a nose-down moment that grows with the angle of attack. This is the condition written C_mα < 0 in the usual convention, where y points to starboard.
- Static and dynamic stability
- A positive static margin states the initial tendency after a small change of the angle of attack, at that operating point. It does not state that the motion which follows dies away. That is dynamic stability, a property of the response in time, and an aircraft of positive static stability can still have an oscillation that grows. The FAA's Pilot's Handbook of Aeronautical Knowledge (FAA-H-8083-25, on the aerodynamics of flight) draws the same distinction. The page therefore concludes nothing about damping from the margin: fly the aircraft and read the result.
Reading a run
What the aircraft does after the first instant is known only from a run. Figure 9 draws the height and the speed of the result selected in Results. The same result is replayed and plotted there with its saved setup.
- Phugoid
- The slow exchange of speed for height of an aircraft disturbed from steady flight. Lanchester's estimate of its period is π√2·V/g, from energy alone, with the lift taken as proportional to the square of the speed. It is quoted under the figure for comparison, not as a property of this model.
Equations and implementation
The flight is one rigid body, written as differential equations of the first order and algebraic laws: 36 unknowns at each instant and 36 equations to match. They are read from mechanism % body and mechanism % virtual_work in multibody_dynamics.f90, and from the laws of flight_dynamics.f90.
The unknowns
| Symbol | Count | Meaning |
|---|---|---|
| q = (u, η, ε) | 7 | the displacement of the centre of mass, and the Euler parameters of the rotation |
| v | 7 | the rates of q |
| a | 7 | the rates of v |
| λ, μ, ν | 3 | the reactions that keep η² + |ε|² = 1 |
| V, Ω | 3 + 3 | the airspeed and the turning rate, in the body's axes |
| F, M | 3 + 3 | the force and the moment of the air and the engine, in the body's axes |
The differential equations
The states are q and v, fourteen in all. For each k = 1, …, 7:
The motion rows are the Euler–Lagrange equations with the virtual work of (6). Their terms:
- The Lagrangian L = T − V, with T and V = −m g·u.
- The angular velocity in the body's axes, ω = 2(η v_ε − v_η ε − ε × v_ε).
- The norm's gradient G = ∂c/∂q, where c = η² + |ε|² − 1.
- The weights W_k: the mass m for the three rows of the displacement, and 4 tr(J)/3 for the four of the Euler parameters. They only scale the rows, so that each multiplier pairs with its row as work.
- The generalized force of the load: Q_{1:3} = R F, the force turned into the ground's axes, the columns of R being the body's axes; and Q_{4:7} = 2 Eᵀ M.
The rate d/dt ∂L/∂v_k is expanded in the accelerations a, so the motion rows are algebraic in a.
The algebraic laws
Fifteen rows. First the norm of the Euler parameters, at three levels, which removes the index of the constraint:
Then the airspeed and the turning rate in the body's axes, i = 1, 2, 3:
Then the load, the force and its moment about the centre of mass:
Here dF is the strip load (5), and the controls are the pulses
The initial data and the classical form
Sixteen conditions at t = 0:
so that the aircraft starts flying horizontally, pitched by the trim's θ₀ (17), positive nose up, with ω₀ = 0. Its angle of attack at the start is then θ₀ too.
The program never writes the classical form: it writes the rows of the Lagrangian above. They are equivalent to the thirteen Newton–Euler equations that most textbooks give:
The rotation rows are Euler's equations in the body's axes.
The trim, as an optimization
The flight starts from the state in which nothing accelerates. The program does not guess it. It finds it by the same machinery as any design: a Lagrangian with an objective and laws, made stationary by the design iteration. The design is three numbers, s = (θ₀, δ₀, T): the pitch of the start (16), a constant elevator deflection added to the pulse (15), and the thrust. The Lagrangian lives on the first two steps of the flight, an interval of length Δ:
The objective is the thrust. The laws (18) say that the centre of mass accelerates neither forward nor up, and that the body does not start to pitch. Each is a functional of the state, an integral over the manifold, so its gradient in s costs one reverse sweep, not a finite difference. The bounds (19) keep the elevator within its travel and the thrust positive.
Stationarity reads three ways. In the multipliers it returns the flight's laws and (18). In the state it returns the adjoint equations, one sweep backwards over the two steps. In the design it returns
Started from the untrimmed design s = (0, 0, 800 N), the default aircraft at 50 m/s needs four iterates (commit dbb5d45):
| Iterate | θ₀ (deg) | δ₀ (deg) | T (N) | largest |c| |
|---|---|---|---|---|
| 1 | 0 | 0 | 800 | 1.24 |
| 2 | −0.5146 | 2.8717 | 727.06 | 9.8 × 10⁻⁴ |
| 3 | −0.515090 | 2.873118 | 732.2830 | 8.6 × 10⁻⁸ |
| 4 | −0.515089 | 2.873118 | 732.2830 | 2.5 × 10⁻¹⁴ |
The violation squares at every iterate. That is Newton's method: with three laws in three designs, each step solves the linearized laws exactly. The multipliers are π = (−612.9, −26.7, 9.94), and −π_k is the rate at which the thrust grows when the k-th law asks for one unit of its acceleration instead of zero. The first is close to −m = −611.5 kg, as it should be: one more newton of thrust buys 1/m of forward acceleration, and the rest is the thrust's share in the lift and the moment through the engine's offset. The bounds are not active, so μ = 0. The page solves the same three laws with its own copy of the model, by Newton's method, and shows the result in Design's card of the start and in Figure 6. Flown for 60 s from the trim, the program holds the height and the speed, and the energy changes by 4 × 10⁻⁶ J.
Two honest remarks. First, three laws in three designs leave a single feasible point, so the objective T selects nothing yet. It starts to choose once a fourth design is free, the speed or the angle of climb: then the trim is the cheapest of many steady flights. Second, the angle of attack is not bounded. At this trim it is −0.515°, far from the stall.
Three remarks that connect the pieces
- Potential against virtual work. Gravity has a potential, so it enters through L. Lift, drag and thrust have none, so they enter only through Q. That one difference is why the library needed
mechanism % virtual_work, and it is why the energy is not conserved but changed by the load's work (7). - Unknowns, not formulas. V, Ω, F and M are unknowns with laws of their own, not substituted formulas. Substituting them made the expression tree copy the body's rotation into every strip: 5.6 GB and 25 s for ten steps. As unknowns, the same physics takes 0.44 s with the same digits.
- Euler parameters, not Euler angles. The rotation has no singularity at 90 degrees of pitch. The price is one constraint, c = 0, held at three levels (11) with its three reactions λ, μ, ν.
What the program records
A result is the program's records, as the program returns them. Results shows nothing else as a solver result.
| Record | Holds |
|---|---|
setup | every entry of the setup as the program received it |
aircraft | the mass, the centre of mass, the inertia, and each surface's area, span and lift slope |
instant | at each recorded instant: t; place, the centre of mass in the ground's axes; euler, the Euler parameters; speed, |V|; alpha, which is −Vz/|V| in the body's axes and has no unit; energy, E; power, F·v + M·ω |
balance | the energy change, the work of the load and the largest difference between them during the march |
Two quantities are not in the records, and the page does not make them up.
- The aircraft's angle of attack. With x forward, y to port and z up it is α = atan2(−V_z, V_x). The record
alphais −V_z/|V|: the sine of that angle only when the sideslip V_y is zero, and never the angle itself. Since V_x and V_y are not recorded, Results plots the recorded quantity under its own name and converts nothing. Should the program record the airspeed in the body's axes, as three numbers namedairspeed_bodyat each instant, the page plots the angle of attack and reports the sideslip angle from it. - The work of the load at each instant. The program records the power at each instant and the work at the end only. Results rebuilds the curve of the work from the recorded power by the trapezoid rule, and says how its end compares with the program's own figure. Where a result is recorded at a stride of the solver's steps, the two differ, and the page says so. Should the program record a series named
work, the page plots that instead.
Using the page
- Design: pick a patch and a projection. Drag an amber control point. With Mirror on, its partner on the other side follows. Type exact values in the fields under the drawing. The ledger on the right is a browser preview and updates as you drag.
- Fly: set the speed, the thrust and the pulses. Design and Fly together are the setup.
- Results: one result with the setup saved with it, a flight recorded in this page. The page says where the current setup differs from that result’s, and remembers the result you chose when the page is opened again in this browser.