Jet  v1.3.3
grid_fractional_single_phase_pressure_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_FRACTIONAL_SINGLE_PHASE_PRESSURE_SOLVER2_H_
8 #define INCLUDE_JET_GRID_FRACTIONAL_SINGLE_PHASE_PRESSURE_SOLVER2_H_
9 
13 #include <jet/fdm_mg_solver2.h>
17 
18 #include <memory>
19 
20 namespace jet {
21 
47  : public GridPressureSolver2 {
48  public:
51 
54 
76  void solve(const FaceCenteredGrid2& input, double timeIntervalInSeconds,
77  FaceCenteredGrid2* output,
78  const ScalarField2& boundarySdf = ConstantScalarField2(kMaxD),
79  const VectorField2& boundaryVelocity = ConstantVectorField2({0,
80  0}),
81  const ScalarField2& fluidSdf = ConstantScalarField2(-kMaxD),
82  bool useCompressed = false) override;
83 
94  const override;
95 
98 
101 
103  const FdmVector2& pressure() const;
104 
105  private:
106  FdmLinearSystem2 _system;
107  FdmCompressedLinearSystem2 _compSystem;
108  FdmLinearSystemSolver2Ptr _systemSolver;
109 
110  FdmMgLinearSystem2 _mgSystem;
111  FdmMgSolver2Ptr _mgSystemSolver;
112 
113  std::vector<Array2<float>> _uWeights;
114  std::vector<Array2<float>> _vWeights;
115  std::vector<Array2<float>> _fluidSdf;
116 
117  std::function<Vector2D(const Vector2D&)> _boundaryVel;
118 
119  void buildWeights(const FaceCenteredGrid2& input,
120  const ScalarField2& boundarySdf,
121  const VectorField2& boundaryVelocity,
122  const ScalarField2& fluidSdf);
123 
124  void decompressSolution();
125 
126  virtual void buildSystem(const FaceCenteredGrid2& input,
127  bool useCompressed);
128 
129  virtual void applyPressureGradient(const FaceCenteredGrid2& input,
130  FaceCenteredGrid2* output);
131 };
132 
134 typedef std::shared_ptr<GridFractionalSinglePhasePressureSolver2>
136 
137 } // namespace jet
138 
139 #endif // INCLUDE_JET_GRID_FRACTIONAL_SINGLE_PHASE_PRESSURE_SOLVER2_H_
grid_pressure_solver2.h
jet::FdmMgLinearSystem2
Multigrid-syle 2-D linear system.
Definition: fdm_mg_linear_system2.h:23
jet::GridFractionalSinglePhasePressureSolver2::linearSystemSolver
const FdmLinearSystemSolver2Ptr & linearSystemSolver() const
Returns the linear system solver.
jet::FdmCompressedLinearSystem2
Compressed linear system (Ax=b) for 2-D finite differencing.
Definition: fdm_linear_system2.h:54
jet::FdmLinearSystem2
Linear system (Ax=b) for 2-D finite differencing.
Definition: fdm_linear_system2.h:36
jet::FdmLinearSystemSolver2Ptr
std::shared_ptr< FdmLinearSystemSolver2 > FdmLinearSystemSolver2Ptr
Shared pointer type for the FdmLinearSystemSolver2.
Definition: fdm_linear_system_solver2.h:31
jet::Vector2D
Vector2< double > Vector2D
Double-type 2D vector.
Definition: vector2.h:340
fdm_mg_linear_system2.h
fdm_mg_solver2.h
jet::GridFractionalSinglePhasePressureSolver2::~GridFractionalSinglePhasePressureSolver2
virtual ~GridFractionalSinglePhasePressureSolver2()
Default destructor.
jet::ScalarField2
Abstract base class for 2-D scalar field.
Definition: scalar_field2.h:18
grid_boundary_condition_solver2.h
jet::GridFractionalSinglePhasePressureSolver2::suggestedBoundaryConditionSolver
GridBoundaryConditionSolver2Ptr suggestedBoundaryConditionSolver() const override
Returns the best boundary condition solver for this solver.
jet::FaceCenteredGrid2
2-D face-centered (a.k.a MAC or staggered) grid.
Definition: face_centered_grid2.h:26
jet::Array< T, 2 >
2-D array class.
Definition: array2.h:42
jet
Definition: advection_solver2.h:18
jet::GridFractionalSinglePhasePressureSolver2::setLinearSystemSolver
void setLinearSystemSolver(const FdmLinearSystemSolver2Ptr &solver)
Sets the linear system solver.
jet::ConstantScalarField2
2-D constant scalar field.
Definition: constant_scalar_field2.h:15
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::GridPressureSolver2
Abstract base class for 2-D grid-based pressure solver.
Definition: grid_pressure_solver2.h:29
jet::GridFractionalSinglePhasePressureSolver2::pressure
const FdmVector2 & pressure() const
Returns the pressure field.
cell_centered_scalar_grid2.h
jet::kMaxD
constexpr double kMaxD
Max double.
Definition: constants.h:88
jet::GridFractionalSinglePhasePressureSolver2::GridFractionalSinglePhasePressureSolver2
GridFractionalSinglePhasePressureSolver2()
Default constructor.
jet::GridFractionalSinglePhasePressureSolver2::solve
void solve(const FaceCenteredGrid2 &input, double timeIntervalInSeconds, FaceCenteredGrid2 *output, const ScalarField2 &boundarySdf=ConstantScalarField2(kMaxD), const VectorField2 &boundaryVelocity=ConstantVectorField2({0, 0}), const ScalarField2 &fluidSdf=ConstantScalarField2(-kMaxD), bool useCompressed=false) override
Solves the pressure term and apply it to the velocity field.
jet::GridBoundaryConditionSolver2Ptr
std::shared_ptr< GridBoundaryConditionSolver2 > GridBoundaryConditionSolver2Ptr
Shared pointer type for the GridBoundaryConditionSolver2.
Definition: grid_boundary_condition_solver2.h:104
vertex_centered_scalar_grid2.h
jet::VectorField2
Abstract base class for 2-D vector field.
Definition: vector_field2.h:18
fdm_linear_system_solver2.h
jet::GridFractionalSinglePhasePressureSolver2
2-D fractional single-phase pressure solver.
Definition: grid_fractional_single_phase_pressure_solver2.h:47
jet::FdmMgSolver2Ptr
std::shared_ptr< FdmMgSolver2 > FdmMgSolver2Ptr
Shared pointer type for the FdmMgSolver2.
Definition: fdm_mg_solver2.h:54
jet::GridFractionalSinglePhasePressureSolver2Ptr
std::shared_ptr< GridFractionalSinglePhasePressureSolver2 > GridFractionalSinglePhasePressureSolver2Ptr
Shared pointer type for the GridFractionalSinglePhasePressureSolver2.
Definition: grid_fractional_single_phase_pressure_solver2.h:135
jet::ConstantVectorField2
2-D constant vector field.
Definition: constant_vector_field2.h:16