FrictionQPotSpringBlock v0.22.7
Loading...
Searching...
No Matches
Particles.h
Go to the documentation of this file.
1
7#ifndef FRICTIONQPOTSPRINGBLOCK_PARTICLES_H
8#define FRICTIONQPOTSPRINGBLOCK_PARTICLES_H
9
10#include "config.h"
11#include "detail.h"
12
13#include <prrng.h>
14
15#include <GMatTensor/version.h>
16
18
22namespace Particles {
23
34inline std::vector<std::string> version_dependencies()
35{
36 return GMatTensor::version_dependencies();
37}
38
43inline std::vector<std::string> version_compiler()
44{
45 return GMatTensor::version_compiler();
46}
47
51using Generator =
52 prrng::pcg32_tensor_cumsum<array_type::tensor<double, 2>, array_type::tensor<ptrdiff_t, 1>, 1>;
53
93class System_Cuspy : public detail::System<1, detail::Cuspy<Generator>, Generator> {
94protected:
97
98public:
113 double m,
114 double eta,
115 double mu,
116 double k_frame,
117 double dt,
118 const std::array<size_t, 1>& shape,
119 uint64_t seed,
120 const std::string& distribution,
121 const std::vector<double>& parameters,
122 double offset = -100.0,
123 size_t nchunk = 5000
124 )
125 : m_gen(
126 std::array<size_t, 1>{nchunk},
127 xt::eval(seed + xt::arange<uint64_t>(shape[0])),
128 xt::eval(xt::zeros<uint64_t>(shape)),
129 detail::string_to_distribution(distribution),
130 parameters,
131 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
132 )
133 {
134 m_gen += offset;
136 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen);
137 }
138};
139
162 1,
163 detail::Cuspy<Generator>,
164 Generator,
165 void,
166 detail::RandomNormalForcing<1>,
167 detail::None> {
168protected:
172
173public:
183 double m,
184 double eta,
185 double mu,
186 double k_frame,
187 double dt,
188 double mean,
189 double stddev,
190 uint64_t seed_forcing,
191 const array_type::tensor<ptrdiff_t, 1>& dinc_init,
193 const std::array<size_t, 1>& shape,
194 uint64_t seed,
195 const std::string& distribution,
196 const std::vector<double>& parameters,
197 double offset = -100.0,
198 size_t nchunk = 5000
199 )
200 : m_gen(
201 std::array<size_t, 1>{nchunk},
202 xt::eval(seed + xt::arange<uint64_t>(shape[0])),
203 xt::eval(xt::zeros<uint64_t>(shape)),
204 detail::string_to_distribution(distribution),
205 parameters,
206 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
207 )
208 {
209 m_gen += offset;
212 m_gen.generators().shape(), mean, stddev, seed_forcing, dinc_init, dinc
213 );
214 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen, nullptr, &m_ext);
215 }
216
217protected:
221 size_t quasistaticActivityFirst() const;
222 size_t quasistaticActivityLast() const;
223 double eventDrivenStep(double, bool, int);
227};
228
233class System_SemiSmooth : public detail::System<1, detail::SemiSmooth<Generator>, Generator> {
234protected:
237
238public:
244 double m,
245 double eta,
246 double mu,
247 double kappa,
248 double k_frame,
249 double dt,
250 const std::array<size_t, 1>& shape,
251 uint64_t seed,
252 const std::string& distribution,
253 const std::vector<double>& parameters,
254 double offset = -100.0,
255 size_t nchunk = 5000
256 )
257 : m_gen(
258 std::array<size_t, 1>{nchunk},
259 xt::eval(seed + xt::arange<uint64_t>(shape[0])),
260 xt::eval(xt::zeros<uint64_t>(shape)),
261 detail::string_to_distribution(distribution),
262 parameters,
263 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
264 )
265 {
266 m_gen += offset;
268 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen);
269 }
270};
271
276class System_Smooth : public detail::System<1, detail::Smooth<Generator>, Generator> {
277protected:
280
281public:
286 double m,
287 double eta,
288 double mu,
289 double k_frame,
290 double dt,
291 const std::array<size_t, 1>& shape,
292 uint64_t seed,
293 const std::string& distribution,
294 const std::vector<double>& parameters,
295 double offset = -100.0,
296 size_t nchunk = 5000
297 )
298 : m_gen(
299 std::array<size_t, 1>{nchunk},
300 xt::eval(seed + xt::arange<uint64_t>(shape[0])),
301 xt::eval(xt::zeros<uint64_t>(shape)),
302 detail::string_to_distribution(distribution),
303 parameters,
304 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
305 )
306 {
307 m_gen += offset;
309 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen);
310 }
311};
312
313} // namespace Particles
314} // namespace FrictionQPotSpringBlock
315
316#endif
System in which the effect of temperature in mimicked by random forcing.
Definition Particles.h:167
detail::Cuspy< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Particles.h:170
detail::RandomNormalForcing< 1 > m_ext
Add extra random force to the residual.
Definition Particles.h:171
System_Cuspy_RandomForcing(double m, double eta, double mu, double k_frame, double dt, double mean, double stddev, uint64_t seed_forcing, const array_type::tensor< ptrdiff_t, 1 > &dinc_init, const array_type::tensor< ptrdiff_t, 1 > &dinc, const std::array< size_t, 1 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Definition Particles.h:182
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Particles.h:169
Standard system with a cuspy potential energy landscape.
Definition Particles.h:93
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Particles.h:95
System_Cuspy(double m, double eta, double mu, double k_frame, double dt, const std::array< size_t, 1 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Definition Particles.h:112
detail::Cuspy< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Particles.h:96
Same as System_Cuspy() but with a semi-smooth potential.
Definition Particles.h:233
System_SemiSmooth(double m, double eta, double mu, double kappa, double k_frame, double dt, const std::array< size_t, 1 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Definition Particles.h:243
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Particles.h:235
detail::SemiSmooth< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Particles.h:236
Same as System_Cuspy() but with a smooth potential.
Definition Particles.h:276
detail::Smooth< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Particles.h:279
System_Smooth(double m, double eta, double mu, double k_frame, double dt, const std::array< size_t, 1 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Definition Particles.h:285
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Particles.h:278
A piece-wise quadratic local potential energy.
Definition detail.h:114
Each particle experiences a random force representing the effect of temperature.
Definition detail.h:882
A potential energy landscape of each particle that is piecewise smooth.
Definition detail.h:213
A potential energy landscape of each particle that is smooth.
Definition detail.h:357
System in generic number of dimensions.
Definition detail.h:1053
void initSystem(double m, double eta, double k_frame, double mu, double dt, detail::Cuspy< Generator > *potential, Generator *chunk, void *interactions=nullptr, void *external=nullptr)
Initialise the system.
Definition detail.h:1096
auto k_frame() const
The stiffness of the loading frame (parameter).
Definition detail.h:1209
prrng::pcg32_tensor_cumsum< array_type::tensor< double, 2 >, array_type::tensor< ptrdiff_t, 1 >, 1 > Generator
Chunked storage of the cumulative sum of random numbers, used in all classes.
Definition Particles.h:51
std::vector< std::string > version_compiler()
Return information on the compiler, platform, C++ standard, and the compilation data.
Definition Particles.h:43
std::vector< std::string > version_dependencies()
Return versions of this library and of all of its dependencies.
Definition Particles.h:34
xt::xarray< T > array
Arbitrary rank array.
Definition config.h:178
Tensor products / operations.
Definition config.h:145