PeriDyno 1.0.0
Loading...
Searching...
No Matches
SimpleVelocityConstraint.h
Go to the documentation of this file.
1
16
17
18#pragma once
20#include "Algorithm/Reduction.h"
23#include "Collision/Attribute.h"
26
35
36namespace dyno {
37
38 class Attribute;
39 template<typename TDataType> class SummationDensity;
40
41 template<typename TDataType>
43 {
44
45 public:
46 typedef typename TDataType::Real Real;
47 typedef typename TDataType::Coord Coord;
48 typedef typename TDataType::Matrix Matrix;
51
52 void constrain() override;
53 bool initialize();
54
58 {
59 visValueSet(this->varViscosity()->getValue());
60 return true;
61 }
62
63 bool visValueSet(Real vis)
64 {
65 std::vector<Real> vis_temp;
66 for (int i = 0; i < m_viscosity.size(); i++)
67 {
68 vis_temp.push_back(vis);
69 }
70 m_viscosity.assign(vis_temp);
71 return true;
72 };
73
75 {
76 m_viscosity.assign(vis);
77 return true;
78 };
79
80 bool SIMPLE_IterNumSet(int i) {
82 return true;
83 };
84
85
86 bool SetCross(Real visT, Real mag, Real k1, Real n1)
87 {
88 CrossVisCeil = visT;
89 CrossVisMag = mag;
90 CrossVisFloor = visT / mag;
91 Cross_K = k1;
92 Cross_N = n1;
93 std::cout << "Cross modle is setted! Viscosity:" << CrossVisFloor
94 << "~" << CrossVisCeil << ", K:"
95 << Cross_K << ", N:" << Cross_N
96 << std::endl;
97
98 IsCrossReady = true;
99 return IsCrossReady;
100 };
101
102
103
104 public:
105
106 DEF_ARRAYLIST_IN(int, NeighborIds, DeviceType::GPU, "");
107
108 DEF_ARRAY_IN(Coord, Position, DeviceType::GPU, "Input real particle position");
109
110 DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Input particle velocity");
111
112 DEF_ARRAY_IN(Coord, Normal, DeviceType::GPU, "Input particle velocity");
113
114 DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Input particle velocity");
115
116 DEF_VAR_IN(Real, SmoothingLength, "");
117
118 DEF_VAR(Real, RestDensity, Real(1000), "Reference density");
119
120 DEF_VAR_IN(Real, SamplingDistance, "");
121
122 DEF_VAR_IN(Real, TimeStep, "");
123
124 DEF_VAR(Real, Viscosity, Real(5000.0), "Initial Viscosity Value");
125
126 DEF_VAR(bool, SimpleIterationEnable, true, "");
127
128 private:
129
136 bool m_bConfigured = false;
137 bool IsCrossReady = false;
138
142
146
147 //Refer to "A Nonlocal Variational Particle Framework for Incompressible Free Surface Flows" for their exact meanings
152
156
157
161
164 //Indicate whether a particle is near the free surface boundary.
166
167 //Used to solve the linear system of PPE with a conjugate gradient method.
171
172 //Used to solve the linear system of velocity constraint with a conjugate gradient method.
178
182
183 std::shared_ptr<SummationDensity<TDataType>> m_densitySum;
184
185 bool init_flag = false;
187
188 };
189
190
191}
particle attribute 0x00000000: [31-30]material; [29]motion; [28]Dynamic; [27-8]undefined yet,...
Definition Attribute.h:26
DEF_VAR(bool, SimpleIterationEnable, true, "")
DEF_VAR(Real, Viscosity, Real(5000.0), "Initial Viscosity Value")
bool SetCross(Real visT, Real mag, Real k1, Real n1)
DEF_ARRAY_IN(Coord, Position, DeviceType::GPU, "Input real particle position")
std::shared_ptr< SummationDensity< TDataType > > m_densitySum
DEF_ARRAY_IN(Coord, Velocity, DeviceType::GPU, "Input particle velocity")
DEF_ARRAYLIST_IN(int, NeighborIds, DeviceType::GPU, "")
DEF_VAR_IN(Real, SmoothingLength, "")
DEF_VAR_IN(Real, TimeStep, "")
DEF_VAR_IN(Real, SamplingDistance, "")
DEF_ARRAY_IN(Attribute, Attribute, DeviceType::GPU, "Input particle velocity")
DEF_VAR(Real, RestDensity, Real(1000), "Reference density")
DEF_ARRAY_IN(Coord, Normal, DeviceType::GPU, "Input particle velocity")
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
Array< T, DeviceType::CPU > CArray
Definition Array.h:151