Stream Function Calculator

Turn velocity fields into streamlines with confidence now. Get u and v from ψ expressions. Download neat reports, compare examples, and learn faster here.

Calculator
Choose a mode, enter expressions, and compute values at a point.
Both modes also compute Δψ between two points.
Used in ψ-mode and for flow-rate Δψ. Variables: x, y. Constants: pi, e.
Smaller h can amplify rounding noise.
Used when building ψ from u,v.
Only used in velocity mode. Example pair: u=y, v=−x.
Reference point for ψ in velocity mode.
,
,
Grid generation is optional and capped to prevent huge outputs.
Example Data Table

Example using ψ(x,y) = x·y. Then u = ∂ψ/∂y = x and v = −∂ψ/∂x = −y.

Point (x,y)ψuv|V|
(0, 0)0000
(1, 0.5)0.51-0.51.1180
(2, 1)22-12.2361
(2, 2)42-22.8284
(3, 1)33-13.1623
Formula Used
  • u(x,y) = ∂ψ/∂y and v(x,y) = −∂ψ/∂x (2D incompressible definition).
  • Exact differential form: dψ = u·dy − v·dx.
  • Path integration (numeric): ψ(x,y) = ψ(x0,y0) + ∫ u(x0,η)dη − ∫ v(ξ,y)dξ.
  • Flow rate per unit depth between two points: Q = Δψ = ψ₂ − ψ₁.
  • Checks: divergence ∇·V ≈ ∂u/∂x + ∂v/∂y, vorticity ω ≈ ∂v/∂x − ∂u/∂y.
All derivatives and integrals are computed numerically, so small approximation error is expected.
How to Use This Calculator
  1. Select a mode: provide ψ(x,y) or provide u(x,y) and v(x,y).
  2. Enter the evaluation point (x,y). Adjust h for smoother derivatives if needed.
  3. For velocity mode, set a reference (x0,y0,ψ0) and choose an integration method and steps.
  4. Optionally enable grid output, set ranges and step, then submit.
  5. Review results below the header. Use CSV/PDF buttons for downloads.
FAQs

1) What is a stream function?

It is a scalar function ψ(x,y) whose contours represent streamlines in 2D incompressible flow. Velocity components come from partial derivatives of ψ, guaranteeing zero divergence in ideal conditions.

2) Why does Δψ represent flow rate?

For 2D incompressible flow, the difference in ψ between two points equals the volume flow rate per unit depth crossing any curve connecting those points. It is a compact way to measure transport without integrating velocity across a line.

3) What does the divergence check tell me?

Divergence near zero suggests the field behaves like an incompressible flow and a stream function can exist. If the value is large, ψ built from u and v may become path dependent and your mismatch |ψA−ψB| will grow.

4) What is the path mismatch |ψA−ψB|?

In velocity mode, ψ is computed along two simple paths. If the field is compatible, both paths agree. The mismatch is a practical numeric indicator of inconsistency, coarse step settings, or a field that is not truly divergence-free.

5) How should I choose the derivative step h?

Start with 1e−4 to 1e−6 for smooth functions. Too large blurs gradients; too small amplifies rounding noise. If results are unstable, try increasing h slightly and compare the divergence and vorticity values.

6) Simpson or trapezoid for integration?

Simpson is often more accurate for smooth functions at the same step count. Trapezoid is simpler and can be robust when functions are less smooth. If you see oscillations, increase steps or switch methods to compare stability.

7) Can I use this for compressible flow?

Not directly. The classic stream function formulation assumes incompressibility in 2D. For compressible cases you may need a mass stream function or alternative potentials. Use the divergence output to judge whether incompressibility is a reasonable approximation.

8) Why are my results slightly different from hand calculations?

This tool uses numerical differentiation and integration. Finite step sizes introduce approximation error. Reduce the grid step or increase integration steps, and tune h for derivatives. Also ensure expressions are continuous and correctly typed with parentheses.

Related Calculators

divergence theorem calculatorhessian matrix calculatorpotential function solvertransport equation solveradvection equation solvervibration equation solver

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.