Skip to content

Commit

Permalink
- fixed z-sort
Browse files Browse the repository at this point in the history
- added parameter stepsPerZSort
- bugfix in the PBDWrapper - the wrapper ignored some settings of the scene file
  • Loading branch information
janbender committed Jan 12, 2024
1 parent e9e67e4 commit 4c063be
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 239 deletions.
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.13.1
- fixed z-sort
- added parameter stepsPerZSort
- bugfix in the PBDWrapper - the wrapper ignored some settings of the scene file

2.13.0
- added implementation of surface tension method: Jeske et al. "Implicit Surface Tension for SPH Fluid Simulation", ACM Transactions on Graphics, 2023 (thanks to Stefan Rhys Jeske)

Expand Down
98 changes: 4 additions & 94 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,105 +96,15 @@ SPlisHSPlasH implements:
* a Maya plugin to model and generate scene files
* a ParaView plugin to import particle data

## Pressure Solvers
A list of all implemented simulation methods can be found here:
[https://splishsplash.physics-simulation.org/features](https://splishsplash.physics-simulation.org/features/)

The SPlisHSPlasH library implements the following pressure solvers:

* Weakly compressible SPH for free surface flows (WCSPH)
* Predictive-corrective incompressible SPH (PCISPH)
* Position based fluids (PBF)
* Implicit incompressible SPH (IISPH)
* Divergence-free smoothed particle hydrodynamics (DFSPH)
* Projective Fluids (PF)
* Implicit compressible SPH (ICSPH)
## Screenshots & Videos

## Boundary Handling
[https://splishsplash.physics-simulation.org/gallery](https://splishsplash.physics-simulation.org/gallery/)

The SPlisHSPlasH library implements the following boundary handling methods:

* Nadir Akinci, Markus Ihmsen, Gizem Akinci, Barbara Solenthaler, and Matthias Teschner, "Versatile rigid-fluid coupling for incompressible SPH", ACM Transactions on Graphics 31(4), 2012
* Dan Koschier and Jan Bender, "Density Maps for Improved SPH Boundary Handling", In Proceedings of ACM SIGGRAPH / EUROGRAPHICS Symposium on Computer Animation (SCA), 2017
* Jan Bender, Tassilo Kugelstadt, Marcel Weiler, Dan Koschier, "Volume Maps: An Implicit Boundary Representation for SPH", ACM SIGGRAPH Conference on Motion, Interaction and Games, 2019

## Viscosity

The SPlisHSPlasH library implements explicit viscosity methods:

* Standard SPH formulation of viscosity

and the implicit methods of the following publications:

* Jan Bender and Dan Koschier, "Divergence-free SPH for incompressible and viscous fluids", IEEE Transactions on Visualization and Computer Graphics, 2017
* Andreas Peer, Markus Ihmsen, Jens Cornelis, and Matthias Teschner, "An Implicit Viscosity Formulation for SPH Fluids", ACM Transactions on Graphics, 34(4), 2015
* Andreas Peer and Matthias Teschner. Prescribed Velocity Gradients for Highly Viscous SPH Fluids with Vorticity Diffusion. IEEE Transactions on Visualization and Computer Graphics, 2016
* An improved version of: Tetsuya Takahashi, Yoshinori Dobashi, Issei Fujishiro, Tomoyuki Nishita, and Ming C. Lin. Implicit Formulation for SPH-based Viscous Fluids. Computer Graphics Forum, 34, 2015.
* Marcel Weiler, Dan Koschier, Magnus Brand and Jan Bender. A Physically Consistent Implicit Viscosity Solver for SPH Fluids. Computer Graphics Forum (Eurographics), 37(2), 2018

## Surface Tension

The SPlisHSPlasH library implements the surface tension methods of the following publications:

* Markus Becker and Matthias Teschner. Weakly compressible SPH for free surface flows. In Proceedings of ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 2007. Eurographics Association.
* Nadir Akinci, Gizem Akinci, and Matthias Teschner. Versatile surface tension and adhesion for SPH fluids. ACM Trans. Graph., 32(6):182:1–182:8, 2013.
* Xiaowei He, Huamin Wang, Fengjun Zhang, Hongan Wang, Guoping Wang, and Kun Zhou, "Robust simulation of sparsely sampled thin features in SPH-based free surface flows", ACM Transactions on Graphics, 34(1), 2014.
* F. Zorilla, M. Ritter, J. Sappl, W. Rauch, M. Harders, "Accelerating Surface Tension Calculation in SPH via Particle Classification and Monte Carlo Integration", Computers 9, 23, 2020.

## Vorticity

The SPlisHSPlasH library implements the vorticity methods of the following publications:

* Jan Bender, Dan Koschier, Tassilo Kugelstadt and Marcel Weiler. A Micropolar Material Model for Turbulent SPH Fluids. In Proceedings of ACM SIGGRAPH / EUROGRAPHICS Symposium on Computer Animation, 2017
* Miles Macklin and Matthias Müller. Position based fluids. ACM Trans. Graph., 32(4):104:1–104:12, July 2013.

## Drag Forces

The SPlisHSPlasH library implements the drag force computation of the following publications:

* Christoph Gissler, Stefan Band, Andreas Peer, Markus Ihmsen and Matthias Teschner. Approximate Air-Fluid Interactions for SPH. In Proceedings of Virtual Reality Interactions and Physical Simulations, 2017
* Miles Macklin, Matthias Müller, Nuttapong Chentanez and Tae-Yong Kim. Unified Particle Physics for Real-Time Applications. ACM Trans. Graph., 33(4), 2014

## Elastic Forces

* M. Becker, M. Ihmsen, and M. Teschner. Corotated SPH for deformable solids. Proceedings of Eurographics Conference on Natural Phenomena, 2009
* A. Peer, C. Gissler, S. Band, and M. Teschner. An Implicit SPH Formulation for Incompressible Linearly Elastic Solids. Computer Graphics Forum, 2017
* Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, and Andreas Longva. Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control. Proceedings of the ACM on Computer Graphics and Interactive Techniques, 2021


## Multi-Phase Fluid Simulation

The SPlisHSPlasH library implements the following publication to realize multi-phase simulations:

* B. Solenthaler and R. Pajarola. Density Contrast SPH Interfaces. In Proceedings of ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 2008.

## Volume Sampling

The SPlisHSPlasH library implements the volume sampling techniques of following publications:

* M. Jiang, Y. Zhou, R. Wang, R. Southern, J. J. Zhang. Blue noise sampling using an SPH-based method. ACM Transactions on Graphics, 2015
* Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, and Andreas Longva. Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control. Proceedings of the ACM on Computer Graphics and Interactive Techniques, 2021


## Screenshots

|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/SPlisHSPlasH/master/doc/images/SPlisHSPlasH2.jpg)|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/SPlisHSPlasH/master/doc/images/SPlisHSPlasH1.jpg)|
|--|--|
|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/SPlisHSPlasH/master/doc/images/SPlisHSPlasH3.jpg)|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/SPlisHSPlasH/master/doc/images/SPlisHSPlasH4.jpg)|

## Videos

The following videos were generated using the SPlisHSPlasH library:

*A Micropolar Material Model for Turbulent SPH Fluids* | *Density Maps for Improved SPH Boundary Handling*
:---:|:---:
[![Video](https://img.youtube.com/vi/fsvDbzEui3w/0.jpg)](https://www.youtube.com/watch?v=fsvDbzEui3w) | [![Video](https://img.youtube.com/vi/P82qmTAahg0/0.jpg)](https://www.youtube.com/watch?v=P82qmTAahg0)
*Divergence-Free Smoothed Particle Hydrodynamics* | *Divergence-Free SPH for Incompressible and Viscous Fluids*
[![Video](https://img.youtube.com/vi/POnmzzhc5E0/0.jpg)](https://www.youtube.com/watch?v=POnmzzhc5E0) | [![Video](https://img.youtube.com/vi/tl4mx0TtaAc/0.jpg)](https://www.youtube.com/watch?v=tl4mx0TtaAc)
*A Physically Consistent Implicit Viscosity Solver for SPH Fluids* | *Turbulent Micropolar SPH Fluids with Foam*
[![Video](https://img.youtube.com/vi/D_nEhix1G-w/0.jpg)](https://www.youtube.com/watch?v=D_nEhix1G-w) | [![Video](https://img.youtube.com/vi/elZieJNBYqk/0.jpg)](https://www.youtube.com/watch?v=elZieJNBYqk)
*Volume Maps: An Implicit Boundary Representation for SPH* | *Implicit Frictional Boundary Handling for SPH*
[![Video](https://img.youtube.com/vi/AV_pl1bMIb8/0.jpg)](https://www.youtube.com/watch?v=AV_pl1bMIb8) | [![Video](https://img.youtube.com/vi/1u5N0eedzic/0.jpg)](https://www.youtube.com/watch?v=1u5N0eedzic)
*Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control* | *A comparison of linear consistent correction methods for first-order SPH derivatives*
[![Video](https://img.youtube.com/vi/8NkyiftmDN0/0.jpg)](https://www.youtube.com/watch?v=8NkyiftmDN0) | [![Video](https://img.youtube.com/vi/k0kKR8mXmK4/0.jpg)](https://www.youtube.com/watch?v=k0kKR8mXmK4)

## Citation

Expand Down
18 changes: 3 additions & 15 deletions SPlisHSPlasH/DFSPH/TimeStepDFSPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ TimeStepDFSPH::TimeStepDFSPH() :
m_simulationData()
{
m_simulationData.init();
m_counter = 0;
m_iterationsV = 0;
m_enableDivergenceSolver = true;
m_maxIterationsV = 100;
Expand Down Expand Up @@ -97,7 +96,7 @@ void TimeStepDFSPH::step()
//////////////////////////////////////////////////////////////////////////
// search the neighbors for all particles
//////////////////////////////////////////////////////////////////////////
performNeighborhoodSearch();
sim->performNeighborhoodSearch();

#ifdef USE_PERFORMANCE_OPTIMIZATION
//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -684,24 +683,13 @@ void TimeStepDFSPH::reset()
{
TimeStep::reset();
m_simulationData.reset();
m_counter = 0;
m_iterations = 0;
m_iterationsV = 0;
}

void TimeStepDFSPH::performNeighborhoodSearch()
void TimeStepDFSPH::performNeighborhoodSearchSort()
{
if (Simulation::getCurrent()->zSortEnabled())
{
if (m_counter % 500 == 0)
{
Simulation::getCurrent()->performNeighborhoodSearchSort();
m_simulationData.performNeighborhoodSearchSort();
}
m_counter++;
}

Simulation::getCurrent()->performNeighborhoodSearch();
m_simulationData.performNeighborhoodSearchSort();
}

void TimeStepDFSPH::emittedParticles(FluidModel *model, const unsigned int startIndex)
Expand Down
5 changes: 1 addition & 4 deletions SPlisHSPlasH/DFSPH/TimeStepDFSPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace SPH
{
protected:
SimulationDataDFSPH m_simulationData;
unsigned int m_counter;
const Real m_eps = static_cast<Real>(1.0e-5);
bool m_enableDivergenceSolver;
unsigned int m_iterationsV;
Expand All @@ -43,9 +42,7 @@ namespace SPH
void computePressureAccel(const unsigned int fluidModelIndex, const unsigned int i, const Real density0, std::vector<std::vector<Real>>& pressure_rho2, const bool applyBoundaryForces = false);
Real compute_aij_pj(const unsigned int fluidModelIndex, const unsigned int i);

/** Perform the neighborhood search for all fluid particles.
*/
void performNeighborhoodSearch();
virtual void performNeighborhoodSearchSort();
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex);

/** Init all generic parameters */
Expand Down
18 changes: 3 additions & 15 deletions SPlisHSPlasH/ICSPH/TimeStepICSPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ TimeStepICSPH::TimeStepICSPH() :
TimeStep()
{
m_simulationData.init();
m_counter = 0;
m_lambda = 200000;
m_clamping = true;

Expand Down Expand Up @@ -78,7 +77,7 @@ void TimeStepICSPH::step()
//////////////////////////////////////////////////////////////////////////
// search the neighbors for all particles
//////////////////////////////////////////////////////////////////////////
performNeighborhoodSearch();
sim->performNeighborhoodSearch();

#ifdef USE_PERFORMANCE_OPTIMIZATION
//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -159,7 +158,6 @@ void TimeStepICSPH::reset()
{
TimeStep::reset();
m_simulationData.reset();
m_counter = 0;
}


Expand Down Expand Up @@ -580,19 +578,9 @@ void TimeStepICSPH::computePressureAccels(const unsigned int fluidModelIndex)
}
}

void TimeStepICSPH::performNeighborhoodSearch()
void TimeStepICSPH::performNeighborhoodSearchSort()
{
if (Simulation::getCurrent()->zSortEnabled())
{
if (m_counter % 500 == 0)
{
Simulation::getCurrent()->performNeighborhoodSearchSort();
m_simulationData.performNeighborhoodSearchSort();
}
m_counter++;
}

Simulation::getCurrent()->performNeighborhoodSearch();
m_simulationData.performNeighborhoodSearchSort();
}

void TimeStepICSPH::emittedParticles(FluidModel *model, const unsigned int startIndex)
Expand Down
5 changes: 1 addition & 4 deletions SPlisHSPlasH/ICSPH/TimeStepICSPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace SPH
Real m_lambda;
bool m_clamping;
const Real m_psi = 1.5;
unsigned int m_counter;

void computeDensityAdv(const unsigned int fluidModelIndex);
void compute_aii(const unsigned int fluidModelIndex);
Expand All @@ -34,9 +33,7 @@ namespace SPH
/** Determine the pressure accelerations when the pressure is already known. */
void computePressureAccels(const unsigned int fluidModelIndex);

/** Perform the neighborhood search for all fluid particles.
*/
void performNeighborhoodSearch();
virtual void performNeighborhoodSearchSort();

virtual void initParameters();
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex);
Expand Down
18 changes: 3 additions & 15 deletions SPlisHSPlasH/IISPH/TimeStepIISPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ TimeStepIISPH::TimeStepIISPH() :
TimeStep()
{
m_simulationData.init();
m_counter = 0;

Simulation *sim = Simulation::getCurrent();
const unsigned int nModels = sim->numberOfFluidModels();
Expand Down Expand Up @@ -62,7 +61,7 @@ void TimeStepIISPH::step()
for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
clearAccelerations(fluidModelIndex);

performNeighborhoodSearch();
sim->performNeighborhoodSearch();

#ifdef USE_PERFORMANCE_OPTIMIZATION
precomputeValues();
Expand Down Expand Up @@ -105,7 +104,6 @@ void TimeStepIISPH::reset()
{
TimeStep::reset();
m_simulationData.reset();
m_counter = 0;
}

void TimeStepIISPH::predictAdvection(const unsigned int fluidModelIndex)
Expand Down Expand Up @@ -520,19 +518,9 @@ void TimeStepIISPH::computePressureAccels(const unsigned int fluidModelIndex)
}
}

void TimeStepIISPH::performNeighborhoodSearch()
void TimeStepIISPH::performNeighborhoodSearchSort()
{
if (Simulation::getCurrent()->zSortEnabled())
{
if (m_counter % 500 == 0)
{
Simulation::getCurrent()->performNeighborhoodSearchSort();
m_simulationData.performNeighborhoodSearchSort();
}
m_counter++;
}

Simulation::getCurrent()->performNeighborhoodSearch();
m_simulationData.performNeighborhoodSearchSort();
}

void TimeStepIISPH::emittedParticles(FluidModel *model, const unsigned int startIndex)
Expand Down
5 changes: 1 addition & 4 deletions SPlisHSPlasH/IISPH/TimeStepIISPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace SPH
{
protected:
SimulationDataIISPH m_simulationData;
unsigned int m_counter;

void predictAdvection(const unsigned int fluidModelIndex);
void pressureSolve();
Expand All @@ -30,9 +29,7 @@ namespace SPH
/** Determine the pressure accelerations when the pressure is already known. */
void computePressureAccels(const unsigned int fluidModelIndex);

/** Perform the neighborhood search for all fluid particles.
*/
void performNeighborhoodSearch();
virtual void performNeighborhoodSearchSort();

virtual void emittedParticles(FluidModel *model, const unsigned int startIndex);

Expand Down
18 changes: 3 additions & 15 deletions SPlisHSPlasH/PBF/TimeStepPBF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ TimeStepPBF::TimeStepPBF() :
TimeStep()
{
m_simulationData.init();
m_counter = 0;
m_velocityUpdateMethod = 0;

Simulation *sim = Simulation::getCurrent();
Expand Down Expand Up @@ -88,7 +87,7 @@ void TimeStepPBF::step()
}

// Perform neighborhood search
performNeighborhoodSearch();
sim->performNeighborhoodSearch();

#ifdef USE_PERFORMANCE_OPTIMIZATION
precomputeValues();
Expand Down Expand Up @@ -163,7 +162,6 @@ void TimeStepPBF::reset()
{
TimeStep::reset();
m_simulationData.reset();
m_counter = 0;
}


Expand Down Expand Up @@ -383,19 +381,9 @@ void TimeStepPBF::pressureSolveIteration(const unsigned int fluidModelIndex, Rea
}
}

void TimeStepPBF::performNeighborhoodSearch()
void TimeStepPBF::performNeighborhoodSearchSort()
{
if (Simulation::getCurrent()->zSortEnabled())
{
if (m_counter % 500 == 0)
{
Simulation::getCurrent()->performNeighborhoodSearchSort();
m_simulationData.performNeighborhoodSearchSort();
}
m_counter++;
}

Simulation::getCurrent()->performNeighborhoodSearch();
m_simulationData.performNeighborhoodSearchSort();
}

void TimeStepPBF::emittedParticles(FluidModel *model, const unsigned int startIndex)
Expand Down
5 changes: 1 addition & 4 deletions SPlisHSPlasH/PBF/TimeStepPBF.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace SPH
{
protected:
SimulationDataPBF m_simulationData;
unsigned int m_counter;
int m_velocityUpdateMethod;

/** Perform a position-based correction step for the following density constraint:\n
Expand All @@ -32,9 +31,7 @@ namespace SPH
void pressureSolve();
void pressureSolveIteration(const unsigned int fluidModelIndex, Real &avg_density_err);

/** Perform the neighborhood search for all fluid particles.
*/
void performNeighborhoodSearch();
virtual void performNeighborhoodSearchSort();

virtual void emittedParticles(FluidModel *model, const unsigned int startIndex);

Expand Down
Loading

0 comments on commit 4c063be

Please sign in to comment.