toxi.sim.fluids
Class FluidSolver

java.lang.Object
  extended by toxi.sim.fluids.FluidSolver

public class FluidSolver
extends java.lang.Object

Optimized Jos Stam style fluid solver with vorticity confinement and buoyancy force.


Constructor Summary
FluidSolver(int w, int h, float timeStep)
          Creates a new instance of the given dimension uses the specified time step.
 
Method Summary
 void decay(float decay)
           
 void densitySolver()
          The basic density solving routine.
 void reset()
          Reset the datastructures.
 void velocitySolver()
          The basic velocity solving routine as described by Stam.
 void vorticityConfinement(float[] Fvc_x, float[] Fvc_y)
          Calculate the vorticity confinement force for each cell in the fluid grid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FluidSolver

public FluidSolver(int w,
                   int h,
                   float timeStep)
Creates a new instance of the given dimension uses the specified time step.

Parameters:
w - matrix width
h - matrix height
timeStep -
Method Detail

decay

public final void decay(float decay)

densitySolver

public void densitySolver()
The basic density solving routine.


reset

public void reset()
Reset the datastructures. We use 1d arrays for speed.


velocitySolver

public void velocitySolver()
The basic velocity solving routine as described by Stam.


vorticityConfinement

public void vorticityConfinement(float[] Fvc_x,
                                 float[] Fvc_y)
Calculate the vorticity confinement force for each cell in the fluid grid. At a point (i,j), Fvc = N x width where width is the curl at (i,j) and N = del |width| / |del |width||. N is the vector pointing to the vortex center, hence we add force perpendicular to N.

Parameters:
Fvc_x - The array to store the x component of the vorticity confinement force for each cell.
Fvc_y - The array to store the y component of the vorticity confinement force for each cell.