Scope
This document covers the SPH implementation in Chrono FSI (not TDPF), with focus on:
- the primary classes in
src/chrono_fsi/andsrc/chrono_fsi/sph/ - who inherits from whom
- how these classes are used in
src/demos/fsi/sph/andsrc/demos/vehicle/ - when each class is the right choice for users
Quick Mental Model
For SPH-FSI, think in layers:
- Generic FSI coupling layer (
ChFsiSystem,ChFsiFluidSystem,ChFsiInterface) - SPH concrete layer (
ChFsiSystemSPH,ChFsiFluidSystemSPH,ChFsiInterfaceSPH) - Problem-builder layer (
ChFsiProblemSPH+ Cartesian/Cylindrical/Wavetank specializations) - Vehicle terrain integration (
CRMTerrain)
Most users should start from layer 3 or layer 4.
Primary Classes
1) Generic FSI layer (solver-independent)
chrono::fsi::ChFsiSystem: Owns one multibody system and one fluid system, advances them, and performs CFD↔MBD data exchange.chrono::fsi::ChFsiFluidSystem: Abstract base for fluid-side solvers that participate in FSI.chrono::fsi::ChFsiInterface: Abstract base for state/force exchange between multibody and fluid systems.chrono::fsi::ChFsiInterfaceGeneric: Generic, buffer-copy interface implementation.
2) SPH FSI layer (concrete implementation)
chrono::fsi::sph::ChFsiFluidSystemSPH: SPH solver with CFD mode (SetCfdSPH) and CRM mode (SetElasticSPH), BCE generation helpers, and SPH parameter API.chrono::fsi::sph::ChFsiSystemSPH: SPH concrete FSI system. By default usesChFsiInterfaceSPH(custom, direct SPH data-manager coupling).chrono::fsi::sph::ChFsiInterfaceSPH: SPH-optimized interface (fewer copy hops than generic interface).
3) SPH problem-builder layer (recommended user API)
chrono::fsi::sph::ChFsiProblemSPH: High-level setup API for particles, BCE markers, rigid bodies, FEA meshes, domains, initialization, stepping.chrono::fsi::sph::ChFsiProblemCartesian: Cartesian-grid setup helper (Constructfrom box, heightmap, or marker files).chrono::fsi::sph::ChFsiProblemCylindrical: Cylindrical-grid setup helper (Constructfor annulus/tank-like domains).chrono::fsi::sph::ChFsiProblemWavetank: Wavetank builder with wavemaker body/motor and optional beach profile.chrono::fsi::sph::ChFsiProblemSPH::ParticlePropertiesCallback: Hook for custom initial particle pressure/density/viscosity/velocity.chrono::fsi::sph::DepthPressurePropertiesCallback: Ready-made hydrostatic initialization callback.
4) Vehicle integration layer
chrono::vehicle::CRMTerrain: Dual role class:ChTerrain(vehicle terrain API)ChFsiProblemCartesian(SPH CRM builder) Adds vehicle-centric features such as moving patch and vehicle-advance callback registration.
5) Optional utilities
chrono::fsi::sph::ChSphVisualizationVSG: VSG plugin to visualize SPH/BCE markers.chrono::fsi::sph::ChFsiSplashsurfSPH: Optional particle-to-surface reconstruction utility (splashsurf).
Inheritance Map
Main API hierarchy
SPH internal physics hierarchy
SPH internal composition (not inheritance):
Interface Clarity
ChFsiInterface vs. ChFsiInterfaceGeneric vs. ChFsiInterfaceSPH
chrono::fsi::ChFsiInterfaceis an abstract base class. It provides shared utilities:- registration of FSI solids (
AddFsiBody,AddFsiMesh1D,AddFsiMesh2D) - extraction of solid states from MBS (
StoreSolidStates) - loading fluid forces back to solids (
LoadSolidForces) - buffer size/consistency checks
- registration of FSI solids (
chrono::fsi::ChFsiInterfaceGenericis a concrete implementation of that base interface. It exchanges data through intermediate CPU buffers and calls:ChFsiFluidSystem::LoadSolidStates(...)ChFsiFluidSystem::StoreSolidForces(...)
chrono::fsi::sph::ChFsiInterfaceSPHis the SPH-specific optimized implementation. It bypasses the generic buffer-copy route and writes/reads directly to/from SPH data-manager host/device structures.
For SPH, ChFsiSystemSPH uses ChFsiInterfaceSPH by default. ChFsiInterfaceGeneric is used only if ChFsiSystemSPH(..., use_generic_interface=true) is requested.
SPH Particle Initialization control when using ChFsiProblemSPH class
ParticlePropertiesCallback
- Declared inside
ChFsiProblemSPH. - Purpose: define initial per-particle properties before particles are inserted into
ChFsiFluidSystemSPH. - Fields you control:
p0(pressure)rho0(density)mu0(viscosity)v0(velocity)pre_pressure_scale0(CRM consolidation-pressure scale used by MCC rheology)
- Important rule: if you override
set(...), set all fields.
Execution timing:
- Called once per particle during
ChFsiProblemSPH::Initialize(). - Not called during time stepping.
DepthPressurePropertiesCallback
- A ready-made callback derived from
ParticlePropertiesCallback. - It sets hydrostatic initial pressure using particle depth:
p0 = rho * g * (zero_height - z)rho0 = rho + p0/c^2mu0 = default fluid/system viscosityv0 = 0
- Use this when you want a hydrostatic initial state (common in tank/drop/wave-type initializations).
Do you use these with ChFsiFluidSystemSPH + ChFsiSystemSPH directly?
- Usually no, because these callbacks belong to the
ChFsiProblemSPHsetup API. - With direct low-level setup, you set properties yourself when calling
AddSPHParticle(...). - For simple global hydrostatic pressure setup in direct mode,
SetInitPressure(...)is another option.
Using ChSphVisualizationVSG with VSG
ChSphVisualizationVSG is a VSG plugin, not a standalone visual system. You use it in addition to a regular VSG visual system.
Standard VSG (vsg3d::ChVisualSystemVSG)
Use this sequence:
- Create
ChSphVisualizationVSGfromChFsiSystemSPH*orChFsiFluidSystemSPH*. - Configure marker visibility/color callbacks.
- Create a regular
vsg3d::ChVisualSystemVSG. - Attach the plugin with
AttachPlugin(visFSI). - Attach your simulation system (
AttachSystem(&sysMBS)for standard FSI demos). - Call
Initialize(). - In the loop, call only
vis->Run()/vis->Render()on the regular visual system.
Vehicle VSG visualizers
With ChWheeledVehicleVisualSystemVSG / ChTrackedVehicleVisualSystemVSG, usage is the same plugin pattern:
AttachVehicle(...)as usualAttachPlugin(visFSI)Initialize()- in the simulation loop, still call the host visual system
vis->Run()andvis->Render()(and typicallyvis->Synchronize(...)/vis->Advance(...)in vehicle demos)
No separate render loop is needed for ChSphVisualizationVSG itself; plugin hooks (OnAttach, OnInitialize, OnRender) are invoked automatically by the hosting VSG visual system during that host system's normal render loop.
Note: SPH run-time visualization copies particle data each render call, so it can be expensive for large particle counts.
When To Use Which Class
Use ChFsiProblemCartesian when
- you want the simplest SPH-FSI setup path
- your domain is box-like, heightmap-based, or loaded from marker files
- you still need rigid bodies and/or FEA coupling without managing raw SPH arrays
This is the most common entry point in src/demos/fsi/sph/.
Use ChFsiProblemWavetank when
- you need a wave tank with piston/flap wavemaker
- you want built-in beach profile support and optional lateral periodic BC
Use ChFsiProblemCylindrical when
- your natural geometry is cylindrical/annular
- you want cylindrical discretization helpers
Use direct ChFsiFluidSystemSPH + ChFsiSystemSPH when
- you need full control over particle creation (
AddSPHParticle) - you need explicit/manual BCE generation and placement
- you are doing method development or low-level debugging
Use CRMTerrain when
- your application is a Chrono vehicle terramechanics problem (CRM soil)
- you need vehicle-facing terrain API plus SPH CRM
- you need moving patch behavior for long traverses
Demo-Grounded Usage Patterns
Pattern A: High-level problem builders
Seen in:
src/demos/fsi/sph/demo_FSI-SPH_Compressibility.cpp(Cartesian, CFD)src/demos/fsi/sph/demo_FSI-SPH_ObjectDrop.cpp(Cartesian, CFD)src/demos/fsi/sph/demo_FSI-SPH_CylindricalTank.cpp(Cylindrical, CFD)src/demos/fsi/sph/demo_FSI-SPH_WaveTank.cpp(Wavetank, CFD)src/demos/fsi/sph/demo_FSI-SPH_FEAdirections.cpp(Cartesian + FEA mesh + node directions)
Best when you want fast setup with fewer low-level details.
Pattern B: Direct SPH+FSI systems
Seen in:
src/demos/fsi/sph/demo_FSI-SPH_DamBreak.cpp(manual SPH/BCE setup)src/demos/fsi/sph/demo_FSI-SPH_AngleRepose.cpp(manual CRM setup)src/demos/fsi/sph/demo_FSI-SPH_BCE.cpp(BCE generation patterns)src/demos/vehicle/fsi/demo_VEH_FSI_FloatingBlock.cpp(vehicle-side FSI example)
Best when you need explicit control of particle/boundary construction.
Pattern C: Vehicle CRM integration
Seen in:
src/demos/vehicle/terrain/demo_VEH_CRMTerrain_WheeledVehicle.cppsrc/demos/vehicle/terrain/demo_VEH_CRMTerrain_TrackedVehicle.cppsrc/demos/vehicle/terrain/demo_VEH_CRMTerrain_MovingPatch.cppsrc/demos/vehicle/test_rigs/demo_VEH_TireTestRig_CRM.cpp
Best when the main object is a vehicle and terrain is CRM-SPH.
Recommended Starting Workflow (User View)
For new users, this is usually the best sequence:
- Create Chrono MBS system.
- Create
ChFsiProblemCartesian. - Set gravity and time steps.
- Choose physics mode:
SetCfdSPH(...)for fluidsSetElasticSPH(...)for CRM soil
- Set
SPHParameters. - Build particle/BCE domain with
Construct(...). - Add interacting solids:
AddRigidBody(...)for rigid objectsAddFeaMesh(...)for flexible structures
Initialize().- Simulation loop with
DoStepDynamics(step)(and normal MBS synchronize/driver logic around it).
For vehicle terramechanics, start from CRMTerrain instead of directly using ChFsiProblemCartesian.