NetDEM v1.0
Loading...
Searching...
No Matches
solver_sdf_pp.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "particle.hpp"
6#include "shape.hpp"
7
8namespace netdem {
9
20public:
29
32
34 bool solve_two_sides{false};
35
39
40 double beta{0.65};
41
46
52 SolverSDFPP(Particle *const p1, Particle *const p2);
53
58 CollisionSolverPP *Clone() const override;
59
65 void Init(Particle *const p1, Particle *const p2) override;
66
71 bool Detect() override;
72
78 void ResolveInit(ContactPP *const cnt, double timestep) override;
79
85 void ResolveUpdate(ContactPP *const cnt, double timestep) override;
86
93 void ResolveInit(CollisionGeometries *const cnt_geoms, double timestep);
94
100 void ResolveUpdate(CollisionGeometries *const cnt_geoms, double timestep);
101
107 void ResolveInitP2ToP1(CollisionGeometries *const cnt_geoms, double timestep);
108
114 void ResolveUpdateP2ToP1(CollisionGeometries *const cnt_geoms,
115 double timestep);
116
122 void ResolveInitP1ToP2(CollisionGeometries *const cnt_geoms, double timestep);
123
129 void ResolveUpdateP1ToP2(CollisionGeometries *const cnt_geoms,
130 double timestep);
131
139 double GetPotential(double dist, double node_area, double size_eq,
140 double size_ratio);
141
142 static double KiToKn(double ki, double size_eq, double size_ratio);
143
144 static double KiFromKn(double kn, double size_eq, double size_ratio);
145
146 static double KiToEstar(double ki, double size_eq, double size_ratio);
147
148 static double KiFromEstar(double Estar, double size_eq, double size_ratio);
149
150private:
151 bool solve_1to2{false}, solve_2to1{false};
152
153 double bound_sphere_radius_1, bound_sphere_radius_2;
154
155 // particle 1 as reference particle
156 Vec3d pos_1, dpos_12, dpos_12_ref;
157 Vec4d quat_1, dquat_12;
158
159 // particle 2 as reference particle
160 Vec3d pos_2, dpos_21, dpos_21_ref;
161 Vec4d quat_2, dquat_21;
162
163 Shape *shape_1{nullptr}, *shape_2{nullptr};
164
168 VecXT<int> node_id_12_list;
169 VecXT<int> node_id_21_list;
170
174 VecXT<double> node_dist_12_list;
175 VecXT<double> node_dist_21_list;
176};
177
178} // namespace netdem
A class representing the geometries associated with a collision.
Definition collision_geometries.hpp:15
An abstract base class for particle-particle collision solvers.
Definition collision_solver_pp.hpp:18
A class representing a contact between two particles.
Definition contact_pp.hpp:20
Definition particle.hpp:26
Signed distance field-based contact solver.
Definition solver_sdf_pp.hpp:19
void ResolveUpdate(ContactPP *const cnt, double timestep) override
Updates the contact resolution for a contact point.
Definition solver_sdf_pp.cpp:191
int potential_type
Whether to solve both sides of the collision.
Definition solver_sdf_pp.hpp:31
void ResolveUpdateP2ToP1(CollisionGeometries *const cnt_geoms, double timestep)
Updates the contact resolution from particle 2 to particle 1.
Definition solver_sdf_pp.cpp:336
static double KiToEstar(double ki, double size_eq, double size_ratio)
Definition solver_sdf_pp.cpp:544
void ResolveInitP2ToP1(CollisionGeometries *const cnt_geoms, double timestep)
Initializes the contact resolution from particle 2 to particle 1.
Definition solver_sdf_pp.cpp:284
static double KiFromKn(double kn, double size_eq, double size_ratio)
Definition solver_sdf_pp.cpp:538
CollisionSolverPP * Clone() const override
Creates a copy of the current collision solver.
Definition solver_sdf_pp.cpp:16
PotentialType
An enumeration of potential types used by the solver.
Definition solver_sdf_pp.hpp:28
@ linear
Definition solver_sdf_pp.hpp:28
@ hertz
Definition solver_sdf_pp.hpp:28
void ResolveInitP1ToP2(CollisionGeometries *const cnt_geoms, double timestep)
Initializes the contact resolution from particle 1 to particle 2.
Definition solver_sdf_pp.cpp:390
double GetPotential(double dist, double node_area, double size_eq, double size_ratio)
Calculates the potential energy of a contact point.
Definition solver_sdf_pp.cpp:498
bool use_equivalent_stiffness
Definition solver_sdf_pp.hpp:38
bool Detect() override
Detects collisions between particles.
Definition solver_sdf_pp.cpp:73
static double KiToKn(double ki, double size_eq, double size_ratio)
Definition solver_sdf_pp.cpp:532
static double KiFromEstar(double Estar, double size_eq, double size_ratio)
Definition solver_sdf_pp.cpp:553
bool solve_two_sides
Definition solver_sdf_pp.hpp:34
SolverSDFPP()
Default constructor for the SolverSDFPP class.
Definition solver_sdf_pp.cpp:10
void ResolveInit(ContactPP *const cnt, double timestep) override
Initializes the contact resolution for a contact point.
Definition solver_sdf_pp.cpp:163
void Init(Particle *const p1, Particle *const p2) override
Initializes the collision solver with two particles.
Definition solver_sdf_pp.cpp:18
double beta
Definition solver_sdf_pp.hpp:40
void ResolveUpdateP1ToP2(CollisionGeometries *const cnt_geoms, double timestep)
Updates the contact resolution from particle 1 to particle 2.
Definition solver_sdf_pp.cpp:443
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