1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/// Standard physical rest density of liquid water at 20 °C in `kg/m³`.
pub const WATER_REST_DENSITY_KGM3: f32 = 1000.0;
/// Physical refractive index (IOR) of liquid water at visible wavelengths.
pub const WATER_REFRACTIVE_INDEX: f32 = 1.333;
/// Physical dynamic viscosity of pure water at 20 °C in `Pa·s`.
pub const WATER_DYNAMIC_VISCOSITY_PAS: f32 = 0.001_002;
/// Physical air-water surface tension coefficient at 20 °C in `N/m`.
pub const WATER_SURFACE_TENSION_NPM: f32 = 0.072_8;
/// Physical density of pure water ice at 0 °C in `kg/m³` (~91.7% submerged).
pub const ICE_DENSITY_KGM3: f32 = 917.0;
/// Physical density of the lightweight buoyant floating orb in `kg/m³` (~45% submerged).
pub const FLOATING_ORB_DENSITY_KGM3: f32 = 450.0;
/// Default physical handheld glass vessel width in meters (`12 cm`).
pub const DEFAULT_VESSEL_WIDTH_M: f32 = 0.12;
/// Default physical handheld glass vessel height in meters (`9 cm`).
pub const DEFAULT_VESSEL_HEIGHT_M: f32 = 0.09;
/// Minimum allowed water volume fill ratio.
pub const FLUID_MIN_FILL_RATIO: f32 = 0.20;
/// Maximum allowed water volume fill ratio.
pub const FLUID_MAX_FILL_RATIO: f32 = 0.85;
/// Default water volume fill ratio.
pub const FLUID_DEFAULT_FILL_RATIO: f32 = 0.48;
/// Maximum pre-allocated PBF fluid particle capacity (zero steady-state reallocation).
pub const FLUID_MAX_PARTICLES: usize = 960;
/// Maximum pre-allocated entrained micro-bubble / foam capacity.
pub const FLUID_MAX_BUBBLES: usize = 220;
/// Maximum pre-allocated buoyant floating rigid bodies inside the vessel.
pub const FLUID_MAX_BUOYANT_BODIES: usize = 4;
/// Default target particle count at maximum simulation fidelity (`FLUID_MAX_PARTICLES`).
pub const FLUID_BASE_PARTICLES_HALF_FILL: usize = FLUID_MAX_PARTICLES;
/// Default fixed physics substeps per frame tick at maximum simulation fidelity.
pub const FLUID_DEFAULT_SUBSTEPS: u32 = 4;
/// Default PBF Jacobi density constraint iterations per substep at maximum simulation fidelity.
pub const FLUID_DEFAULT_SOLVER_ITERS: u32 = 6;
/// Silent hydrostatic PBF relaxation iterations executed during `reset_water` so Frame 1 starts in exact equilibrium.
pub const FLUID_HYDROSTATIC_RELAX_ITERS: u32 = 10;
/// Maximum cached PBF neighbor indices stored per particle in the flat zero-alloc neighbor table.
pub const FLUID_MAX_NEIGHBORS: usize = 32;
/// Smoothing radius multiplier relative to nominal resting particle spacing `d0`.
pub const FLUID_KERNEL_RADIUS_MULT: f32 = 2.45;
/// Dimensionless CFM relaxation factor scaled by inverse particle area `1 / A_p`.
pub const FLUID_CFM_RELAXATION_FACTOR: f32 = 0.11;
/// Tensile-instability artificial pressure coefficient (`s_corr`, Macklin & Müller 2013).
pub const FLUID_SCORR_K: f32 = 0.000_85;
/// Tensile-instability reference distance fraction `Δq / h`.
pub const FLUID_SCORR_DQ_RATIO: f32 = 0.24;
/// Base XSPH viscosity blending coefficient corresponding to 20 °C water.
pub const FLUID_BASE_XSPH_COEFF: f32 = 0.042;
/// Additional free-surface XSPH velocity smoothing keeping gravity-capillary waves coherent without breakup.
pub const FLUID_SURFACE_XSPH_BOOST: f32 = 0.065;
/// Physical bulk viscous damping rate per second (`s⁻¹`) allowing natural wave sloshing while converging cleanly to rest.
pub const FLUID_VISCOUS_DAMP_PER_SEC: f32 = 0.62;
/// Sub-millimeter PBF constraint-creep damping rate (`s⁻¹`) active only when external excitation is zero and particle speed is microscopic.
pub const FLUID_REST_SETTLE_DAMP_PER_SEC: f32 = 5.2;
/// Vorticity confinement strength keeping interior high-speed eddies crisp without exciting free-surface particles.
pub const FLUID_VORTICITY_EPSILON: f32 = 0.000_18;
/// Minimum particle speed in `m/s` required before interior vorticity confinement activates.
pub const FLUID_VORTICITY_MIN_SPEED_MPS: f32 = 0.28;
/// Laplacian free-surface smoothing strength minimizing surface spikes into smooth capillary-gravity waves.
pub const FLUID_SURFACE_LAPLACIAN_GAIN: f32 = 0.022;
/// Hydrophilic glass wall capillary adhesion strength near the left/right tank walls.
pub const FLUID_WALL_MENISCUS_STRENGTH: f32 = 0.000_065;
/// Stationary hardware linear acceleration noise deadzone in `m/s²`.
pub const FLUID_SENSOR_LIN_DEADZONE_MPS2: f32 = 0.30;
/// Stationary hardware gyroscope angular velocity deadzone in `rad/s`.
pub const FLUID_SENSOR_GYRO_DEADZONE_RAD_S: f32 = 0.045;
/// Stationary hardware gravity vector micro-tremor deadzone in `m/s²` preventing idle IMU noise from shaking the camera horizon.
pub const FLUID_SENSOR_GRAVITY_DEADZONE_MPS2: f32 = 0.05;
/// Small-angle dt-invariant gravity low-pass damping rate in Hertz for smooth handheld IMU tracking.
pub const FLUID_SENSOR_GRAVITY_DAMP_HZ: f32 = 8.5;
/// Maximum clamped particle speed in `m/s` preventing tunneling on extreme impulses.
pub const FLUID_MAX_PARTICLE_SPEED_MPS: f32 = 2.85;
/// Maximum clamped linear shake acceleration in `m/s²`.
pub const FLUID_MAX_LINEAR_ACCEL_MPS2: f32 = 65.0;
/// Maximum clamped angular velocity in `rad/s`.
pub const FLUID_MAX_OMEGA_RAD_S: f32 = 24.0;
/// Maximum clamped angular acceleration in `rad/s²`.
pub const FLUID_MAX_ALPHA_RAD_S2: f32 = 140.0;
/// Wall boundary restitution coefficient for high-speed liquid splash impacts.
pub const FLUID_WALL_RESTITUTION: f32 = 0.06;
/// Wall boundary tangential slip retention factor (smooth borosilicate glass interior).
pub const FLUID_WALL_TANGENTIAL_KEEP: f32 = 0.982;
/// Glass tank inner corner bevel radius expressed as a fraction of the smaller vessel axis.
pub const FLUID_CORNER_RADIUS_RATIO: f32 = 0.055;
/// Virtual shake decay rate per second (`exp(-decay * dt)`).
pub const FLUID_SHAKE_DECAY_PER_SEC: f32 = 8.5;
/// Buoyant micro-bubble terminal rise velocity in `m/s`.
pub const FLUID_BUBBLE_RISE_SPEED_MPS: f32 = 0.16;
/// Speed threshold in `m/s` above which energetic surface particles entrain foam and micro-bubbles.
pub const FLUID_FOAM_SPEED_THRESHOLD_MPS: f32 = 0.32;
/// Pointer stir radius expressed as a fraction of vessel width.
pub const FLUID_STIR_RADIUS_RATIO: f32 = 0.16;
/// Maximum spatial hash grid cell capacity (`64 * 64 = 4096` cells, zero reallocation).
pub const FLUID_MAX_GRID_CELLS: usize = 4096;
/// Maximum clamped fixed-update delta time in seconds for unconditional stability.
pub const FLUID_MAX_STEP_DT: f32 = 1.0 / 30.0;
/// Deterministic PRNG initial seed for bubble jitter and splash micro-variation.
pub const FLUID_RNG_SEED: u64 = 0x517C_C1B7_2722_0A95;