suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
Particle.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2026 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
30#ifndef PARTICLE_H
31#define PARTICLE_H
32
33#include <Element/Element.h>
34#ifdef SUANPAN_VTK
35#include <vtkVertex.h>
36#endif
37
38class Particle : public Element {
39public:
41 unsigned, // tag
42 unsigned, // node tag
43 std::vector<Node::DOF>&& // dof identifier
44 );
45
46 [[nodiscard]] Type type() const final { return Type::DEM; }
47
48 int update_status() override { return SUANPAN_SUCCESS; }
49
50 int commit_status() override { return SUANPAN_SUCCESS; }
51 int clear_status() override { return SUANPAN_SUCCESS; }
52 int reset_status() override { return SUANPAN_SUCCESS; }
53};
54
55template<unsigned DIM> class SphericalParticle : public Particle {
56protected:
58
59public:
60 SphericalParticle(const unsigned T, const unsigned N, std::vector<Node::DOF>&& D, const double R, const double E, const double V, const double A, const double M, const double I)
61 : Particle(T, N, std::move(D))
62 , radius(R)
65 , damping(A)
66 , mass(M)
67 , inertia(I) {}
68
69 [[nodiscard]] double get(const Parameter P) const override {
70 if(Parameter::ELASTIC == P) return elastic_modulus;
71 if(Parameter::POISSON == P) return poisson_ratio;
72 if(Parameter::RADIUS == P) return radius;
73 if(Parameter::MASS == P) return mass;
74 if(Parameter::INERTIA == P) return inertia;
75 if(Parameter::DAMPING == P) return damping;
76
77 return 0.;
78 }
79
80#ifdef SUANPAN_VTK
81 [[nodiscard]] vtkSmartPointer<vtkCell> GetCell() const override { return vtkSmartPointer<vtkVertex>::New(); }
82
83 mat GetData(const OutputType P) override {
85 if(OutputType::V == P) return get_current_velocity();
87
88 return {};
89 }
90
91 mat GetDeformation(double) override { return get_coordinate(DIM).t() + get_current_displacement().head(DIM); }
92#endif
93};
94
96public:
98 unsigned, // tag
99 unsigned, // node tag
100 double, // radius
101 double, // elastic modulus
102 double, // poisson ratio
103 double, // damping
104 double, // mass
105 double // inertia
106 );
107
108 int initialize(const shared_ptr<DomainBase>&) override;
109};
110
111class SphericalParticle2D final : public SphericalParticle<2u> {
112public:
114 unsigned, // tag
115 unsigned, // node tag
116 double, // radius
117 double, // elastic modulus
118 double, // poisson ratio
119 double, // damping
120 double // mass
121 );
122
123 int initialize(const shared_ptr<DomainBase>&) override;
124};
125
127public:
129 unsigned, // tag
130 unsigned, // node tag
131 double, // radius
132 double, // elastic modulus
133 double, // poisson ratio
134 double, // damping
135 double, // mass
136 double // inertia
137 );
138
139 int initialize(const shared_ptr<DomainBase>&) override;
140};
141
142class SphericalParticle3D final : public SphericalParticle<3u> {
143public:
145 unsigned, // tag
146 unsigned, // node tag
147 double, // radius
148 double, // elastic modulus
149 double, // poisson ratio
150 double, // damping
151 double // mass
152 );
153
154 int initialize(const shared_ptr<DomainBase>&) override;
155};
156
157#endif
158
OutputType
Definition OutputType.h:23
Parameter
Definition ElementBase.h:64
Type
Definition ElementBase.h:59
A Element class.
Definition Element.h:118
vec get_current_velocity() const override
Definition Element.cpp:468
vec get_current_acceleration() const override
Definition Element.cpp:481
vec get_current_displacement() const override
Definition Element.cpp:455
mat get_coordinate() const override
Definition Element.cpp:359
Definition Particle.h:95
int initialize(const shared_ptr< DomainBase > &) override
Definition Particle.cpp:26
Definition Particle.h:126
int initialize(const shared_ptr< DomainBase > &) override
Definition Particle.cpp:48
The Particle class represents the abstract particle used in DEM.
Definition Particle.h:38
int clear_status() override
Definition Particle.h:51
Type type() const final
Definition Particle.h:46
int commit_status() override
Definition Particle.h:50
int update_status() override
Definition Particle.h:48
int reset_status() override
Definition Particle.h:52
Definition Particle.h:111
int initialize(const shared_ptr< DomainBase > &) override
Definition Particle.cpp:37
Definition Particle.h:142
int initialize(const shared_ptr< DomainBase > &) override
Definition Particle.cpp:59
Definition Particle.h:55
const double damping
Definition Particle.h:57
const double inertia
Definition Particle.h:57
SphericalParticle(const unsigned T, const unsigned N, std::vector< Node::DOF > &&D, const double R, const double E, const double V, const double A, const double M, const double I)
Definition Particle.h:60
const double radius
Definition Particle.h:57
double get(const Parameter P) const override
Definition Particle.h:69
const double elastic_modulus
Definition Particle.h:57
const double mass
Definition Particle.h:57
const double poisson_ratio
Definition Particle.h:57
constexpr auto SUANPAN_SUCCESS
Definition suanPan.h:166