org.jbox2d.util.sph
Class SmoothParticle

java.lang.Object
  extended by org.jbox2d.util.sph.Particle
      extended by org.jbox2d.util.sph.SmoothParticle

public class SmoothParticle
extends Particle


Field Summary
protected  double c
           
protected  double ChangeDensity
           
protected  Vec2 ChangeVelocity
           
protected  double density
           
protected  double h
           
 int ID
           
protected  double maxDensity
           
protected  double minDensity
           
protected  int numNeighbors
           
protected  double pressure
           
protected  int shapeID
           
 
Fields inherited from class org.jbox2d.util.sph.Particle
deleted, mass, pos, vel
 
Constructor Summary
SmoothParticle()
           
SmoothParticle(SmoothParticle SP)
           
SmoothParticle(Vec2 p, Vec2 v, double m, double d, double pr, double len, double speedSnd)
           
 
Method Summary
 void addForceX(Parameter param)
          Add the body force in the x direction.
 void addForceY(Parameter param)
          Add the body force in the y direction.
protected  double artificialViscosity(SmoothParticle sp, Parameter param)
          This is used to simulate viscous fluids.
 void calcChangeDensity(SmoothParticle sp, Vec2 v_ij)
          Adds the contributions of the change in density from the neighbor "sp".
 void calcChangeVelocity(SmoothParticle sp, Vec2 v_ij, Parameter param)
          Add the contribution of the acceleration due to the free particle "sp".
 void calcPressure(Parameter p)
          Calculates the pressure for this SPH particle.
 double getChangeDensity()
           
 Vec2 getChangeVelocity()
           
 double getChangeVelocityX()
           
 double getChangeVelocityY()
           
 double getDensity()
           
 double getMaxDensity()
           
 double getMinDensity()
           
 int getNumNeighbors()
           
 double getPressure()
           
 int getShapeID()
           
 double getSmoothingLength()
           
 double getSpeedSound()
           
protected  double gradientKernelX(SmoothParticle sp)
          X component of gradient of SPH smoothing kernel
protected  double gradientKernelY(SmoothParticle sp)
          Y component of gradient of SPH smoothing kernel
protected  double kernel(SmoothParticle sp)
          SPH smoothing kernel
 void setChangeDensity(double cd)
           
 void setChangeVelocity(Vec2 ChangeV)
           
 void setDensity(double den)
           
 void setMaxDensity(double m)
           
 void setMinDensity(double m)
           
 void setMinMaxDensity()
          Keeps track of our particle's min and max density
 void setNumNeighbors(int n)
           
 void setPressure(double p)
           
 void setShapeID(int id)
           
 void setSmoothingLength(double len)
           
 void setSpeedSound(double spSnd)
           
 void zeroSPHVars()
          Zeroes out the delta values.
 
Methods inherited from class org.jbox2d.util.sph.Particle
deleteParticle, isEmpty, undeleteParticle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public int ID

pressure

protected double pressure

density

protected double density

h

protected double h

c

protected double c

ChangeDensity

protected double ChangeDensity

ChangeVelocity

protected Vec2 ChangeVelocity

shapeID

protected int shapeID

numNeighbors

protected int numNeighbors

minDensity

protected double minDensity

maxDensity

protected double maxDensity
Constructor Detail

SmoothParticle

public SmoothParticle()

SmoothParticle

public SmoothParticle(Vec2 p,
                      Vec2 v,
                      double m,
                      double d,
                      double pr,
                      double len,
                      double speedSnd)

SmoothParticle

public SmoothParticle(SmoothParticle SP)
Method Detail

setPressure

public void setPressure(double p)

setDensity

public void setDensity(double den)

setSmoothingLength

public void setSmoothingLength(double len)

setSpeedSound

public void setSpeedSound(double spSnd)

setChangeVelocity

public void setChangeVelocity(Vec2 ChangeV)

setChangeDensity

public void setChangeDensity(double cd)

setMinDensity

public void setMinDensity(double m)

setMaxDensity

public void setMaxDensity(double m)

setShapeID

public void setShapeID(int id)

setNumNeighbors

public void setNumNeighbors(int n)

getPressure

public double getPressure()

getSmoothingLength

public double getSmoothingLength()

getDensity

public double getDensity()

getSpeedSound

public double getSpeedSound()

getChangeDensity

public double getChangeDensity()

getChangeVelocity

public Vec2 getChangeVelocity()

getChangeVelocityX

public double getChangeVelocityX()

getChangeVelocityY

public double getChangeVelocityY()

getShapeID

public int getShapeID()

getMinDensity

public double getMinDensity()

getMaxDensity

public double getMaxDensity()

getNumNeighbors

public int getNumNeighbors()

calcPressure

public void calcPressure(Parameter p)
Calculates the pressure for this SPH particle. The state equation comes from **** and is used to model water.


zeroSPHVars

public void zeroSPHVars()
Zeroes out the delta values. The reason is because the delta values come from summing up contributions from all neighbors and we don't want to add to the last time steps value.


calcChangeDensity

public void calcChangeDensity(SmoothParticle sp,
                              Vec2 v_ij)
Adds the contributions of the change in density from the neighbor "sp".


calcChangeVelocity

public void calcChangeVelocity(SmoothParticle sp,
                               Vec2 v_ij,
                               Parameter param)
Add the contribution of the acceleration due to the free particle "sp".


addForceX

public void addForceX(Parameter param)
Add the body force in the x direction.


addForceY

public void addForceY(Parameter param)
Add the body force in the y direction.


artificialViscosity

protected double artificialViscosity(SmoothParticle sp,
                                     Parameter param)
This is used to simulate viscous fluids.


kernel

protected double kernel(SmoothParticle sp)
SPH smoothing kernel


gradientKernelX

protected double gradientKernelX(SmoothParticle sp)
X component of gradient of SPH smoothing kernel


gradientKernelY

protected double gradientKernelY(SmoothParticle sp)
Y component of gradient of SPH smoothing kernel


setMinMaxDensity

public void setMinMaxDensity()
Keeps track of our particle's min and max density