GridSmokeSolver3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: GridSmokeSolver3.h
3 > Project Name: CubbyFlow
4 > Author: Dongmin Kim
5 > Purpose: 3-D grid-based smoke solver.
6 > Created Time: 2017/08/18
7 > Copyright (c) 2018, Dongmin Kim
8 *************************************************************************/
9 #ifndef CUBBYFLOW_GRID_SMOKE_SOLVER3_H
10 #define CUBBYFLOW_GRID_SMOKE_SOLVER3_H
11 
13 
14 namespace CubbyFlow
15 {
28  {
29  public:
30  class Builder;
31 
34 
37  const Size3& resolution,
38  const Vector3D& gridSpacing,
39  const Vector3D& gridOrigin);
40 
42  virtual ~GridSmokeSolver3();
43 
45  double GetSmokeDiffusionCoefficient() const;
46 
48  void SetSmokeDiffusionCoefficient(double newValue);
49 
52 
54  void SetTemperatureDiffusionCoefficient(double newValue);
55 
69  double GetBuoyancySmokeDensityFactor() const;
70 
84  void SetBuoyancySmokeDensityFactor(double newValue);
85 
99  double GetBuoyancyTemperatureFactor() const;
100 
114  void SetBuoyancyTemperatureFactor(double newValue);
115 
124  double GetSmokeDecayFactor() const;
125 
134  void SetSmokeDecayFactor(double newValue);
135 
144  double GetTemperatureDecayFactor() const;
145 
154  void SetTemperatureDecayFactor(double newValue);
155 
158 
161 
163  static Builder GetBuilder();
164 
165  protected:
166  void OnEndAdvanceTimeStep(double timeIntervalInSeconds) override;
167 
168  void ComputeExternalForces(double timeIntervalInSeconds) override;
169 
170  private:
171  size_t m_smokeDensityDataID = 0;
172  size_t m_temperatureDataID = 0;
173  double m_smokeDiffusionCoefficient = 0.0;
174  double m_temperatureDiffusionCoefficient = 0.0;
175  double m_buoyancySmokeDensityFactor = -0.000625;
176  double m_buoyancyTemperatureFactor = 5.0;
177  double m_smokeDecayFactor = 0.001;
178  double m_temperatureDecayFactor = 0.001;
179 
180  void ComputeDiffusion(double timeIntervalInSeconds);
181 
182  void ComputeBuoyancyForce(double timeIntervalInSeconds);
183  };
184 
186  using GridSmokeSolver3Ptr = std::shared_ptr<GridSmokeSolver3>;
187 
191  class GridSmokeSolver3::Builder final : public GridFluidSolverBuilderBase3<GridSmokeSolver3::Builder>
192  {
193  public:
195  GridSmokeSolver3 Build() const;
196 
199  };
200 }
201 
202 #endif
Front-end to create GridSmokeSolver3 objects step by step.
Definition: GridSmokeSolver3.h:191
double GetTemperatureDiffusionCoefficient() const
Returns temperature diffusion coefficient.
3-D vector class.
Definition: Vector3.h:26
double GetBuoyancySmokeDensityFactor() const
Returns the buoyancy factor which will be multiplied to the smoke density.
static Builder GetBuilder()
Returns builder fox GridSmokeSolver3.
double GetBuoyancyTemperatureFactor() const
Returns the buoyancy factor which will be multiplied to the temperature.
double GetSmokeDecayFactor() const
Returns smoke decay factor.
std::shared_ptr< GridSmokeSolver3 > GridSmokeSolver3Ptr
Shared pointer type for the GridSmokeSolver3.
Definition: GridSmokeSolver3.h:186
virtual ~GridSmokeSolver3()
Destructor.
3-D grid-based smoke solver.
Definition: GridSmokeSolver3.h:27
void ComputeExternalForces(double timeIntervalInSeconds) override
Computes the external force terms.
void SetTemperatureDecayFactor(double newValue)
Sets the temperature decay factor.
3-D point class.
Definition: Point3.h:26
std::shared_ptr< ScalarGrid3 > ScalarGrid3Ptr
Shared pointer for the ScalarGrid3 type.
Definition: ScalarGrid3.h:179
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver3.h:303
ScalarGrid3Ptr GetTemperature() const
Returns temperature field.
Definition: pybind11Utils.h:24
Abstract base class for grid-based 3-D fluid solver.
Definition: GridFluidSolver3.h:33
void OnEndAdvanceTimeStep(double timeIntervalInSeconds) override
Called at the end of a time-step.
double GetSmokeDiffusionCoefficient() const
Returns smoke diffusion coefficient.
ScalarGrid3Ptr GetSmokeDensity() const
Returns smoke density field.
GridSmokeSolver3Ptr MakeShared() const
Builds shared pointer of GridSmokeSolver3 instance.
void SetTemperatureDiffusionCoefficient(double newValue)
Sets temperature diffusion coefficient.
GridSmokeSolver3()
Default constructor.
GridSmokeSolver3 Build() const
Builds GridSmokeSolver3.
double GetTemperatureDecayFactor() const
Returns temperature decay factor.
void SetBuoyancySmokeDensityFactor(double newValue)
Sets the buoyancy factor which will be multiplied to the smoke density.
void SetSmokeDecayFactor(double newValue)
Sets the smoke decay factor.
void SetSmokeDiffusionCoefficient(double newValue)
Sets smoke diffusion coefficient.
void SetBuoyancyTemperatureFactor(double newValue)
Sets the buoyancy factor which will be multiplied to the temperature.