Calculator
Example data table
| Scenario | Key inputs (sample) | What you should observe |
|---|---|---|
| Lid-driven cavity | Lx=1, Ly=1, Nx=41, Ny=41, ρ=1, ν=0.01, dt=0.001, steps=200, nit=50, U_lid=1 | Re ≈ 100, a primary vortex forms, divergence stays small. |
| Couette flow | H=0.05, U_top=1, U_bottom=0, μ=0.01 | Linear u(y) profile and constant shear stress. |
| Poiseuille flow | H=0.05, dp/dx=-10, μ=0.01, width=1 | Parabolic u(y) with maximum at y=H/2. |
Formula used
This calculator focuses on incompressible flow. The governing equations are:
For the lid-driven cavity, a finite-difference projection method is used:
- Compute a pressure Poisson right-hand side from velocity gradients.
- Solve the pressure Poisson equation with iterative relaxation (SOR).
- Update velocities using convection, pressure gradient, and diffusion terms.
- Apply boundary conditions: no-slip walls, moving top lid.
Analytic modes use closed-form solutions:
- Couette flow: u(y)=U0+(U1−U0)·y/H and τ=μ·(U1−U0)/H.
- Poiseuille flow: u(y)=−(1/(2μ))·(dp/dx)·y(H−y) and Q′=−(dp/dx)·H³/(12μ).
How to use this calculator
- Select a flow scenario (cavity, Couette, or Poiseuille).
- Enter density and viscosity values. Use the sync option if needed.
- For cavity flow, choose grid size, dt, steps, and pressure iterations.
- Press Solve. Results appear above the form under the header.
- Use Download CSV for data tables and centerline profiles.
- Use Download PDF for a quick printable report.
Navier–Stokes Solver: Interpreting Outputs
1) Model scope and assumptions
This tool targets incompressible, constant-property flow on a uniform grid. The cavity mode uses a 2D projection scheme with finite differences. It is best for laminar to moderately separated flows; analytic modes provide quick reference checks. No-slip walls are enforced each step, with a moving top lid in the cavity. Pressure is defined up to a constant, so one side acts as a reference.
2) Non-dimensional checks: Reynolds number
A helpful summary metric is the Reynolds number, Re = Ulid L / ν. With L = 1 m, Ulid = 1 m/s, and ν = 0.01 m²/s, Re ≈ 100. Higher Re strengthens the main vortex and corner eddies, creating sharper gradients and slower convergence.
3) Stability hints: dt, CFL, and diffusion limits
Explicit updates require stable advection and diffusion. A practical CFL check is dt (|u|/dx + |v|/dy) < 1. Also keep dt < dx²/(4ν). Example: Nx = 41 gives dx ≈ 0.025 and, with ν = 0.01, the diffusion limit is about 0.0156. Using dt = 0.001 is conservative. When ν is very small, advection dominates and dt must shrink.
4) Pressure Poisson iterations and divergence control
The pressure correction drives divergence toward zero by adjusting the intermediate velocity field. The nit setting controls Poisson iterations per time step; 30–100 is typical. The SOR factor (ω) accelerates convergence, with 1.4–1.8 commonly effective. If divergence grows, increase nit or reduce dt.
5) Grid resolution and boundary layers
Accuracy scales with grid spacing. In a cavity, boundary layers can be thin, roughly δ ~ L/√Re. At Re = 1000, δ is near 0.03 for L = 1. A 41×41 grid (dx ≈ 0.025) is marginal, so refine if profiles look jagged.
6) Diagnostics you can export
The CSV export includes summary outputs plus centerline velocity profiles. Vertical centerline u(y) at x = L/2 and horizontal centerline v(x) at y = L/2 show recirculation strength. Track max speed and divergence to judge convergence. For reproducible comparisons, keep L, Ulid, and ν fixed while refining Nx and Ny, then overlay centerline curves from multiple runs. When profiles stop changing, the flow field is approaching a steady solution.
7) Using analytic benchmarks for sanity checks
Couette flow returns a linear u(y) and constant shear τ = μ (Utop−Ubottom)/H. Poiseuille flow returns a parabola with umax = −(dp/dx) H²/(8μ). With dp/dx = −10 Pa/m, H = 0.05 m, and μ = 0.01 Pa·s, umax ≈ 0.3125 m/s. This is a fast sanity check before cavity runs. The per-width flow rate is Q′ = −(dp/dx) H³/(12μ), giving Q′ ≈ 0.0104 m²/s.
FAQs
1) What does “nit” do?
It sets the number of pressure Poisson iterations per time step. Higher values usually reduce divergence and improve incompressibility, but increase runtime. Start around 50 and adjust as needed.
2) How should I choose the time step dt?
Use small dt for stability. Keep CFL below roughly 1 and ensure dt is smaller than a diffusion-based limit like dx²/(4ν). If the solution oscillates, decrease dt.
3) Why isn’t divergence exactly zero?
Finite grid spacing and a limited pressure-iteration count leave a small residual. Increasing nit, refining the grid, or reducing dt typically lowers divergence.
4) What is the SOR ω parameter?
ω is the relaxation factor for the pressure solve. Values between 1 and 1.9 can speed convergence. If ω is too large, iterations may become unstable and divergence can increase.
5) Can this handle turbulent 3D flows?
No. This is a 2D educational solver with simplified numerics. For turbulence, 3D geometry, or complex boundaries, use dedicated CFD software with appropriate turbulence models and meshing tools.
6) What’s the relation between μ and ν?
Dynamic viscosity μ and kinematic viscosity ν are linked by μ = ρν. If you change density, re-sync viscosities so the intended fluid properties remain consistent.
7) How do I know the cavity solution has converged?
Enable early stopping and watch velocity-change tolerance. Also compare centerline profiles between later steps; when they stop shifting noticeably and divergence stays small, the flow field is close to steady.