Techniquecore
Monaghan artificial viscosity
Also called SPH artificial viscosity.
Adds a pairwise viscous pressure between approaching SPH particles so shocks are captured without particles passing through each other.
The Monaghan artificial viscosity is the term that lets smoothed particle hydrodynamics (SPH) compute shocks. The inviscid SPH equations have no mechanism that turns kinetic energy into heat at a shock, so the particles behind a shock oscillate, and in a strong collision particle streams pass through each other. Monaghan and Gingold (1983) added a viscous pressure to every pair of particles that approach each other. It has a linear term, which acts like a bulk and shear viscosity, and a quadratic term, which acts like the von Neumann-Richtmyer viscosity and stops interpenetration. The pairwise form keeps the exact momentum conservation of SPH, and the heat it makes is exactly the kinetic energy it removes.
In plain words
When two SPH particles move toward each other fast, as they do in a shock, the plain equations let them overshoot and ring, or even pass through each other. The artificial viscosity adds an extra repulsive pressure between any two particles that are approaching. The pressure grows with the closing speed: in proportion to it for slow approach, and with its square for fast approach. The force pushes the pair apart equally and oppositely, so total momentum does not change. The kinetic energy that the force removes is added to the internal energy of the pair, so total energy does not change either. Particles that move apart feel no extra force. The result is a shock that is a few particle spacings wide, with the correct jump in density, velocity and pressure.
When it applies
- SPH for compressible flow: gas dynamics, astrophysics, impacts and explosions. The Euler equations have discontinuous solutions, and a particle method needs some dissipation to find the physically correct one.
- Weakly compressible SPH for liquids, where a small linear term ( of about 0.01 to 0.1, ) damps pressure noise and keeps the particles in order.
- Any pairwise particle scheme in which the force between two particles depends on their distance and the kernel gradient, so that a pair term can be added without changing the conservation structure.
- It is not a physical viscosity model. For a real viscous fluid, use a physical viscous term, such as the one of Morris, Fox and Zhu (1997); the artificial term adds an effective viscosity proportional to that does not converge to a prescribed value of .
The template
VISCOUS-PAIR-TERM(i, j, x, v, ρ, c, h; α, β, ε)- 1
x_ij ← x_i - x_j; v_ij ← v_i - v_j - 2
if v_ij · x_ij ≥ 0 then return 0 ▷ the pair is moving apart - 3
h̄ ← (h_i + h_j)/2; c̄ ← (c_i + c_j)/2; ρ̄ ← (ρ_i + ρ_j)/2 - 4
μ ← h̄ (v_ij · x_ij) / (|x_ij|^2 + ε h̄^2) ▷ μ < 0 - 5
Π ← (-α c̄ μ + β μ^2) / ρ̄ ▷ Π > 0 - 6
a_i -= m_j Π ∇_i W_ij; a_j += m_i Π ∇_i W_ij - 7
ė_i += (1/2) m_j Π v_ij · ∇_i W_ij; ė_j += (1/2) m_i Π v_ij · ∇_i W_ij
The holes are the two coefficients and and the small number . The values , and are the usual choice for gas dynamics and are used on the SPH page. They are rules of thumb found by trial on shock tubes, not values that follow from a theory. The term is added for each pair inside the kernel support, in the same loop as the pressure force; in the SPH momentum equation it is simply added to .
Line L2 switches the term off for receding pairs, so expansion waves are not smeared. Line L4 measures the closing speed: is about , a velocity difference times , which is close to the velocity divergence times . The term keeps finite when two particles nearly coincide. Line L5 is the viscous pressure. The linear term gives an effective viscosity proportional to , which spreads the shock. The quadratic term is large only when the closing speed is large compared with , as in a strong shock or a collision of two streams; it is the particle form of the von Neumann-Richtmyer viscosity. Lines L6 and L7 apply the term with the antisymmetric kernel gradient.
Why it conserves momentum and only heats. Line L6 changes by and by the opposite amount, so the total momentum is unchanged. The rate of change of the kinetic energy of the pair is , and line L7 adds exactly to the internal energy. For a radial kernel, with , so for an approaching pair. With both terms of are positive. So the viscosity always turns kinetic energy into internal energy and never the reverse, which is the discrete form of the entropy condition at a shock.
Hand example. Take two particles in 1D with , , and , at distance and with closing velocity . Line L4 gives . Line L5 gives
The cubic spline has , so . Line L6 gives , a push of away from , and . Line L7 gives . The kinetic energy changes at the rate , which is minus the sum of the two heating rates.
Classic examples
The Sod shock tube. The standard test is the Riemann problem of Sod: on the left and on the right, . The run below used the code of the SPH page with 80 equal-mass particles on , leapfrog with , to , and compared with the exact Riemann solution. The error is the mean absolute density error on ; the overshoot is the largest velocity in minus the exact post-shock velocity 0.92745.
| (1, 2) | (0.5, 1) | (1, 0) | (0.1, 0.2) | (0, 0) | |
|---|---|---|---|---|---|
| density error | 0.0134 | 0.0129 | 0.0124 | 0.0167 | 0.0470 |
| velocity overshoot | 0.041 | 0.050 | 0.027 | 0.340 | 1.770 |
Without viscosity the post-shock state is noise, with velocity errors larger than the flow itself. With a small viscosity the shock rings. Every choice with from 0.5 to 1 gives a clean shock; for this weak shock the quadratic term is not needed, and in this run it gave a slightly larger error. The total energy changed by about of its value in all runs, which is the time-stepping error, because the viscosity itself conserves energy.
Strong shocks and colliding streams. In a Mach 10 or stronger shock, or when two gas streams collide, the closing speed is many times the sound speed in the cold gas. Then is small next to the momentum flux and particles from the two sides interpenetrate. The quadratic term grows like the square of the closing speed and stops this; this is the reason for in astrophysical codes. The Rankine-Hugoniot conditions give the exact jumps to compare with.
Liquids with weakly compressible SPH. In dam break and sloshing problems the flow is subsonic, and an between about 0.01 and 0.1 with is used to damp the acoustic noise of the stiff equation of state. Here the term acts as a numerical viscosity, and the Reynolds number of the run depends on it.
Comparison with Riemann solvers. In Godunov type finite volume schemes the dissipation comes from upwinding. Monaghan (1997) wrote the SPH viscosity in the same form, as a signal speed times a velocity jump, which shows that the two approaches are close.
Variations
- Signal velocity form. Monaghan (1997) writes , with and a signal speed . It has the same linear and quadratic parts, and it extends to an artificial thermal conductivity.
- Time-dependent coefficients. Morris and Monaghan (1997) give each particle its own , which grows where the flow is compressed () and decays back to a small floor over a few sound crossing times of . Away from shocks the viscosity is then small.
- Cullen and Dehnen switch. Cullen and Dehnen (2010) use the time derivative of to detect a shock before it arrives, and set near zero elsewhere; it gives nearly inviscid SPH away from shocks.
- Shear limiter. Balsara (1995) multiplies by a factor , which reduces the unwanted viscosity in shear flows and rotating disks.
- Physical viscosity instead. For a viscous liquid with a given , use a physical viscous term, such as the one of Morris, Fox and Zhu (1997), and keep at most a small artificial term for stability.
Pitfalls
- Viscosity on receding pairs. Without the test on line L2 the term also acts in expansions, where it smears rarefaction waves and adds heat that should not be there.
- Dropping . Without on line L4, blows up when two particles come very close, and the time step must collapse.
- Unequal pair terms. If is computed with values of only, such as and , then and momentum is no longer conserved. Use symmetric averages, as on line L3.
- Leaving the heating out. Applying line L6 without line L7 removes kinetic energy without heating the gas. Total energy then falls at every shock and the post-shock temperature is wrong.
- Too much viscosity in shear flows. The linear term acts also in pure shear, where for half the pairs. Rotating disks and vortices decay too fast; use a switch or a limiter.
- Treating and as physical constants. The best values depend on the kernel, the ratio and the test. Check them on a shock tube with the same setup as the production run.
- The time step. The viscosity adds its own stability limit, which shrinks as and grow. A step chosen from the sound speed alone can be unstable in a strong shock; include the signal speed , up to constants, in the Courant limit.
Exercises
- Show that for every approaching pair and that the total energy is unchanged by lines L6 and L7 in the semi-discrete system.
- For two particles in 1D at distance , with , find the closing speed at which the quadratic term equals the linear term, for and .
- Run the Sod test with at 80 and 160 particles on the left, and check that the shock width, measured in particle spacings, stays about the same.
References
- J. J. Monaghan and R. A. Gingold, Shock simulation by the particle method SPH, Journal of Computational Physics 52 (1983) 374-389
- Joseph J. Monaghan, Smoothed particle hydrodynamics, Annual Review of Astronomy and Astrophysics 30 (1992) 543-574, the artificial viscosity with alpha and beta and its use in the momentum and energy equations
- J. J. Monaghan, SPH and Riemann solvers, Journal of Computational Physics 136 (1997) 298-307, the signal velocity form of the viscosity
- J. P. Morris and J. J. Monaghan, A switch to reduce SPH viscosity, Journal of Computational Physics 136 (1997) 41-50
- D. S. Balsara, von Neumann stability analysis of smoothed particle hydrodynamics, suggestions for optimal algorithms, Journal of Computational Physics 121 (1995) 357-372, the shear limiter of the viscosity
- Lee Cullen and Walter Dehnen, Inviscid smoothed particle hydrodynamics, Monthly Notices of the Royal Astronomical Society 408 (2010) 669-683
- Joseph P. Morris, Patrick J. Fox and Yi Zhu, Modeling low Reynolds number incompressible flows using SPH, Journal of Computational Physics 136 (1997) 214-226
- Joseph J. Monaghan, Smoothed particle hydrodynamics, Reports on Progress in Physics 68 (2005) 1703-1759
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 2F76S1 Edit this page History Report an error Markdown