Test your feel for Bernoulli’s equation by trimming a nozzle to keep the downstream pressure inside a safe head band while gusts, pump boosts, and elevation shifts perturb the flow seeded by your inputs.
Set the calculator inputs, then press play to start balancing head.
Bernoulli's principle links pressure, velocity, and elevation along a streamline, asserting that their energy contributions trade off to keep the total constant. Textbook problems ask for the unknown pressure at a nozzle exit or the speed at a pipe constriction, but without a picture the flow seems static. In reality a fluid parcel accelerates or slows, gaining kinetic energy while surrendering pressure or climbing against gravity. The simulator above turns the algebra into a moving story: a circle representing a parcel slides through a pipe that widens or narrows according to the specified velocities. Three striped bars track how much of the parcel's mechanical energy resides in pressure, kinetic, or potential form. As the parcel approaches a throat, the kinetic bar swells while the pressure bar shrinks, and if the pipe rises, the green potential bar grows. This visualization helps students and engineers connect the terms in Bernoulli's equation to tangible changes in flow. Because everything runs locally in your browser, you can experiment with extreme cases, pause the motion, or export a CSV without installing software.
The calculator requires fluid density , initial pressure , initial velocity , initial elevation , final velocity , and final elevation . All inputs must be finite SI values; the script rejects negative densities or nonnumeric entries. Gravity is taken as m/s². The flow is assumed steady, inviscid, incompressible, and along a single streamline with no pump or turbine adding or removing energy. A fixed time step Δt controls the animation; it is clamped between 0.001 and 0.1 seconds for visual clarity. To depict the pipe geometry, the code infers an upstream cross-sectional area of one square unit; continuity then sets the downstream area by . Heights change linearly along the pipe. These simplifications keep the visualization intuitive while preserving Bernoulli's core energy balance.
Bernoulli's equation for points 1 and 2 reads
.
Solving for the unknown pressure gives
.
The total mechanical energy per unit volume remains constant along the path. The simulator computes at the inlet, then updates each term as the parcel advances, verifying that the sum changes only within numerical error. Deviations appear in the caption as an energy drift percentage. Because the equations are algebraic, the animation does not solve differential equations; instead it interpolates the velocity and height between the endpoints and applies the analytic formulas at each frame.
The particle starts at the left end of the canvas with velocity . Each animation frame advances its position using an explicit Euler step , where interpolates linearly between and . Height follows a similar interpolation. At each new position the code computes pressure from the rearranged Bernoulli equation and updates the energy bars: orange for pressure energy , blue for kinetic energy , and green for potential energy . The bars' widths represent fractions of the inlet total. Because the analytic expression guarantees constant , the integration is numerically stable, but extremely large Δt values can cause the particle to skip past the outlet; therefore the controls bound the step size and allow pausing or resetting if the motion becomes erratic.
A fire hose delivers water (ρ = 1000 kg/m³) from street level to a nozzle 5 m above the pump. The hose enters the pump at 0.1 MPa with speed 2 m/s and exits the nozzle at 25 m/s. Plugging these values into Bernoulli's equation predicts the nozzle pressure:
which evaluates to roughly 33 kPa, indicating a significant pressure drop as kinetic and potential energy increase. Entering these numbers and pressing Play shows the parcel accelerating through a contracting pipe while the orange pressure bar shrinks and the blue kinetic bar dominates. The green bar grows slightly due to the 5 m elevation gain. The caption reports negligible energy drift, confirming numerical consistency. Press Pause at mid-travel to read intermediate values, or download the CSV to analyze how pressure varies with position.
The table contrasts the hose scenario with two variations: a larger outlet velocity and a downhill nozzle. Pressures are computed using the analytic expression above.
| Case | v₂ (m/s) | h₂ (m) | P₂ (kPa) |
|---|---|---|---|
| Baseline | 25 | 5 | 33 |
| Faster stream | 30 | 5 | -19 |
| Downhill | 25 | -2 | 101 |
The canvas renders a horizontal pipe whose diameter tapers to reflect the velocity change dictated by continuity. The parcel's speed is indicated by its horizontal motion, while the pipe's centerline follows the specified elevations. The energy bars beneath the canvas portray the instantaneous partition: orange for pressure, blue for kinetic, green for potential. Their striped patterns ensure legibility without relying on color alone. The figcaption and hidden text summary narrate the current position, pressure, and energy drift for screen-reader users.
The model assumes inviscid, steady, one-dimensional flow with no pumps, turbines, or losses. Real pipes exhibit friction, shocks, and secondary flows at bends. Pressures below vapor pressure can trigger cavitation, an effect absent here. Rapid transients, compressibility, and turbulence also violate the assumptions. The animation's interpolation ignores entrance effects and the true shape of streamlines through complex geometries. Nevertheless, for modest velocities in smooth pipes the simulator captures the essence of Bernoulli's balance.
Future upgrades could add head-loss terms, couple multiple pipe segments, or integrate a Reynolds-number check with the Reynolds Number Calculator. Combining this tool with the Hagen–Poiseuille Flow Simulator or the Venturi Effect Calculator would allow exploration of energy losses and flow measurements in more complex systems.