1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| /* The general DLMFD plugin */
# include "dlmfd-plugin.h"
/* Here we overload the generic events defined in the global DLMFD plugin
dlmfd-plugin.h such that it uses my toy granular solver */
/** Overloading of the granular solver init event */
// -------------------------------------------------
event GranularSolver_init (t < -1.) {
particle * pp = particles;
for (int k = 0; k < NPARTICLES; k++) {
/* Contact model parameters needed to setup the granular time-step */
pp[k].wished_ratio = 0.1;
pp[k].en = 1;
pp[k].vzero = 1;
compute_wo (&pp[k]);
/* add this term to make sure that the gravity is added only once in the granular subproblem (it is already present in the granular solver) */
foreach_dimension()
pp[k].adforce.x = -pp[k].gravity.x;
}
}
/** Overloading of the granular solver predictor event */
// ------------------------------------------------------
event GranularSolver_predictor (t < -1.) {
if ( pid() == 0 ) printf("Prediction: my rk-4 toy granular solver\n");
particle * pp = particles;
granular_subproblem (pp, 1, dt, rhoval);
}
/** Overloading of the granular solver velocity update event */
// ------------------------------------------------------------
event GranularSolver_updateVelocity (t < -1.) {
if ( pid() == 0 ) printf("Correction: my rk-4 toy granular solver\n");
particle * pp = particles;
granular_subproblem (pp, 0, dt, rhoval);
}
|