2-D grid-based smoke solver. More...

#include <Core/Solver/Grid/GridSmokeSolver2.h>

Inheritance diagram for CubbyFlow::GridSmokeSolver2:
CubbyFlow::GridFluidSolver2 CubbyFlow::PhysicsAnimation CubbyFlow::Animation

Classes

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

Public Member Functions

 GridSmokeSolver2 ()
 Default constructor. More...
 
 GridSmokeSolver2 (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~GridSmokeSolver2 ()
 Destructor. More...
 
double GetSmokeDiffusionCoefficient () const
 Returns smoke diffusion coefficient. More...
 
void SetSmokeDiffusionCoefficient (double newValue)
 Sets smoke diffusion coefficient. More...
 
double GetTemperatureDiffusionCoefficient () const
 Returns temperature diffusion coefficient. More...
 
void SetTemperatureDiffusionCoefficient (double newValue)
 Sets temperature diffusion coefficient. More...
 
double GetBuoyancySmokeDensityFactor () const
 Returns the buoyancy factor which will be multiplied to the smoke density. More...
 
void SetBuoyancySmokeDensityFactor (double newValue)
 Sets the buoyancy factor which will be multiplied to the smoke density. More...
 
double GetBuoyancyTemperatureFactor () const
 Returns the buoyancy factor which will be multiplied to the temperature. More...
 
void SetBuoyancyTemperatureFactor (double newValue)
 Sets the buoyancy factor which will be multiplied to the temperature. More...
 
double GetSmokeDecayFactor () const
 Returns smoke decay factor. More...
 
void SetSmokeDecayFactor (double newValue)
 Sets the smoke decay factor. More...
 
double GetTemperatureDecayFactor () const
 Returns temperature decay factor. More...
 
void SetTemperatureDecayFactor (double newValue)
 Sets the temperature decay factor. More...
 
ScalarGrid2Ptr GetSmokeDensity () const
 Returns smoke density field. More...
 
ScalarGrid2Ptr GetTemperature () const
 Returns temperature field. More...
 
- Public Member Functions inherited from CubbyFlow::GridFluidSolver2
 GridFluidSolver2 ()
 Default constructor. More...
 
 GridFluidSolver2 (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
 Constructs solver with initial grid size. More...
 
virtual ~GridFluidSolver2 ()
 Default destructor. More...
 
const Vector2DGetGravity () const
 Returns the gravity vector of the system. More...
 
void SetGravity (const Vector2D &newGravity)
 Sets the gravity of the system. More...
 
double GetViscosityCoefficient () const
 Returns the viscosity coefficient. More...
 
void SetViscosityCoefficient (double newValue)
 Sets the viscosity coefficient. More...
 
double GetCFL (double timeIntervalInSeconds) const
 Returns the CFL number from the current velocity field for given time interval. More...
 
double GetMaxCFL () const
 Returns the max allowed CFL number. More...
 
void SetMaxCFL (double newCFL)
 Sets the max allowed CFL number. More...
 
bool GetUseCompressedLinearSystem () const
 Returns true if the solver is using compressed linear system. More...
 
void SetUseCompressedLinearSystem (bool onoff)
 Sets whether the solver should use compressed linear system. More...
 
const AdvectionSolver2PtrGetAdvectionSolver () const
 Returns the advection solver instance. More...
 
void SetAdvectionSolver (const AdvectionSolver2Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver2PtrGetDiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void SetDiffusionSolver (const GridDiffusionSolver2Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver2PtrGetPressureSolver () const
 Returns the pressure solver instance. More...
 
void SetPressureSolver (const GridPressureSolver2Ptr &newSolver)
 Sets the pressure solver. More...
 
int GetClosedDomainBoundaryFlag () const
 Returns the closed domain boundary flag. More...
 
void SetClosedDomainBoundaryFlag (int flag)
 Sets the closed domain boundary flag. More...
 
const GridSystemData2PtrGetGridSystemData () const
 Returns the grid system data. More...
 
void ResizeGrid (const Size2 &newSize, const Vector2D &newGridSpacing, const Vector2D &newGridOrigin) const
 Resizes grid system data. More...
 
Size2 GetResolution () const
 Returns the resolution of the grid system data. More...
 
Vector2D GetGridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector2D GetGridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid2PtrGetVelocity () const
 Returns the velocity field. More...
 
const Collider2PtrGetCollider () const
 Returns the collider. More...
 
void SetCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter2PtrGetEmitter () const
 Returns the emitter. More...
 
void SetEmitter (const GridEmitter2Ptr &newEmitter)
 Sets the emitter. More...
 
- Public Member Functions inherited from CubbyFlow::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
virtual ~PhysicsAnimation ()
 Destructor. 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 ()
 
virtual ~Animation ()
 
void Update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

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

Protected Member Functions

void OnEndAdvanceTimeStep (double timeIntervalInSeconds) override
 Called at the end of a time-step. More...
 
void ComputeExternalForces (double timeIntervalInSeconds) override
 Computes the external force terms. More...
 
- Protected Member Functions inherited from CubbyFlow::GridFluidSolver2
void OnInitialize () override
 Called when it needs to setup initial condition. More...
 
void OnAdvanceTimeStep (double timeIntervalInSeconds) override
 Called when advancing a single time-step. More...
 
unsigned int GetNumberOfSubTimeSteps (double timeIntervalInSeconds) const override
 Returns the required sub-time-steps for given time interval. More...
 
virtual void OnBeginAdvanceTimeStep (double timeIntervalInSeconds)
 Called at the beginning of a time-step. More...
 
virtual void ComputeViscosity (double timeIntervalInSeconds)
 Computes the viscosity term using the diffusion solver. More...
 
virtual void ComputePressure (double timeIntervalInSeconds)
 Computes the pressure term using the pressure solver. More...
 
virtual void ComputeAdvection (double timeIntervalInSeconds)
 Computes the advection term using the advection solver. More...
 
virtual ScalarField2Ptr GetFluidSDF () const
 Returns the signed-distance representation of the fluid. More...
 
void ComputeGravity (double timeIntervalInSeconds)
 Computes the gravity term. More...
 
void ApplyBoundaryCondition () const
 Applies the boundary condition to the velocity field. More...
 
void ExtrapolateIntoCollider (ScalarGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (CollocatedVectorGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (FaceCenteredGrid2 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
ScalarField2Ptr GetColliderSDF () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField2Ptr GetColliderVelocityField () const
 Returns the velocity field of the collider. More...
 

Detailed Description

2-D grid-based smoke solver.

This class extends GridFluidSolver2 to implement smoke simulation solver. It adds smoke density and temperature fields to define the smoke and uses buoyancy force to simulate hot rising smoke.

See also
Fedkiw, Ronald, Jos Stam, and Henrik Wann Jensen. "Visual simulation of smoke." Proceedings of the 28th annual conference on Computer graphics and interactive techniques. ACM, 2001.

Constructor & Destructor Documentation

◆ GridSmokeSolver2() [1/2]

CubbyFlow::GridSmokeSolver2::GridSmokeSolver2 ( )

Default constructor.

◆ GridSmokeSolver2() [2/2]

CubbyFlow::GridSmokeSolver2::GridSmokeSolver2 ( const Size2 resolution,
const Vector2D gridSpacing,
const Vector2D gridOrigin 
)

Constructs solver with initial grid size.

◆ ~GridSmokeSolver2()

virtual CubbyFlow::GridSmokeSolver2::~GridSmokeSolver2 ( )
virtual

Destructor.

Member Function Documentation

◆ ComputeExternalForces()

void CubbyFlow::GridSmokeSolver2::ComputeExternalForces ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Computes the external force terms.

This function computes the external force applied for given time interval. By default, it only computes the gravity.

See also
GridFluidSolver2::ComputeGravity

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ GetBuilder()

static Builder CubbyFlow::GridSmokeSolver2::GetBuilder ( )
static

Returns builder fox GridSmokeSolver2.

◆ GetBuoyancySmokeDensityFactor()

double CubbyFlow::GridSmokeSolver2::GetBuoyancySmokeDensityFactor ( ) const

Returns the buoyancy factor which will be multiplied to the smoke density.

This class computes buoyancy by looking up the value of smoke density and temperature, compare them to the average values, and apply multiplier factor to the diff between the value and the average. That multiplier is defined for each smoke density and temperature separately. For example, negative smoke density buoyancy factor means a heavier smoke should sink.

Returns
The buoyancy factor for the smoke density.

◆ GetBuoyancyTemperatureFactor()

double CubbyFlow::GridSmokeSolver2::GetBuoyancyTemperatureFactor ( ) const

Returns the buoyancy factor which will be multiplied to the temperature.

This class computes buoyancy by looking up the value of smoke density and temperature, compare them to the average values, and apply multiplier factor to the diff between the value and the average. That multiplier is defined for each smoke density and temperature separately. For example, negative smoke density buoyancy factor means a heavier smoke should sink.

Returns
The buoyancy factor for the temperature.

◆ GetSmokeDecayFactor()

double CubbyFlow::GridSmokeSolver2::GetSmokeDecayFactor ( ) const

Returns smoke decay factor.

In addition to the diffusion, the smoke also can fade-out over time by setting the decay factor between 0 and 1.

Returns
The decay factor for smoke density.

◆ GetSmokeDensity()

ScalarGrid2Ptr CubbyFlow::GridSmokeSolver2::GetSmokeDensity ( ) const

Returns smoke density field.

◆ GetSmokeDiffusionCoefficient()

double CubbyFlow::GridSmokeSolver2::GetSmokeDiffusionCoefficient ( ) const

Returns smoke diffusion coefficient.

◆ GetTemperature()

ScalarGrid2Ptr CubbyFlow::GridSmokeSolver2::GetTemperature ( ) const

Returns temperature field.

◆ GetTemperatureDecayFactor()

double CubbyFlow::GridSmokeSolver2::GetTemperatureDecayFactor ( ) const

Returns temperature decay factor.

In addition to the diffusion, the smoke also can fade-out over time by setting the decay factor between 0 and 1.

Returns
The decay factor for smoke temperature.

◆ GetTemperatureDiffusionCoefficient()

double CubbyFlow::GridSmokeSolver2::GetTemperatureDiffusionCoefficient ( ) const

Returns temperature diffusion coefficient.

◆ OnEndAdvanceTimeStep()

void CubbyFlow::GridSmokeSolver2::OnEndAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Called at the end of a time-step.

Reimplemented from CubbyFlow::GridFluidSolver2.

◆ SetBuoyancySmokeDensityFactor()

void CubbyFlow::GridSmokeSolver2::SetBuoyancySmokeDensityFactor ( double  newValue)

Sets the buoyancy factor which will be multiplied to the smoke density.

This class computes buoyancy by looking up the value of smoke density and temperature, compare them to the average values, and apply multiplier factor to the diff between the value and the average. That multiplier is defined for each smoke density and temperature separately. For example, negative smoke density buoyancy factor means a heavier smoke should sink.

Parameters
newValueThe new buoyancy factor for smoke density.

◆ SetBuoyancyTemperatureFactor()

void CubbyFlow::GridSmokeSolver2::SetBuoyancyTemperatureFactor ( double  newValue)

Sets the buoyancy factor which will be multiplied to the temperature.

This class computes buoyancy by looking up the value of smoke density and temperature, compare them to the average values, and apply multiplier factor to the diff between the value and the average. That multiplier is defined for each smoke density and temperature separately. For example, negative smoke density buoyancy factor means a heavier smoke should sink.

Parameters
newValueThe new buoyancy factor for temperature.

◆ SetSmokeDecayFactor()

void CubbyFlow::GridSmokeSolver2::SetSmokeDecayFactor ( double  newValue)

Sets the smoke decay factor.

In addition to the diffusion, the smoke also can fade-out over time by setting the decay factor between 0 and 1.

Parameters
[in]newValueThe new decay factor.

◆ SetSmokeDiffusionCoefficient()

void CubbyFlow::GridSmokeSolver2::SetSmokeDiffusionCoefficient ( double  newValue)

Sets smoke diffusion coefficient.

◆ SetTemperatureDecayFactor()

void CubbyFlow::GridSmokeSolver2::SetTemperatureDecayFactor ( double  newValue)

Sets the temperature decay factor.

In addition to the diffusion, the temperature also can fade-out over time by setting the decay factor between 0 and 1.

Parameters
[in]newValueThe new decay factor.

◆ SetTemperatureDiffusionCoefficient()

void CubbyFlow::GridSmokeSolver2::SetTemperatureDiffusionCoefficient ( double  newValue)

Sets temperature diffusion coefficient.


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