On Modeling, Numerical Techniques, & Fluids

Download Report

Transcript On Modeling, Numerical Techniques, & Fluids

Ronald Fedkiw
Stanford University
Industrial Light + Magic
What is plausible
simulation?
• There is no safe place to start...
• One cannot even assume that the correct
answer is plausible
– suppose a character threw a ball forward at the ground
and it bounced back into their hand like a boomerang
– this is a backward scattering of the ball, and does have
some small probability of occurring
– unfortunately, it is not very likely and the audience will
be hard pressed to accept it
– in fact, one would expect the characters to be rather
surprised at the outcome
– that is, character emotion is needed to aid plausibility in
this case
What is plausible
simulation?
• If 10,000 balls are thrown forward at the
ground, and 1 bounces back that might be ok
– the collision result of the ball with the ground obeys a
“BRDF-like” probability for the scattering direction
– one might believe that 1 out of 10,000 balls backscatters
– in fact, one might expect some backscatter
– in this instance the audience witnesses a reasonable
probability distribution first hand (lots of balls)
– but when only one ball is thrown, the audience expects
the most likely solution, and insists that the characters
expect this too
– however, this can appear too sterile (e.g. mirror
reflection)
What is plausible
simulation?
• When rendering, many rays are cast per pixel,
and both sampling and averaging occurs until a
single solution is converged upon
– rendering algorithms tend to pick a solution near the
average value
– in dynamics it is not always sensical to compute and
display an average solution
– can only depict a single solution (unless we have more
balls)
– so it never makes sense to show something improbable
unless the characters will act surprised by the event
– plausible simulation seems somehow connected with
story telling, imagination, etc.
What is plausible
simulation?
• Many times, one cannot compute the correct
solution anyway
– for turbulence we have no idea what the correct
equations even are
– engineers use turbulence models with the goal of
reproducing some aspect of the physics
– they tune parameters to get what they want
– i.e. they work to match experiments for lift, drag, etc.
– however, they could not care less about the visual norm
– these models are mostly useless for visually plausible
simulation
What is plausible
simulation?
• Many times, one cannot compute the correct
solution anyway
– for collisions the result depends on the microstructure
of the material
– the microstructure occurs on a microscopic scale that is
difficult to measure and even more difficult to model
– since we cannot see the microstructure, we cannot
expect the audience to believe all high probability
microstructure events
– the audience will instead assume a microstructure and
we need to be faithful to that
What is plausible
simulation?
• Many times, one cannot compute the correct
solution anyway
– for collisions the result depends on the approach
velocity, angular velocity, internal response, etc.
– these are all difficult to measure and model exactly
– the flight conditions of a thrown ball depend on the
texture of the skin on the fingers, how it was released,
the firing of muscles in the hand, fingers and arm, etc.
– quite a lot is unknown, unmodeled, etc.
What is plausible
simulation?
• Summary
– the correct physics may seem implausible
– the correct physics may be impossible to compute
– often, engineers only care about macroscopic integral
quantities like lift and drag, not high frequency visual
features
– characters probably need to react a certain way in order
to make the correct physics seem plausible
What is plausible
simulation?
• I have no idea
• But, let me tell you how to take advantage of
it...
Mathematical Equations
• Physicists, chemists, engineers, etc. are all
interested in mathematical descriptions of the
world around us
– these are models!
– they are intended to capture some aspect of the
problem
– they are not intended to be exact, true, or delivered
from your favorite deity
– that does not mean that they are not useful
– e.g., even though electrons do not orbit atoms like
planets, that model does account for certain
phenomena, and can be quite useful
Numerical Algorithms
• Since the equations are not necessarily correct,
there is no reason to force the numerical
algorithms to exactly mimic the equations
– consistency is over-rated
• if your algorithm does not solve the given equations,
it may solve some other set of equations that are
interesting in their own right
– accuracy is over-rated
• there is no reason to strive for 8 digits of accuracy
when solving a set of equations that is inconsistent
with the physics in the second or third decimal pace
Examples
• The Navier-Stokes equations do not allow 2
water drops to merge into a single drop
• The Navier-Stokes equations do not allow a
falling drop to actually hit the ground
• the numerous models for frictional contact and
collision do not accurately account for
microstructure
• For large deformations, accurate stress strain
relationships are unknown (a nonlinear Green
strain coupled to linear elasticity is useless)
• bending of shells and cloth, plasticity, fracture,
damping, etc...
What do numerical
analysts do?
• They sit in their office waiting for some scientist
or engineer to walk in with a set of equations
and say “simulate this”
– a numerical analyst does not know the underlying
physics
– thus, the best they can do is to faithfully and
consistently solve the equations they are given
– if they’re algorithm is not consistent with the equations,
they are essentially constructing a new model
– this is less than ideal since they do not know the
physics of the problem at hand
– once they have consistency, they strive for accuracy in
order to get a more efficient algorithm
We are the “scientists”
• We understand the underlying problem and we
know what we want... plausible simulation
– I don’t know what it is, but I know that I want it
– it makes lot’s of $$ at the box office
– it makes graduate students work
– it makes our friends think we are cool
We are the “scientists”
• We can write down a set of equations
• We understand the visual norm
• We can consult numerical textbooks to solve
the equations
– ode and pde solvers
– linear algebra routines
– optimization
– solid and fluid mechanics
– statistics
• We can consult with the numerical analysts
directly
Caution
• Be careful borrowing equations and numerical
algorithms from other fields
– most likely, the equations were not written down to
respect the visual norm
– most likely, the numerical methods were not concerned
with the visual norm
– simple import of existing technology has little value
– instead, novel contributions are needed to get equations
and algorithms that respect and flourish under the
visual norm
One way to exploit
plausible simulation
• There are many examples of visually rich
phenomena that are nearly impossible or
completely impossible to simulate
• We can choose or derive a set of equations and
a numerical method that is faithful to our needs,
the visual norm
• This is no worse than a turbulence model that
gets the correct lift and drag but is inaccurate on
the small scale eddies
• This is no worse than any number of friction
models
One way to exploit
plausible simulation
• If we choose the equations and the numerical
method wisely, impossible problems may
become practical or even trivial
– e.g. it would be quite costly to simulate all the waves in
the ocean with the nonlinear three dimensional NavierStokes equations
– instead the equations can be both linearized and reduced
to two dimensions based on a height field
– this made the Titanic sink, a perfect storm, and 300
million dollars for Pixar
– that’s plausible enough for me
One Way Wave Equation
central
vi 1 vi 1
v 
x
2h
h2
4
v v 
v
 O(h )
t
x
6 xxx
initial data
central
v v 0
t
x
upwind
vi  v i 1
v 
x
h
h
3
v  v  v  O(h )
t
x 2 xx
exact solution
upwind
Higher Order Approximation
r
- add a new h G term to cancel out the leading order error terms
central
h2
r
4
v v 
v
 h G  O(h )
t
x
6 xxx
upwind
h
r
3
v  v  v  h G  O(h )
t
x 2 xx
Thoughts...
- in traditional CFD, the results of numerical calculations are only
meaningful when the computed solution is well-resolved
- well-resolved computations are within the convergent asymptotic
regime where the numerical errors are proportional to the mesh
spacing
r
- the only sensical h G terms are those that accelerate convergence
in the asymptotic regime, i.e. high order methods that cancel error
• What happens in very complex flow fields where one cannot
possibly use enough grid points to resolve all the important features?
In general, one can claim very little about under resolved calculations
on relatively coarse grids.
high order method
asymptotic regime
new method?
true solution
x
Vorticity Confinement – coarse grid fix
- vorticity 
 u
needs help to overcome coarse grid dissipation

- locate the vorticity with N 

- calculate the magnitude and direction of the force that the vorticity
should exert N  
- scale the force so that it vanishes for consistency, but still gives a
good answer on a coarse grid x  N  
p
2
u  u u 
  u  x ( N   )
t

Smoke
Simulation of Large
Scale Phenomena
• The computational cost of 3D simulations
can be overwhelming
– use 2D fluid simulations to obtain the desired
detail and synthesize rich motion
– “define” a 3D velocity field from 2D fluid
simulations and interpolation
– advect particles with the virtual 3D velocity field
and a spatially tiled Komolgorov spectrum
Velocity Field
Construction
2D Simulation
2D Simulation
Interpolation
3D Velocity
Field
2D Simulation
Kolmogorov
Spectrum
Velocity Field
Construction
Velocity Field
Construction
Simulation of Large
Scale Phenomena
NIH Visible Human
NIH Visible Human