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

#include <Core/Solver/Grid/GridSmokeSolver3.hpp>

Inheritance diagram for CubbyFlow::GridSmokeSolver3:
CubbyFlow::GridFluidSolver3 CubbyFlow::PhysicsAnimation CubbyFlow::Animation

Classes

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

Public Member Functions

 GridSmokeSolver3 ()
 Default constructor. More...
 
 GridSmokeSolver3 (const Vector3UZ &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
 Constructs solver with initial grid size. More...
 
 GridSmokeSolver3 (const GridSmokeSolver3 &)=delete
 Deleted copy constructor. More...
 
 GridSmokeSolver3 (GridSmokeSolver3 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~GridSmokeSolver3 () override=default
 Default virtual destructor. More...
 
GridSmokeSolver3operator= (const GridSmokeSolver3 &)=delete
 Deleted copy assignment operator. More...
 
GridSmokeSolver3operator= (GridSmokeSolver3 &&) noexcept=delete
 Deleted move assignment operator. 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...
 
ScalarGrid3Ptr GetSmokeDensity () const
 Returns smoke density field. More...
 
ScalarGrid3Ptr GetTemperature () const
 Returns temperature field. More...
 
- Public Member Functions inherited from CubbyFlow::GridFluidSolver3
 GridFluidSolver3 ()
 Default constructor. More...
 
 GridFluidSolver3 (const Vector3UZ &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin)
 Constructs solver with initial grid size. More...
 
 GridFluidSolver3 (const GridFluidSolver3 &)=delete
 Deleted copy constructor. More...
 
 GridFluidSolver3 (GridFluidSolver3 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~GridFluidSolver3 () override=default
 Default virtual destructor. More...
 
GridFluidSolver3operator= (const GridFluidSolver3 &)=delete
 Deleted copy assignment operator. More...
 
GridFluidSolver3operator= (GridFluidSolver3 &&) noexcept=delete
 Deleted move assignment operator. More...
 
const Vector3DGetGravity () const
 Returns the gravity vector of the system. More...
 
void SetGravity (const Vector3D &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 isOn)
 Sets whether the solver should use compressed linear system. More...
 
const AdvectionSolver3PtrGetAdvectionSolver () const
 Returns the advection solver instance. More...
 
void SetAdvectionSolver (const AdvectionSolver3Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver3PtrGetDiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void SetDiffusionSolver (const GridDiffusionSolver3Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver3PtrGetPressureSolver () const
 Returns the pressure solver instance. More...
 
void SetPressureSolver (const GridPressureSolver3Ptr &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 GridSystemData3PtrGetGridSystemData () const
 Returns the grid system data. More...
 
void ResizeGrid (const Vector3UZ &newSize, const Vector3D &newGridSpacing, const Vector3D &newGridOrigin) const
 Resizes grid system data. More...
 
Vector3UZ GetResolution () const
 Returns the resolution of the grid system data. More...
 
Vector3D GetGridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector3D GetGridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid3PtrGetVelocity () const
 Returns the velocity field. More...
 
const Collider3PtrGetCollider () const
 Returns the collider. More...
 
void SetCollider (const Collider3Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter3PtrGetEmitter () const
 Returns the emitter. More...
 
void SetEmitter (const GridEmitter3Ptr &newEmitter)
 Sets the emitter. 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 GridSmokeSolver3. More...
 
- Static Public Member Functions inherited from CubbyFlow::GridFluidSolver3
static Builder GetBuilder ()
 Returns builder fox GridFluidSolver3. 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::GridFluidSolver3
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 ScalarField3Ptr 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 (ScalarGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (CollocatedVectorGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
void ExtrapolateIntoCollider (FaceCenteredGrid3 *grid)
 Extrapolates given field into the collider-occupied region. More...
 
ScalarField3Ptr GetColliderSDF () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField3Ptr GetColliderVelocityField () const
 Returns the velocity field of the collider. More...
 

Detailed Description

3-D grid-based smoke solver.

This class extends GridFluidSolver3 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

◆ GridSmokeSolver3() [1/4]

CubbyFlow::GridSmokeSolver3::GridSmokeSolver3 ( )

Default constructor.

◆ GridSmokeSolver3() [2/4]

CubbyFlow::GridSmokeSolver3::GridSmokeSolver3 ( const Vector3UZ resolution,
const Vector3D gridSpacing,
const Vector3D gridOrigin 
)

Constructs solver with initial grid size.

◆ GridSmokeSolver3() [3/4]

CubbyFlow::GridSmokeSolver3::GridSmokeSolver3 ( const GridSmokeSolver3 )
delete

Deleted copy constructor.

◆ GridSmokeSolver3() [4/4]

CubbyFlow::GridSmokeSolver3::GridSmokeSolver3 ( GridSmokeSolver3 &&  )
deletenoexcept

Deleted move constructor.

◆ ~GridSmokeSolver3()

CubbyFlow::GridSmokeSolver3::~GridSmokeSolver3 ( )
overridedefault

Default virtual destructor.

Member Function Documentation

◆ ComputeExternalForces()

void CubbyFlow::GridSmokeSolver3::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
GridFluidSolver3::ComputeGravity

Reimplemented from CubbyFlow::GridFluidSolver3.

◆ GetBuilder()

static Builder CubbyFlow::GridSmokeSolver3::GetBuilder ( )
static

Returns builder fox GridSmokeSolver3.

◆ GetBuoyancySmokeDensityFactor()

double CubbyFlow::GridSmokeSolver3::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::GridSmokeSolver3::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::GridSmokeSolver3::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()

ScalarGrid3Ptr CubbyFlow::GridSmokeSolver3::GetSmokeDensity ( ) const

Returns smoke density field.

◆ GetSmokeDiffusionCoefficient()

double CubbyFlow::GridSmokeSolver3::GetSmokeDiffusionCoefficient ( ) const

Returns smoke diffusion coefficient.

◆ GetTemperature()

ScalarGrid3Ptr CubbyFlow::GridSmokeSolver3::GetTemperature ( ) const

Returns temperature field.

◆ GetTemperatureDecayFactor()

double CubbyFlow::GridSmokeSolver3::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::GridSmokeSolver3::GetTemperatureDiffusionCoefficient ( ) const

Returns temperature diffusion coefficient.

◆ OnEndAdvanceTimeStep()

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

Called at the end of a time-step.

Reimplemented from CubbyFlow::GridFluidSolver3.

◆ operator=() [1/2]

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

Deleted copy assignment operator.

◆ operator=() [2/2]

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

Deleted move assignment operator.

◆ SetBuoyancySmokeDensityFactor()

void CubbyFlow::GridSmokeSolver3::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::GridSmokeSolver3::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::GridSmokeSolver3::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::GridSmokeSolver3::SetSmokeDiffusionCoefficient ( double  newValue)

Sets smoke diffusion coefficient.

◆ SetTemperatureDecayFactor()

void CubbyFlow::GridSmokeSolver3::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::GridSmokeSolver3::SetTemperatureDiffusionCoefficient ( double  newValue)

Sets temperature diffusion coefficient.


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