Simulation in Computer Graphics Partial Differential Equations Matthias Teschner Computer Science Department University of Freiburg
Motivation various dynamic effects and physical processes are described by partial differential equations PDEs e.g., wave propagation, advection, diffusion we consider PDEs that describe the time rate of change of a quantity at fixed positions University of Freiburg Computer Science Department Computer Graphics - 2
Motivation this is a short overview of a large research field in mathematics and physics applied to the fields of animation and computer graphics goals: you know what a PDE is you know PDEs for specific effects you know how to solve theses PDFs with finite differences University of Freiburg Computer Science Department Computer Graphics - 3
Outline introduction 1D advection mathematical background definition types boundary conditions numerical solution methods examples advection diffusion wave equation University of Freiburg Computer Science Department Computer Graphics - 4
Advection simulation of temperate evolution consider temperature at position and time start with known temperatures at time 0: consider some wind speed how to compute at arbitrary position and time University of Freiburg Computer Science Department Computer Graphics - 5
Advection Equation in 1D consider temperature change within a small time step at a fixed position temperature is only advected no additional effects T depends on two variables (space and time) / t denotes the time derivative / x denotes the space derivative University of Freiburg Computer Science Department Computer Graphics - 6
Analytical Solution define an initial condition temperature distribution at all positions at time 0 at a position and time is obtained by shifting the temperature distribution at time 0 by the distance University of Freiburg Computer Science Department Computer Graphics - 7
Numerical Solution with Finite Differences Discretization consider / sample the function at discrete positions with distance and discrete times with time step approximate the partial derivatives with finite differences University of Freiburg Computer Science Department Computer Graphics - 8
Numerical Solution with Finite Differences Approximate Computation of T can be solved for from the initial condition, temperature is known at all sample positions at some time i.e., for all positions, we can compute if we have computed for all positions, we can compute and so on University of Freiburg Computer Science Department Computer Graphics - 9
Numerical Solution with Finite Differences Boundary Conditions at time, the temperature is known at sample positions: however, the computation of the temperature at requires the temperature at setting boundary conditions / define missing values e.g., periodic boundaries temperature leaving/entering the right-hand side of the simulation domain, enters/leaves the left-hand side of the domain University of Freiburg Computer Science Department Computer Graphics - 10
Outline introduction 1D advection mathematical background definition types boundary conditions numerical solution methods examples advection diffusion wave equation University of Freiburg Computer Science Department Computer Graphics - 11
Definition a partial differential equation PDE describes the behavior of an unknown multivariable function partial derivatives of, e.g. the function and the independent variables, e.g. using example: notation ordinary differential equations are a special case for functions that depend on one variable University of Freiburg Computer Science Department Computer Graphics - 12
PDEs in Physics independent variables are static problems: (1D), (2D), (3D) dynamic problems: (1D+1), (2D+1), (3D+1) unknown functions are scalars, e.g. temperature, density vectors, e.g. displacement, velocity University of Freiburg Computer Science Department Computer Graphics - 13
PDE Classification order given by the highest order of a partial derivative linearity the function and its partial derivatives only occur linearly coefficients may be functions of independent variables e.g. second-order linear PDE of function with two independent variables general form non-linear example University of Freiburg Computer Science Department Computer Graphics - 14
PDE Classification second-order PDEs can be classified into hyperbolic parabolic elliptic classification is geometrically motivated is characterized by different mathematical and physical behavior determines type of required boundary conditions University of Freiburg Computer Science Department Computer Graphics - 15
PDE Classification hyperbolic time-dependent processes reversible, not evolving to a steady state undiminished propagation e.g., wave motion parabolic time-dependent processes irreversible, evolving to a steady state dissipative e.g., heat diffusion elliptic time-independent already in a steady state University of Freiburg Computer Science Department Computer Graphics - 16
Boundary Conditions generally, many functions solve a PDE physical applications expect one solution is typically defined in a simulation domain the physical solution is required to satisfy certain conditions on the boundary of initial condition Dirichlet condition Neumann condition University of Freiburg Computer Science Department Computer Graphics - 17
Numerical Solution - Overview Governing Equations IC / BC Discretization System of Algebraic Equations Equation (Matrix) Solver Approx. Solution continuous form Finite Difference Finite Volume Finite Element Discrete Nodal Values e.g., CG Spectral Boundary Element University of Freiburg Computer Science Department Computer Graphics - 18
Discretization time derivatives finite differences spatial derivatives finite differences FDM, finite elements FEM, finite volumes FVM example 1D advection continuous form discretizing the time derivative with FD discretizing the spatial derivative with FD algebraic equation University of Freiburg Computer Science Department Computer Graphics - 19
2D Sampling function is reconstructed at fixed sample positions at fixed time points simplest case: sampling of on a regular grid e.g., 2D+1 dimensions grid spacing and time step University of Freiburg Computer Science Department Computer Graphics - 20
2D Finite Difference Approximations time derivative time marching spatial derivatives forward scheme backward scheme central scheme if information moves from left to right, backward is upwind, otherwise forward is upwind upwind is typically preferred University of Freiburg Computer Science Department Computer Graphics - 21
2D Finite Difference Approximations higher-order derivatives, e.g. higher-order approximations, e.g. University of Freiburg Computer Science Department Computer Graphics - 22
Explicit Solution Schemes - 1D Advection advection equation upwind simple stability rule information must not travel more than one grid cell per time step CFL number time step should be sufficiently small to result in discretization solver (solution scheme) University of Freiburg Computer Science Department Computer Graphics - 23
Explicit Solution Schemes - 1D Advection downwind centered, FTCS (forward time centered space) Leap-frog University of Freiburg Computer Science Department Computer Graphics - 24
Explicit Solution Schemes - 1D Advection Lax-Wendroff Beam-Warming Lax-Friedrich University of Freiburg Computer Science Department Computer Graphics - 25
Outline introduction 1D advection mathematical background definition types boundary conditions numerical solution methods examples advection diffusion wave equation University of Freiburg Computer Science Department Computer Graphics - 26
Advection in 2D and 3D 1D advection generally, the velocity is a vector with direction and length spatial derivative of in direction 2D 3D therefore, University of Freiburg Computer Science Department Computer Graphics - 27
2D Finite Difference Solution Scheme advection equation discretization solution scheme variant velocity can vary with the location PDE still first order and linear University of Freiburg Computer Science Department Computer Graphics - 28
Diffusion in 1D density describes the concentration of a substance in a tube with cross section conduction law: the mass flow through an area (flux) is prop. to the neg. gradient of the density normal to k - conductivity University of Freiburg Computer Science Department Computer Graphics - 29
Diffusion in 2D and 3D equation Laplace operator intuition for second spatial derivative constant gradient, i.e., has no effect 2D 3D Flux, no change Flux, positive change University of Freiburg Computer Science Department Computer Graphics - 30
2D Finite Difference Solution Scheme diffusion equation discretization solution scheme intuition if the average value of the neighboring cells is larger than the cell value, the value increases and vice versa University of Freiburg Computer Science Department Computer Graphics - 31
Wave Equation in 1D Vibrating string function is the displacement of the string normal to assuming small displacement and constant stress force acting normal to cross section is component in -direction Newton s Second Law for an infinitesimal segment University of Freiburg Computer Science Department Computer Graphics - 32
Wave Equation in 2D and 3D 1D wave equation 2D: 3D: 2D finite difference solution scheme c speed of wave propagation University of Freiburg Computer Science Department Computer Graphics - 33
Demo combination of wave equation, advection, and diffusion wave equation advection equation diffusion equation update rule (spatial derivatives not discretized) University of Freiburg Computer Science Department Computer Graphics - 34
Literature Alan Jeffrey, Applied Partial Differential Equations An Introduction, Academic Press, Amsterdam, ISBN 0-12-382252-1 John D. Anderson, Computational Fluid Dynamics The Basics with Applications, McGraw-Hill Inc., New York, ISBN 0-07-001685-2 University of Freiburg Computer Science Department Computer Graphics - 35