Fluid Mechanics Programs
Interactive Python simulations and Fortran code for computational fluid dynamics
These Python programs run directly in your browser using Pyodide (WebAssembly Python). The first run downloads the Python environment (~15MB). Click "Run" to execute!
Pipe Flow (Hagen-Poiseuille)
Analytical solution for laminar flow in a circular pipe (Hagen-Poiseuille flow)
Click Run to execute the Python code
First run will download Python environment (~15MB)
Fundamental Equations of Fluid Mechanics
Navier-Stokes Equations
The fundamental equations governing viscous fluid motion:
Conservation of Mass (Continuity):
For incompressible flow: $\nabla \cdot \mathbf{v} = 0$
Conservation of Momentum:
Material derivative: $\frac{D\mathbf{v}}{Dt} = \frac{\partial \mathbf{v}}{\partial t} + (\mathbf{v} \cdot \nabla)\mathbf{v}$
In component form (Cartesian, incompressible):
Bernoulli Equation
For steady, inviscid, incompressible flow along a streamline:
$p$ = static pressure [Pa]
$\frac{1}{2}\rho v^2$ = dynamic pressure [Pa]
$\rho g h$ = hydrostatic pressure [Pa]
Total head form:
Continuity Equation
Mass conservation for steady flow:
For incompressible flow:
$Q$ = volumetric flow rate [m³/s]
$\dot{m}$ = mass flow rate [kg/s]
Hagen-Poiseuille Flow (Laminar Pipe Flow)
Velocity profile (parabolic):
Maximum velocity (at centerline):
Average velocity:
Volumetric flow rate:
Wall shear stress:
Darcy friction factor (laminar):
Stream Function $\psi$
For 2D incompressible flow, automatically satisfies continuity:
Properties:
- $\bullet$ Lines of constant $\psi$ are streamlines
- $\bullet$ $\psi_2 - \psi_1 = Q$ (volume flow between streamlines)
- $\bullet$ $\nabla^2 \psi = -\omega$ (relates to vorticity)
Vorticity $\boldsymbol{\omega}$
Measure of local rotation in fluid:
In 2D:
Vorticity transport equation:
Boundary Layer Theory
Blasius equation (flat plate):
With similarity variable:
Boundary layer thickness (99%):
Displacement thickness:
Momentum thickness:
Skin friction coefficient:
Potential Flow Elements
Uniform Flow
Source/Sink
Free Vortex
Doublet
Flow Around Cylinder
Rankine Vortex
Important Dimensionless Numbers
Reynolds Number
Inertia / Viscous forces
Mach Number
Flow / Sound speed
Froude Number
Inertia / Gravity forces
Euler Number
Pressure / Inertia forces
Weber Number
Inertia / Surface tension
Strouhal Number
Oscillatory / Mean flow