19
Smoothed Particle Smoothed Particle Hydrodynamics (SPH) Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an average over neighboring particles 1. Only neighbors contribute to the average 2. Close particles should contribute more than distant particles In the average: Use a weight function

Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Embed Size (px)

Citation preview

Page 1: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Smoothed Particle Hydrodynamics (SPH)Smoothed Particle Hydrodynamics (SPH)

Fluid dynamicsThe fluid is represented by a particle system

Some particle properties are determined by taking an average over neighboring particles

1. Only neighbors contribute to the average

2. Close particles should contribute more than distant particles

In the average: Use a weight function

Page 2: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Before we consider the details…Before we consider the details…

How do we describe our particle system?How do we describe our particle system?Each particle is specified by a state list:Each particle is specified by a state list:

mass, velocity, position, force,mass, velocity, position, force,

density, pressure, color density, pressure, color

),,,,,,( iiiiiii Cprm FvParticle i

Page 3: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

The GoalThe Goal

The acceleration of a particle isThe acceleration of a particle is

gravityi

einteractivi

viscosityi

pressurei

i aaaadt

dv

Let us now learn how to set up the particle list…

Page 4: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

In our simulation we choose to have the same mass for In our simulation we choose to have the same mass for all particles, mall particles, mii = m = m

The mass m is calculated by

particlesofnumberTotal

volumeTotalfluidofDensitym

Note! Do not change the mass during the simulation

Particle massParticle mass

Page 5: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Let us now go back to the weighted averages…Let us now go back to the weighted averages…

How do we determine the density of a particle?How do we determine the density of a particle?

ijrj

ijji rWm )(

Weight function or Kernel function

•The density calculation is done every time step

•The neighbor list must be updated every time step

0 10 20 30 40 50 60 70 80 90 1000

0.05

0.1

0.15

0.2

0.25

0.3

0.35

W

Page 6: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Surface trackingSurface tracking

It is not trivial to know where the surface should be…It is not trivial to know where the surface should be…

We can find the surface by monitoring the densityWe can find the surface by monitoring the density If the density at a particle deviates too much compared If the density at a particle deviates too much compared

to expected density we tag it as a surface particleto expected density we tag it as a surface particle

Page 7: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

PressurePressure

We get the pressure from the relation:We get the pressure from the relation:

02 isi cp

where cwhere css is the speed of sound and is the speed of sound and ρρ00

is the fluid reference densityis the fluid reference density

Page 8: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Let us take a look on the particle property Let us take a look on the particle property list againlist again

),,,,,,( iiiiiii Cprm Fv

The next property we focus on is the forceThe next property we focus on is the force

Velocities and positions are calculated from the forces in a Velocities and positions are calculated from the forces in a way similar to an ordinary particle systemway similar to an ordinary particle system

But before we go into that we need to learn more about But before we go into that we need to learn more about taking averages…taking averages…

Page 9: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

In SPH we formally define averages in the following way:

V

drrrWrArA ')'()'()(

In practice we use a discrete version of this:

j

ijjj

j

irWA

mA )(

j

ijjj

j

irWA

mA )(

j

ijjj

j

irWA

mA )(22

jijj

jijj

j

j

i

rWm

rWm

)(

)(

Example

Meshless method!!

Page 10: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Velocities and ForcesVelocities and Forces

Motion equation in elasticity:Motion equation in elasticity: extFdt

dv

11

We also had:We also had: CNow we instead use:Now we instead use: p

All this together produces the following fluid All this together produces the following fluid equation called Navier-Stokes equationequation called Navier-Stokes equation

gvv

extFpdt

d

11

Page 11: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Our task is now to convert each term on the Our task is now to convert each term on the RHS in Navier-Stokes to SPH-averagesRHS in Navier-Stokes to SPH-averages

First term (pressure) becomes:First term (pressure) becomes:

j

ijij

i

rWPp )(1

22

j

j

i

i

j

jij

ppmP

where where

Page 12: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

The second term (viscosity):The second term (viscosity):

j

ijij

i

rW )(2Vv

22

j

j

i

i

j

jij

m

vvVwhere where

Page 13: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

SummarySummary

The acceleration of a particle can now be written:The acceleration of a particle can now be written:

gravityi

einteractivi

viscosityi

pressurei

i aaaadt

dv

j

ijijpressurei rWPa )(

j

ijijviscosityi rWVa )(

einteractivi

i

einteractivi Fa

1

),0,0( ga gravityi

Page 14: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

For each time step:For each time step: Find neighbors to each particle and store in a Find neighbors to each particle and store in a

listlist Calculate density for each particleCalculate density for each particle Calculate pressure for each particleCalculate pressure for each particle Calculate all type of accelerations for each Calculate all type of accelerations for each

particle, and sum it upparticle, and sum it up Find new velocities and positions by using the Find new velocities and positions by using the

same integration method as before… same integration method as before…

Page 15: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an
Page 16: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

The color property?The color property?

What is the use of this property?What is the use of this property? We can use it to detect the We can use it to detect the position of the surfaceposition of the surface of of

our fluid our fluid We can also use it to find the We can also use it to find the normal vectorsnormal vectors at the at the

surface (important for rendering!)surface (important for rendering!) The normal vectors allow us to implement surface The normal vectors allow us to implement surface

tensiontension By adding several color fields we can for example By adding several color fields we can for example

implement a simple model of implement a simple model of flame propagationflame propagation

Page 17: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

The color fieldThe color field

The color parameter is a quantity that is zero everywhere The color parameter is a quantity that is zero everywhere except at the particle where it has a finite valueexcept at the particle where it has a finite value

Similar to how we calculated density we now calculate Similar to how we calculated density we now calculate the average color at particle i asthe average color at particle i as

j

ijjj

j

irWC

mC )(

Deviations of the color field show us where the surface is, and this case we choose to study Deviations of the color field show us where the surface is, and this case we choose to study the derivative of color fieldthe derivative of color field

Page 18: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

The gradient of a color field isThe gradient of a color field is

j

ijjj

j

irWC

mC )(

When the magnitude of the gradient is When the magnitude of the gradient is larger than a certain value, we tag the larger than a certain value, we tag the particle as a surface particleparticle as a surface particle

Page 19: Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an

Surface tensionSurface tension

The force that tends to make surfaces The force that tends to make surfaces smooth (like a drop of liquid) can be smooth (like a drop of liquid) can be modeled in the following way:modeled in the following way:

in

niis

tensioni Ca 2

where where j

ijjj

j

irWC

mC )(22

ii Cn andand

Note: If the magnitude of ni is small we can get numerical problem in the division above. To avoid this we only calculate if the magnitude of ni exceeds a certain threshold.

inn /i