Fluid Simulation on Surfaces
Maria Andrade, Leonardo Carvalho, Dalia Bonilla
In this work, we
show how to calculate the Navier-Stokes equations on
a smooth surface, where we want to simulate a fluid
flow. We used a parametrization of a Catmull-Clark
surface, from which we calculate a metric that
depends on its tangent vectors and use this metric
to get the necessary differential operators to solve
the problem. The Navier-Stokes equations are solved
on a discretization of the surface, dealing with the
transition of the fluid between the patches that
form the surface. This work is based in the work of
Jos Stam.
Example: Simulation of fluid on a closed surface.
To simulate fluid we need to get a parametrization of
some surface, one good candidate is a Catmull-Clark surface,
which is smooth almost everywhere.
Moreover, it is necessary to compare vectors in
different points on the surface for fluid simulators, for
example, velocity, force, etc.
The Navier-Stokes equations on a smooth surface are
where
-
is the fluid's velocity;
-
is the viscosity;
-
are external forces;
-
is the fluid's density;
-
is a diffusion rate;
- are sources of density.
We used a parametrization of the Catmull-Clark subdivision surface, as described by Jos Stam, 1998,
where the surface is divided into patches, as you can see in this example:
Surface divided into patches. The colors indicate the coordinate system of each patch.
From this parametrization
we calculate the metric matrix defined by
The inverse of the metric matrix is
And we denote the determinant of the metric matrix
The equations are solved in four steps:
Addition of forces
First, we solve this equation
which is discretized by
So we just sum the values of the external forces to the current velocity.
Forces added to a velocity field on the surface.
Diffusion
Now, we solve the diffusion equation
which is discretized by
where the Laplacian operator is given by
Result of a diffusion step.
Advection
The advection equation is given by
where the gradient operator is given by
which is solved using a semi-Lagrangian technique, where we calculate the trajectory of each point of the grid to get its velocity in the previous time.
Projection
The result of the last step is projected
such that
where the divergent is given by
To find this projection we solve the Poisson equation
followed by
These steps are summarized in the following picture:
Addition of density sources
For the density field, we first solve this equation
which is discretized by
So we just sum the values from the sources to the current density.
From the initial density (on the left), we add sources (on the right).
Diffusion of density field
Next, we solve the diffusion
which is discretized by
Advection of density field
Finally, the advection equation is given by
which is solved also using a semi-Lagrangian technique.
Results
This example shows the result of the simulation without the treatment of neighbour patches.
The fluid seems to vanish from one patch to another.
This example compares the results of the simulation without and with the treatment of neighbour patches, respectively.
The effect of diffusion of the density can be seen in this example.
Effect of viscosity on the simulation.
Stanford Bunny.