PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
contactDeck.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2024 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#ifndef INP_CONTACTDECK_H
12#define INP_CONTACTDECK_H
13
14namespace inp {
15
24
26 double d_contactR;
27
30
32
33 double d_vMax;
34 double d_deltaMax;
35 double d_Kn;
37
39
40 double d_eps;
41 double d_betan;
43
45
46 double d_mu;
49 double d_KnFactor;
51 double d_kappa;
53
58 : d_contactR(0.), d_computeContactR(true), d_vMax(0.), d_deltaMax(0.),
59 d_Kn(0.), d_eps(0.), d_betan(0.), d_mu(0.), d_dampingOn(true),
60 d_frictionOn(true), d_KnFactor(1.), d_betanFactor(1.), d_kappa(1.) {};
61
74
82 std::string printStr(int nt = 0, int lvl = 0) const {
83
84 auto tabS = util::io::getTabS(nt);
85 std::ostringstream oss;
86 oss << tabS << "------- ContactPairDeck --------" << std::endl << std::endl;
87 oss << tabS << "Contact radius = " << d_contactR << std::endl;
88 oss << tabS << "v_max = " << d_vMax << ", Delta_max = " << d_deltaMax
89 << ", Kn = " << d_Kn << std::endl;
90 oss << tabS << "epsilon = " << d_eps << ", Beta_n = " << d_betan << std::endl;
91 oss << tabS << "Friction coefficient = " << d_mu << std::endl;
92 oss << tabS << "Damping status = " << d_dampingOn << std::endl;
93 oss << tabS << "Kn factor = " << d_KnFactor
94 << ", Beta n factor = " << d_betanFactor << std::endl;
95 oss << tabS << "Bulk modulus = " << d_kappa << std::endl;
96 oss << tabS << std::endl;
97 return oss.str();
98 }
99
106 void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); }
107
115 double getKn(const double &v1, const double &v2) const {
116
117 return d_Kn * (v1 * v2) / (v1 + v2);
118 }
119
121 double getKn(const double &v1, const double &v2) {
122
123 return d_Kn * (v1 * v2) / (v1 + v2);
124 }
125
132 double getWKn(const double &v) const {
133
134 return d_Kn * v;
135 }
136
138 double getWKn(const double &v) {
139
140 return d_Kn * v;
141 }
142
150 double getBetan(const double &v1, const double &v2) const {
151
152 return d_betan * std::sqrt((v1 * v2) / (v1 + v2));
153 }
154
156 double getBetan(const double &v1, const double &v2) {
157
158 return d_betan * std::sqrt((v1 * v2) / (v1 + v2));
159 }
160
167 double getWBetan(const double &v) const {
168
169 return d_betan * std::sqrt(v);
170 }
171
173 double getWBetan(const double &v) {
174
175 return d_betan * std::sqrt(v);
176 }
177};
178
182
186 std::vector<std::vector<ContactPairDeck>> d_data;
187
195 const ContactPairDeck &getContact(const size_t &i, const size_t &j) const {
196 //return d_data[i < j ? i : j][i < j ? j : i];
197 return d_data[i][j];
198 }
199
201 ContactPairDeck &getContact(const size_t &i, const size_t &j) {
202 //return d_data[i < j ? i : j][i < j ? j : i];
203 return d_data[i][j];
204 }
205
213 std::string printStr(int nt = 0, int lvl = 0) const {
214
215 auto tabS = util::io::getTabS(nt);
216 std::ostringstream oss;
217 oss << tabS << "------- ContactDeck --------" << std::endl << std::endl;
218 for (size_t i =0; i<d_data.size(); i++) {
219 for (size_t j = 0; j < d_data.size(); j++) {
220 oss << tabS << "ContactPairDeck id = (" << i << "," << j << ") info:"
221 << std::endl;
222 oss << getContact(i,j).printStr(nt+2, lvl);
223 }
224 }
225
226 oss << tabS << std::endl;
227
228 return oss.str();
229 }
230
237 void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); }
238};
239
242} // namespace inp
243
244#endif // INP_CONTACTDECK_H
Collection of methods and database related to input.
Definition mesh.h:20
std::string getTabS(int nt)
Returns tab spaces of given size.
Definition io.h:40
Structure to read and store particle-particle contact related input data.
ContactPairDeck & getContact(const size_t &i, const size_t &j)
Returns the contact data.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
const ContactPairDeck & getContact(const size_t &i, const size_t &j) const
Returns the contact data.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
std::vector< std::vector< ContactPairDeck > > d_data
Store contact parameters for each pair of zone.
Structure to read and store particle-particle contact related input data.
Definition contactDeck.h:23
double d_contactR
contact radius
Definition contactDeck.h:26
bool d_frictionOn
parameters for frictional force
Definition contactDeck.h:48
double d_eps
parameters for normal damping force
Definition contactDeck.h:40
bool d_computeContactR
Flag that indicates whether contact radius is to be computed.
Definition contactDeck.h:29
ContactPairDeck(const ContactPairDeck &cd)
Copy constructor.
Definition contactDeck.h:67
double d_kappa
parameters for frictional force
Definition contactDeck.h:51
void print(int nt=0, int lvl=0) const
Prints the information about the object.
double d_betan
parameters for normal damping force
Definition contactDeck.h:41
double getKn(const double &v1, const double &v2) const
Get contact force factor.
double d_betanFactor
parameters for frictional force
Definition contactDeck.h:50
double d_vMax
parameters for normal force
Definition contactDeck.h:33
double d_KnFactor
parameters for frictional force
Definition contactDeck.h:49
double d_Kn
parameters for normal force
Definition contactDeck.h:35
double getKn(const double &v1, const double &v2)
Get contact force factor.
ContactPairDeck()
Constructor.
Definition contactDeck.h:57
double getBetan(const double &v1, const double &v2)
Get damping force factor for particle-wall.
double getWBetan(const double &v) const
Get damping force factor for particle-wall.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
Definition contactDeck.h:82
double d_mu
parameters for frictional force
Definition contactDeck.h:46
double getWKn(const double &v)
Get contact force factor for particle-wall.
double getWBetan(const double &v)
Get damping force factor for particle-wall.
double d_deltaMax
parameters for normal force
Definition contactDeck.h:34
double getWKn(const double &v) const
Get contact force factor for particle-wall.
bool d_dampingOn
parameters for frictional force
Definition contactDeck.h:47
double getBetan(const double &v1, const double &v2) const
Get damping force factor for particle-wall.