pdes - stony brook...
TRANSCRIPT
![Page 1: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/1.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
PDEs
![Page 2: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/2.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
On to PDEs...
● Next up: PDEs
– PDEs are at the heart of many physical systems
– We will study three classes of PDEs, represented by the wave/advection equation, the Poisson equation, and the diffusion equation
● Where do we stand?
● Differentiation:
– We saw how Taylor expansions give rise to difference formula with varying orders of accuracy
– These ideas will be at the heart of the spatial discretization we use with PDEs
● Interpolation:
– We will see the interpolation ideas again as we reconstruct our discretized data to find values at interfaces in our PDE discretizations
![Page 3: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/3.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
On to PDEs...
● ODEs:
– A common procedure is to spatially discretize a PDE and then solve the result initial value ODE system using ODE methods—this is called the method of lines approach
● Linear algebra:
– We will have a choice of discretizing explicitly or implicitly. Implicit discretizations often result in a linear system to solve, using our linear algebra techniques
– We will see the iterative methods come into play when we consider the Poisson equation
● FFTs:
– As already motivated, FFTs can be used to transform a PDE into an algebraic equation in Fourier-space, enabling its easy solution. (Some restrictions apply)
![Page 4: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/4.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
● Different types of PDEs require different solution methods
– Methodology matches the underlying behavior
● We will study the three main classes of PDEs:
– Hyperbolic
● e.g. the wave equation: ut - uxx = 0
● Characterized by real, distinct propagation speeds (for a system, the eigenvalues are real)
● Requires initial conditions and boundary conditions (on the upwind boundaries)
● Supports discontinuities, propagation of waves, etc.● The equations of compressible hydrodynamics form a hyperbolic system● The scalar linear advection equation will be our model for these methods
![Page 5: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/5.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
The Sod problem from compressible hydrodynamics—here we see three characteristic waves that carry information propagating outward from an initial disturbance
![Page 6: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/6.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
– Elliptic
● e.g. the Poisson equation: uxx + uyy = f
● No “speed” associated with propagating information—the solution responds instantaneously to the boundaries
● Requires boundary conditions on all sides● Solutions are smooth● Also arises in low-Mach number flow as a constraint on the velocities,
electrostatics, gravity, ...
![Page 7: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/7.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
with u = 0 on the boundary.
This example comes from a simple python code on my website
![Page 8: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/8.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
– Parabolic
● e.g. the diffusion equation: ut = uxx
● Inbetween hyperbolic and elliptic● Solution smooths out sharp features
![Page 9: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/9.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
Diffusion of a Gaussian in one-dimension
![Page 10: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/10.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
● Formally, these names come from a mathematical classification analogous to conic sections
– Written as:
– Hyperbolic if
– Parabolic if
– Elliptic if
(Wikiped
ia)
![Page 11: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/11.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Introduction to PDEs
● We can also discuss them in terms of initial value vs. boundary value problems
– Typical boundary conditions are
● Dirichlet (specify value at the boundary)● Neumann (specify the derivative normal to the boundary)● Periodic
● Many equations or systems are mixed types, e.g.
– Viscous flow (both hyperbolic + parabolic)
– Constrained flow (hyperbolic + elliptic)
![Page 12: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/12.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Discretization
● We need to discretize both space and time (or multiple space dimensions)
● There are many different types of spatial discretizations we can employ
– Finite difference
– Finite volume
– Finite element
– Spectral
– Particle methods (SPH)
● Each have their own strengths and weaknesses
● All but finite-element see wide use in astrophysics
![Page 13: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/13.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Spectral Methods
● Solution is expressed in terms of a superposition of globally-defined basis functions (Fourier series, Chebyshev, or Legendre functions)
● Solve for evolution of the weights in the superposition
● Ideally for smooth flow
– Doesn't handle discontinuities (e.g. shocks) well
● Wide application in turbulence studies
![Page 14: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/14.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Finite Elements
● Derivation similar to spectral—form inner product of function and basis functions
– In F-E, compact basis functions are used
● Popular in engineering—works well on irregular domains
Wikipedia
![Page 15: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/15.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Structured Grids
● Discretization on a series of logically Cartesian grids
– Allows for easy access to any element, avoiding indirect addressing on machines—maximizes cache performance
● Two popular approaches: finite-difference and finite-volume
– Underlying mathematical formulation differs
– Often can result in identical discretizations
![Page 16: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/16.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Finite Difference Approximation
● Function values are stored at discrete grid points
– Discrete values are simply:
– Replace derivatives in the PDE with discrete differences between neighboring grid points
– This is basically what we've already done with ODEs (think about the orbit problem)
![Page 17: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/17.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Finite Volume Approximation
● In the finite-volume approach, we store the average of the function value over an interval/zone
– Where:
– Note that half-integers are used to label the zone boundaries
– This discretization arises naturally when we model conservation laws in integral form
![Page 18: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/18.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Multiple Dimensions
● Either of these discretizations can be extended to multiple dimensions, using similar definitions
2-d finite-difference grid 2-d finite-volume grid
![Page 19: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/19.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Structured Adaptive Mesh Refinment
● Structured AMR uses a nested hierarchy of grids to focus resolution in regions of complex flow
![Page 20: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/20.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
SPH
● No grid
● Represent mass distribution as a collection of particles
● Form continuous quantities by integrating over particles via a smoothing kernel
● Lagrangrian approach (more on that later...)
Two spherical mass distributions represented by a structured grid (a) and SPH particles (b). Note, there is a lot of unneeded resolution in the space between the spheres in the grid case.
(Stephen Oxley)
![Page 21: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/21.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Aside: Gravity Only
● Pure gravity simulations often employ an N-body technique
– Particles represent mass
– Accelerations are computed by computing the total gravitational force on each particle due to all other particles
– Position/velocity advanced via Newton's laws
● Not a PDE
● Direct calculation is N2, but we'll see later there is an N log N method
![Page 22: PDEs - Stony Brook Universitybender.astro.sunysb.edu/classes/numerical_methods/lectures/pde-overview.pdf– These ideas will be at the heart of the spatial discretization we use with](https://reader034.vdocuments.us/reader034/viewer/2022042109/5e893ec6d2ab11667c5608cb/html5/thumbnails/22.jpg)
PHY 604: Computational Methods in Physics and Astrophysics II
Grid Basics
● It should not come as a surprise that the finer we make the grid, the more accurate our solution
● For time-dependent problems (like hyperbolic or parabolic equations), sometimes there is a relation between the size of the timestep we can take and the grid spacing
● Now when we talk about order-of-accuracy, we will need to discuss both the spatial and temporal accuracy