2-D SPH solver. More...

#include <Core/Solver/Particle/SPH/SPHSolver2.hpp>

Inheritance diagram for CubbyFlow::SPHSolver2:
CubbyFlow::ParticleSystemSolver2 CubbyFlow::PhysicsAnimation CubbyFlow::Animation CubbyFlow::PCISPHSolver2

Classes

class  Builder
 Front-end to create SPHSolver2 objects step by step. More...
 

Public Member Functions

 SPHSolver2 ()
 Constructs a solver with empty particle set. More...
 
 SPHSolver2 (double targetDensity, double targetSpacing, double relativeKernelRadius)
 
 SPHSolver2 (const SPHSolver2 &)=delete
 Deleted copy constructor. More...
 
 SPHSolver2 (SPHSolver2 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~SPHSolver2 () override=default
 Default virtual destructor. More...
 
SPHSolver2operator= (const SPHSolver2 &)=delete
 Deleted copy assignment operator. More...
 
SPHSolver2operator= (SPHSolver2 &&) noexcept=delete
 Deleted move assignment operator. More...
 
double GetEosExponent () const
 Returns the exponent part of the equation-of-state. More...
 
void SetEosExponent (double newEosExponent)
 Sets the exponent part of the equation-of-state. More...
 
double GetNegativePressureScale () const
 Returns the negative pressure scale. More...
 
void SetNegativePressureScale (double newNegativePressureScale)
 Sets the negative pressure scale. More...
 
double GetViscosityCoefficient () const
 Returns the viscosity coefficient. More...
 
void SetViscosityCoefficient (double newViscosityCoefficient)
 Sets the viscosity coefficient. More...
 
double GetPseudoViscosityCoefficient () const
 Returns the pseudo viscosity coefficient. More...
 
void SetPseudoViscosityCoefficient (double newPseudoViscosityCoefficient)
 Sets the pseudo viscosity coefficient. More...
 
double GetSpeedOfSound () const
 Returns the speed of sound. More...
 
void SetSpeedOfSound (double newSpeedOfSound)
 Sets the speed of sound. More...
 
double GetTimeStepLimitScale () const
 Multiplier that scales the max allowed time-step. More...
 
void SetTimeStepLimitScale (double newScale)
 Sets the multiplier that scales the max allowed time-step. More...
 
SPHSystemData2Ptr GetSPHSystemData () const
 Returns the SPH system data. More...
 
- Public Member Functions inherited from CubbyFlow::ParticleSystemSolver2
 ParticleSystemSolver2 ()
 Constructs an empty solver. More...
 
 ParticleSystemSolver2 (double radius, double mass)
 Constructs a solver with particle parameters. More...
 
 ParticleSystemSolver2 (const ParticleSystemSolver2 &)=delete
 Deleted copy constructor. More...
 
 ParticleSystemSolver2 (ParticleSystemSolver2 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~ParticleSystemSolver2 () override=default
 Default virtual destructor. More...
 
ParticleSystemSolver2operator= (const ParticleSystemSolver2 &)=delete
 Deleted copy assignment operator. More...
 
ParticleSystemSolver2operator= (ParticleSystemSolver2 &&) noexcept=delete
 Deleted move assignment operator. More...
 
double GetDragCoefficient () const
 Returns the drag coefficient. More...
 
void SetDragCoefficient (double newDragCoefficient)
 Sets the drag coefficient. More...
 
double GetRestitutionCoefficient () const
 Gets the restitution coefficient. More...
 
void SetRestitutionCoefficient (double newRestitutionCoefficient)
 Sets the restitution coefficient. More...
 
const Vector2DGetGravity () const
 Returns the gravity. More...
 
void SetGravity (const Vector2D &newGravity)
 Sets the gravity. More...
 
const ParticleSystemData2PtrGetParticleSystemData () const
 Returns the particle system data. More...
 
const Collider2PtrGetCollider () const
 Returns the collider. More...
 
void SetCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const ParticleEmitter2PtrGetEmitter () const
 Returns the emitter. More...
 
void SetEmitter (const ParticleEmitter2Ptr &newEmitter)
 Sets the emitter. More...
 
const VectorField2PtrGetWind () const
 Returns the wind field. More...
 
void SetWind (const VectorField2Ptr &newWind)
 Sets the wind. More...
 
- Public Member Functions inherited from CubbyFlow::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
 PhysicsAnimation (const PhysicsAnimation &)=default
 Default copy constructor. More...
 
 PhysicsAnimation (PhysicsAnimation &&) noexcept=default
 Default move constructor. More...
 
virtual ~PhysicsAnimation ()=default
 Default virtual destructor. More...
 
PhysicsAnimationoperator= (const PhysicsAnimation &)=default
 Default copy assignment operator. More...
 
PhysicsAnimationoperator= (PhysicsAnimation &&) noexcept=default
 Default move assignment operator. More...
 
bool GetIsUsingFixedSubTimeSteps () const
 Returns true if fixed sub-timestepping is used. More...
 
void SetIsUsingFixedSubTimeSteps (bool isUsing)
 Sets true if fixed sub-timestepping is used. More...
 
unsigned int GetNumberOfFixedSubTimeSteps () const
 Returns the number of fixed sub-timesteps. More...
 
void SetNumberOfFixedSubTimeSteps (unsigned int numberOfSteps)
 Sets the number of fixed sub-timesteps. More...
 
void AdvanceSingleFrame ()
 Advances a single frame. More...
 
Frame GetCurrentFrame () const
 Returns current frame. More...
 
void SetCurrentFrame (const Frame &frame)
 Sets current frame cursor (but do not invoke update()). More...
 
double GetCurrentTimeInSeconds () const
 Returns current time in seconds. More...
 
- Public Member Functions inherited from CubbyFlow::Animation
 Animation ()=default
 Default constructor. More...
 
 Animation (const Animation &)=default
 Default copy constructor. More...
 
 Animation (Animation &&) noexcept=default
 Default move constructor. More...
 
virtual ~Animation ()=default
 Default virtual destructor. More...
 
Animationoperator= (const Animation &)=default
 Default copy assignment operator. More...
 
Animationoperator= (Animation &&) noexcept=default
 Default move assignment operator. More...
 
void Update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder fox SPHSolver2. More...
 
- Static Public Member Functions inherited from CubbyFlow::ParticleSystemSolver2
static Builder GetBuilder ()
 Returns builder fox ParticleSystemSolver2. More...
 

Protected Member Functions

unsigned int GetNumberOfSubTimeSteps (double timeIntervalInSeconds) const override
 Returns the number of sub-time-steps. More...
 
void AccumulateForces (double timeStepInSeconds) override
 Accumulates the force to the forces array in the particle system. More...
 
void OnBeginAdvanceTimeStep (double timeStepInSeconds) override
 Performs pre-processing step before the simulation. More...
 
void OnEndAdvanceTimeStep (double timeStepInSeconds) override
 Performs post-processing step before the simulation. More...
 
virtual void AccumulateNonPressureForces (double timeStepInSeconds)
 
virtual void AccumulatePressureForce (double timeStepInSeconds)
 
void ComputePressure ()
 Computes the pressure. More...
 
void AccumulatePressureForce (const ConstArrayView1< Vector2D > &positions, const ConstArrayView1< double > &densities, const ConstArrayView1< double > &pressures, ArrayView1< Vector2D > pressureForces)
 Accumulates the pressure force to the given pressureForces array. More...
 
void AccumulateViscosityForce ()
 
void ComputePseudoViscosity (double timeStepInSeconds)
 Computes pseudo viscosity. More...
 
- Protected Member Functions inherited from CubbyFlow::ParticleSystemSolver2
void OnInitialize () override
 Initializes the simulator. More...
 
void OnAdvanceTimeStep (double timeStepInSeconds) override
 Called to advance a single time-step. More...
 
void ResolveCollision ()
 Resolves any collisions occurred by the particles. More...
 
void ResolveCollision (ArrayView1< Vector2D > newPositions, ArrayView1< Vector2D > newVelocities)
 
void SetParticleSystemData (const ParticleSystemData2Ptr &newParticles)
 Assign a new particle system data. More...
 

Detailed Description

2-D SPH solver.

This class implements 2-D SPH solver. The main pressure solver is based on equation-of-state (EOS).

See also
M{"u}ller et al., Particle-based fluid simulation for interactive applications, SCA 2003.
M. Becker and M. Teschner, Weakly compressible SPH for free surface flows, SCA 2007.
Adams and Wicke, Meshless approximation methods and applications in physics based modeling and animation, Eurographics tutorials 2009.

Constructor & Destructor Documentation

◆ SPHSolver2() [1/4]

CubbyFlow::SPHSolver2::SPHSolver2 ( )

Constructs a solver with empty particle set.

◆ SPHSolver2() [2/4]

CubbyFlow::SPHSolver2::SPHSolver2 ( double  targetDensity,
double  targetSpacing,
double  relativeKernelRadius 
)

Constructs a solver with target density, spacing, and relative kernel radius.

◆ SPHSolver2() [3/4]

CubbyFlow::SPHSolver2::SPHSolver2 ( const SPHSolver2 )
delete

Deleted copy constructor.

◆ SPHSolver2() [4/4]

CubbyFlow::SPHSolver2::SPHSolver2 ( SPHSolver2 &&  )
deletenoexcept

Deleted move constructor.

◆ ~SPHSolver2()

CubbyFlow::SPHSolver2::~SPHSolver2 ( )
overridedefault

Default virtual destructor.

Member Function Documentation

◆ AccumulateForces()

void CubbyFlow::SPHSolver2::AccumulateForces ( double  timeStepInSeconds)
overrideprotectedvirtual

Accumulates the force to the forces array in the particle system.

Reimplemented from CubbyFlow::ParticleSystemSolver2.

◆ AccumulateNonPressureForces()

virtual void CubbyFlow::SPHSolver2::AccumulateNonPressureForces ( double  timeStepInSeconds)
protectedvirtual

Accumulates the non-pressure forces to the forces array in the particle system.

◆ AccumulatePressureForce() [1/2]

virtual void CubbyFlow::SPHSolver2::AccumulatePressureForce ( double  timeStepInSeconds)
protectedvirtual

Accumulates the pressure force to the forces array in the particle system.

Reimplemented in CubbyFlow::PCISPHSolver2.

◆ AccumulatePressureForce() [2/2]

void CubbyFlow::SPHSolver2::AccumulatePressureForce ( const ConstArrayView1< Vector2D > &  positions,
const ConstArrayView1< double > &  densities,
const ConstArrayView1< double > &  pressures,
ArrayView1< Vector2D pressureForces 
)
protected

Accumulates the pressure force to the given pressureForces array.

◆ AccumulateViscosityForce()

void CubbyFlow::SPHSolver2::AccumulateViscosityForce ( )
protected

Accumulates the viscosity force to the forces array in the particle system.

◆ ComputePressure()

void CubbyFlow::SPHSolver2::ComputePressure ( )
protected

Computes the pressure.

◆ ComputePseudoViscosity()

void CubbyFlow::SPHSolver2::ComputePseudoViscosity ( double  timeStepInSeconds)
protected

Computes pseudo viscosity.

◆ GetBuilder()

static Builder CubbyFlow::SPHSolver2::GetBuilder ( )
static

Returns builder fox SPHSolver2.

◆ GetEosExponent()

double CubbyFlow::SPHSolver2::GetEosExponent ( ) const

Returns the exponent part of the equation-of-state.

◆ GetNegativePressureScale()

double CubbyFlow::SPHSolver2::GetNegativePressureScale ( ) const

Returns the negative pressure scale.

◆ GetNumberOfSubTimeSteps()

unsigned int CubbyFlow::SPHSolver2::GetNumberOfSubTimeSteps ( double  timeIntervalInSeconds) const
overrideprotectedvirtual

Returns the number of sub-time-steps.

Reimplemented from CubbyFlow::PhysicsAnimation.

◆ GetPseudoViscosityCoefficient()

double CubbyFlow::SPHSolver2::GetPseudoViscosityCoefficient ( ) const

Returns the pseudo viscosity coefficient.

◆ GetSpeedOfSound()

double CubbyFlow::SPHSolver2::GetSpeedOfSound ( ) const

Returns the speed of sound.

◆ GetSPHSystemData()

SPHSystemData2Ptr CubbyFlow::SPHSolver2::GetSPHSystemData ( ) const

Returns the SPH system data.

◆ GetTimeStepLimitScale()

double CubbyFlow::SPHSolver2::GetTimeStepLimitScale ( ) const

Multiplier that scales the max allowed time-step.

This function returns the multiplier that scales the max allowed time-step. When the scale is 1.0, the time-step is bounded by the speed of sound and max acceleration.

◆ GetViscosityCoefficient()

double CubbyFlow::SPHSolver2::GetViscosityCoefficient ( ) const

Returns the viscosity coefficient.

◆ OnBeginAdvanceTimeStep()

void CubbyFlow::SPHSolver2::OnBeginAdvanceTimeStep ( double  timeStepInSeconds)
overrideprotectedvirtual

Performs pre-processing step before the simulation.

Reimplemented from CubbyFlow::ParticleSystemSolver2.

◆ OnEndAdvanceTimeStep()

void CubbyFlow::SPHSolver2::OnEndAdvanceTimeStep ( double  timeStepInSeconds)
overrideprotectedvirtual

Performs post-processing step before the simulation.

Reimplemented from CubbyFlow::ParticleSystemSolver2.

◆ operator=() [1/2]

SPHSolver2& CubbyFlow::SPHSolver2::operator= ( const SPHSolver2 )
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

SPHSolver2& CubbyFlow::SPHSolver2::operator= ( SPHSolver2 &&  )
deletenoexcept

Deleted move assignment operator.

◆ SetEosExponent()

void CubbyFlow::SPHSolver2::SetEosExponent ( double  newEosExponent)

Sets the exponent part of the equation-of-state.

This function sets the exponent part of the equation-of-state. The value must be greater than 1.0, and smaller inputs will be clamped. Default is 7.

◆ SetNegativePressureScale()

void CubbyFlow::SPHSolver2::SetNegativePressureScale ( double  newNegativePressureScale)

Sets the negative pressure scale.

This function sets the negative pressure scale. By setting the number between 0 and 1, the solver will scale the effect of negative pressure which can prevent the clumping of the particles near the surface. Input value outside 0 and 1 will be clamped within the range. Default is 0.

◆ SetPseudoViscosityCoefficient()

void CubbyFlow::SPHSolver2::SetPseudoViscosityCoefficient ( double  newPseudoViscosityCoefficient)

Sets the pseudo viscosity coefficient.

This function sets the pseudo viscosity coefficient which applies additional pseudo-physical damping to the system. Default is 10.

◆ SetSpeedOfSound()

void CubbyFlow::SPHSolver2::SetSpeedOfSound ( double  newSpeedOfSound)

Sets the speed of sound.

This function sets the speed of sound which affects the stiffness of the EOS and the time-step size. Higher value will make EOS stiffer and the time-step smaller. The input value must be higher than 0.0.

◆ SetTimeStepLimitScale()

void CubbyFlow::SPHSolver2::SetTimeStepLimitScale ( double  newScale)

Sets the multiplier that scales the max allowed time-step.

This function sets the multiplier that scales the max allowed time-step. When the scale is 1.0, the time-step is bounded by the speed of sound and max acceleration.

◆ SetViscosityCoefficient()

void CubbyFlow::SPHSolver2::SetViscosityCoefficient ( double  newViscosityCoefficient)

Sets the viscosity coefficient.


The documentation for this class was generated from the following file: