PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
time_int Namespace Reference

Data Structures

class  Integrator
 

Functions

void applyRigidBodyConstraint (data::ModelData &data)
 
void updateCentralDifference (data::ModelData &data)
 
void updateVerletHalfKickAndDrift (data::ModelData &data)
 
void updateVerletSecondKick (data::ModelData &data)
 

Function Documentation

◆ applyRigidBodyConstraint()

void time_int::applyRigidBodyConstraint ( data::ModelData data)

Definition at line 19 of file integrator.cpp.

19 {
20 const auto &rigid = data.d_modelDeck_p->d_rigidParticles;
21 if (rigid.empty())
22 return;
23
24 // Nodal force in the integrators is a force density (acceleration = f/rho).
25 // A rigid translating body of mass M has acceleration a = sum(f_i V_i) / M,
26 // so replacing each nodal force density by rho * a reproduces that motion
27 // without touching the integrators themselves.
28 for (const auto &[pid, mass] : rigid) {
29 util::Point net(0., 0., 0.);
30 for (std::size_t II = 0; II < data.numPdForceNodes(); II++) {
31 const auto i = data.pdForceNode(II);
32 if (data.getPtId(i) != pid)
33 continue;
34 net += data.getVol(i) * data.getF(i);
35 }
36
37 const auto acc = net / mass;
38 for (std::size_t II = 0; II < data.numPdForceNodes(); II++) {
39 const auto i = data.pdForceNode(II);
40 if (data.getPtId(i) != pid)
41 continue;
42 data.getF(i) = data.getDensity(i) * acc;
43 }
44 }
45}
Definition contact.h:20
A structure to represent 3d vectors.
Definition point.h:30

Referenced by time_int::Integrator::integrate(), main(), and time_int::Integrator::step().

Here is the caller graph for this function:

◆ updateCentralDifference()

void time_int::updateCentralDifference ( data::ModelData data)

Definition at line 47 of file integrator.cpp.

47 {
48 const auto dim = data.dimension();
49 const auto dt = data.currentDt();
50
51 tf::Executor executor(util::parallel::getNThreads());
52 tf::Taskflow taskflow;
53
54 taskflow.for_each_index(
55 (std::size_t) 0, data.numPdForceNodes(), (std::size_t) 1,
56 [&data, dim, dt](std::size_t II) {
57 const auto i = data.pdForceNode(II);
58 const auto rho = data.getDensity(i);
59 auto &v = data.getV(i);
60 auto &u = data.getU(i);
61 auto &x = data.getX(i);
62 const auto &f = data.getF(i);
63
64 for (int dof = 0; dof < dim; dof++) {
65 if (data.isDofFree(i, dof)) {
66 v[dof] += (dt / rho) * f[dof];
67 u[dof] += dt * v[dof];
68 x[dof] += dt * v[dof];
69 }
70 }
71
72 data.setVMag(i, v.length());
73 }
74 );
75
76 executor.run(taskflow).get();
77}
unsigned int getNThreads()
Get number of threads to be used by taskflow.

References util::parallel::getNThreads().

Referenced by time_int::Integrator::step().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVerletHalfKickAndDrift()

void time_int::updateVerletHalfKickAndDrift ( data::ModelData data)

Definition at line 79 of file integrator.cpp.

79 {
80 const auto dim = data.dimension();
81 const auto dt = data.currentDt();
82
83 tf::Executor executor(util::parallel::getNThreads());
84 tf::Taskflow taskflow;
85
86 taskflow.for_each_index(
87 (std::size_t) 0, data.numPdForceNodes(), (std::size_t) 1,
88 [&data, dim, dt](std::size_t II) {
89 const auto i = data.pdForceNode(II);
90 const auto rho = data.getDensity(i);
91 auto &v = data.getV(i);
92 auto &u = data.getU(i);
93 auto &x = data.getX(i);
94 const auto &f = data.getF(i);
95
96 for (int dof = 0; dof < dim; dof++) {
97 if (data.isDofFree(i, dof)) {
98 v[dof] += 0.5 * (dt / rho) * f[dof];
99 u[dof] += dt * v[dof];
100 x[dof] += dt * v[dof];
101 }
102 }
103
104 data.setVMag(i, v.length());
105 }
106 );
107
108 executor.run(taskflow).get();
109}

References util::parallel::getNThreads().

Referenced by time_int::Integrator::step().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVerletSecondKick()

void time_int::updateVerletSecondKick ( data::ModelData data)

Definition at line 111 of file integrator.cpp.

111 {
112 const auto dim = data.dimension();
113 const auto dt = data.currentDt();
114
115 tf::Executor executor(util::parallel::getNThreads());
116 tf::Taskflow taskflow;
117
118 taskflow.for_each_index(
119 (std::size_t) 0, data.numPdForceNodes(), (std::size_t) 1,
120 [&data, dim, dt](std::size_t II) {
121 const auto i = data.pdForceNode(II);
122 const auto rho = data.getDensity(i);
123 auto &v = data.getV(i);
124 const auto &f = data.getF(i);
125
126 for (int dof = 0; dof < dim; dof++) {
127 if (data.isDofFree(i, dof)) {
128 v[dof] += 0.5 * (dt / rho) * f[dof];
129 }
130 }
131
132 data.setVMag(i, v.length());
133 }
134 );
135
136 executor.run(taskflow).get();
137}

References util::parallel::getNThreads().

Referenced by time_int::Integrator::step().

Here is the call graph for this function:
Here is the caller graph for this function: