26
Radial Basis Function-Generated Finite Differences (RBF-FD): New Opportunities for Applications in Scientific Computing Natasha Flyer Computational and Information Systems Lab National Center for Atmospheric Research Boulder, Colorado USA In collaboration with: Bengt Fornberg, Victor Bayona, Greg Barnett, Samuel Elliott

Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

  • Upload
    others

  • View
    18

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Radial Basis Function-Generated Finite Differences (RBF-FD): New Opportunities for Applications in Scientific Computing

Natasha FlyerComputational and Information Systems Lab

National Center for Atmospheric ResearchBoulder, Colorado USA

In collaboration with: Bengt Fornberg, Victor Bayona, Greg Barnett, Samuel Elliott

Page 2: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

An exposition of RBF-FD properties through examples

1. Algorithmic simplicity

2. Complete geometric flexibility

3. High-order convergence

4. No special treatment of boundaries needed

5. Easy coupling to other methods

6. Local adaptivity/variable resolution

7. Excels on HPC architectures

Examples:

1. Shallow water equations (movie)

2. Stokes flow (movie)

3. Incompressible Navier-Stokes

4. Compressible Navier-Stokes

5. Compressible Euler questions (movie)

Page 3: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

One main evolution path in numerical methods for PDEs:

Finite Differences (FD) First general numerical approach for solving PDEs (1910) FD weights obtained by using local polynomial approximations

Pseudospectral (PS) Can be seen either as the limit of increasing-order FD methods, (1970) or as approximations by basis functions, such as Fourier or

Chebyshev; Very accurate, but low geometric flexibility

Radial Basis Functions (RBF) Basis functions are translates of radially symmetric functions (1990) dependent on the data locations. PS becomes a special case.

But now possible to scatter nodes in any number of dimensions, with no danger of singular matrices

RBF-FD All approximations are again local as in FD, but now nodes can be(2003) placed freely

- Easy to achieve high orders of accuracy (4th to 8th order)- Excellent for distributed memory HPC- Local node refinement easy in any number of dimensions

Page 4: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

General RBF idea in pictures (for 2-D scattered data):

Scattered data f (x, y) within a 2-D region

Center an RBF at each (x,y) point - here ‘rotated’ Gaussians

Linear combination of the RBFs that fits all the data

Many types of RBFs are available: 𝜑(𝑟 = | 𝒙 − 𝒙𝑘 |2 )

Page 5: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

What is “special” about expanding in RBF?

Page 6: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Going local: Concept of an RBF-FD stencil2-D planar

3-D volume Surface in 3-D space

2-D-like stencil on curvedsurface.

Normal direction (if present)can be discretized separately.

2-D planar

Node set with variable resolution

3D Cloud stencil

Hybridize with other numerical methods FV

, FE,

SE,

FD

RB

F-FD

Page 7: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Simplicity of RBF-FD Differentiation Matrices

2. For higher-order RBF-FD matrix and differentiation weights 𝒘𝒌Element-wise square and exponentitate Get Gaussian matrix A, use GE to solve for weights

Ex.: Stencil of n = 21 nodes

1. Calculate distance 𝒓𝒊𝒋 = 𝒙𝒊 − 𝒙𝒋 𝟐from each node to all other nodes in stencil

𝒙𝟏 − 𝒙𝟏 𝟐 𝒙𝟏 − 𝒙𝟐 𝟐 . . . . 𝒙𝟏 − 𝒙𝒏 𝟐

⋮ ⋱ ⋮𝒙𝒏 − 𝒙𝟏 𝟐 𝒙𝒏 − 𝒙𝟐 𝟐 . . . . 𝒙𝒏 − 𝒙𝒏 𝟐

Result: Distance matrix BUT ALSOSimplest RBF matrix. Same as centering RBF 𝒓 at each node evaluating it at all in

z

x

𝑬𝒙𝒑(−𝒓𝟐𝟏𝟏) 𝑬𝒙𝒑(−𝒓𝟐𝟏𝟐) . . . 𝑬𝒙𝒑(−𝒓𝟐𝟏𝒏)⋮ ⋱ ⋮

𝑬𝒙𝒑(−𝒓𝟐𝒏𝟏) 𝑬𝒙𝒑(−𝒓𝟐𝒏𝟐) . . . . 𝑬𝒙𝒑(−𝒓𝟐𝒏𝒏)

𝒘𝟏

⋮𝒘𝒏

=𝒅/𝒅𝒙[𝑬𝒙𝒑 −𝒓𝟐𝟏 ]|

⋮𝒅/𝒅𝒙[𝑬𝒙𝒑 −𝒓𝟐𝒏 ]|

Page 8: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

- DM has exact same sparsity structure regardless of derivative operator L being approximated- Invert n x n (37) matrices N times - PREPROCESSING and completely parallel- Method is O(N) since n << N

Ex. of 2 RBF-FD stencils for calculating d/dx weights at 2 different points, represented by

Sparsity Pattern of RBF-FD DMDM Dx is 99.98% emptyEach row is weights corresponding to 1 RBF-FD stencil

𝑑

𝑑𝑥𝑢 |∎ =

𝑘=1

𝑛 = 37

𝑤𝑘𝑢𝑘

Page 9: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

IDX = knnsearch(xyz,xyz,'K',n); % n is stencil size

for k = 1:N % Loop over all points N in domain

X = xyz(IDX(k,:),:); % nodes in the kth stencilr2 = (X(:,1) - X(:,1)').^2 + …

(X(:,2) - X(:,2)').^2 + …(X(:,3) - X(:,3)').^2 ; % Distance matrix

A = exp(-r2); % RBF-FD matrix

RHS_dx = -2*(X(:,1) – X(k,1)).* exp(-r2); % derivative of GA w.r.t x,y,zRHS_dy = -2*(X(:,2) – X(k,2)).* exp(-r2);RHS_dz = -2*(X(:,3) – X(k,3)).* exp(-r2);

Dx(k,:) = A\RHS_dx; % Differentiation matrices (DM)Dy(k,:) = A\RHS_dy; Dz(k,:) = A\RHS_dz;

end

Coding RBF-FD Method is FAST and EASY

Have DMs for any geometry and point distribution in 3D space

Page 10: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Pulse width: 160 km30 km

3 km

Grid Resolution vs. Effective Resolution: The need for high-order

Solid Line: Initial pulse Dashed Line: Final Pulse after traveling the US coast to coast

Page 11: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

RBF-FD example: Convective flow around a sphere(Fornberg and Lehto, 2011)

Test problem: Solid body rotation around a sphere

Initial condition: Cosine bell C1

Gaussian RBFsN = 25,600, n = 74, RK4 in time

RBF-FD stencil illustration: N = 900 nodes, n = 31.

Numerical solution:- 2% loss in peak height after 33 years; - Minimal trailing wave trains

Key novelty: Stability achieved by hyperviscosity ∆8

12 days 33 years

Page 12: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Day 6: Unstable vortex dynamics

Shallow water wave equations on the sphere:Evolution of a highly unstable wave (Flyer et al., JCP, 2012)

Day 3: Initial Signs of Instability

Page 13: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

RBF-FD

Spectral Element

Discontinuous Galerkin

Finite Volume

Vorticity at

“ Truth” 0.35 x 0.35

DG,FV, SE, RBF-FD

(555 km)

(38 km)655Kpts.

Page 14: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Multi – CPU and Multi – GPU performance: 2.6M nodes on sphere (15km)(Elliott et al., 2017, Int. J. High Perf. Comp. Appli.)

0500

100015002000250030003500400045005000

Per

form

ance

(G

FL

OP

S)

Number of GPUs

NVIDIA PSG P100

0

1000

2000

3000

4000

5000

6000

7000

4 12 20 28 36 44 52 60 68P

erfo

rman

ce (

GF

LO

PS

)Number of Nodes

Intel Broadwell CPU

36 cores/node, 72 nodes, 2592 cores

6 Teraflops4.5 Teraflops

Both are > 𝟏𝟎𝟎𝑿 speedups over the highest achieved performance by the previous single device GPU implementation.

Tesla

Page 15: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Thermal Convection in a 3D Spherical Shell (Earth’s Mantle)

Conservation Eqns. of:1) Mass: Incompressible 2) Momentum: Stokes flow3) Energy: Advection-Diffusion

(Wright, Flyer, Yuen 2010; Flyer, Wright, Fornberg 2015)

Solution for Ra = 1M , Integrated 20B yrs.

Isosurfaces of perturbed temperature:One frame from a movie generated in MATLAB on a PC

At a lower Ra number, a similar RBF calculation revealed a physical instability in an unexpected parameter regime, afterwards confirmed on the Japanese Earth Simulator.

Page 16: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B
Page 17: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

A New Approach to RBF-FD (Flyer, Fornberg, et al., JCP, 2016)

What is the problem with Gaussians or any other infinitely smooth RBF?

Answer: Stagnation error: Defined as the convergence error stagnating or even increasing as resolution increases, r → 0

𝑒− 𝜀𝑟𝟐

As node distance r → 0, 𝜀 must increase to avoid ill-conditioning, leads to stagnation error since 𝜀𝑟remains the same.

New Approach: Polyharmonic Splines: r m, m = odd + High-order polynomials

No high Polys: Low accuracy No RBF: Can not scatter nodes; Severe Runge Phenomena near boundaries

RBF PHS 𝒓 𝟓 2D: 1, x ,y , x2, xy, y2, . . . up to say 5th degree

+

Result: A new RBF-FD basis with b) High – order convergence; c) No bd. treatment needed to avoid Runge phenom.; C) No stagnation error

Page 18: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

No Special Boundary Treatment

2nd –order classic FD: No RungeAccuracy increases: Runge sets in

Keep up to 6th order polys but increase stencil and thus number of PHS RBF;

Result: Recover (1, -2, 1) FD weightsbut at 6th-order accuracy but No Runge

Consider approximating the weights for d2/dx2 at x = 0

Page 19: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

r3

r3

r7

Polynomials in Control (Flyer, Barnett, Wicker, JCP, 2016)

L2

error in approximating d/dx of

near center of a 37 node stencil, using r3 and r7 with corresponding polynomials

Dashed line machine round-off error of 10-15/h

Page 20: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Steady-state Incompressible Navier-Stokes at High Re: Lid Driven Cavity

Governed by nonlinear biharmonic equationStream-function formulation

With BCs

Basis functions used:

RBF 𝒓 𝟕 + Up to 8th degree polynomials {1, x ,y, x2, xy, y2, . . . }

Bayona, Flyer, et al. 2017 JCP

Page 21: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

RBF-FD: N = 36,10025x difference in spacing

Qualitatively matches resultsFor 8th degree FD but with 10xLess points (FD: N = 361,200)

Results:

Page 22: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Time evolution of Potential Temperature 𝜃: 100m

Basis functions used:

RBF 𝒓 𝟓 +

Up to 4th degree polys.

3 Kelvin-Helmholtz rotors form due to shear instability

2D Compressible Navier-Stokes

Domain: 51.2km x 6.4km

Page 23: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Comparisons on different node layouts: change 1 line of code

Comparison:

Cartesian: Most unphysical artifacts (`wiggles’), 1st rotor not formed at 800m

Hexagonal: Excellent results; now easy to implement opposed to past

Scattered: Little performance penalty but one gains greatly geometric flexibility

800m

400m

200m

Only showing half of domain due to symmetry

Ugh!!

Page 24: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Comparisons to other numerical methods at 400m

- Only the RBF-FD calculations shows the beginning of second rotor at 400m- No other method gives results at 800m grid resolution

Page 25: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

2D Cold Downdraft (Euler equations) with Topography

Schematic node layout: Use hexagonal in atmosphere and quasi-uniform to conform to topography: Resolution is 25m

Page 26: Radial Basis Function-Generated Finite Differences (RBF-FD ... · Finite Volume Vorticity at Truth 0.35 x 0.35 DG,FV, SE, RBF-FD (555 km) ... Solution for Ra = 1M , Integrated 20B

Conclusions

Established:

- RBF-FD latches onto the physics at much coarser resolutions than other numerical methods, giving higher accuracy and convergence

- RBF-FD have shown strong linear scaling on on the latest HPC platforms

- Startup cost for modeling with RBF-FD is cheapdue to their algorithmic simplicity

Some recent review material

1. N. Flyer, G.B. Wright, and B. Fornberg, 2014.Radial basis function-generated finite differences: A mesh-free method for computational geosciences, Handbook of Geomathematics, Springer-Verlag

2. B. Fornberg and N. Flyer, 2015Solving PDEs with Radial Basis Functions, Acta Numerica.

3. B. Fornberg and N. Flyer, 2015A Primer on Radial Basis Functions with Applications to the Geosciences, SIAM Press.