Jet  v1.3.3
grid_fractional_single_phase_pressure_solver3.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_SOLVER3_H_
8 #define INCLUDE_JET_GRID_FRACTIONAL_SINGLE_PHASE_PRESSURE_SOLVER3_H_
9 
13 #include <jet/fdm_mg_solver3.h>
17 
18 #include <memory>
19 
20 namespace jet {
21 
47  public:
49 
51 
73  void solve(
74  const FaceCenteredGrid3& input, double timeIntervalInSeconds,
75  FaceCenteredGrid3* output,
76  const ScalarField3& boundarySdf = ConstantScalarField3(kMaxD),
77  const VectorField3& boundaryVelocity = ConstantVectorField3({0, 0, 0}),
78  const ScalarField3& fluidSdf = ConstantScalarField3(-kMaxD),
79  bool useCompressed = false) override;
80 
91  const override;
92 
95 
98 
100  const FdmVector3& pressure() const;
101 
102  private:
103  FdmLinearSystem3 _system;
104  FdmCompressedLinearSystem3 _compSystem;
105  FdmLinearSystemSolver3Ptr _systemSolver;
106 
107  FdmMgLinearSystem3 _mgSystem;
108  FdmMgSolver3Ptr _mgSystemSolver;
109 
110  std::vector<Array3<float>> _uWeights;
111  std::vector<Array3<float>> _vWeights;
112  std::vector<Array3<float>> _wWeights;
113  std::vector<Array3<float>> _fluidSdf;
114 
115  std::function<Vector3D(const Vector3D&)> _boundaryVel;
116 
117  void buildWeights(const FaceCenteredGrid3& input,
118  const ScalarField3& boundarySdf,
119  const VectorField3& boundaryVelocity,
120  const ScalarField3& fluidSdf);
121 
122  void decompressSolution();
123 
124  virtual void buildSystem(const FaceCenteredGrid3& input,
125  bool useCompressed);
126 
127  virtual void applyPressureGradient(const FaceCenteredGrid3& input,
128  FaceCenteredGrid3* output);
129 };
130 
132 typedef std::shared_ptr<GridFractionalSinglePhasePressureSolver3>
134 
135 } // namespace jet
136 
137 #endif // INCLUDE_JET_GRID_FRACTIONAL_SINGLE_PHASE_PRESSURE_SOLVER3_H_
jet::GridPressureSolver3
Abstract base class for 3-D grid-based pressure solver.
Definition: grid_pressure_solver3.h:29
jet::GridFractionalSinglePhasePressureSolver3Ptr
std::shared_ptr< GridFractionalSinglePhasePressureSolver3 > GridFractionalSinglePhasePressureSolver3Ptr
Shared pointer type for the GridFractionalSinglePhasePressureSolver3.
Definition: grid_fractional_single_phase_pressure_solver3.h:133
jet::ScalarField3
Abstract base class for 3-D scalar field.
Definition: scalar_field3.h:18
jet::FdmMgLinearSystem3
Multigrid-syle 3-D linear system.
Definition: fdm_mg_linear_system3.h:23
jet::GridFractionalSinglePhasePressureSolver3::setLinearSystemSolver
void setLinearSystemSolver(const FdmLinearSystemSolver3Ptr &solver)
Sets the linear system solver.
jet::ConstantVectorField3
3-D constant vector field.
Definition: constant_vector_field3.h:16
fdm_mg_linear_system3.h
cell_centered_scalar_grid3.h
grid_boundary_condition_solver3.h
jet
Definition: advection_solver2.h:18
fdm_mg_solver3.h
jet::VectorField3
Abstract base class for 3-D vector field.
Definition: vector_field3.h:18
jet::FdmCompressedLinearSystem3
Compressed linear system (Ax=b) for 3-D finite differencing.
Definition: fdm_linear_system3.h:57
jet::FaceCenteredGrid3
3-D face-centered (a.k.a MAC or staggered) grid.
Definition: face_centered_grid3.h:26
jet::ConstantScalarField3
3-D constant scalar field.
Definition: constant_scalar_field3.h:15
jet::FdmMgSolver3Ptr
std::shared_ptr< FdmMgSolver3 > FdmMgSolver3Ptr
Shared pointer type for the FdmMgSolver3.
Definition: fdm_mg_solver3.h:54
jet::GridBoundaryConditionSolver3Ptr
std::shared_ptr< GridBoundaryConditionSolver3 > GridBoundaryConditionSolver3Ptr
Shared pointer type for the GridBoundaryConditionSolver3.
Definition: grid_boundary_condition_solver3.h:104
jet::kMaxD
constexpr double kMaxD
Max double.
Definition: constants.h:88
jet::FdmLinearSystem3
Linear system (Ax=b) for 3-D finite differencing.
Definition: fdm_linear_system3.h:39
grid_pressure_solver3.h
jet::Vector3D
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
jet::GridFractionalSinglePhasePressureSolver3::GridFractionalSinglePhasePressureSolver3
GridFractionalSinglePhasePressureSolver3()
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::GridFractionalSinglePhasePressureSolver3::linearSystemSolver
const FdmLinearSystemSolver3Ptr & linearSystemSolver() const
Returns the linear system solver.
jet::GridFractionalSinglePhasePressureSolver3::pressure
const FdmVector3 & pressure() const
Returns the pressure field.
jet::GridFractionalSinglePhasePressureSolver3::solve
void solve(const FaceCenteredGrid3 &input, double timeIntervalInSeconds, FaceCenteredGrid3 *output, const ScalarField3 &boundarySdf=ConstantScalarField3(kMaxD), const VectorField3 &boundaryVelocity=ConstantVectorField3({0, 0, 0}), const ScalarField3 &fluidSdf=ConstantScalarField3(-kMaxD), bool useCompressed=false) override
Solves the pressure term and apply it to the velocity field.
fdm_linear_system_solver3.h
jet::GridFractionalSinglePhasePressureSolver3::suggestedBoundaryConditionSolver
GridBoundaryConditionSolver3Ptr suggestedBoundaryConditionSolver() const override
Returns the best boundary condition solver for this solver.
jet::Array< T, 3 >
3-D array class.
Definition: array3.h:43
jet::FdmLinearSystemSolver3Ptr
std::shared_ptr< FdmLinearSystemSolver3 > FdmLinearSystemSolver3Ptr
Shared pointer type for the FdmLinearSystemSolver3.
Definition: fdm_linear_system_solver3.h:31
vertex_centered_scalar_grid3.h
jet::GridFractionalSinglePhasePressureSolver3
3-D fractional single-phase pressure solver.
Definition: grid_fractional_single_phase_pressure_solver3.h:46
jet::GridFractionalSinglePhasePressureSolver3::~GridFractionalSinglePhasePressureSolver3
virtual ~GridFractionalSinglePhasePressureSolver3()