PeriDyno 1.0.0
Loading...
Searching...
No Matches
DivergenceFreeSphSolver.h
Go to the documentation of this file.
1
2#pragma once
5namespace dyno {
6
7 template<typename TDataType> class SummationDensity;
8
9 /*
10 *
11 * @brief This is the GPU implementation of the DFSPH (Divergence Free SPH) method based on Peridyno.
12 * For details, refer to "Divergence-Free SPH for Incompressible and Viscous Fluids" by Bender and Koschier, IEEE TVCG, 2016.
13 * The code was written by Shusen Liu (liushusen@iscas.ac.cn), ISCAS, December (Christmas), 2024.
14 * In this method, the incompressiblity is achieved by the combining of the Divergence solver and the Density solver.
15 *
16 * @note It is suggested to use the Spiky Kernel for computation, and the smoothing-length(support radius) cannot be less than 2.5 times initial particle spacing.
17 * If the simulation fails, please turn down the time-step size.
18 *
19 *
20 */
21
22 template<typename TDataType>
24 {
26 public:
27 typedef typename TDataType::Real Real;
28 typedef typename TDataType::Coord Coord;
29
32
33 public:
34 DEF_VAR_IN(Real, TimeStep, "Time Step");
35
39 DEF_ARRAY_IN(Coord, Position, DeviceType::GPU, "Input particle position");
40
44 DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Input particle velocity");
45
50 DEF_ARRAYLIST_IN(int, NeighborIds, DeviceType::GPU, "Neighboring particles' ids");
51
55 DEF_ARRAY_OUT(Real, Density, DeviceType::GPU, "Final particle density");
56
57
61 DEF_VAR(bool, DivergenceSolverDisabled, false, "Disable the Divergence solver in the DFSPH method");
62
66 DEF_VAR(bool, DensitySolverDisabled, false, "Disable the Density solver in the DFSPH method");
67
71 DEF_VAR(Real, RestDensity, 1000, "Reference density");
72
76 DEF_VAR(Real, DivergenceErrorThreshold, 0.1, "Error Thershold for the Divergence solver");
77
81 DEF_VAR(Real, DensityErrorThreshold, 0.001, "Error Thershold for the Divergence solver");
82
83
87 DEF_VAR(Real, MaxIterationNumber, 50, "Maximum number of iteration of each solver");
88
89
90 public:
91 void compute() override;
92
94
96
98
99 private:
100
101 /*
102 * @brief Particle Stiffness parameter for the density solver ("K_i" in the paper)
103 */
105
106 /*
107 * @brief Particle Stiffness parameter for the divervence solver ("K^v_i" in the paper)
108 */
110
111 /*
112 * @brief Alpha factor ("Alpha_i" in the paper)
113 */
115
116 /*
117 * @brief The density estimated by the divergence ("\rho^*_i" in the paper)
118 */
120
121 /*
122 * @brief Velocity divergences or ("\frac{D \rho_i}{D t}" in the paper)
123 */
125
126
127 private:
128 std::shared_ptr<SummationDensity<TDataType>> mSummation;
129 };
130
132}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
DEF_ARRAY_IN(Coord, Position, DeviceType::GPU, "Input particle position")
Particle positions.
DEF_VAR(bool, DensitySolverDisabled, false, "Disable the Density solver in the DFSPH method")
Disable the density solver.
DEF_VAR(Real, DivergenceErrorThreshold, 0.1, "Error Thershold for the Divergence solver")
Error Threshold for the Divergence solver.
DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Input particle velocity")
Particle velocities.
DEF_ARRAY_OUT(Real, Density, DeviceType::GPU, "Final particle density")
Final particle densities.
std::shared_ptr< SummationDensity< TDataType > > mSummation
DEF_ARRAYLIST_IN(int, NeighborIds, DeviceType::GPU, "Neighboring particles' ids")
Neighboring particles' ids.
DEF_VAR(Real, MaxIterationNumber, 50, "Maximum number of iteration of each solver")
Maximum number of iteration of each solver.
DEF_VAR(bool, DivergenceSolverDisabled, false, "Disable the Divergence solver in the DFSPH method")
Disable the divergence solver.
DEF_VAR_IN(Real, TimeStep, "Time Step")
DEF_VAR(Real, DensityErrorThreshold, 0.001, "Error Thershold for the Divergence solver")
Error Threshold for the Density solver.
DEF_VAR(Real, RestDensity, 1000, "Reference density")
Rest density.
The standard summation density.
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89