Jet  v1.3.3
grid_smoke_solver2.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_GRID_SMOKE_SOLVER2_H_
8 #define INCLUDE_JET_GRID_SMOKE_SOLVER2_H_
9 
10 #include <jet/grid_fluid_solver2.h>
11 
12 namespace jet {
13 
26  public:
27  class Builder;
28 
31 
34  const Size2& resolution,
35  const Vector2D& gridSpacing,
36  const Vector2D& gridOrigin);
37 
39  virtual ~GridSmokeSolver2();
40 
42  double smokeDiffusionCoefficient() const;
43 
45  void setSmokeDiffusionCoefficient(double newValue);
46 
49 
51  void setTemperatureDiffusionCoefficient(double newValue);
52 
67 
81  void setBuoyancySmokeDensityFactor(double newValue);
82 
96  double buoyancyTemperatureFactor() const;
97 
111  void setBuoyancyTemperatureFactor(double newValue);
112 
121  double smokeDecayFactor() const;
122 
131  void setSmokeDecayFactor(double newValue);
132 
142 
151  void setTemperatureDecayFactor(double newValue);
152 
155 
158 
160  static Builder builder();
161 
162  protected:
163  void onEndAdvanceTimeStep(double timeIntervalInSeconds) override;
164 
165  void computeExternalForces(double timeIntervalInSeconds) override;
166 
167  private:
168  size_t _smokeDensityDataId;
169  size_t _temperatureDataId;
170  double _smokeDiffusionCoefficient = 0.0;
171  double _temperatureDiffusionCoefficient = 0.0;
172  double _buoyancySmokeDensityFactor = -0.000625;
173  double _buoyancyTemperatureFactor = 5.0;
174  double _smokeDecayFactor = 0.001;
175  double _temperatureDecayFactor = 0.001;
176 
177  void computeDiffusion(double timeIntervalInSeconds);
178 
179  void computeBuoyancyForce(double timeIntervalInSeconds);
180 };
181 
183 typedef std::shared_ptr<GridSmokeSolver2> GridSmokeSolver2Ptr;
184 
185 
190  : public GridFluidSolverBuilderBase2<GridSmokeSolver2::Builder> {
191  public:
194 
197 };
198 
199 } // namespace jet
200 
201 #endif // INCLUDE_JET_GRID_SMOKE_SOLVER2_H_
jet::GridSmokeSolver2::setSmokeDecayFactor
void setSmokeDecayFactor(double newValue)
Sets the smoke decay factor.
jet::GridFluidSolver2::gridSpacing
Vector2D gridSpacing() const
Returns the grid spacing of the grid system data.
jet::GridSmokeSolver2::temperatureDiffusionCoefficient
double temperatureDiffusionCoefficient() const
Returns temperature diffusion coefficient.
jet::GridSmokeSolver2::smokeDecayFactor
double smokeDecayFactor() const
Returns smoke decay factor.
jet::GridFluidSolver2::gridOrigin
Vector2D gridOrigin() const
Returns the origin of the grid system data.
grid_fluid_solver2.h
jet::GridSmokeSolver2::~GridSmokeSolver2
virtual ~GridSmokeSolver2()
Destructor.
jet::GridFluidSolver2
Abstract base class for grid-based 2-D fluid solver.
Definition: grid_fluid_solver2.h:34
jet::GridSmokeSolver2::temperature
ScalarGrid2Ptr temperature() const
Returns temperature field.
jet::GridSmokeSolver2::setSmokeDiffusionCoefficient
void setSmokeDiffusionCoefficient(double newValue)
Sets smoke diffusion coefficient.
jet::GridSmokeSolver2::buoyancySmokeDensityFactor
double buoyancySmokeDensityFactor() const
Returns the buoyancy factor which will be multiplied to the smoke density.
jet
Definition: advection_solver2.h:18
jet::GridSmokeSolver2::smokeDiffusionCoefficient
double smokeDiffusionCoefficient() const
Returns smoke diffusion coefficient.
jet::GridSmokeSolver2Ptr
std::shared_ptr< GridSmokeSolver2 > GridSmokeSolver2Ptr
Shared pointer type for the GridSmokeSolver2.
Definition: grid_smoke_solver2.h:183
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::GridSmokeSolver2::setBuoyancySmokeDensityFactor
void setBuoyancySmokeDensityFactor(double newValue)
Sets the buoyancy factor which will be multiplied to the smoke density.
jet::GridSmokeSolver2::Builder::makeShared
GridSmokeSolver2Ptr makeShared() const
Builds shared pointer of GridSmokeSolver2 instance.
jet::ScalarGrid2Ptr
std::shared_ptr< ScalarGrid2 > ScalarGrid2Ptr
Shared pointer for the ScalarGrid2 type.
Definition: scalar_grid2.h:188
jet::Size2
2-D size class.
Definition: size2.h:19
jet::GridSmokeSolver2::smokeDensity
ScalarGrid2Ptr smokeDensity() const
Returns smoke density field.
jet::GridSmokeSolver2::buoyancyTemperatureFactor
double buoyancyTemperatureFactor() const
Returns the buoyancy factor which will be multiplied to the temperature.
jet::GridSmokeSolver2::computeExternalForces
void computeExternalForces(double timeIntervalInSeconds) override
Computes the external force terms.
jet::GridSmokeSolver2
2-D grid-based smoke solver.
Definition: grid_smoke_solver2.h:25
jet::GridSmokeSolver2::onEndAdvanceTimeStep
void onEndAdvanceTimeStep(double timeIntervalInSeconds) override
Called at the end of a time-step.
jet::GridSmokeSolver2::setTemperatureDecayFactor
void setTemperatureDecayFactor(double newValue)
Sets the temperature decay factor.
jet::GridSmokeSolver2::Builder
Front-end to create GridSmokeSolver2 objects step by step.
Definition: grid_smoke_solver2.h:190
jet::GridSmokeSolver2::builder
static Builder builder()
Returns builder fox GridSmokeSolver2.
jet::GridSmokeSolver2::GridSmokeSolver2
GridSmokeSolver2(const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin)
Constructs solver with initial grid size.
jet::GridSmokeSolver2::GridSmokeSolver2
GridSmokeSolver2()
Default constructor.
jet::GridSmokeSolver2::Builder::build
GridSmokeSolver2 build() const
Builds GridSmokeSolver2.
jet::GridSmokeSolver2::setBuoyancyTemperatureFactor
void setBuoyancyTemperatureFactor(double newValue)
Sets the buoyancy factor which will be multiplied to the temperature.
jet::GridFluidSolver2::resolution
Size2 resolution() const
Returns the resolution of the grid system data.
jet::GridFluidSolverBuilderBase2
Base class for grid-based fluid solver builder.
Definition: grid_fluid_solver2.h:300
jet::GridSmokeSolver2::smokeTemperatureDecayFactor
double smokeTemperatureDecayFactor() const
Returns temperature decay factor.
jet::GridSmokeSolver2::setTemperatureDiffusionCoefficient
void setTemperatureDiffusionCoefficient(double newValue)
Sets temperature diffusion coefficient.