Smoothed-Particle Hydrodynamics (SPH)
Smoothed-particle hydrodynamics (SPH) is a branch of computational fluid dynamics, which belongs in the category of particle-based and mesh-free methods. It was first developed for astrophysical flows related problems and has gained an increasing popularity over the last few years due to its very good applicability and easy extensibility in problems describing free surface and multiphase flows in both simple and complex geometries.
In the SPH formulation, the fluid is approximated as being comprised of identical fictitious particles whose interpolated properties can approximate any function that is of interest over a domain :
In this equation, is a kernel function and is defined as the smoothing length that characterizes the size of the support domain of the kernel. The discrete equivalent of the above expression for the th particle can be written as
The kernel function provides the weight which is assigned to each particle based on their distance from the point of interest (i.e. the point where the function is to be evaluated). The movement of the particles obeys Newton's second law of motion and the forces applied on the particles are being calculated as explained above.
More information on SPH and its applications can be found in the following resources
- http://dx.doi.org/10.1098/rspa.2019.0801
- https://doi.org/10.3389/fams.2021.797455
- https://www.ansys.com/en-gb/blog/what-is-sph-simulation
- https://www.dive-solutions.de/blog/sph-basics
- https://doi.org/10.5194/gmd-11-2691-2018
- https://arxiv.org/pdf/2104.00537.pdf
The algorithm
In this exemplar the following algorithm which describes the solution steps of a 2D formulation of the Navier-Stokes equation is implemented:
Density
The density of the fluid associated with each particle is approximated as
where and is the mass of a particle and the kernel density function for density, is given by
where is the distance between particle and particle , normalised by the interaction radius , given by
The interaction radius describes the distance over which a particle has an influence on the behaviour of the system.
Pressure
The pressure is calculated based on the ideal gas law
where is a resting density and is a gas constant.
Pressure force
The force exerted on the particle due to pressure from neighboring fluid particles is calculated as
where is the the kernel density function for pressure :
Viscous force
The force acting on each particle due to viscous effects is calculated as
where , is the velocity of particle , is the dynamic viscosity, and is given by:
Gravity force:
Finally, the force due to gravity is given by:
where is the acceleration due to gravity.
Acceleration
The acceleration of particle is given by:
Time integration
We solve the equation as a function of time by finding the velocity and position of each particle at each of a number of time steps. We denote a property of particle at time step as . The state of the property half way between time steps and is denoted as .
We begin with the initial conditions of the system, which are the positions and velocities of the particles at time . We iteratively use the state of the system at time step to find the state of the system at time step using a leap-frog scheme, which provides improved stability characteristics:
However, because the velocity is calculated at half-steps, we need to initialise the scheme on the first time step using:
where is the time step size. To ensure convergence, a small time-step is required. A value of is suggested.
Initial Condition
To initialise the simulation, one or more particles must be specified. These should be evenly distributed.
Once the particles are placed, the particle densities should be evaluated with an assumed mass of and the mass subsequently scaled so that the density is equal to the reference density:
Boundary Conditions
All the boundaries are solid walls with damped reflecting boundary conditions. If particles are within a distance h of the boundary, their velocity and position should be updated to reverse the motion of the particle and keep it within the domain. For example, on the right boundary, the -component of position and velocity would be modified as: