Lattice Boltzmann Solver Calculator

Tune collision, relaxation, and boundary conditions quickly today. Run compact simulations and inspect macroscopic fields. Export CSV and PDF reports for transparent research workflows.

Simulate two-dimensional fluid flow using a lattice Boltzmann solver. Configure grids, viscosity, boundaries, and forcing. View stability checks, Reynolds estimates, and export results for verification.

Solver inputs

Cavity uses a moving top wall. Channel uses periodic x and wall bounce-back in y.
More steps improve development and convergence.
Used to compute τ via τ = 1/2 + ν/cs² when auto.
Stability requires τ > 0.5.
Ignored for channel case.
A small body-force drives Poiseuille-like flow.
Keep small for low-Mach behavior.
Stops when avg-speed residual falls below tolerance.
Caps recorded time-series rows.

Example data table

Case Nx Ny Steps ν U (lid) Fx
Lid-driven cavity 60 60 500 0.02 0.08 0
Channel 100 50 1200 0.05 0 1e-6
Use smaller grids first, then scale up while monitoring stability notes.

Formula used

This calculator uses the D2Q9 lattice with BGK collision. The discrete populations \(f_i\) evolve as:

Streaming + collision:

f_i(x + c_i, t + 1) = f_i(x, t) - \omega\,[f_i(x,t) - f_i^{eq}(x,t)] + S_i

where  \omega = 1/\tau,  and  c_s^2 = 1/3

Macroscopic fields follow:

rho = \sum_i f_i
u = (\sum_i f_i c_{ix}) / rho
v = (\sum_i f_i c_{iy}) / rho

The equilibrium distribution (low-Mach expansion) is:

f_i^{eq} = w_i rho [ 1 + 3(c_i·u) + 4.5(c_i·u)^2 - 1.5|u|^2 ]

For the channel case, an optional small body force is applied using a standard forcing source term to drive Poiseuille-like flow.

How to use this calculator

  1. Select a case: lid-driven cavity for recirculation, or channel for pressure-driven-like flow.
  2. Choose grid size and steps. Start modest to validate stability.
  3. Set viscosity \(\nu\). Keep characteristic speeds small for accuracy.
  4. Use auto \(\tau\) from \(\nu\), or set \(\tau\) manually above 0.5.
  5. For cavity, set lid velocity \(U\). For channel, enable forcing and set \(F_x\) small.
  6. Press Solve. Results appear above this form.
  7. Download CSV for the full time series and PDF for a compact report.

Technical article

1. What the lattice Boltzmann method represents

LBM evolves discrete particle populations and reconstructs flow from their moments. This solver uses the 2D D2Q9 stencil with 9 velocities. Density is ρ = Σfi, and velocity is u = (Σfici)/ρ, computed at every lattice node.

2. D2Q9 lattice data and low-Mach guidance

D2Q9 includes 1 rest direction, 4 axis directions, and 4 diagonals with weights 4/9, 1/9, and 1/36. The lattice sound speed is fixed at cs2 = 1/3. Keep max |u| small (Mach ≤ 0.1) to limit compressibility error.

3. BGK collision and viscosity mapping

Collision uses a single-relaxation-time BGK step with ω = 1/τ. The kinematic viscosity maps as ν = cs2(τ - 0.5), so τ must remain above 0.5. Larger ν increases damping and helps stability on coarse meshes, while smaller ν demands finer resolution.

4. Boundary condition data used here

No-slip walls use bounce-back, reflecting populations along the opposite direction to enforce near-zero wall velocity. The lid-driven cavity applies a top-wall velocity boundary using a Zou/He-style reconstruction with u = U and v = 0, suitable for moderate lid speeds.

5. Channel forcing and steady profile targets

The channel case uses periodic boundaries in x and solid walls in y. A small body force Fx can be applied using a forcing source term to mimic a pressure gradient. Start with Fx near 10-6 and confirm that maximum speed stays low as the profile approaches steady flow.

6. Reported diagnostics and convergence data

At each reporting interval, the calculator records average speed, maximum speed, average kinetic energy, and a residual based on changes in average speed. When enabled, the run stops once the residual falls below your tolerance, saving steps during near-steady evolution.

7. Reynolds number estimate inside the tool

A Reynolds estimate is computed as Re ≈ UrefL/ν, using L ≈ N − 1 in the primary flow direction. For cavities, Uref is the lid speed; for channels, Uref is the maximum speed. Use Re to compare configurations.

8. Practical workflow for reliable results

Begin with grids near 50–60 cells per side and a few hundred steps, then increase resolution until trends stabilize. If warnings appear, reduce U or Fx, increase ν, or refine the mesh. Export CSV for auditing and PDF for quick sharing.

FAQs

1) What does D2Q9 mean in this solver?

D2Q9 means two spatial dimensions with nine discrete velocity directions. It is the most common LBM stencil for 2D incompressible-style flows and supports stable vortex formation and channel profiles.

2) Why must τ be greater than 0.5?

In BGK LBM, viscosity scales with τ - 0.5. If τ approaches 0.5, viscosity becomes too small and numerical stability deteriorates. This calculator nudges τ slightly above 0.5 when needed.

3) How do I choose grid size and steps?

Start with 50–60 cells per direction and a few hundred steps to validate settings. Then increase steps and resolution until the residual decreases smoothly and results stop changing noticeably with refinement.

4) What is the role of the body force in the channel case?

The body force acts like a pressure gradient, driving flow between no-slip walls. Keep it small to maintain low-Mach behavior. Use the time-series trends to confirm the profile is settling.

5) Why does the solver warn about large velocities?

Large lattice velocities increase compressibility error and can destabilize BGK collision. As max speed grows, reduce forcing or lid speed, increase viscosity, or refine the grid to recover stability.

6) What do the CSV and PDF exports contain?

The CSV stores step-by-step report rows for average speed, maximum speed, kinetic energy, and residual. The PDF provides a compact summary plus the first rows of the time series for quick sharing.

7) Can I compare this output to analytical solutions?

Yes. The channel case can be compared qualitatively to a parabolic Poiseuille profile once steady. Use consistent viscosity and forcing, and refine the grid to reduce discretization effects.

Related Calculators

markov chain monte carlometropolis monte carlokinetic monte carlodiscrete element methodconjugate heat transferquantum monte carlomultibody dynamicsstiff ode solveradaptive mesh refinementparticle in cell

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.