Download - IGERT: SPH and Free Surface Flows

Transcript
Page 1: IGERT:  SPH and Free Surface Flows

IGERT: SPH and Free Surface Flows

Robert A. DalrympleCivil Engineering

Page 2: IGERT:  SPH and Free Surface Flows

Wave Theories

Flat Bottom Theories

Small Amplitude (Airy Theory, 1845)

Shallow Water (Boussinesq, 1871, KdV, 1895)

Intermediate and Deep Depths (Stokes, 1856, Stokes V)

Page 3: IGERT:  SPH and Free Surface Flows

Wave Modeling

Numerical modeling began in the 1960’s

Numerically assisted analytical methods

Finite difference modeling (marker and cell)

Page 4: IGERT:  SPH and Free Surface Flows

Stream Function on the Web

Page 5: IGERT:  SPH and Free Surface Flows

Finite Difference and FiniteElements in the 70’s

• 2-D to 3-D• Multiple numbers of waves• Shoaling, refraction, diffraction

Page 6: IGERT:  SPH and Free Surface Flows

Parabolic Modeling (REF/DIF)

Scripps Canyon--NCEXhttp://science.whoi.edu/users/elgar/NCEX/wp-refdif.html

Page 7: IGERT:  SPH and Free Surface Flows

Boussinesq Model

Empirical breakingWave-induced currents!

Much more computing time

Page 8: IGERT:  SPH and Free Surface Flows

Perturbation TheoryO(/εn)

Direct Wavefield SimulationO(100)

DNS/LES O() ~ O(10)

Wave Theory & Modeling

Laboratory Experiments O(10) / Field Measurements O(100)

• Kinematic and dynamic boundary conditions on interface

• Mud energy dissipation for wavefield simulation

• Cross validation• Shear instability characteristics• Parameter for simulations

• Cross validation• Interfacial boundary

conditions• Parameters for

simulations• Dissipation model

development

HOS/SNOW (MIT, JHU)

Page 9: IGERT:  SPH and Free Surface Flows

Meshfree Lagrangian Numerical Method for Wave Breaking

WaterParticles

2h

r

Boundary Particles

Radius ofKernel function, W

Fluid is described by quantities at discrete nodes

Approximated by a summation interpolant; other options: MLS

Page 10: IGERT:  SPH and Free Surface Flows

Topics

• Meshfree methods• Interpolation methods• SPH modeling • Results• GPU : the future

Page 11: IGERT:  SPH and Free Surface Flows

Mesh-Free Methods

Smoothed particle hydrodynamics (SPH) (1977)Diffuse element method (DEM) (1992)Element-free Galerkin method (EFG / EFGM) (1994)Reproducing kernel particle method (RKPM) (1995)hp-cloudsNatural element method (NEM)Material point method (MPM)Meshless local Petrov Galerkin (MLPG)Generalized finite difference method (GFDM)Particle-in-cell (PIC)Moving particle finite element method (MPFEM)Finite cloud method (FCM)Boundary node method (BNM)Boundary cloud method (BCM)Method of finite spheres (MFS)Radial Basis Functions (RBF)

Page 12: IGERT:  SPH and Free Surface Flows

Particle Methods

Discrete Element MethodMolecular DynamicsSPHVortex Methods

Page 13: IGERT:  SPH and Free Surface Flows

Why Interpolation?

• For discrete models of continuous systems, we need the ability to interpolate values in between discrete points.

• Half of the SPH technique involves interpolation of values known at particles (or nodes).

Page 14: IGERT:  SPH and Free Surface Flows

Interpolation

• To find the value of a function between known values.

Consider the two pairs of values (x,y): (0.0, 1.0), (1.0, 2.0)

What is y at x = 0.5? That is, what’s (0.5, y)?

Page 15: IGERT:  SPH and Free Surface Flows

Linear Interpolation

x1 x2

y1

y2

Page 16: IGERT:  SPH and Free Surface Flows

Polynomial InterpolantsGiven N (=4) data points,

Find the interpolating function that goes through the points:

If there were N+1 data points, the function would be

with N+1 unknown values, ai, of the Nth order polynomial

Page 17: IGERT:  SPH and Free Surface Flows

Polynomial InterpolantForce the interpolant through the four points to get four equations:

Rewriting:

The solution for a is found by inverting p

Page 18: IGERT:  SPH and Free Surface Flows

ExampleData are: (0,2), (1,0.3975), (2, -0.1126), (3, -0.0986).

Fitting a cubic polynomial through the four points gives:

Page 19: IGERT:  SPH and Free Surface Flows

Polynomial Fit to Example

Exact: redPolynomial fit: blue

Page 20: IGERT:  SPH and Free Surface Flows

Beware of Extrapolation

An Nth order polynomial has N roots!

Exact: red

Page 21: IGERT:  SPH and Free Surface Flows

Least Squares InterpolantFor N points, we will use a lower order fitting polynomial of order m < (N-1).

The least squares fitting polynomial is similar to the exact fit form:

Now p is N x m matrix. Since we have fewer unknown coefficients as data points, the interpolant cannot go through each point. Define the error as the amount of “miss”

Sum of the (errors)2:

Page 22: IGERT:  SPH and Free Surface Flows

Least Squares InterpolantMinimizing the sum with respect to the coefficients a:

Solving,

This can be rewritten in this form,

which introduces a pseudo-inverse.

Reminder:

for cubic fit

Page 23: IGERT:  SPH and Free Surface Flows

Question

Show that the equation above leads to the following expression for the best fit straight line:

Page 24: IGERT:  SPH and Free Surface Flows

Cubic Least Squares Example

x: -0.2 .44 1.0 1.34 1.98 2.50 2.95 3.62 4.13 4.64 4.94y: 2.75 1.80 -1.52 -2.83 -1.62 1.49 2.98 0.81 -2.14 -2.93 -1.81

Data irregularly spaced

Page 25: IGERT:  SPH and Free Surface Flows

Least Squares InterpolantCubic Least Squares Fit: * is the fitting polynomial o is the given data

Exact

Page 26: IGERT:  SPH and Free Surface Flows

Piecewise InterpolationPiecewise polynomials: fit all points

Linear: continuity in y+, y- (fit pairs of points)

Quadratic: +continuity in slope

Cubic splines: +continuity in second derivative

RBFAll of the above, but smoother

Page 27: IGERT:  SPH and Free Surface Flows

Moving Least Squares Interpolant

are monomials in x for 1D (1, x, x2, x3)x,y in 2D, e.g. (1, x, y, x2, xy, y2 ….)

Note aj are functions of x

Page 28: IGERT:  SPH and Free Surface Flows

Moving Least Squares InterpolantDefine a weighted mean-squared error:

where W(x-xi) is a weighting function that decayswith increasing x-xi.

Same as previous least squares approach, except for W(x-xi)

Page 29: IGERT:  SPH and Free Surface Flows

Weighting Function

q=x/h

Page 30: IGERT:  SPH and Free Surface Flows

Moving Least Squares InterpolantMinimizing the weighted squared errors for the coefficients:

,, ,

Page 31: IGERT:  SPH and Free Surface Flows

Moving Least Squares Interpolant

Solving

The final locally valid interpolant is:

Page 32: IGERT:  SPH and Free Surface Flows

MLS Fit to (Same) Irregular Data

Given data: circles; MLS: *; exact: line

h=0.51

Page 33: IGERT:  SPH and Free Surface Flows

.3

.5

1.0

1.5

Varying h Values

Page 34: IGERT:  SPH and Free Surface Flows

Basis for Smoothed Particle Hydrodynamics SPH

From astrophysics (Lucy,1977; Gingold and Monaghan, 1977))

An integral interpolant (an approximation to a Dirac delta function):

kernel

Page 35: IGERT:  SPH and Free Surface Flows

The Kernel (or Weighting Function)

Compact support: 2D-circle of radius h 3D-sphere of radius h

1D-line of length 2h

h

Page 36: IGERT:  SPH and Free Surface Flows

Fundamental Equation of SPH

where W(s-x,h) is a kernel, which behaves like Dirac function.

Page 37: IGERT:  SPH and Free Surface Flows

Delta Function (1 D)

Page 38: IGERT:  SPH and Free Surface Flows

Kernel Requirements (Monaghan)

Monotonically decreasing with distance |s-x|

Symmetric with distance

Page 39: IGERT:  SPH and Free Surface Flows

Numerical Approximations of the Integrals

The incremental volume: mj/j , where the mass is constant.

which is an interpolant!

Partition of unity

Page 40: IGERT:  SPH and Free Surface Flows

KernelsGaussian:

Not compactly supported -- extends to infinity.

Page 41: IGERT:  SPH and Free Surface Flows

KernelsMoving Particle Semi-implicit (MPS):

Quadratic:

(discontinuous slope at q=1)

Page 42: IGERT:  SPH and Free Surface Flows

Spline Kernel

Same kernel as usedin MLS interpolant.

Page 43: IGERT:  SPH and Free Surface Flows

Gradients

Given SPH interpolant:

Find the gradient directly and analytically:

O.K., but when uj is a constant, there is a problem.

Page 44: IGERT:  SPH and Free Surface Flows

Gradients (2)

To fix problem, recall partition of unity equation:

The gradient of this equation is zero:

So we can multiply by ui = u(x) and subtract from Eq.(A)

(A)

Page 45: IGERT:  SPH and Free Surface Flows

ConsistencyTaylor series expansion of u(x,t) about point s (1-D):

Consistency conditions are then:

Integrals of all higher moments must be zero.

Page 46: IGERT:  SPH and Free Surface Flows

MLS and Shepard Interpolant

Page 47: IGERT:  SPH and Free Surface Flows

Governing Equations

Kinematics

Conservation of Mass

Conservation of Momentum

Equation of State: Pressure = f()

Page 48: IGERT:  SPH and Free Surface Flows

Kinematic Equationfor i=1, np

Mass Conservation

Page 49: IGERT:  SPH and Free Surface Flows

Conservation of Mass

Integrate both sides by the kernel and integrate over the domain:

Next use Gauss theorem:

Page 50: IGERT:  SPH and Free Surface Flows

Conservation of Mass (2)

0

Put in discrete form:

j

Page 51: IGERT:  SPH and Free Surface Flows

Conservation of Mass (3)From before (consistency condition):

The derivative of this expression is

Multiplying by ui and adding to previous conservationequation:

Page 52: IGERT:  SPH and Free Surface Flows

Conservation of Mass (4)To determine the density at a given point s:

A more accurate approach is:

During computations, the density can be regularly redetermined through this expression, due to Randles and Liberski.

Page 53: IGERT:  SPH and Free Surface Flows

Conservation of MomentumEquations of motion:

Multiply by and the kernel and integrate as before:

Subtract the zero sum:

Page 54: IGERT:  SPH and Free Surface Flows

Conservation of MomentumEquations of motion:

Multiply by and the kernel and integrate as before:

Page 55: IGERT:  SPH and Free Surface Flows

Conservation of Momentum (2)Another formulation (used in JHU SPH):

Page 56: IGERT:  SPH and Free Surface Flows

Equation of State: Weak Compressibility

which implies a speed of sound, CS:

where is usually 7 and B is a constant

No need to solve PDE for pressure

Page 57: IGERT:  SPH and Free Surface Flows

Closure Submodels

Viscosity generally accounted for by an artificial empirical term (Monaghan 1992):

0.

0.

0

ijij

ijij

ij

ijij

ij

c

rv

rv

22

.

ij

ijijij r

h rv

Page 58: IGERT:  SPH and Free Surface Flows

Sub-Particle Scale (SPS) Turbulence Model• Spatial-filter over the governing equations (compressible):

(Favre-averaging)

= SPS stress tensor with elements: ijijkkijtij kSS 3

232 ~~

2

• Eddy viscosity: SlCst2

• Smagorinsky constant: Cs 0.12 See Lo & Shao (2002), Gotoh et al. (2002) for incompressible SPS

2/12 ijijSSS

Sij = strain tensor

ff ~

*

Page 59: IGERT:  SPH and Free Surface Flows

Neighbor Lists

Which particles within 2h of particle i?

In principle, each particle interacts with every other particlein the domain: N x N calculations (“all pair search”)

Linked List:“Cells”: Examine particles in neighboring cells;

only 9 cells to examine.

Tree SearchDevelop a tree. Search geometrically.

Page 60: IGERT:  SPH and Free Surface Flows

Neighbor ListLink list is reconstructed each time step. Cells are 2h x 2h in size.

from SPHysics Users Manual

Page 61: IGERT:  SPH and Free Surface Flows

Time Stepping

Discretize time:

Take an Euler step (first order derivative expression):

Use this to get a value of

Then make a corrector step:

Monaghan; moreaccurate than Euler step

Page 62: IGERT:  SPH and Free Surface Flows

Beeman’s Method

Better velocity estimate (but more storage, and needs an+1)

Predictor-corrector version (for velocity):

Page 63: IGERT:  SPH and Free Surface Flows

Boundary conditions are problematic in SPH due to: the boundary is not well definedkernel sum deficiencies at boundaries, e.g. density

Ghost (or virtual) particles (Takeda et al. 1994)Leonard-Jones forces (Monaghan 1994)Boundary particles with repulsive forces (Monaghan 1999)Rows of fixed particles that masquerade as interior flow particles

(Dalrymple & Knio 2001)

(Can use kernel normalization techniques to reduce interpolation errors at

the boundaries, Bonet and Lok 2001)

Boundary Conditions

b

a f = n R(y) P(x)

y

(slip BC)

Page 64: IGERT:  SPH and Free Surface Flows

DEVELOPED JOINTLY BY RESEARCHERS AT:

Universita di Roma “La Sapienza”

(Italy)

Universidade de Vigo

(Spain)

Johns Hopkins University

(USA)

University of Manchester

(U.K.)

SPHYSICS

Page 65: IGERT:  SPH and Free Surface Flows

Model Validation – hydrodynamics model

– Star points are experiment data

Page 66: IGERT:  SPH and Free Surface Flows

Model Validation – hydrodynamics model

– Star points are experiment data

Page 67: IGERT:  SPH and Free Surface Flows

Model Validation – hydrodynamics model

– Star points are experiment data

Page 68: IGERT:  SPH and Free Surface Flows

Bore in a Box

Tsunami represented by a dam break

Page 69: IGERT:  SPH and Free Surface Flows

Bore in a Box: 2004

Page 70: IGERT:  SPH and Free Surface Flows

3D Weak Plunger

Page 71: IGERT:  SPH and Free Surface Flows

Coherent Structures

The rate of strain tensor and the rotation tensor are

Q criterion

Second invariant of the velocity gradient tensor

Positive values of Q imply vorticity greater than strain

, velocity gradient tensor

Page 72: IGERT:  SPH and Free Surface Flows

Coherent Structures: Q Criterion

Page 73: IGERT:  SPH and Free Surface Flows

Paradigm Shift: GPU Models

Page 74: IGERT:  SPH and Free Surface Flows

CPU vs GPU

Floating point operations per second: GPU vs CPU

Nvidia CUDA Programming Guide, 1.1

Page 75: IGERT:  SPH and Free Surface Flows

Nvidia CUDA Programming Guide, 1.1

CPU/GPU Architectures

Page 76: IGERT:  SPH and Free Surface Flows

Bore in a Box

Real time: CPU vs GPU on a laptop

Page 77: IGERT:  SPH and Free Surface Flows

Bore in a Box

677,360 particles

Page 78: IGERT:  SPH and Free Surface Flows

Nvidia Tesla Computing Card

4 Gb/240 = 16 Mb/ core