SPHSolver#
The SPHSolver implements Smoothed Particle Hydrodynamics for fluid simulation.
Overview#
SPH approximates fluid dynamics using particles:
Pressure forces from density
Viscosity forces from velocity differences
Surface tension (optional)
Free surface handling
Supported Materials#
Material |
Description |
|---|---|
|
General liquid simulation |
Usage#
import genesis as gs
gs.init()
scene = gs.Scene(
sph_options=gs.options.SPHOptions(
lower_bound=(-1, -1, 0),
upper_bound=(1, 1, 2),
particle_size=0.02,
),
)
# Add fluid
fluid = scene.add_entity(
gs.morphs.Box(pos=(0, 0, 0.5), size=(0.4, 0.4, 0.4)),
material=gs.materials.SPH.Liquid(
rho=1000, # Density
mu=0.01,
),
)
# Add rigid container
container = scene.add_entity(
gs.morphs.Box(
pos=(0, 0, 0.5),
size=(0.5, 0.5, 0.5),
),
vis_mode="collision",
)
scene.build()
for i in range(1000):
scene.step()
Configuration#
Key options in SPHOptions:
Option |
Type |
Description |
|---|---|---|
|
tuple |
Domain lower corner |
|
tuple |
Domain upper corner |
|
float |
Particle spacing |
|
float |
Internal timestep |
Parameters#
Parameter |
Description |
Typical Range |
|---|---|---|
|
Rest density |
1000 kg/m^3 (water) |
|
Dynamic viscosity |
0.001-0.1 |
|
Pressure stiffness |
1000-10000 |
See Also#
SPHEntity - SPHEntity
SPH - SPH materials
gs.options.SPHOptions - Full options