smoothed particle hydrodynamics - cfca · – principle of smoothed particle hydrodynamics •...

Post on 13-Jun-2020

21 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Smoothed Particle Hydrodynamics

2nd-3rd Aug. 2014Takayuki Saitoh

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

PART 1Theory

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

What is SPH?• SPH is a Lagrangian scheme of fluid

dynamics developed by Lucy (1977) and Gingold & Monaghan (1977)– Solve evolution of fluid elements– Fluid quantities are evaluated via the

convolution of particles

Muller+’03 SIGGRAPH Saitoh et al.

~cm scale  ~1022cm scale 

Advantages of SPH• Advantages

– Galilean invariance– Suitable for simulations with a wide dynamic

range because of Lagrangian nature– High density regions have high resolution

Governing Equations of Compressive fluid

• Continuity equation

• Momentum equation

• Energy equation

• Equation of state

Derivation of SPH (1)• Physical quantity, f, at x is

• Applying the kernel approximation, this equation becomes

• Here, W is the compact support function which is reduced to δ when h0

Derivation of SPH (2)• Spatial derivation is

Kernel Function• Kernel function should be

1. normalized unity2. the compact support3. reduced to the δ function when h0

• The cubic spline function is the widely used as the kernel function:

Accuracy• Consider the Taylor exp. of f and

substitute it into the f(r)

• If the kernel function is an even function, we have

• SPH is the second order scheme

Fundamental Equation of SPH

• Discretize the kernel approximated equations using the volume element drʼ = m/ρ

• Substituting f = ρ, we have

In standard SPH, every quantities evaluate using this ρ

Equation of Motion (1)• Lagrangian:

• Constraint:

Equation of Motion (2)• Euler-Lagrange Equation:

Equation of Motion (3)• Solve the last half (h1,h2,…,hN),

Equation of Motion (4)• Combining these two equations, we get

• Solving this eq. for λ, we have

Equation of Motion (5)• Solve the fist half (r1,r2,…,rN):

Equation of Motion (6)•

• Then, we have

Energy Equation (1)• When you choose the internal energy as

the independent thermodynamics variable, you need the energy equation.

• Energy equation can be obtained from the fist law of thermodynamics:

Energy Equation (2)• Time derivative of the density is

• Rearranging this eq., we get

Energy Equation (3)• Again, rearranging the eq., we obtain

• Finally, we have

Summary of SPH eqs.

Other SPH eqs. (1)• With other const.:

Other SPH eqs. (2)• The conventional set of SPH equations:

Problem in SPH• SPH cannot deal with

contact discontinuities, resulting in suppression of fluid instabilities (Agertz+2007)– The reason is that the

standard formulation of SPH uses differentiability of density

SPH Grid

Hydrostatic Equilibrium test

ρ=1

ρ=4

Initially hydrostatic equilibrium

Saitoh & Makino 2013

Pressure at Contact Discon.

• Density over(under) estimate Error in pressure (=repulsive force) Suppression of mixing

• We should reconstruct SPH with different way in order to avoid differentiability of density

27

Underest.Overest.

Density Pressure

Saitoh & Makino 2013

Density Independent SPH• Since pressure is the smooth quantity at

the contact discontinuity, we use the differentiability of pressure (energy density) (See Saitoh & Makino 2013).

Formulation of Density Independent SPH

• We use a new volume element:

• Physical quantity f is

• Substituting q into f, we have

29The value q is proportional to P in an ideal-gas

Saitoh & Makino 2013

Summary of DISPH eqs.

Other DISPH eqs. (1)• With other const.:

Other DISPH eqs. (2)• The conventional set of SPH equations:

Pressure at Contact Discon. with DISPH

Since we use pressure as the fundamental quantity,we have smooth pressure at the contact discon.

Hydrostatic Equilibrium test

34

SPH DISPH

Saitoh & Makino 2013

Our SPH

Standard SPH

Initial condition

Generalized DISPH• We can use y=Pζ, instead of q(=P/(γ-1))

– Note that, when ζ=1, these equations are reduce to the original DISPH

• See Saitoh & Makino (2013)

36

DISPH for Non-ideal EOS• Non-ideal EOS is important for geophysical

applications to express mantle, iron core, etc.– P=P(ρ,u)

• We directly use P as a fundamental quantity.• See Hosono, Saitoh and Makino (2013)

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

Artificial Viscosity• In order to handle shocks, we introduce

the artificial viscosity terms for momentum and energy equation.

• Following Monaghan 1997, we use

Artificial Viscosity (2)• The contributions of the artificial

viscosity to the momentum and energy equations are as follows:

Balsara Limiter• In order to suppress the shear viscosity,

we use the Balsara Limiter (Balsara1995):

where csi = sound speed and εb = 1.e-4.• Πij Πij

Balsara:

Time integration:Leapfrog

n n+1/2 n+1

position

velocity

acc

1. Kick 3. Kick

2.Drift

Time Integration:Leapfrog

n n+1/2 n+1

position

velocity

Acc

1. Kick 3. Kick

2.Drift

Time Integration:Internal Energy

n n+1/2 n+1

position

velocity

acc

1. Kick 3. Kick

2.Drift

U

dU/dt

1. Kick

2. Predict

3. Kick

Time Integration:Internal Energy

n n+1/2 n+1

position

velocity

Acc

1. Kick 3. Kick

2.Drift

U

du/dt

1. Kick

2. Predict

3. Kick

Time step• The Courant-Friedrichs-Lewy (CFL)

condition is used for the evaluation of time step dt:

where CCFL~0.1 and

and βsig ~ 1.

Kernel size• Two ways to determine the kernel size

– Constant neighbor number

– Use density:

• The tree algorithm (Barnes & Hut 1986) is widely used for the neighbor particles search

Exercises• Get Equations in Pages 23, and 24• Get Equations in Pages 30, 31, and 32

– Hint: See Saitoh & Makino (2013) and Hopkins (2013)

PART 2Practics

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

ASURA(Subset version)• is an SPH code written in lang C (C99)

– ASURA is originally developed for simulations of galaxy formation

– I wrote it as simple/clear as I can. Hope it help your understanding.

• is parallelized by OpenMP• can run both DISPH and SSPH just

selecting a flag in the input parameter file.• includes standard benchmark tests.• A separate program for visualization via

PGPlot is included.

License• This version of ASURA is distributed

under the MIT License.• http://opensource.org/licenses/MIT

Directory structure• src : source code• runs : work directory

– shocktube : 1D shocktube– hydrostatic : 2D hydrostatic– kh:Kelvin-Helmholtz inst.– rt:Rayleigh-Taylor inst.

• plot:plot tool• doc:Documents generated by DoxyGen

Compile• ASURA requires only “gcc”

– cd ./src– make– Then, we have “asura.out”

How to run• Copy the binary file at “src/asura.out” to

the directory in which the parameter file is included.– e.g., cp ./src/asura.out ./runs/shocktube

• Exec. the binary “./asura.out”– ASURA automatically reads the parameter

file, integrates the system and writes the data with the interval set in the parameter file.

Parameter file “param.txt”

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

Shock tube tests• Shock tube test is the standard

benchmark test for the compressive fluid.

• This test shows the shock-capturing ability of schemes.

x

Run shock tube tests• Working directory: ./runs/shocktube• Letʼs try following two case:

– UseDISPH 1 and ./data_disph– UseDISPH 0 and ./data_ssph

Compile plot program• Plot program requires “gcc” and “pgplot”

– cd ./plot– make– Then, we have “plot.out”

Parameter file for plot• Parameters are

defined in param.txt– DataDir_0? are the

path to the data dir– PlotType selects

output data type– OutDir is the directory

to save the output data (eps/png files)

Shocktube: DISPH• Shocktube test (runs/shocktube)

Shocktube: SSPH• Shocktube test (runs/shocktube)

Hydrostatic Equilibrium tests

• SSPH has unphysical repulsive force at the contact discontinuity.

• To understand the resultant of this force, we study the evolution of the hydrostatic equilibrium system.

ρ=1

ρ=4

Change Kernel function• You can use following 5 types of kernel

functions:– Cubic spline kernel (Schoenberg 1946)– Cubic spline kernel with the Thomas &

Couchman (1992) modification– Wendland kernel C2, C4, and C6 (Dehnen &

Aly 2012)• Select one of them via

“SelectKernelType” in the param.txt

Run Hydrostatic Equilibrium tests

• Working directory: ./runs/hs• Letʼs try following four case:

– UseDISPH 1, SelectKernelType 1 and ./data_disph

– UseDISPH 0, SelectKernelType 1 and ./data_ssph

– UseDISPH 1, SelectKernelType 2 and ./data_disph_WC2

– UseDISPH 0, SelectKernelType 2 and ./data_ssph_WC2

Run Hydrostatic Equilibrium tests

• Working directory: ./runs/hs• Letʼs try following four case:

– UseDISPH 1, SelectKernelType 1 and ./data_disph

– UseDISPH 0, SelectKernelType 1 and ./data_ssph

– UseDISPH 1, SelectKernelType 2 and ./data_disph_WC2

– UseDISPH 0, SelectKernelType 2 and ./data_ssph_WC2

Plot Hydrostatic: SelectKernelType 1

• Hydrostatic tests (run/hydrostatic)

Plot Hydrostatic: SelectKernelType 2

• Hydrostatic tests (runs/hydrostatic)• Wendland Kernel C2

Kelvin-Helmholtz instability tests

ρ=2, P=2.5

ρ=1, P=2.5

ρ=1, P=2.5

0.5

-0.5

-0.5

• Shear origin fluid instability

• Init. density diff.: 1:2, Pinit=2.5, vrelative=1

• Velocity perturbation is imposed on the interface

Run Kelvin-Helmholtz instability tests

• Working directory: ./runs/kh• Letʼs try following 2 cases:

– UseDISPH 1, and ./data_disph– UseDISPH 0, and ./data_ssph

Plot Kelvin-Helmholtz inst

• Kelvin-Helmholtz inst. tests (runs/kh)

Rayleigh-Taylor instability tests

• Gravity induced fluid instability

• Init density ratio at y=0.5 is 1:2

• Velocity perturbation is imposed on the interface

Gravity

DensityEntropy

Run Rayleigh-Taylorinstability tests

• Working directory: ./runs/rt• Letʼs try following 2 cases:

– UseDISPH 1, and ./data_disph– UseDISPH 0, and ./data_ssph

Plot Rayleigh-Taylor inst.

• Rayleigh-Taylor inst. tests (runs/rt)

Exercises• Change “Nparticles” and “Ns” in

param.txt and compare the results• Check conservation of total energy, total

momentum, and total angular momentum.– Check these values and compare them with

their initial values.

PART 3References

Contents1. Theoretical part

– Principle of Smoothed particle hydrodynamics• Standard formulation of SPH• Density Independent SPH

– Artificial viscosity, time integration, time step2. Practical part

– Brief explanation of ASURA– Benchmark tests

• 1D shock tube test• 2D hydrostatic equilibrium test• 2D Kelvin-Helmholtz instability test• 2D Rayleigh-Taylor instability test

3. References

Original papers • Lucy, AJ, vol. 82, p. 1013-1024, 1977• Monaghan & Gingold, MNRAS, vol. 181,

p. 375-389, 1977

Reviews• Monaghan, ARAA. Vol. 30 p. 543-574,

1992 • Monaghan, RPPh, Vol. 68, p. 1703-1759,

2005• Rosswog, New A. Reviews, Vol. 53, p.

78-104, 2009• Springel, ARAA, vol. 48, p.391-430,

2010

Other Important Papers• Hernquist & Katz, ApJ Supplement Series,

vol. 70, p. 419-446, 1989• Ritchie & Thomas, MNRAS, Vol. 323 p.

743-756, 2001• Springel & Hernquist, MNRAS, Vol. 333 p.

649-664, 2002• Price, JCoPh, Vol. 227, p. 10040-10057• Read et al., MNRAS, Vol. 405 p. 1513-1530,

2010

Other Important Papers• Cullen & Dehnen, MNRAS, Vol. p. 669-683,

2010• Dehnen & Aly, MNRAS, Vol. 425, p. 1068-

1082, 2012• Saitoh & Makino, ApJ, Vol. 768, article id.

44, 2013• Hopkins, MNRAS, Vol. 428, p.2840-2856,

2013• Hosono, Saitoh & Makino, PASJ, Vol.65,

Article No.108, 2013

Misc.• Balsara, JCoPh, Vol. 121, p.357-372,

1995• Monaghan, JCoPh, Volume 136, p. 298-

307, 1997• Saitoh & Makino, ApJ Letters, Vol. 697,

p. L99-L102, 2009• Saitoh & Makino, PASJ, Vol.62, p.301-

314, 2010

top related