NetDEM v1.0
Loading...
Searching...
No Matches
solver_sdf_pw.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "particle.hpp"
6#include "shape.hpp"
7
8namespace netdem {
9
19public:
28
31
33 bool solve_two_sides{false};
34
38
39 double beta{0.65};
40
45
52 SolverSDFPW(Particle *const p, Wall *const w);
53
59 CollisionSolverPW *Clone() const override;
60
68 void Init(Particle *const p, Wall *const w) override;
69
75 bool Detect() override;
76
84 void ResolveInit(ContactPW *const cnt, double timestep) override;
85
93 void ResolveUpdate(ContactPW *const cnt, double timestep) override;
94
102 void ResolveInit(CollisionGeometries *const cnt_geoms, double timestep);
103
111 void ResolveUpdate(CollisionGeometries *const cnt_geoms, double timestep);
112
120 void ResolveInitWToP(CollisionGeometries *const cnt_geoms, double timestep);
121
129 void ResolveUpdateWToP(CollisionGeometries *const cnt_geoms, double timestep);
130
138 void ResolveInitPToW(CollisionGeometries *const cnt_geoms, double timestep);
139
147 void ResolveUpdatePToW(CollisionGeometries *const cnt_geoms, double timestep);
148
159 double GetPotential(double dist, double node_area, double size_eq,
160 double size_ratio);
161
162 static double KiToKn(double ki, double size_eq, double size_ratio);
163
164 static double KiFromKn(double kn, double size_eq, double size_ratio);
165
166 static double KiToEstar(double ki, double size_eq, double size_ratio);
167
168 static double KiFromEstar(double Estar, double size_eq, double size_ratio);
169
170private:
172 bool solve_1to2{false};
173
175 bool solve_2to1{false};
176
178 double bound_sphere_radius_1;
179
181 double bound_sphere_radius_2;
182
183 // particle as reference
184
186 Vec3d pos_1;
187
189 Vec3d dpos_12;
190
192 Vec3d dpos_12_ref;
193
195 Vec4d quat_1;
196
198 Vec4d dquat_12;
199
200 // wall as reference
201
203 Vec3d pos_2;
204
206 Vec3d dpos_21;
207
209 Vec3d dpos_21_ref;
210
212 Vec4d quat_2;
213
215 Vec4d dquat_21;
216
218 Shape *shape_1{nullptr};
219
221 Shape *shape_2{nullptr};
222
226 VecXT<int> node_id_12_list;
227 VecXT<int> node_id_21_list;
228
232 VecXT<double> node_dist_12_list;
233 VecXT<double> node_dist_21_list;
234};
235
236} // namespace netdem
A class representing the geometries associated with a collision.
Definition collision_geometries.hpp:15
An abstract class representing a collision solver for a particle and a wall.
Definition collision_solver_pw.hpp:20
A class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
Definition particle.hpp:26
A class used to solve collisions between a particle and a wall using a signed distance field.
Definition solver_sdf_pw.hpp:18
static double KiToKn(double ki, double size_eq, double size_ratio)
Definition solver_sdf_pw.cpp:538
bool Detect() override
Detects if there is a collision between the particle and the wall.
Definition solver_sdf_pw.cpp:71
void ResolveUpdate(ContactPW *const cnt, double timestep) override
Updates the contact information object and resolves the collision based on the updated information an...
Definition solver_sdf_pw.cpp:199
void ResolveUpdatePToW(CollisionGeometries *const cnt_geoms, double timestep)
Updates the contact geometries object and resolves the collision based on the updated information and...
Definition solver_sdf_pw.cpp:451
void ResolveInit(ContactPW *const cnt, double timestep) override
Resolves the collision based on the initial contact information and timestep.
Definition solver_sdf_pw.cpp:171
void ResolveInitWToP(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision between the wall and the particle based on the initial contact geometries and ...
Definition solver_sdf_pw.cpp:292
void ResolveUpdateWToP(CollisionGeometries *const cnt_geoms, double timestep)
Updates the contact geometries object and resolves the collision based on the updated information and...
Definition solver_sdf_pw.cpp:345
PotentialType
An enumeration of potential types used by the solver.
Definition solver_sdf_pw.hpp:27
@ linear
Definition solver_sdf_pw.hpp:27
@ hertz
Definition solver_sdf_pw.hpp:27
static double KiToEstar(double ki, double size_eq, double size_ratio)
Definition solver_sdf_pw.cpp:550
void Init(Particle *const p, Wall *const w) override
Initializes the SolverSDFPW instance with the given particles and walls.
Definition solver_sdf_pw.cpp:16
double GetPotential(double dist, double node_area, double size_eq, double size_ratio)
Calculates the potential energy between two shapes based on their distance and type of potential func...
Definition solver_sdf_pw.cpp:504
bool use_equivalent_stiffness
Definition solver_sdf_pw.hpp:37
int potential_type
Whether to solve both sides of the collision.
Definition solver_sdf_pw.hpp:30
CollisionSolverPW * Clone() const override
Clones the current SolverSDFPW instance.
Definition solver_sdf_pw.cpp:14
static double KiFromKn(double kn, double size_eq, double size_ratio)
Definition solver_sdf_pw.cpp:544
double beta
Definition solver_sdf_pw.hpp:39
bool solve_two_sides
Definition solver_sdf_pw.hpp:33
SolverSDFPW()
Default constructor for SolverSDFPW class.
Definition solver_sdf_pw.cpp:10
static double KiFromEstar(double Estar, double size_eq, double size_ratio)
Definition solver_sdf_pw.cpp:559
void ResolveInitPToW(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision between the particle and the wall based on the initial contact geometries and ...
Definition solver_sdf_pw.cpp:400
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19