IPAM Research in Industrial Projects for Students (RIPS...

36
IPAM Research in Industrial Projects for Students (RIPS) Viscoelastic Liquids * Summer 2004 (June 28th-August 27th) Final Report Prepared for Pixar Animation Studios IPAM RIPS Team: Andrew Lutomirski Katarina Petrovi´ c Paul-James White Lauren Anderson (Project Manager) Faculty Advisors: Dr. Doug Enright Dr. Chohong Min Liaison: Dr. John R. Anderson * This project was jointly sponsored by the NSF (DMS 9810282) and Pixar Animation Studios.

Transcript of IPAM Research in Industrial Projects for Students (RIPS...

Page 1: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

IPAM Research in IndustrialProjects for Students (RIPS)

��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Viscoelastic Liquids∗

Summer 2004 (June 28th-August 27th)

Final Report Prepared for

Pixar Animation Studios

IPAM RIPS Team:

Andrew Lutomirski

Katarina Petrovic

Paul-James White

Lauren Anderson (Project Manager)

Faculty Advisors:

Dr. Doug Enright

Dr. Chohong Min

Liaison:

Dr. John R. Anderson

∗This project was jointly sponsored by the NSF (DMS 9810282) and Pixar Animation Studios.

Page 2: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 3: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Abstract

Fluids of varying viscosity/viscoelasticity exhibit both solid and fluid characteristics.Some examples of viscoelastic fluids include toothpaste, soft-serve ice cream, ketchup,gelatin, melted chocolate and tar. The goal of our project is to implement an algorithmthat successfully animates viscoelastic fluids in three dimensions. In order to achieve thisgoal, we began by performing various runs with varying parameters of a pre-existing 2Dand 3D Navier-Stokes simulation engine in order to enhance our understanding of theexisting model. We studied numerical schemes to handle the additional elastic/plasticterms to model viscoelastic behavior, and formulated a two dimensional viscoelasticsimulation incorporating these additional terms. After obtaining a working algorithm,we were able to generate different animation effects such as merging and bouncing. Wealso generated simulations displaying how the elastic coefficient changes the behavior ofthe liquid. We then implemented the algorithm in three dimensions. Our modificationof the existing three dimensional simulation engine generated realistic results. A visualpalette illustrating the behavior of a viscoelastic liquid undergoing dropping and pouringwith various elastic and/or plastic parameters was created. Reference video footage ofactual physical examples of viscoelastic liquids, e.g. ketchup, gelatin, toothpaste, and”goop”, was taken. From the reference toothpaste footage and the visual palette ofpouring behavior, we were able to determine the elastic and plastic parameters necessaryto animate realistic looking toothpaste. We explored different effects such as bouncing,varying viscosity with strain rate to approximate ketchup, and squirting behavior withthe three dimensional viscoelastic code.

Keywords: viscoelastic, plasticity, integrated strain rate, Navier-Stokes, level set,MAC (Marker-and-Cell) Grid, CFL (Courant-Friedrichs-Levy) condition.

Page 4: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 5: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Table of contents

Acknowledgments v

CHAPTER 1

Introduction 11.1 Problem Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Report Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

CHAPTER 2

Governing Equations 32.1 The Eulerian Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 The Navier-Stokes Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3 Plasticity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

CHAPTER 3

Numerical Method 53.1 The Particle Level Set Method . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 MAC (Marker-and-Cell) Grid . . . . . . . . . . . . . . . . . . . . . . . . . . 53.3 Solving the Navier-Stokes Equations . . . . . . . . . . . . . . . . . . . . . . 63.4 CFL Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

CHAPTER 4

Results 74.1 Code Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 Free-Surface Strain Condition . . . . . . . . . . . . . . . . . . . . . . . . . . 74.3 Visual Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

CHAPTER 5

Additional Animation Effects 135.1 Bouncing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.2 Varying Viscosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.3 Squirting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

CHAPTER 6

Conclusion 15

i

Page 6: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

ii Table of contents

APPENDIX A

Code segments 17A.1 Outline of the algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

APPENDIX B

Two-Phase Viscoelastic Flow Model 1 21B.1 Modeling Two-Phase Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . 21B.2 Modeling Visco-Elastic Force . . . . . . . . . . . . . . . . . . . . . . . . . . 21B.3 Numerical Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

1This section was authored by Chohong Min.

ii

Page 7: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

List of figures

4.1 Two-Dimensional Colliding Blobs . . . . . . . . . . . . . . . . . . . . . . . . 84.2 Tome strain boundary after 300 frames . . . . . . . . . . . . . . . . . . . . . 94.3 Elastic strain boundary After 300 frames . . . . . . . . . . . . . . . . . . . . 94.4 Still Frames Demonstrating a Range of Elasticity Values . . . . . . . . . . . 104.5 Still Frames Demonstrating a Range of Elastic Decay Rate Values . . . . . . 114.6 Still Frames Demonstrating a Range of Yield Point Values . . . . . . . . . . 114.7 A String of Images Demonstrating Pouring of a Viscoelastic Liquid . . . . . 12

iii

Page 8: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 9: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Acknowledgments

This project is supported by the National Science Foundation (DMS 9810282) and PixarAnimation Studios. We thank the Harvey Mudd College Math Clinic for use of theirLATEX report template. We would also like to thank our Faculty Mentors, Doug Enright,for providing us with the necessary C++ code to build on and Chohong Min for givingus relevant numerical background.

v

Page 10: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 11: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 1

IntroductionPixar Animation Studios is the industry leader in the creation of original stories in themedium of computer animation. Pixar has combined artistic and innovative technologyto create five of the most successful animated films of all time: Academy Award r©-winning Toy Story (1995), A Bug’s Life (1998), Golden-Globe-winner Toy Story 2 (1999),Monsters, Inc. (2001), and Finding Nemo (2003).

Pixar’s relentless pursuit of creative technical solutions to the needs of the underlyingstory have made Pixar’s films a unique mixture of cutting-edge visual special effects andgood old fashion story telling. Recent research advancements in fluid animation haveraised audience expectations, providing motivation for Pixar to explore the animationof high viscosity/viscoelastic liquids. Our team has been tasked with determining whichnumerical algorithms are appropriate for the animation of viscoelastic liquids.

1.1 Problem Background

Liquids are usually simulated as a volume with a velocity field defined at fixed points inspace (an Eulerian model). For a liquid with a free-surface boundary, a particle level-setmethod can be used to track the movement of the liquid-air interface. A property of thismodel is that it does not retain a history of the shape evolution of the liquid, i.e. thereis no way to determine where a small piece of the fluid came from. This is problematicwhen modeling a viscoelastic fluid, which retains memory of its original shape. In 2004Goktekin et al. [6] presented a scheme for modeling a viscoelastic fluid using an Eulerianmodel. The model includes an integrated strain rate (effectively the rate at which agiven infinitesimal section of fluid is being stretched or sheared) in order to solve for thetotal strain on the fluid as a function of position. This allows the restoring force to becomputed, affording a realistic model of the fluid’s attempt to preserve its shape. Thisidea has became the underlying model that we used to incorporate elasticity into theexisting free surface Navier-Stokes simulation.

1.2 Approach

• Become familiar with the existing free surface model and experiment with param-eters

• Determine appropriate numerical scheme to handle additional stress term

• Implement algorithm in existing two-dimensional simulation

1

Page 12: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

2 Introduction

• Experiment with parameters and verify stability

• Determine promising parameters for three-dimensions

• Extend working algorithm into existing three-dimensional simulation

• Experiment with parameters to mimic physical examples

• Create a visual palette demonstrating capabilities of implementation

• If time permits, extend code to handle fracturing viscoelastic liquids

1.3 Report Overview

This report is organized as follows:

• Chapter 2 discusses the governing equations for our model

• Chapter 3 covers the numerical method we use to handle each term of the governingequations

• Chapter 4 describes our results with the three-dimensional simulation with someexamples

• Chapter 5 discusses the additional animation effects we were able to achieve

• Chapter 6 concludes our report and gives suggestions for future work

• Appendix A outlines the important segments of our algorithm

• Appendix B gives an alternative approach to our problem

2

Page 13: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 2

Governing Equations

2.1 The Eulerian Model

When modeling liquids, keeping track of displacements (the common way to calculatestrains from which the elastic stresses are calculated in solids) can become very com-plicated and in some cases impossible in the presence of merging and pinching of theviscoelastic liquid interface. There have been various attempts to incorporate elasticityby modeling the system as a set of particles connected by springs which track displace-ments to the interface and apply a restoring force to the interface, i.e. see [14, 9]. Energyminimization methods have also been used, see [13, 12]. Since these methods have greatdifficulty and/or are not able to model merging, pinching, or folding of the liquid inter-face, a different approach must be used.

We chose an Eulerian model to overcome this difficulty and we incorporated an ad-ditional stress term, tracking deformation with a linear, time-independent strain tensor.As this method imposes no internal fluid structure, it can handle merging and pinchingwith ease. This method, as proposed in [6], computes the strain as follows:

ε =(∇~u + (∇~u)T )

2− ε

Plc, (2.1)

where ∇~u+∇~uT

2is the instantaneous strain rate and ε is the total (convected) time deriva-

tive of ε, and εPlc

is the plastic flow rate, discussed below.

2.2 The Navier-Stokes Equations

In the Eulerian model, the motion of fluids can be described by the Navier-Stokes equa-tions. These equations enforce the conservation of momentum and mass. We use theincompressible Navier-Stokes equations, as the fluids we model are nearly incompressible.The incompressibility condition we impose replaces the conservation of mass constraintwith the condition that the velocity field be divergence-free.

The Navier-Stokes equations, with our extra strain tensor, are:

∂~u

∂t+ (~u · ∇)~u = −∇p

ρ+

µv

ρ∇2~u +

1

ρ∇ · (µeε) + ~g, (2.2)

∇ · ~u = 0, (2.3)

3

Page 14: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

4 Governing Equations

where ~u represents the velocity vector, t is time, p is the pressure, ρ is the density of thefluid, ~g is the value of gravity and ε is the elastic strain tensor. The constants µv and µe

represent the coefficients of viscosity and elasticity respectively.The tensor ε in equation 2.2 represents the elastic stress acting upon the liquid.

In n dimensions ε is represented by a symmetric n-dimensional rank-2 tensor whosecomponents represent the strain the fluid is undergoing in each direction.

2.3 Plasticity

We also wish to capture plastic behavior with our model. Plasticity is the propertythat fluids undergo non-reversible change in shape under certain strain conditions. Weuse von Mises’ criterion [6] that plastic flow is an exponential decay in strain above athreshold:

εPlc

= −αε′

‖ε′‖max(0, ‖ε′‖ − γ) (2.4)

γ is the yield point, α is the elastic decay rate and ε′ is the dilation-free strain:

ε′ = ε− Tr(ε)

nI. (2.5)

While Tr(ε) = 0 due to incompressibility, we leave it in because we do not perfectlyenforce incompressibility. It should not make much difference, however.

4

Page 15: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 3

Numerical Method

3.1 The Particle Level Set Method

In order to numerically solve the equations which govern our viscoelastic liquid systemwe need to use appropriate numerical schemes. In the method we will be using, theliquid is defined using a level set function. The level set function, φ, takes a negativevalue inside the liquid, zero on the boundary and a positive value outside the liquid. Ineach time step the level set is moved (i.e. advected) based on the liquid velocity field, ~u,by using the advection equation,

φt + ~u · ∇φ = 0. (3.1)

The level set method [10] is a very practical technique for defining a liquid volumeand easily deals with topological changes, but has one great disadvantage, in regions oflow resolution use of this method can lead to a loss of volume which is visually manifestedas tiny drops disappearing in space. To correct this problem, we use a hybrid particlelevel set model [3] that adds two sets of particles, one on each side of the level set, whichreduce any numerical diffusion errors present in equation 3.1. The particles are advectedtogether with the level set function according to the following equation,

d~xp

dt= ~u(~xp), (3.2)

where ~u(~xp) is the velocity of the fluid at the location ~xp where the each particle is.Afterward advecting both the particles and level set, the particles are used to makecorrections to the level set function where necessary. The particle level set methoddefines a smooth fluid surface that retains liquid volume when advanced through time.

3.2 MAC (Marker-and-Cell) Grid

The parameters for our system are defined spatially on a grid that covers the domainof our simulation. The type of grid we use is the Marker and Cell Grid proposed byHarlow and Welch [7]. Scalar values such as the pressure p and the level set function φare stored in the center of grid cells while the components of the velocities are kept onthe appropriate cell walls. Unlike Goktekin et al. [6], we store all of the components ofthe stress tensor in the center of the grid, rather on the cell walls and corners.

5

Page 16: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

6 Numerical Method

3.3 Solving the Navier-Stokes Equations

Solving the Navier-Stokes equations is essential for our model since these equationsdictate the velocity field and ultimately the behavior of the visually perceived liquidinterface. Currently we use a numerical operator splitting approach [2] as follows. First,we handle the velocity advection term by using a semi-Lagrangian advection technique [5]to evolve the entire velocity field,

(~u · ∇)~u. (3.3)

This creates a partially evolved velocity field. To this velocity field we now add in thecontributions due to viscosity,

µv

ρ∇2~u, (3.4)

body forcing terms such as gravity,~g, (3.5)

and elastic stress terms,µe

ρ∇ · ε. (3.6)

After applying the contributions of equations 3.4-3.6, we calculate a pressure fieldwhich when applied to the partially updated velocity field will result in a divergence-free(i.e. mass preserving) velocity field. A point to make is that all the spatial derivativesin equations 3.4-3.6 are approximated using central differencing. At each time step, thestress tensor is updated by integrating the rate of strain term and its effect on the fluidis included in order to complete the update of the velocity field.

The previously mentioned method describes a single forward Euler step to solve theNavier-Stokes equations, i.e. equations 2.2 and 2.3. For added stability we can use ahigher order scheme such as a 2nd or 3rd order TVD-Runge Kutta scheme [10]. Theobvious trade off, however, is longer run times since we are now effectively doubling ortripling the computational expense.

3.4 CFL Condition

The addition of the elastic terms introduces an upper limit on the time step for stability:

the elastic wave speed√

µε

ρmust be less than the cell propagation speed speed, i.e. ∆x

∆t,

of the solver. We use ∆t ≤ ∆x√

ρµε

.

6

Page 17: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 4

Results

4.1 Code Overview

We began with a C++ free surface incompressible flow solver [4] provided by facultymentor, Doug Enright. We implemented the integrated strain rate model as describedin Chapters 2 and 3, including von Mises’s plasticity condition, and created variousexamples demonstrating the capabilities of our model (Figure 4.1). For simplicity, weuse pure (scalar) semi-Lagrangian advection for the strain tensor, so our scheme is notinvariant under rotation; this way our advection scheme is always stable.

4.2 Free-Surface Strain Condition

It is necessary to specially treat the strain at the free-surface boundary. To see this,consider the following analytic flow field (with α > 0):

~u = (αx,−αy) (4.1)

∇ · ~u = 0 (4.2)

ε ∝ ∇~u =

(α 00 −α

). (4.3)

Since the strain is uniform everywhere, the force is zero everywhere. This means thatthe object fails to resist deformation.

Intuitively, a physical viscoelastic fluid cannot exert a normal force at the surface,except for the pressure. This is because the force has no mass - if the force were nonzero,the acceleration would be infinite. But each fluid cell exerts force related to its straintensor. Thus, the normal and shear components at the surface must be zero. Since thetrace of the extra-strain tensor must be zero due to incompressibility, we can concludethat all components should be zero. Thus, the free-surface strain condition is:

ε = 0.

Various attempts to enforce this introduced artifacts into the solution where the rigidboundary intersected the free surface. Ignoring it led to obviously incorrect behavior.

Our first scheme to enforce the above free-surface strain condition was derivedfrom [15]. For every Euler step, we zero the strain field in all cells with φ ≥ 0 andall of their neighbors. This generates reasonable results, except that the surface distorts

7

Page 18: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

8 Results

(a) Colliding Liquid BlobsPrior to Collision

(b) Result of Non-ElasticBlobs After Collision

(c) Result of Elastic BlobsAfter Collision

Figure 4.1. Colliding Blobs in Two-Dimensions

badly over time. This seems to be caused by cells in which φ is very close to zero. Thesecells may slightly oscillate between positive and negative φ as we approach steady state,which will incorrectly erase the strain in the cell’s neighbors, allowing the fluid in thatcell to flow. Figure 4.2 shows the result after 300 frames; note how the right side is nolonger spherical. (These figures are from a 2D version of our solver.)

To address this, we tried modifying the strain evolution to enforce the boundarycondition:

ε =(∇~u + (∇~u)T )

2(1−H(φ)), (4.4)

8

Page 19: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Free-Surface Strain Condition 9

Figure 4.2. Sagging Surface after 300 Frames

where

H(φ) =

0 φ < −ε,12

+ φ2ε

+ 12π

sin(

πφε

)−ε ≤ φ ≤ ε,

1 ε < φ.

(4.5)

This scheme generates (to first-order accuracy) zero strain outside the fluid, assumingthat advection errors are small. It is not prone to the oscillation problem described above,and it generates much more stable steady-state solutions. This scheme does not enforcethe boundary condition perfectly after a large number of frames; this property does notappear to prevent steady state from being reached. Figure 4.3 shows the result after 300frames; the blob remains round.

Figure 4.3. Stable Surface After 300 Frames

The problem with this scheme is that, when the fluid detaches from a wall, eitherthrough advection or by bouncing (see below), discontinuities are introduced in the strainfield.

Page 20: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

10 Results

Our current scheme is to adjust the stress forcing without directly enforcing a strain-free boundary:

µ′ε(~x) = µε · (1−H(φ(~x))) (4.6)

~F (~x) = ∇ · (µ′ε(~x) · ε(~x)) (4.7)

This models, to first order, the fact that there is no stress force outside the interface.In practice, this results in a nearly stress-free boundary.

4.3 Visual Palette

The main goal of our project was to explore a range of animation effects with the workingthree dimensional simulation engine we developed. We created a series of animations(all ran on a 503 grid) by varying parameters to demonstrate the dependence of thebehavior of the viscoelastic liquid on each parameter value. We took values for elasticitybetween µe = 1000, 5000, 10000; the decay rate α = 0, 25, 500; and the yield pointγ = 0, 0.1, 0.5. This animation palette was helpful in determining promising parametersfor physical examples such as toothpaste. Figures 4.4, 4.5, and 4.6 show the variationof one parameter while keeping all other parameters constant. Increasing the elasticityconstant (µe) as shown in figure 4.4 presents an increase in solid-like behavior as weexpected. In figure 4.5 you can see an increase in decay rate (α) causes the liquid torelax in less time. Modifying the yield point (γ) as in figure 4.6 demonstrates the directcorrelation to the strain at which the liquid begins to flow. Figure 4.7 contains successiveframes demonstrating the pouring behavior of a viscoelastic liquid with a relatively lowelasticity.

Animations and stills of all the visual palette runs made are included on the reportCD.

(a) µe = 1, 000Nm (b) µe = 5, 000N

m (c) µe = 10, 000Nm

Figure 4.4. Behavior of Viscoelastic Liquid With Varying Elasticity Values, α = 0s−1

and γ = 0.0

10

Page 21: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Visual Palette 11

(a) α = 0s−1 (b) α = 25s−1 (c) α = 500s−1

Figure 4.5. Behavior of Viscoelastic Liquid With Varying Elastic Decay Rate (α) Val-ues, µe = 5, 000N

mand γ = 0.0

(a) γ = 0.0 (b) γ = 0.1 (c) γ = 0.5

Figure 4.6. Behavior of Viscoelastic Liquid With Varying Yield Point (γ) Values, µe =5, 000N

mand α = 25s−1

Page 22: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

12 Results

(a) Frame 1 (b) Frame 20 (c) Frame 40

(d) Frame 60 (e) Frame 80 (f) Frame 100

Figure 4.7. Viscoelastic Pouring palette with µe = 1, 000Nm

, α = 25s−1, and γ = 0.5

12

Page 23: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 5

Additional Animation Effects

5.1 Bouncing

In all the previous animations, once the liquid reached the bottom of the container itwas unable to detach even though it was physically supposed to. This is reasonable fora sticky fluid, but non-sticky fluids (like Jello) should be able to bounce. This happenedbecause once the fluid reached the ground the positive values of the level set functionthat represented open space were advected into the ground and had no way of advectingback out. In order to model bouncing behavior, we apply a condition that, if the pressureat the boundary drops below a pre-defined threshold, we removed liquid from that cell(i.e. set φ = ∆x). This empty space below the fluid would then allow it to bounceback up. This scheme is not quite physically accurate because it conserves neither mass,momentum nor energy, but it generates reasonable looking results and is therefor usefulfor animation purposes. We are considering possible alternate schemes that would dealwith such problems as handling the strain at the newly-detached free surface.

5.2 Varying Viscosity

Many common fluids, especially foods, undergo strain thinning [1]. Strain thinningfluids decrease in viscosity with increasing strain rate. In one dimension, this means thatstress = (rate of shear)n. In higher dimensions, we extend this to µv = µ0 · ‖D‖n−1,where

D =(∇~u + (∇~u)T )

2(5.1)

is the strain rate. Because µv is no longer constant, we change the viscosity force to∇ · (µv∇D).

Naive application of this scheme however results in instabilities for two reasons. First,the µv grows without bound at low D. Secondly, rapid small fluctuations in the velocityfield result in amplified oscillations in viscosity, which produces large forces. We addressthe former by capping viscosity and the latter by averaging over time (where R is thetime-averaged normed strain rate):

R =1

τD

(‖∇~u + (∇~u)T‖2

−R

), (5.2)

µv = µ0 ·max(Rn−1, 2) (5.3)

Numerically, we solve the variable viscosity as follows:

13

Page 24: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

14 Additional Animation Effects

r = e−∆t/τD , (5.4)

R(t + ∆t) = rR(t) + (1− r)

(‖∇~u(t) + (∇~u(t))T‖2

−R(t)

), (5.5)

µv(t) = µ0 ·max(R(t)n−1, 2) (5.6)

This way, strain thinning does not lag, and, as τD → 0, this scheme approaches ascheme without temporal averaging.

A value of n = 0.5 appears to model ketchup well.

5.3 Squirting

Another behavior that we tried to animate is the property of ketchup to come out inspurts when squirted from a bottle. One factor that causes this behavior may be strainthinning. This is the property of the viscosity to decrease as the strain on the fluidincreases. As a result of this the flow rate will tend to be unstable, since higher flowmeans less resistance. We attempted to model this as a constant pressure applied to thetop of a ”bottle,” and a disc with a hole in it at the bottom. We had some trouble withthe collision object that resulted in unphysical results, but our method may work witha little more time.

14

Page 25: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

CHAPTER 6

Conclusion

The goal of this project was to create an algorithm that realistically animated threedimensional viscoelastic liquids. We were able to extend the existing two-dimensionalcode provided to us by our faculty mentor, Doug Enright, so that it models elastic andplastic behaviors. Numerical stability issues as well as elastic stress free surface boundaryconditions had to be addressed.

We were also able to extend the simulation to three dimensions by appropriatelyadapting and extending the two dimensional algorithm. Bouncing behavior was ob-tained by modifying the physically-based algorithm. A visual palette of how the variousparameters in our code affect the behavior of our liquid was created. From this palettewe were able to determine the elasticity and plasticity parameters necessary to obtainbehavior analogous to real life examples, such as toothpaste. We proposed and imple-mented a varying viscosity strain-thinning algorithm to animate the behavior of ketchup.Some progress was made on animating the squirting of ketchup out of a bottle. We wereable to create an animation of this effect but certain problems on the boundaries causedthe animation to become unstable and unrealistic.

Based upon the work presented here, future efforts such as incorporating time-dependent viscosity, strain-thickening, and the fracturing of viscoelastic liquids shouldbe examined.

15

Page 26: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 27: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

APPENDIX A

Code segments

A.1 Outline of the algorithm

Initialize data structures

For each frame

Subcycle time until next frame reached as follows:

For each lagrangian time step substep (dt)

Update position of levelset and particles via subcycling at levelset CFL

Advect levelset

Advect particles

Combine particles and levelset

Fill ghost cells for velocity and strain

Advect velocity

Advect strain

Update stress terms (see attached function)

Update velocity due to strain (see attached function)

Update velocity due to gravity

If viscosity > critical value

Update viscosity implicitly

Else

Update viscosity explicitly

Solve then update velocity due to pressure

Enforce boundary conditions:

No slip for velocity

Constant extrapolation for strain

Extrapolate velocity across interface

Zero strain out away from interface

Enforce boundary conditions:

17

Page 28: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

18 Code segments

No slip for velocity

Constant extrapolation for strain

The previously mentioned functions are defined as follows:

Update Stress Terms:

Iterate over the grid and for each grid cell

Calculate Ux, Uy, Uz, Vx, Vy, Vz, Wx, Wy and Wz, using central differencing

Update stress due to plasticity as follows:

Etrace = Trace of stress tensor matrix

Enorm = Norm of stress tensor matrix

If (Enorm > Plasticity Gamma)

Scale = 0

Else

Scale = Plasticity Alpha * (Enorm - Plasticity Gamma) / Enorm

Etrace = Trace of stress tensor matrix

EXX -= dt * scale * (EXX - Etrace / 3)

EXY -= dt * scale * EXY

EXZ -= dt * scale * EXZ

EYY -= dt * scale * (EYY - Etrace / 3)

EYZ -= dt * scale * EYZ

EZZ -= dt * scale * (EZZ - Etrace / 3)

Update stress due to elasticity as follows:

EXX += dt * Ux

EXY += dt * (Uy + Vx) / 2

EXZ += dt * (Uz + Wx) / 2

EYY += dt * dt * Vy

EYZ += dt * (Vz + Wy) / 2

EZZ += dt * Wz

Update velocity due to strain:

Iterate over the grid and for each grid cell

Calculate the following partial derivatives using central differencing

These partial derivatives are not taken

U += dt * (dEXX/dx + dEXY/dY + dEXZ/dz)

18

Page 29: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Outline of the algorithm 19

V += dt * (dEYY/dy + dEYZ/dz + dEXY/dx)

W += dt * (dEZZ/dz + dEXZ/dx + dEYZ/dy)

Page 30: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 31: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

APPENDIX B

Two-Phase Viscoelastic Flow Model 1

B.1 Modeling Two-Phase Flow

The two phase flow approach [8] has often been employed to the simulation of onephase flow with moving interface, since it removes the difficulty treating the boundarycondition at the interface. It usually fills the empty space with a negligible flow, such asair.

Combined with the level set method capturing the interface [11], a two-phase flowis modeled by the incompressible Navier-Stokes equation with variable density and vis-cosity.

~ut + (~u · ∇) ~u = 1ρ

(∇p +∇ · (2µND) + ~f

)+ ~g

∇ · ~u = 0φt + (~u · ∇) φ = 0

ρ = ρ− + (ρ+ − ρ−) H(φ)µN = µ−N +

(µ+

N − µ−N)H(φ)

Here, D denotes the strain rate tensor, ∇~u+∇~u∗2

, and ~f is an external force that willbe taken as a Visco-Elastic force.

Given an incompressible vector field ~u, it is canonically decomposed as the sum oftranslation, deformation and rotation ;

~u(x + h) = ~u(x) +∇~u · h + O(h2)= ~u(x) + ∇~u+∇~u∗

2· h + ∇~u−∇~u∗

2· h + O(h2)

Physically, it is obvious to see that the friction or viscosity should be a function ofthe deformation only.

B.2 Modeling Visco-Elastic Force

By the analysis of the Section B.1, a highly viscous flow hardly allows deformations.The main idea of visco-elastic flow is to give a delay to the Newtonian viscous force, sothat deformation is easily allowed at the initial time but the Newtonian viscous forcecorresponding to the deformations is remembered and taken into effect later time torestore the original shape. We use the following well-known ODE to remember theNewtonian viscous force ;

1This section was authored by Chohong Min.

21

Page 32: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

22 Two-Phase Viscoelastic Flow Model 1

~ft = λ[∇ · (2µED)− ~f

]

Its analytical solution is easily given as

~f(t) = λ

∫ 0

−∞eλ(t+τ)∇ · (2µED(τ)) dτ

Since λ∫ 0

−∞ eλ(t+τ)dτ = 1, ~f is an weighted average of the past Newtonian viscous

forces. Via this visco-elastic force ~f , the Newtonian viscous force is remembered andtaken into effect through later time.

B.3 Numerical Algorithm

~u and ~f are sampled at the boundary of the MAC cell, and φ and p are sampled at thecenter of the cell. First, the level set function is updated using the ENO interpolationon convection and the TVD-RK method on time.

φn+1 − φn

∆t+ (~un · ∇) φn = 0

The velocity is advanced with a temporary variable ~u∗;

~u∗ − ~un

∆t+ (~un · ∇) ~un =

1

ρn+1

(∇ · (2µn+1

N D∗) + ~fn)

+ ~g

~u∗ is projected into a divergence free,

∇ ∇pρn+1 = ∇ · ~u∗

~un+1 = ~u∗ − ∇pρn+1

The visco-elastic force is updated by taking an average that came from the analysisof Section B.1 ;

~fn+1 = λ∇ · (2µn+1

E Dn+1)

ρn+1+ λe−λ∆t ·

(~fn + (~un · ∇) ~fn

)

B.3.1 CFL condition

φ is numerically stable if ;

∆t ≤ ∆x

d · ‖~un‖∞(B.1)

Here d denotes the dimension. ~f is also stable with the above CFL condition, sinceit is an average of the next step and the convected part.

22

Page 33: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Numerical Algorithm 23

Since ~f is an average of the Newtonian force past, we can think that the viscositypart of ~u∗ is mixed with an implicit part ∇ · (2µn

ND∗) and an explicit part ~fn. By arule of thumb that any numerical scheme with an implicit part for the heat equationis unconditionally stable, the vector field is numerically stable with the above CFLcondition. The projection part is naturally stable by the Hodge theory. In overall, ournumerical algorithm is stable with the CFL condition B.1.

Page 34: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)
Page 35: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

Bibliography

[1] Ulf Balmstedt. Viscosity and rheology: Theorectical and practical considerations inliquid food processing. New food, 3(2), 2000.

[2] Mark Carlson, Peter J. Mucha, R. Brooks Van Horn III, and Greg Turk. Melting andflowing. In ACM SIGGRAPH Symposium on Computer Animation, pages 167–174,2002.

[3] D. Enright, R. Fedkiw, J. Ferziger, and I. Mitchell. A hybrid particle level setmethod for improved interface capturing. J. Comp. Phys., 183(1):83–116, 2002.

[4] Douglas Enright, Stephen Marschner, and Ronald Fedkiw. Animation and renderingof complex water surfaces. ACM Trans. on Graphics (SIGGRAPH 2002 Proceed-ings), 21(3):736–744, 2002.

[5] Nick Foster and Ronald Fedkiw. Practical animation of liquids. In Eugene Fiume,editor, Proceedings of SIGGRAPH 2001, Computer Graphics Proceedings, AnnualConference Series, pages 23–30. ACM, ACM Press / ACM SIGGRAPH, 2001.

[6] Tolga G. Goktekin, Adam W. Bargteil, and James F. O’Brien. A method for an-imating viscoelastic fluids. In To Appear in the Proceedings of ACM SIGGRAPH2004. ACM Press, August 2004.

[7] F. Harlow and J. Welch. Numerical calculation of time-dependent viscous incom-pressible flow of fluid with free surface. Phys. Fluids, 8(1):2182–2189, 1965.

[8] P. Smereka M. Sussman, E. Fateni and S.J. Osher. An improved level set methodfor incompressible two-phase flows. journal of computers and fluids. Journal ofComputers and Fluids, 27(5-6):663–680.

[9] Daniel Nixon and Richard Lobb. A fluid-based soft-object model. IEEE ComputerGraphics & Applications, 22(4):68–75, 2002.

[10] S. Osher and R. Fedkiw. The Level Set Method and Dynamic Implicit Surfaces.Springer-Verlag, New York, 2002.

[11] S. Osher and J. Sethian. Fronts propagating with curvature-dependent speed: Al-gorithms based on hamilton-jacobi equations. Journal of Comp.Phys, 79:12–49,1988.

25

Page 36: IPAM Research in Industrial Projects for Students (RIPS ...math.ewha.ac.kr/~chohong/publications/rips_final_report.pdf · IPAM Research in Industrial Projects for Students (RIPS)

26 Bibliography

[12] D. Terzopoulos and K. Fleischer. Modeling inelastic deformation: viscoelasticity,plasticity, fracture. Comput. Graph. (SIGGRAPH Proc.), pages 269–278, 1988.

[13] D. Terzopoulos, J. Platt, A. Barr, and K. Fleischer. Elastically deformable models.Comput. Graph. (Proc. SIGGRAPH 87), 21(4):205–214, 1987.

[14] Demetri Terzopoulos, John Platt, and Kurt Fleischer. Heating and melting de-formable models (from goop to glop). In Graphics Interface ’89, pages 219–226,June 1989.

[15] M.F. Tome, N. Mangiavacchi, J.A. Cuminato, A. Castelo, and S. McKee. A finitedifference technique for simulating unsteady viscoelastic free surface flows. J. Non-Newt. Fluid Mech., 106:61–106, 2002.

26