Loading...
Searching...
No Matches
GridSinglePhasePressureSolver3.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_SINGLE_PHASE_PRESSURE_SOLVER3_HPP
12#define CUBBYFLOW_SINGLE_PHASE_PRESSURE_SOLVER3_HPP
13
18
19namespace CubbyFlow
20{
36{
37 public:
40
43 delete;
44
47 delete;
48
51
55
59
83 void Solve(const FaceCenteredGrid3& input, double timeIntervalInSeconds,
86 ConstantScalarField3{ std::numeric_limits<double>::max() },
88 ConstantVectorField3{ { 0, 0, 0 } },
89 const ScalarField3& fluidSDF =
90 ConstantScalarField3{ -std::numeric_limits<double>::max() },
91 bool useCompressed = false) override;
92
105
108 const;
109
112
114 [[nodiscard]] const FDMVector3& GetPressure() const;
115
116 private:
117 void BuildMarkers(
118 const Vector3UZ& size,
119 const std::function<Vector3D(size_t, size_t, size_t)>& pos,
121
122 void DecompressSolution();
123
124 virtual void BuildSystem(const FaceCenteredGrid3& input,
125 bool useCompressed);
126
127 virtual void ApplyPressureGradient(const FaceCenteredGrid3& input,
129
130 FDMLinearSystem3 m_system;
131 FDMCompressedLinearSystem3 m_compSystem;
132 FDMLinearSystemSolver3Ptr m_systemSolver;
133
134 FDMMGLinearSystem3 m_mgSystem;
135 FDMMGSolver3Ptr m_mgSystemSolver;
136
137 std::vector<Array3<char>> m_markers;
138};
139
142 std::shared_ptr<GridSinglePhasePressureSolver3>;
143} // namespace CubbyFlow
144
145#endif
N-D constant scalar field.
Definition ConstantScalarField.hpp:21
N-D constant vector field.
Definition ConstantVectorField.hpp:21
N-D face-centered (a.k.a MAC or staggered) grid.
Definition FaceCenteredGrid.hpp:32
Abstract base class for 2-D grid-based pressure solver.
Definition GridPressureSolver3.hpp:30
3-D single-phase pressure solver.
Definition GridSinglePhasePressureSolver3.hpp:36
void SetLinearSystemSolver(const FDMLinearSystemSolver3Ptr &solver)
Sets the linear system solver.
const FDMLinearSystemSolver3Ptr & GetLinearSystemSolver() const
Returns the linear system solver.
GridSinglePhasePressureSolver3()
Default constructor.
GridSinglePhasePressureSolver3(const GridSinglePhasePressureSolver3 &)=delete
Deleted copy constructor.
void Solve(const FaceCenteredGrid3 &input, double timeIntervalInSeconds, FaceCenteredGrid3 *output, const ScalarField3 &boundarySDF=ConstantScalarField3{ std::numeric_limits< double >::max() }, const VectorField3 &boundaryVelocity=ConstantVectorField3{ { 0, 0, 0 } }, const ScalarField3 &fluidSDF=ConstantScalarField3{ -std::numeric_limits< double >::max() }, bool useCompressed=false) override
Solves the pressure term and apply it to the velocity field.
GridBoundaryConditionSolver3Ptr SuggestedBoundaryConditionSolver() const override
Returns the best boundary condition solver for this solver.
GridSinglePhasePressureSolver3(GridSinglePhasePressureSolver3 &&) noexcept=delete
Deleted move constructor.
const FDMVector3 & GetPressure() const
Returns the pressure field.
Definition Matrix.hpp:30
Abstract base class for N-D scalar field.
Definition ScalarField.hpp:25
Abstract base class for N-D vector field.
Definition VectorField.hpp:43
Definition pybind11Utils.hpp:21
std::shared_ptr< FDMLinearSystemSolver3 > FDMLinearSystemSolver3Ptr
Shared pointer type for the FDMLinearSystemSolver3.
Definition FDMLinearSystemSolver3.hpp:52
Vector3< double > Vector3D
Definition Matrix.hpp:787
ConstantScalarField< 3 > ConstantScalarField3
3-D ConstantScalarField type.
Definition ConstantScalarField.hpp:46
ScalarField< 3 > ScalarField3
3-D ScalarField type.
Definition ScalarField.hpp:64
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738
std::shared_ptr< FDMMGSolver3 > FDMMGSolver3Ptr
Shared pointer type for the FDMMGSolver3.
Definition FDMMGSolver3.hpp:55
std::shared_ptr< GridSinglePhasePressureSolver3 > GridSinglePhasePressureSolver3Ptr
Shared pointer type for the GridSinglePhasePressureSolver3.
Definition GridSinglePhasePressureSolver3.hpp:142
std::shared_ptr< GridBoundaryConditionSolver3 > GridBoundaryConditionSolver3Ptr
Shared pointer type for the GridBoundaryConditionSolver3.
Definition GridBoundaryConditionSolver3.hpp:117
Compressed linear system (Ax=b) for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:63
Linear system (Ax=b) for 3-D finite differencing.
Definition FDMLinearSystem3.hpp:44
Multigrid-syle 3-D linear system.
Definition FDMMGLinearSystem3.hpp:27