Jeff Schoner
COMP 259, Spring 2005
Final Project Report

Proposal from early in the semester
Demo (OS X binary zipped)

Fluid/Fiber Interaction

Introduction

Motivation and Background

The extensive publication record for the simulation of deformable objects within the domain of computer graphics today spans over 25 years. Similarly, a great deal of work has been done with respect to the simulation of fluids. Somewhat less research has been carried out on simulating these two kinds of materials in a shared environment. Much of it has been concerned with a certain kind of coupled simulation, where one medium affects but is not affected by another [Carlson et al. 2004].

For example, if we simulate a tree blowing in the wind, it is reasonable to apply forces to the tree based on a time-varying vector field for the wind, while it would most likely not be necessary to simulate the effect the tree has on the wind field. However, for the simulation of the interaction between a ball and a tub of water, we would like each component to be able to affect the other. Hence, if the water pushes the ball, the ball should push back on the water and affect its motion appropriately.

State of the Art and New Challenges

Over the past two years, three papers in particular have been published concerning this problem of fluid/solid interaction [Genevaux et al. 2003, Müller et al. 2004 and Carlson et al. 2004]. Carlson focuses on the interaction of rigid bodies with fluids, employing a continuum model for the fluid. Genevaux also employs a continuum model for the fluid, but handles deformable objects (represented as spring-mass conglomerations). Finally, Müller takes a completely different approach, where solid and fluid components are both represented as particles.

Currently I am aware of no work in computer graphics, which focuses on the simulation of the interaction between fiber-like deformable solids (such as hair, rope or a myriad of other materials) and fluids. Extensive prior work on the simulation of hair alone in dry environments warrants the interest in simulating its interaction with immersive water.

Goals

Originally, I planned to extend an existing 2D fluid simulator into three dimensions and then add interaction by following an approach similar to that of Genevaux. Such an approach would employ a Eulerian (regular grid approximation of continuous function) method for the fluid and a Lagrangian (particle-based) method for the fibers. The ultimate product to be produced was a proof-of-concept system that did two way fluid/fiber interaction.

Results

Methods Implemented

I asked around for existing 3D fluid simulation code, but was unable to find anything. I found a couple of 2D fluid simulators (mostly employing the method of Stam from SIGGRAPH 99), but all of them had code that was difficult to understand. In the end, I decided to just write a 3D fluid simulator from scratch. Stam's paper, while describing what is probably the most widely used method in computer graphics, left out a lot of details concerning the actual implementation. Furthermore, for non-periodic boundary conditions, the use of a Poission solver was needed, which was difficult to deal with.

Instead, I turned to an earlier journal article by Foster and Metaxas (1996), which described in more complete detail their methods for solving the Navier Stokes equations for an incompressible fluid. Their approach differs from Stam's in two significant ways. First, the use finite differences to solve the advection term, whereas Stam uses a more heuristic approach so as to make the solution of the system easier. Presumably, the Foster and Metaxas method is more true to the underlying Navier Stokes equations. Second, instead of using a Poisson solver to do the divergence-free projection step, Foster and Metaxas employ a simple relaxation scheme. While the use of relaxation is slower than the use of a Poisson solver by Stam and also Carlson et al., it is very easy to implement and therefore requires no use of hard to find third party software. The fluid part of my simulator uses these above mentioned methods of Foster and Metaxas.

For the simulation of individual fibers, I use a simple mass-spring particle system (essentially, the one from the first homework assignment with some improvements). The coupling between the fiber simulator and fluid simulator is carried out in a manner very similar to that of Genevaux et al.

Interactivity

It is possible to run the simulation interactively, so long as the number of grid cells is kept relatively low and so long as the error tolerance for the iterative relaxation scheme used to achieve a divergence-free field after each time step is kept relatively large. Because I have focused on the interaction between the fluid and fiber, as opposed to the fluid itself, these conditions which would have lead to low quality in a pure fluid simulation do not significantly compromise quality here. More specifically, the use of a 16x16x16 fluid simulation grid when combined with linear interpolation of fluid velocities and forces for the interaction still gives realistic looking behavior while remaining interactive. Even though my implementation is interactive and employs a coarse grid, there is no reason why the method could not use a finer grid and run as an offline.

Assumptions

I assume that individual fibers are so small as to not displace any fluid volume. This is reasonable since the fibers themselves are much thinner than the grid used. In fact, this method would not be particularly appropriate for thicker fibers. In such a case, an implementation resembling that of Carlson et al. might work better. I also assume that the mass of the fibers is such that their density does not significantly differ from that of the surrounding fluid. This assumption allows me to avoid explicitly dealing with buoyancy. Once again, in most cases this is not a problem. Fibers that float or sink immediately to the bottom of the fluid are not the kind I have focused on for this project.

Some Details on the Coupling

As the fluid simulator and particle system simulator employ standard techniques that can be found in the referenced papers, I'm not going to describe their methods. However, it is worth discussing how I couple the two systems together.

When a fluid and a body are interacting, torques are applied by the fluid to the solid object. Conceptually, this occurs because the fluid molecules are colliding with those of the solid. Macroscopically, this results in pushing and friction. Since I assume the fibers are infinitely thin, it is sufficient to model the interaction using dynamic friction. From observation, we know that a stationary solid object lying in a flowing fluid will have forces applied to it by the fluid. However, in the case where a solid object is flowing in a fluid at the same speed as the fluid itself, no force will be exerted. Similarly, a moving object passing through stationary fluid will cause the fluid to begin moving. I couple the fibers and fluids by applying an equal and opposite force proportional to the difference in their velocities. More mathematically, this is,

f = c * (v_f - v_s)

where f is the force that will be applied to the fiber, c is a frictional coefficient, v_f is the velocity of the fluid and v_s is the velocity of the (solid) fiber.

This quantity is computed for every particle in a fiber chain. The particles in the fiber chain should be close enough together that they are found at the furthest from each other in adjacent fluid grid cells. This force is then added into the force accumulator of the particle. An equal and opposite force needs to be applied to the fluid. This is done by applying an external force to the fluid. Because the fluid velocity is sampled on the edges of each cell (the pressure is sampled in the center), the external force is applied to each of these "walls" proportional to the barycentric coordinates of each cubic cell. If a fiber particle should drift outside the simulation volume, an elastic penalty force is applied to push it back in. After all forces have been accumulated for the fluid and particle system simulators, an integration step is performed on each independently.

Finally, the two systems are drawn. The particle system is drawn as a set of spheres (for particles) connected by lines (for springs) as appropriate. Showing the fluid is much more difficult. Most of the computer graphics literature on fluids focuses on simulation of the surface of fluid. Since the focus here is on fluid/fiber interaction, the flow of the fluid is more important. In fact, the simulation does not deal with the fluid surface at all. The simulation takes place in a box filled completely with fluid. To show the flow, massless markers are introduced and shown as points. These markers do not interact with the fluid or fibers at all. They only show the movement of the flow. At simulation initialization, they are placed randomly throughout the simulation volume and advected through the velocity field of the fluid over time. If a tracer passes outside the simulation volume by flowing out a sink or simply overshooting the simulation volume, it is dumped back at any available source.

Demos

You can download the OS X binary of one configuration which clearly shows the two-way interaction of the fiber with the fluid.

Images


Summary and Future Work

The main contribution of this project is a two-way interactive fluid/fiber simulator. Its implementation required the following to be written: For future work, a number of improvements could be made. A more modern Stam style fluid simulator could be implemented and used instead. This would improve stability and possibly performance. Additionally, detection and response for fiber-fiber collision and fiber self collision would be necessary for optimal behavior.

Bibliography

Mark Carlson, Peter J. Mucha and Greg Turk. ``Rigid fluid: animating the interplay between rigid bodies and fluid'' in the Proceedings of ACM SIGGRAPH 2004.

Nick Foster and Dimitri Metaxas, ``Realistic Animation of Liquids'', Graphical Models and Image Processing, 58(5):471-483, September 1996.

Olivier Genevaux, Arash Habibi and Jean-Michel Dischler. ``Simulating Fluid-Solid Interaction'' in the Proceedings of Graphics Interface 2003.

Matthias Müller, Simon Schirm, Matthias Teschner, Bruno Heidelberger and Markus Gross. ``Interaction of Fluids with Deformable Solids'' in the Proceedings of Computer Animation and Social Agents (CASA) 2004.

Jos Stam, ``Stable Fluids'' in the Proceedings of SIGGRAPH 1999.