Upload
hoangnga
View
237
Download
8
Embed Size (px)
Citation preview
Matthias Teschner
Computer Science DepartmentUniversity of Freiburg
Simulation in Computer Graphics
Partial Differential Equations
University of Freiburg – Computer Science Department – Computer Graphics - 2
Motivation
various dynamic effects and physical processesare 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 - 3
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 - 4
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 - 5
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 - 6
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 - 7
Analytical Solution
define an initial condition temperature distribution at all positions at time 0
at a position and time is obtained byshifting the temperature distribution at time 0 by the distance
University of Freiburg – Computer Science Department – Computer Graphics - 8
Numerical Solution with Finite DifferencesDiscretization
consider / sample the function at discrete positions with distance and discretetimes with time step
approximate the partial derivatives with finite differences
University of Freiburg – Computer Science Department – Computer Graphics - 9
Numerical Solution with Finite DifferencesApproximate Computation of T
can be solved for
from the initial condition, temperatureis 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 - 10
Numerical Solution with Finite DifferencesBoundary 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 - 11
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 - 12
Definition
a partial differential equation PDE describes the behavior of an unknown multivariable function using partial derivatives of , e.g.
the function and
the independent variables, e.g.
example:
notation
ordinary differential equations are a special casefor functions that depend on one variable
University of Freiburg – Computer Science Department – Computer Graphics - 13
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 - 14
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 functionwith two independent variables general form
non-linear example
University of Freiburg – Computer Science Department – Computer Graphics - 15
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 - 16
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 - 17
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 certainconditions on the boundary of
initial condition
Dirichlet condition
Neumann condition
University of Freiburg – Computer Science Department – Computer Graphics - 18
Numerical Solution - Overview
GoverningEquationsIC / BC
DiscretizationSystem ofAlgebraicEquations
Equation(Matrix)Solver
Approx.Solution
Finite Difference
Finite Volume
Finite Element
Spectral
Boundary Element
DiscreteNodal Values
e.g., CGcontinuousform
University of Freiburg – Computer Science Department – Computer Graphics - 19
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 - 20
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 - 21
2D Finite Difference Approximations
time derivative
spatial derivatives
if information moves from left to right, backward is upwind, otherwise forward is upwind
upwind is typically preferred
time marching
forward scheme
backward scheme
central scheme
University of Freiburg – Computer Science Department – Computer Graphics - 22
2D Finite Difference Approximations
higher-order derivatives, e.g.
higher-order approximations, e.g.
University of Freiburg – Computer Science Department – Computer Graphics - 23
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 - 24
Explicit Solution Schemes - 1D Advection
downwind
centered, FTCS (forward time centered space)
Leap-frog
University of Freiburg – Computer Science Department – Computer Graphics - 25
Explicit Solution Schemes - 1D Advection
Lax-Wendroff
Beam-Warming
Lax-Friedrich
University of Freiburg – Computer Science Department – Computer Graphics - 26
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 - 27
Advection in 2D and 3D
1D advection
generally, the velocity is a vector with direction and length
spatial derivative of in direction
therefore,
2D 3D
University of Freiburg – Computer Science Department – Computer Graphics - 28
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 - 29
Diffusion in 1D
density describes the concentration of asubstance 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 - 30
Diffusion in 2D and 3D
equation
intuition for second spatial derivative
constant gradient, i.e. , has no effect
Laplaceoperator
Flux, no change Flux, positive change
2D 3D
University of Freiburg – Computer Science Department – Computer Graphics - 31
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 - 32
Wave Equation in 1D
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
Vibrating string
University of Freiburg – Computer Science Department – Computer Graphics - 33
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 - 34
Demo
combination of wave equation, advection, and diffusion
update rule (spatial derivatives not discretized)
wave equation
advection equation
diffusion equation
University of Freiburg – Computer Science Department – Computer Graphics - 35
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