Liquid Pour Simulator Back
SPH Fluid Simulator

Liquid Pour Simulator

Experience SPH-based particle fluid in real time. Adjust gravity, viscosity, and container shape to intuitively explore fluid dynamics.

Controls

p/frame
Click canvas to drop a burst of particles
0
Particles
0%
Fill Level

Theory Notes

SPH discretizes fluid into particles. Each particle's physical quantities are weighted averages over neighbors via a smoothing kernel.

P = ρgh (hydrostatic pressure)
a = −∇P/ρ + g + F_visc

Inter-particle repulsion models pressure; cohesion approximates surface tension. In industry, LS-DYNA SPH is used for casting fill and sloshing analysis.

Sim
Theory & Key Formulas

$$v = \sqrt{2gh}$$

トリチェリの定理:\(h\) は液面高さ [m]、\(v\) は流出速度 [m/s]

$$Q = C_d A \sqrt{2gh}$$

流量:\(C_d\) 流量係数(≈0.6〜0.7)、\(A\) 開口面積 [m²]

$$\frac{dh}{dt} = -\frac{A_{out}}{A_{tank}} C_d \sqrt{2gh}$$

タンク水位の時間変化:\(A_{tank}\) タンク断面積

What is SPH Fluid Simulation?

🙋
What exactly is SPH? The particles in this simulator seem to flow like a real liquid, but they're just dots. How does that work?
🎓
Great question! SPH stands for Smoothed Particle Hydrodynamics. Basically, it's a clever way to simulate fluids by representing them as millions of moving particles, not as a grid. Each particle carries properties like density and pressure. In this simulator, when you change the Pour Rate, you're controlling how many of these computational particles are introduced into the scene each second.
🙋
Wait, really? So the particles aren't just for show—they are the fluid? How do they know to stick together and not just fly apart?
🎓
Exactly! They interact. The core idea is that each particle "smoothes" its influence over its neighbors. A particle's density is calculated by summing up the contributions of all nearby particles. This density then determines its pressure. High-density regions (like the bottom of the container) create high pressure, which pushes particles apart, preventing them from collapsing. Try lowering the Gravity slider—you'll see the particles spread out more easily because the pressure from stacking up isn't as strong.
🙋
That makes sense for pressure, but what about stickiness? Why does honey in the simulator flow slower than water? Is that just the Viscous Damping?
🎓
You've hit on a key force! Viscosity is the internal friction of a fluid. In SPH, it's modeled as a force that resists the relative motion between neighboring particles. The Viscous Damping parameter you see directly controls the strength of this force. A high value makes particles "drag" on each other more, mimicking thick honey. A low value lets them slide past easily, like water. It's a simplified but very effective model for visual simulation.

Physical Model & Key Equations

The heart of SPH is estimating continuous field quantities (like density $\rho$) at any point in space by summing contributions from neighboring particles. This is done using a smoothing kernel function $W$.

$$ \rho_i = \sum_j m_j W(\mathbf{r}_i - \mathbf{r}_j, h) $$

Here, $\rho_i$ is the density at particle $i$, $m_j$ is the mass of a neighboring particle $j$, $\mathbf{r}$ are positions, and $h$ is the smoothing length that defines the radius of influence. In the simulator, this is why particles only affect those close to them.

Once density is known, pressure is typically calculated using a simple equation of state. The pressure force then drives the fluid motion, combined with viscosity and gravity.

$$ \mathbf{F}^{pressure}_i = - \sum_j m_j \left( \frac{P_i}{\rho_i^2}+ \frac{P_j}{\rho_j^2}\right) \nabla W(\mathbf{r}_i - \mathbf{r}_j, h) $$

$\mathbf{F}^{pressure}_i$ is the pressure force on particle $i$, and $P$ is pressure derived from density. $\nabla W$ is the gradient of the smoothing kernel. This force pushes particles from high-density to low-density areas. The Gravity parameter in the simulator adds a constant downward force $\mathbf{F}^{gravity}_i = m_i \mathbf{g}$ to this equation.

Frequently Asked Questions

Yes, you can adjust the number of particles (resolution) from the simulator's settings panel. Increasing the number of particles reproduces more flow details but increases computational load. The particle size can be indirectly changed via the smoothing length (influence radius).
Increasing gravity causes the liquid to fall faster and splashes to become more intense. Increasing viscosity makes the liquid thicker like honey, slowing down the flow. Decreasing viscosity results in a more fluid, water-like behavior.
This tool is intended for education and learning, with a focus on real-time visualization. For quantitative design validation, please use dedicated CAE software (e.g., commercial particle-based tools). However, it is useful for understanding physical trends.
Currently, you can select from preset shapes (rectangular, cylindrical, inclined ramp, etc.). Free-form shape creation is planned for future updates. However, the container size and tilt can be adjusted via parameters.

Real-World Applications

Automotive Engineering: SPH is extensively used in car crash tests to simulate fuel sloshing in tanks or coolant flow. Engineers use tools like LS-DYNA to ensure fluids don't cause secondary hazards during an impact, which is much cheaper and safer than physical testing.

Visual Effects (VFX): Nearly every large-scale water, lava, or magical fluid effect in movies is created using SPH-based solvers. The method's particle-based nature fits perfectly with rendering pipelines, allowing for realistic splashes and flows around complex shapes.

Civil & Hydraulic Engineering: SPH is used to model extreme fluid-structure interactions, such as dam breaks, wave impact on coastal structures, or debris flows. Its ability to handle large deformations and free surfaces makes it ideal for these chaotic events.

Manufacturing Process Simulation: Engineers simulate processes like liquid metal casting, concrete pouring, or even 3D printing with liquid resins. SPH helps predict potential defects like air bubbles or incomplete filling based on the fluid's viscosity and pour rate.

Common Misconceptions and Points to Note

First, it's a major misconception that more particles always lead to a better simulation. While increasing particle count does improve resolution, the computation time grows at a rate close to the square of the particle number. In practice, identifying the minimum number of particles required to achieve the necessary accuracy is where your skill comes into play. For instance, coarse particles may suffice to observe the overall flow in a container, but capturing fine splashes or the formation of tiny droplets due to surface tension requires techniques like locally refining the particle resolution.

Next, beware of parameter setting pitfalls. Sliders for "viscosity" or "surface tension" in simulators are often dimensionless relative values. This means you must consider scaling (similarity laws) to directly correlate them with values for real-world fluids. For example, simply increasing the viscosity slider using settings that replicate water to mimic more viscous glycerin will produce results deviating from actual behavior. In practical work, a "validation" process is essential, where you calibrate parameters by comparing simulation results against theoretical/experimental values for known simple cases (e.g., pipe flow).

Finally, don't overlook the importance of initial conditions. Whether you start injection with particles arranged in a uniform grid or placed randomly can lead to completely different initial instabilities, significantly affecting the results. Also, setting an injection speed unrealistically high can generate non-physical pressures or splashing, causing the calculation to diverge. The first step is to carefully observe the real-world process and set an initial state that matches it.

How to Use

  1. Select container geometry (rectangular, cylindrical, or conical) from the dropdown menu.
  2. Adjust gravity (0.5–15 m/s²) using the slider; default 9.81 m/s² mimics Earth conditions. Higher values increase particle settling speed.
  3. Set viscosity (0.001–0.1 Pa·s) to simulate fluid behavior; water ≈0.001 Pa·s, honey ≈10 Pa·s equivalent.
  4. Define pour rate (5–500 particles/second) controlling liquid discharge volume during simulation.
  5. Configure maximum particles (1000–50000) to balance visual detail and computational performance.
  6. Click Play to initiate SPH particle dynamics; observe splash patterns, surface tension effects, and settling behavior in real time.

Worked Example

Pour 2 liters of water into a 300×200×400 mm rectangular container. Set gravity 9.81 m/s², viscosity 0.001 Pa·s, pour rate 150 particles/second, max 25000 particles. Particles accelerate downward, create a hemispherical splash crown reaching 80 mm above the liquid surface within 0.3 seconds, then settle into a stable column 180 mm high. Total fill time: 13 seconds. Adjust viscosity to 0.05 Pa·s (glycerin-like fluid); splash height reduces to 45 mm and dampens 40% faster due to increased energy dissipation.

Practical Notes

  1. For industrial mixing simulation, increase gravity to 12–15 m/s² and viscosity to 0.05–0.1 Pa·s to model dense slurries (concrete, starch suspensions) with predictable settling patterns.
  2. Container height-to-width ratios below 2:1 cause lateral splash overflow; adjust container proportions or reduce pour rate for containment validation.
  3. SPH accuracy degrades with particle counts below 5000 for containers larger than 500 mm; increase max particles for industrial scale-up scenarios.
  4. Zero-gravity mode (gravity slider at 0.1) models microgravity fluid behavior in aerospace fuel tank design; particles form spherical clusters rather than pools.