Pressure

Pressure is a NearBehavior that simulates pressure behavior between particles. Pressure relaxation is a fundamental step for modelling particle-based fluid behavior. The implementation uses a double-density relaxation algorithm based on the common SPH paradigm from the paper "Particle-based Viscoelastic Fluid Simulation" by Clavet. The pressure relaxation algorithm loses energy overtime at a rate depending on the scaling factors. Note that the size of the effective radius will effect the rest density as well as the emergent interactions from this behavior; larger values have pronounced surface tension effects. Moreover, pScale alters the long range pressure reactions, while pScaleNear determines the "stiffness" of the particle system. The user is encouraged to test out different constants for specific effects.

Constructor

new Pressure(radius, pScale, restDensity, pScaleNear, nearRepulsion)

Instantiates new Pressure behavior object

Parameters:
NameTypeDefaultDescription
radiusNumber

effective radius, determines the area of which density is sampled from

pScaleNumber

pressure relaxation scaling constant

restDensityNumber

target resting density (there are no units, its an approximate value)

pScaleNearNumber0

near pressure relaxation scaling constant

nearRepulsionBooleantrue

whether near pressure repulsion is active (true by default)

Extends

Methods

applyBehavior(particle, particles, timeStep)

Calculates and applies the pressure relaxation

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>
timeStepNumber

applyCorrection(particle, particles)

This class does not require final position corrections

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>

findDensity(particle, particles) → {Array.<Number>}

Calculates the approximate density within the effective radius of the particle

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>
Returns:

an array of 2 numbers, [density, nearDensity]

Type: 
Array.<Number>

range() → {null}

Returns the effective range / defines the size of the nearby range

Returns:
Type: 
null