Jet  v1.3.3
grid_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_SINGLE_PHASE_PRESSURE_SOLVER3_H_
8 #define INCLUDE_JET_GRID_SINGLE_PHASE_PRESSURE_SOLVER3_H_
9 
12 #include <jet/fdm_mg_solver3.h>
15 
16 #include <memory>
17 
18 namespace jet {
19 
35  public:
38 
41 
63  void solve(
64  const FaceCenteredGrid3& input, double timeIntervalInSeconds,
65  FaceCenteredGrid3* output,
66  const ScalarField3& boundarySdf = ConstantScalarField3(kMaxD),
67  const VectorField3& boundaryVelocity = ConstantVectorField3({0, 0, 0}),
68  const ScalarField3& fluidSdf = ConstantScalarField3(-kMaxD),
69  bool useCompressed = false) override;
70 
82  const override;
83 
86 
89 
91  const FdmVector3& pressure() const;
92 
93  private:
94  FdmLinearSystem3 _system;
95  FdmCompressedLinearSystem3 _compSystem;
96  FdmLinearSystemSolver3Ptr _systemSolver;
97 
98  FdmMgLinearSystem3 _mgSystem;
99  FdmMgSolver3Ptr _mgSystemSolver;
100 
101  std::vector<Array3<char>> _markers;
102 
103  void buildMarkers(
104  const Size3& size,
105  const std::function<Vector3D(size_t, size_t, size_t)>& pos,
106  const ScalarField3& boundarySdf, const ScalarField3& fluidSdf);
107 
108  void decompressSolution();
109 
110  virtual void buildSystem(const FaceCenteredGrid3& input,
111  bool useCompressed);
112 
113  virtual void applyPressureGradient(const FaceCenteredGrid3& input,
114  FaceCenteredGrid3* output);
115 };
116 
118 typedef std::shared_ptr<GridSinglePhasePressureSolver3>
120 
121 } // namespace jet
122 
123 #endif // INCLUDE_JET_GRID_SINGLE_PHASE_PRESSURE_SOLVER3_H_
jet::GridSinglePhasePressureSolver3::linearSystemSolver
const FdmLinearSystemSolver3Ptr & linearSystemSolver() const
Returns the linear system solver.
jet::GridPressureSolver3
Abstract base class for 3-D grid-based pressure solver.
Definition: grid_pressure_solver3.h:29
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::GridSinglePhasePressureSolver3::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.
jet::ConstantVectorField3
3-D constant vector field.
Definition: constant_vector_field3.h:16
fdm_mg_linear_system3.h
jet::GridSinglePhasePressureSolver3Ptr
std::shared_ptr< GridSinglePhasePressureSolver3 > GridSinglePhasePressureSolver3Ptr
Shared pointer type for the GridSinglePhasePressureSolver3.
Definition: grid_single_phase_pressure_solver3.h:119
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::GridSinglePhasePressureSolver3::~GridSinglePhasePressureSolver3
virtual ~GridSinglePhasePressureSolver3()
Default destructor.
jet::GridSinglePhasePressureSolver3::pressure
const FdmVector3 & pressure() const
Returns the pressure field.
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::Size3
3-D size class.
Definition: size3.h:19
jet::GridBoundaryConditionSolver3Ptr
std::shared_ptr< GridBoundaryConditionSolver3 > GridBoundaryConditionSolver3Ptr
Shared pointer type for the GridBoundaryConditionSolver3.
Definition: grid_boundary_condition_solver3.h:104
jet::GridSinglePhasePressureSolver3::suggestedBoundaryConditionSolver
GridBoundaryConditionSolver3Ptr suggestedBoundaryConditionSolver() const override
Returns the best boundary condition solver for this solver.
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
fdm_linear_system_solver3.h
jet::GridSinglePhasePressureSolver3
3-D single-phase pressure solver.
Definition: grid_single_phase_pressure_solver3.h:34
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
jet::GridSinglePhasePressureSolver3::GridSinglePhasePressureSolver3
GridSinglePhasePressureSolver3()
Default constructor.
jet::GridSinglePhasePressureSolver3::setLinearSystemSolver
void setLinearSystemSolver(const FdmLinearSystemSolver3Ptr &solver)
Sets the linear system solver.