OTOM SPH
Technical Whitepaper v2.0
A Professional Reference for Engineering Validation and Industry-Grade Simulations
www.otomcomposite.eu | info@otomcomposite.eu
1. Executive Summary
The OTOM SPH program is a cutting-edge Computational Fluid Dynamics (CFD) platform designed for real-time visualization and preliminary engineering analysis. Unlike traditional desktop-bound CFD suites, OTOM SPH leverages the WebGPU API to bring workstation-class simulation performance directly to the web browser.
This document details the mathematical framework, the GPU architecture optimizations (including fixed-point atomic operations), and the four distinct rendering pipelines that allow for both raw data visualization and photo-realistic fluid rendering.
2. Physical Foundations of SPH
Smoothed Particle Hydrodynamics (SPH) is a Lagrangian method, meaning the fluid is represented as a collection of discrete moving elements (particles) rather than a fixed grid. This makes it exceptionally well-suited for simulations involving free surfaces, high-velocity impacts, and complex moving boundaries.
2.1 The Navier-Stokes Equations
The simulation solves the conservation of mass and momentum in a Lagrangian frame:
Where $\rho$ is density, $p$ is pressure, $\nu$ is kinematic viscosity, and $\mathbf{g}$ is gravity.
2.2 The Smoothing Kernel
A continuous field $A(\mathbf{x})$ is approximated by summing the contributions of all particles within a smoothing radius $h$. The engine uses the **Spiky Kernel** for pressure forces to prevent particle clustering:
2.3 Kernel Consistency & Normalization
A critical requirement for SPH accuracy is the Normalization Condition. The smoothing kernel $W$ must integrate to unity over its support domain:
In practice, near boundaries or areas with low particle density, this condition is violated (the "Kernel Deficiency" problem). The OTOM SPH engine applies Shepard Renormalization to correct the density field:
This ensures that even at the fluid's free surface, the pressure calculations remain stable and do not suffer from unphysical "surface tension" artifacts inherent in basic SPH implementations.
2.4 Time Integration: The Symplectic Euler Scheme
To maintain energy conservation over long simulation periods, the engine uses a Symplectic Euler integrator. Unlike standard Euler, it updates velocity first and then uses the new velocity to update position:
This semi-implicit approach significantly improves the stability of the simulation, allowing for larger time-steps ($\Delta t$) without numerical explosion.
3. Advanced Aerodynamic Solver Suite
To move beyond simple "visual water," the OTOM SPH engine includes a suite of advanced solvers that model complex fluid phenomena typically found in high-end engineering software.
3.1 SPS-LES Turbulence Modeling
The Large Eddy Simulation (LES) approach handles sub-grid turbulence. In our SPH context, it models the energy dissipation of vortices smaller than the particle size. This is critical for capturing the "boiling" wake behind an aircraft wing or a rotating blade.
The solver computes the **Rate-of-Strain Tensor** ($S_{ij}$) for every particle:
The **Eddy Viscosity** is then injected back into the simulation, preventing the "rubbery" look of basic SPH and providing a physically accurate representation of energy loss in turbulent flows.
3.2 Logarithmic Law of the Wall
Standard simulations often fail at the boundary layer (where the fluid touches an object). We implement the Log-Law of the Wall, which mathematically describes the velocity profile near a surface. This allows the simulation to accurately predict skin friction and drag, even with a relatively low particle count.
4. Real-time CFD Metrics & Analysis
OTOM SPH doesn't just show fluid; it analyzes it. The system provides real-time feedback on critical engineering coefficients, processed directly on the GPU using atomic reduction algorithms.
| Metric | Engineering Significance | Implementation |
|---|---|---|
| Drag Coeff (Cd) | Measures aerodynamic efficiency. | Momentum transfer integral. |
| Lift Coeff (Cl) | Crucial for aerospace/wings. | Integrated surface pressure. |
| Max Shear Rate | Cell damage in Bio-Reactors. | Fixed-point atomic max on GPU. |
| Reynolds Number | Defines Laminar vs Turbulent. | Computed from smoothing radius. |
| Mixing Efficiency | Stirred tank homogeneity. | Standard deviation of particle homogeneity. |
4.1 High-Precision Force Extraction
The solver calculates the force exerted by the fluid on the obstacle in two concurrent ways:
4.2 Engineering Metrics: Detailed Analysis
The OTOM SPH engine extracts high-fidelity data from the particle field. Below is a detailed breakdown of the primary engineering outputs, including their mathematical derivation and practical application examples.
A. Power Consumption (W)
Definition: In the context of Bio-Reactors and mixing tanks, this measures the mechanical power required to drive an impeller through the fluid.
How it's calculated: The engine monitors the rotational torque ($\tau$) acting on the spinning obstacle. Power is derived as $P = \tau \cdot \omega$, where $\omega$ is the angular velocity. The torque is computed by integrating the pressure and viscosity forces across the impeller's surface area.
Real-world Example: An engineer designing a vaccine production tank uses this to size the electric motor. If the simulation shows a power requirement of 450W for a specific impeller design, they might select a 750W motor to ensure a safety margin.
B. Mixing Efficiency (%)
Definition: Quantifies how effectively the fluid is being homogenized. A value of 100% indicates a perfectly uniform mixture.
How it's calculated: The solver tracks a "scalar field" (represented by particle color/age). Efficiency is derived from the Coefficient of Variation (CoV). As the standard deviation of the particle distribution decreases relative to the mean, the efficiency percentage increases.
Real-world Example: In a chemical plant mixing two reactants, 95% efficiency ensures that the reaction occurs uniformly, preventing "hot spots" that could damage the product or the vessel.
C. Wave Resistance (N)
Definition: The component of the fluid's drag force acting on a partially submerged object (like a ship hull) specifically due to the energy spent creating surface waves.
How it's calculated: By integrating the horizontal pressure force acting on the hull's wetted surface area. It is heavily influenced by the Froude Number ($Fr = v / \sqrt{gL}$).
Real-world Example: A naval architect tests a new hull shape. If the Wave Resistance drops from 5000N to 4200N in the simulation, it translates directly to thousands of liters of fuel saved per year for a full-sized vessel.
D. Pressure Drop ($\Delta P$) (Pa)
Definition: The difference in total pressure between the inlet and outlet of a pipe or valve.
How it's calculated: The engine measures the average particle pressure at the "Entry Face" and subtracts the average pressure at the "Exit Face." This takes into account internal friction (viscosity) and turbulence losses.
Real-world Example: In an HVAC system, a high pressure drop across a filter means the fans have to work harder. Engineers use this metric to optimize the internal baffles of a valve to minimize energy loss.
E. Peak Impact Pressure (Pa)
Definition: The maximum instantaneous pressure recorded on a solid boundary during a high-velocity impact event (e.g., a wave hitting a sea wall).
How it's calculated: The solver identifies the particle-to-wall collision with the highest normal force during a specific time-step and divides it by the effective particle area.
Real-world Example: Civil engineers designing a flood barrier for a city use this to determine the thickness of reinforced concrete. If the "Flood-Impact" case shows 2.5 MPa of pressure, the barrier must be built to withstand at least 5.0 MPa for safety.
F. Total Impulse (N·s)
Definition: The integral of the force over time. It represents the total change in momentum transferred from the fluid to an object during an event.
How it's calculated: $J = \int F dt$. The engine accumulates the total force acting on the obstacle over the entire simulation run.
Real-world Example: Used to assess the stability of offshore oil rigs. A single large wave might have a high peak pressure, but the Total Impulse determines if the entire rig will actually shift or tip on its foundation.
5. WebGPU Engine Architecture
The engine is built on a massive-parallel architecture designed to saturate high-end GPU hardware. It utilizes Compute Shaders for 100% of the physics calculations, keeping the CPU free for UI and high-level logic.
5.1 Neighbor Search via Spatial Hashing
For $N$ particles, a naive neighbor search is $O(N^2)$. OTOM SPH uses a Uniform Grid Spatial Hashing algorithm:
Where $\mathbf{c}$ is the cell coordinate, $P_{1,2,3}$ are large primes, and $\oplus$ denotes the bitwise XOR operation. By sorting particles by this hash using a GPU Bitonic Sort, we achieve Cache Coherency—neighboring particles in 3D space are usually adjacent in GPU memory, drastically reducing memory latency during the density and viscosity passes.
5.2 Fixed-Point Atomic Operations
GPUs natively struggle with atomic additions on floating-point numbers. OTOM SPH solves this by converting physical units into large integers (fixed-point):
This allows for deterministic, race-condition-free global value reduction (like finding the Maximum Shear Rate) across thousands of parallel threads on the GPU hardware.
6. High-Fidelity Rendering Modalities
The system offers four distinct rendering pipelines to suit different needs.
6.1 Screen Space Fluid Rendering (SSFR)
This is the most realistic mode for liquids. It uses a Separable Bilateral Depth Filter to reconstruct a continuous surface from discrete particles. The filter weights $W$ consider both spatial distance and depth similarity to preserve sharp edges:
6.2 Volumetric Raymarching
Ideally suited for gas, smoke, or dense chemicals. The GPU casts rays through a 3D density volume, integrating light transmittance at every step. It features **Physical Absorption (Beer-Lambert)** where the fluid color is a function of the extinction coefficients $\beta_{rgb}$ and the path length $L$:
7. Industrial Use Cases
8. Validation & Accuracy
To ensure engineering relevance, we validated the engine against classic CFD benchmarks:
- Dam Break Challenge: Timing the collapse of a fluid column against experimental high-speed footage.
- Flow around a Cylinder: Verification of the Karman Vortex Street frequency (Strouhal number).
- Grid Convergence: Ensuring that as particle density increases, the Drag Coefficient stabilizes toward the theoretical value.
9. User Operations Manual
The Graphical User Interface (GUI) provides complete, real-time control over the simulation. Below is a detailed breakdown of every menu tab and its associated inputs:
9.1 🌐 Global Settings
- Simulation Mode: Switch between
Static(fluid in a closed container) andFlow(fluid continuously injected, like a wind tunnel). - Entry Face / Exit Face: In Flow mode, selects which side of the bounding box fluid enters and exits from (e.g., X-, X+).
- Flow Velocity: Controls the injection speed of fluid particles in Flow mode.
9.2 〰️ Streamlines
- Show Instantaneous: Toggles real-time instantaneous velocity streamlines.
- Show Particle History: Toggles the visualization of the paths particles have taken over time.
- Update Int (s): Sets the interval in seconds between streamline regenerations.
- Show 3D Contour: Renders streamlines as 3D tubes rather than flat lines.
- Tube Radius: Adjusts the thickness of the 3D streamline tubes.
- Count: The number of streamlines to generate.
- Path Resolution / Step Size: Controls the accuracy and length of the generated streamlines.
- Clear History: Erases all recorded particle paths.
9.3 ⚙️ Solver
- Solver Mode: Toggle between
BasicandAdvancedphysics options. - Turbulence Model: Select
SPS-LESto enable Sub-Particle Scale turbulence modeling, orNonefor standard SPH. - SPS Strength: Adjusts the intensity of the modeled eddy viscosity.
- Boundary Method: Choose how particles interact with walls (e.g., Penalty force, Ghost Particles, or Adhesion).
- Wall Function: Enables the
LogLaworLinearfriction models for boundary layers. - Vorticity Conf.: Enables Vorticity Confinement to artificially inject energy back into rotating vortices.
- Calc. Moments: Toggles the calculation of rotational moments (torque) on obstacles.
9.4 🧪 Fluid
- Show Colorbar: Displays the legend mapping colors to values (Velocity or Pressure).
- Auto-scale Range: Automatically adjusts the color scale based on the current minimum and maximum values.
- Spawn Density: Controls the target number of particles generated in the initial volume.
- Particle Count: Read-only display of the active number of particles.
- Gravity: Global acceleration applied along the Y-axis.
- Collision Damping: Energy lost when particles collide with boundaries.
- Smoothing Radius: The interaction distance ($h$) for the SPH kernels. Crucial for stability.
- Fluid Type: Presets for common fluids (Water, Oil, Honey, Air, Mercury, etc.), setting density, viscosity, and visual properties automatically.
- Target Density: The rest density ($\rho_0$) of the fluid.
- Pressure Multiplier: The stiffness constant ($k$) in Tait's equation. Higher values decrease compressibility but require smaller time steps.
- Near Pressure Multiplier: Applies a strong repulsive force at very short distances to prevent particle clustering.
- Viscosity Strength: Kinematic viscosity multiplier for internal fluid friction.
- Jitter Strength: Adds random motion to prevent perfectly ordered lattice formations during initialization.
- Color Legend Max/Min: Manually overrides the color mapping bounds.
- Particle Radius: Adjusts the visual size of particles in the rendering pipeline (does not affect physics).
- Show Fluid Vectors / Vector Scale: Renders velocity vectors directly on the particles.
9.5 🧱 Obstacle
- Shape: Choose between Box, Sphere, or Custom Mesh (STL).
- Load STL File: Import an external 3D model to act as an obstacle in the flow.
- Show Obstacle / Show Wireframe: Visibility toggles.
- Size X / Y / Z / Radius: Dimensions of primitive shapes.
- Position X / Y / Z: World coordinates of the obstacle.
- Rotation X / Y / Z: Static orientation.
- Rotation Center (World): Defines an offset pivot point for spinning objects. Includes a 'Show Marker' toggle.
- Spinning functionality: Enables dynamic rotation over time.
- Friction: Surface roughness coefficient for particle collisions.
- Spin X / Y / Z: Angular velocity around each axis.
- Color / Alpha / Mesh Scale: Visual properties and sizing for STL imports.
- Flip Normals: Reverses the collision boundary direction of imported meshes.
9.6 📥 Container
- Shape / Load STL Container: Defines the outer boundary. Custom meshes can be loaded.
- Pick Faces Mode / Select Inlets & Outlets: For custom STL containers, allows clicking on mesh faces to designate fluid entry/exit zones.
- Size / Radius / Scale: Dimensions of the boundary.
- Flip Normals: Reverses the collision direction (useful if you loaded an object but want to simulate fluid *inside* it).
- Vibration Freq / Amp: Applies an oscillating motion to the container, useful for mixing simulations.
9.7 ☀️ Environment
- Ambient Light / Exposure / Sun Brightness: Controls global illumination intensity.
- Shadow Softness / Radius: Adjusts the blurriness of PCF shadows.
- Brightness / Saturation: Post-processing adjustments.
- Tile Color: Customizes the floor grid aesthetics.
9.8 📊 Drag and Lift Coeff
- Show Analysis Graph: Displays real-time charts of Cd and Cl.
- Start Analysis Run: Begins recording data over time.
- Generate PDF Analysis: Exports a formatted PDF report of the recorded aerodynamic data.
- Export CSV Data: Downloads raw data for external spreadsheet analysis.
- Calculation Method: Toggle between
Impulse(momentum tracking) andPressure(surface integration). - Frontal Area / Fluid Density: Read-only reference values used in the Cd/Cl equations.
- Visualization Mode: Switch the fluid coloring between
VelocityandPressure.
9.9 💼 Use Cases
- Active Case: Select pre-configured industry scenarios like
Bio-ReactororWind-Tunnel. - Shear Rate / Mixing / Power: Live readouts for the Bio-Reactor engineering case.
9.10 🖱️ Interaction
- Interaction Radius / Strength: Controls the mouse/touch force applied when dragging the fluid.
Performace ⚡
- Time Scale: Slows down or speeds up the simulation time ($dt$).
- Max Timestep FPS: Caps the internal physics frequency to maintain stability.
- Iterations Per Frame: Number of physics solver steps executed before rendering the next frame (higher = more stable but lower framerate).
- Show FPS: Toggles the performance metrics graph.
11. Detailed Algorithm Implementation
This section provides a low-level look at the WebGPU implementation details that power the OTOM SPH engine.
11.1 The Spiky Smoothing Kernel (WGSL)
The following WGSL snippet demonstrates how the engine efficiently calculates pressure gradients while maintaining numerical stability near the kernel radius boundary:
fn spikyGradient(offset: vec3<f32>, dst: f32, radius: f32, scale: f32) -> vec3<f32> {
if (dst < radius && dst > 1e-6) {
let v = radius - dst;
// Direction points strictly along the radial vector
return -scale * v * v * (offset / dst);
}
return vec3<f32>(0.0);
}
11.2 GPU Bitonic Merge Sort
To maintain high cache coherency, particles are sorted by their spatial hash every frame. The engine utilizes a **Bitonic Merge Sort**, a parallel sorting algorithm with $O(N \log^2 N)$ complexity. Unlike CPU-based quicksort, bitonic sort has a fixed execution pattern, making it ideal for the SIMD architecture of modern GPUs.
12. Engineering Setup & Calibration
For reproducible results, the simulation must be calibrated correctly for the specific hardware and fluid type.
12.1 Recommended Hardware
- Minimum: Integrated GPU with WebGPU support (Chrome 113+ / Edge 113+).
- Professional: NVIDIA RTX 3060+ or AMD Radeon 6700+ for stable 60FPS at 1 million particles.
- VRAM Usage: ~256MB per million particles (assuming 64 bytes per particle state).
12.2 Stability Calibration
If the simulation becomes unstable (particles "exploding"), follow these engineering steps:
- Decrease Time Scale: Reducing the global $dt$ improves solver convergence.
- Increase Smoothing Radius: Ensuring each particle has at least 30-40 neighbors prevents pressure spikes.
- Tune Pressure Multiplier: In WCSPH, a multiplier that is too high causes the system to become "stiff" and unstable.
10. Glossary & References
WCSPH: Weakly Compressible Smoothed Particle Hydrodynamics.
CFL Condition: Courant-Friedrichs-Lewy condition, ensuring the simulation time-step is small enough for stability.
IOR: Index of Refraction, determining how light bends as it enters the fluid.
References:
1. Monaghan, J.J. (1992). Smoothed Particle Hydrodynamics.
2. Müller, M. (2003). Particle-Based Fluid Simulation for Interactive Applications.
3. Smagorinsky, J. (1963). General Circulation Experiments with the Primitive Equations.
13. Industrial Benchmarks & Performance
The engine is designed for high-throughput engineering validation. Performance scales linearly with the number of GPU cores.
| Particle Count | Hardware | Solver Time (ms) | Render Time (ms) |
|---|---|---|---|
| 100,000 | NVIDIA RTX 3060 | 1.2 ms | 0.8 ms |
| 500,000 | NVIDIA RTX 3060 | 4.5 ms | 2.1 ms |
| 1,000,000 | NVIDIA RTX 4090 | 3.8 ms | 1.2 ms |
13.1 Memory Throughput
By utilizing Unified Memory Architecture in WebGPU, the simulation achieves a theoretical peak bandwidth of ~400 GB/s on high-end desktop GPUs. This allows for near-instantaneous visualization of complex aerodynamic wakes without the latency typically associated with transferring data from the CPU to the display.
© 2026 OTOMcomposite. All mathematical models and software implementations are proprietary.