2-D grid-based smoke solver. More...
#include <Core/Solver/Grid/GridSmokeSolver2.hpp>
Classes | |
class | Builder |
Front-end to create GridSmokeSolver2 objects step by step. More... | |
Public Member Functions | |
GridSmokeSolver2 () | |
Default constructor. More... | |
GridSmokeSolver2 (const Vector2UZ &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin) | |
Constructs solver with initial grid size. More... | |
GridSmokeSolver2 (const GridSmokeSolver2 &)=delete | |
Deleted copy constructor. More... | |
GridSmokeSolver2 (GridSmokeSolver2 &&) noexcept=delete | |
Deleted move constructor. More... | |
~GridSmokeSolver2 () override=default | |
Default virtual destructor. More... | |
GridSmokeSolver2 & | operator= (const GridSmokeSolver2 &)=delete |
Deleted copy assignment operator. More... | |
GridSmokeSolver2 & | operator= (GridSmokeSolver2 &&) 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... | |
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 Vector2UZ &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin) | |
Constructs solver with initial grid size. More... | |
GridFluidSolver2 (const GridFluidSolver2 &)=delete | |
Deleted copy constructor. More... | |
GridFluidSolver2 (GridFluidSolver2 &&) noexcept=delete | |
Deleted move constructor. More... | |
~GridFluidSolver2 () override=default | |
Default virtual destructor. More... | |
GridFluidSolver2 & | operator= (const GridFluidSolver2 &)=delete |
Deleted copy assignment operator. More... | |
GridFluidSolver2 & | operator= (GridFluidSolver2 &&) noexcept=delete |
Deleted move assignment operator. More... | |
const Vector2D & | GetGravity () 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 isOn) |
Sets whether the solver should use compressed linear system. More... | |
const AdvectionSolver2Ptr & | GetAdvectionSolver () const |
Returns the advection solver instance. More... | |
void | SetAdvectionSolver (const AdvectionSolver2Ptr &newSolver) |
Sets the advection solver. More... | |
const GridDiffusionSolver2Ptr & | GetDiffusionSolver () const |
Returns the diffusion solver instance. More... | |
void | SetDiffusionSolver (const GridDiffusionSolver2Ptr &newSolver) |
Sets the diffusion solver. More... | |
const GridPressureSolver2Ptr & | GetPressureSolver () 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 GridSystemData2Ptr & | GetGridSystemData () const |
Returns the grid system data. More... | |
void | ResizeGrid (const Vector2UZ &newSize, const Vector2D &newGridSpacing, const Vector2D &newGridOrigin) const |
Resizes grid system data. More... | |
Vector2UZ | 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 FaceCenteredGrid2Ptr & | GetVelocity () const |
Returns the velocity field. More... | |
const Collider2Ptr & | GetCollider () const |
Returns the collider. More... | |
void | SetCollider (const Collider2Ptr &newCollider) |
Sets the collider. More... | |
const GridEmitter2Ptr & | GetEmitter () 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... | |
PhysicsAnimation (const PhysicsAnimation &)=default | |
Default copy constructor. More... | |
PhysicsAnimation (PhysicsAnimation &&) noexcept=default | |
Default move constructor. More... | |
virtual | ~PhysicsAnimation ()=default |
Default virtual destructor. More... | |
PhysicsAnimation & | operator= (const PhysicsAnimation &)=default |
Default copy assignment operator. More... | |
PhysicsAnimation & | operator= (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... | |
Animation & | operator= (const Animation &)=default |
Default copy assignment operator. More... | |
Animation & | operator= (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 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/4]
CubbyFlow::GridSmokeSolver2::GridSmokeSolver2 | ( | ) |
Default constructor.
◆ GridSmokeSolver2() [2/4]
CubbyFlow::GridSmokeSolver2::GridSmokeSolver2 | ( | const Vector2UZ & | resolution, |
const Vector2D & | gridSpacing, | ||
const Vector2D & | gridOrigin | ||
) |
Constructs solver with initial grid size.
◆ GridSmokeSolver2() [3/4]
|
delete |
Deleted copy constructor.
◆ GridSmokeSolver2() [4/4]
|
deletenoexcept |
Deleted move constructor.
◆ ~GridSmokeSolver2()
|
overridedefault |
Default virtual destructor.
Member Function Documentation
◆ ComputeExternalForces()
|
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 |
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()
|
overrideprotectedvirtual |
Called at the end of a time-step.
Reimplemented from CubbyFlow::GridFluidSolver2.
◆ operator=() [1/2]
|
delete |
Deleted copy assignment operator.
◆ operator=() [2/2]
|
deletenoexcept |
Deleted move assignment operator.
◆ 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
-
newValue The 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
-
newValue The 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] newValue The 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] newValue The 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:
- Core/Solver/Grid/GridSmokeSolver2.hpp