Jet  v1.3.3
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
jet::GridSmokeSolver2 Class Reference

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

#include <jet/grid_smoke_solver2.h>

Inheritance diagram for jet::GridSmokeSolver2:
jet::GridFluidSolver2 jet::PhysicsAnimation jet::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 smokeDiffusionCoefficient () const
 Returns smoke diffusion coefficient. More...
 
void setSmokeDiffusionCoefficient (double newValue)
 Sets smoke diffusion coefficient. More...
 
double temperatureDiffusionCoefficient () const
 Returns temperature diffusion coefficient. More...
 
void setTemperatureDiffusionCoefficient (double newValue)
 Sets temperature diffusion coefficient. More...
 
double buoyancySmokeDensityFactor () 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 buoyancyTemperatureFactor () 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 smokeDecayFactor () const
 Returns smoke decay factor. More...
 
void setSmokeDecayFactor (double newValue)
 Sets the smoke decay factor. More...
 
double smokeTemperatureDecayFactor () const
 Returns temperature decay factor. More...
 
void setTemperatureDecayFactor (double newValue)
 Sets the temperature decay factor. More...
 
ScalarGrid2Ptr smokeDensity () const
 Returns smoke density field. More...
 
ScalarGrid2Ptr temperature () const
 Returns temperature field. More...
 
- Public Member Functions inherited from jet::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 Vector2Dgravity () const
 Returns the gravity vector of the system. More...
 
void setGravity (const Vector2D &newGravity)
 Sets the gravity of the system. More...
 
double viscosityCoefficient () const
 Returns the viscosity coefficient. More...
 
void setViscosityCoefficient (double newValue)
 Sets the viscosity coefficient. More...
 
double cfl (double timeIntervalInSeconds) const
 Returns the CFL number from the current velocity field for given time interval. More...
 
double maxCfl () const
 Returns the max allowed CFL number. More...
 
void setMaxCfl (double newCfl)
 Sets the max allowed CFL number. More...
 
bool useCompressedLinearSystem () 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 AdvectionSolver2PtradvectionSolver () const
 Returns the advection solver instance. More...
 
void setAdvectionSolver (const AdvectionSolver2Ptr &newSolver)
 Sets the advection solver. More...
 
const GridDiffusionSolver2PtrdiffusionSolver () const
 Returns the diffusion solver instance. More...
 
void setDiffusionSolver (const GridDiffusionSolver2Ptr &newSolver)
 Sets the diffusion solver. More...
 
const GridPressureSolver2PtrpressureSolver () const
 Returns the pressure solver instance. More...
 
void setPressureSolver (const GridPressureSolver2Ptr &newSolver)
 Sets the pressure solver. More...
 
int closedDomainBoundaryFlag () const
 Returns the closed domain boundary flag. More...
 
void setClosedDomainBoundaryFlag (int flag)
 Sets the closed domain boundary flag. More...
 
const GridSystemData2PtrgridSystemData () const
 Returns the grid system data. More...
 
void resizeGrid (const Size2 &newSize, const Vector2D &newGridSpacing, const Vector2D &newGridOrigin)
 Resizes grid system data. More...
 
Size2 resolution () const
 Returns the resolution of the grid system data. More...
 
Vector2D gridSpacing () const
 Returns the grid spacing of the grid system data. More...
 
Vector2D gridOrigin () const
 Returns the origin of the grid system data. More...
 
const FaceCenteredGrid2Ptrvelocity () const
 Returns the velocity field. More...
 
const Collider2Ptrcollider () const
 Returns the collider. More...
 
void setCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const GridEmitter2Ptremitter () const
 Returns the emitter. More...
 
void setEmitter (const GridEmitter2Ptr &newEmitter)
 Sets the emitter. More...
 
- Public Member Functions inherited from jet::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
virtual ~PhysicsAnimation ()
 Destructor. More...
 
bool isUsingFixedSubTimeSteps () 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 numberOfFixedSubTimeSteps () 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 currentFrame () const
 Returns current frame. More...
 
void setCurrentFrame (const Frame &frame)
 Sets current frame cursor (but do not invoke update()). More...
 
double currentTimeInSeconds () const
 Returns current time in seconds. More...
 
- Public Member Functions inherited from jet::Animation
 Animation ()
 
virtual ~Animation ()
 
void update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

static Builder builder ()
 Returns builder fox GridSmokeSolver2. More...
 
- Static Public Member Functions inherited from jet::GridFluidSolver2
static Builder builder ()
 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 jet::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 numberOfSubTimeSteps (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 fluidSdf () const
 
void computeGravity (double timeIntervalInSeconds)
 Computes the gravity term. More...
 
void applyBoundaryCondition ()
 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 colliderSdf () const
 Returns the signed-distance field representation of the collider. More...
 
VectorField2Ptr colliderVelocityField () 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]

jet::GridSmokeSolver2::GridSmokeSolver2 ( )

Default constructor.

◆ GridSmokeSolver2() [2/2]

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

Constructs solver with initial grid size.

◆ ~GridSmokeSolver2()

virtual jet::GridSmokeSolver2::~GridSmokeSolver2 ( )
virtual

Destructor.

Member Function Documentation

◆ builder()

static Builder jet::GridSmokeSolver2::builder ( )
static

Returns builder fox GridSmokeSolver2.

◆ buoyancySmokeDensityFactor()

double jet::GridSmokeSolver2::buoyancySmokeDensityFactor ( ) 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 buoyance factor for the smoke density.

◆ buoyancyTemperatureFactor()

double jet::GridSmokeSolver2::buoyancyTemperatureFactor ( ) 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 buoyance factor for the temperature.

◆ computeExternalForces()

void jet::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 jet::GridFluidSolver2.

◆ onEndAdvanceTimeStep()

void jet::GridSmokeSolver2::onEndAdvanceTimeStep ( double  timeIntervalInSeconds)
overrideprotectedvirtual

Called at the end of a time-step.

Reimplemented from jet::GridFluidSolver2.

◆ setBuoyancySmokeDensityFactor()

void jet::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 jet::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 jet::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 jet::GridSmokeSolver2::setSmokeDiffusionCoefficient ( double  newValue)

Sets smoke diffusion coefficient.

◆ setTemperatureDecayFactor()

void jet::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 jet::GridSmokeSolver2::setTemperatureDiffusionCoefficient ( double  newValue)

Sets temperature diffusion coefficient.

◆ smokeDecayFactor()

double jet::GridSmokeSolver2::smokeDecayFactor ( ) 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.

◆ smokeDensity()

ScalarGrid2Ptr jet::GridSmokeSolver2::smokeDensity ( ) const

Returns smoke density field.

◆ smokeDiffusionCoefficient()

double jet::GridSmokeSolver2::smokeDiffusionCoefficient ( ) const

Returns smoke diffusion coefficient.

◆ smokeTemperatureDecayFactor()

double jet::GridSmokeSolver2::smokeTemperatureDecayFactor ( ) 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.

◆ temperature()

ScalarGrid2Ptr jet::GridSmokeSolver2::temperature ( ) const

Returns temperature field.

◆ temperatureDiffusionCoefficient()

double jet::GridSmokeSolver2::temperatureDiffusionCoefficient ( ) const

Returns temperature diffusion coefficient.


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