tRenamed rotational components - simple_DEM - a simple 2D Discrete Element Method code for educational purposes
(HTM) git clone git://src.adamsgaard.dk/simple_DEM
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 15e7e030d19d71c7f137b498f6c52fa1c4317d0e
(DIR) parent 35b095af7f07ca4ad9da0872b4bcca7f9cc74e69
(HTM) Author: Anders Damsgaard Christensen <adc@geo.au.dk>
Date: Thu, 15 Nov 2012 21:45:12 +0100
Renamed rotational components
Diffstat:
M grains.c | 24 ++++++++++++------------
M header.h | 8 ++++----
M vtk_export.c | 2 +-
3 files changed, 17 insertions(+), 17 deletions(-)
---
(DIR) diff --git a/grains.c b/grains.c
t@@ -15,13 +15,13 @@ void prediction(grain* g)
g[i].vx += 0.5 * dt * g[i].ax;
g[i].vy += 0.5 * dt * g[i].ay;
- g[i].th += dt * g[i].vth + 0.5 * dt * dt * g[i].ath;
- g[i].vth += 0.5 * dt * g[i].ath;
+ g[i].ang += dt * g[i].angv + 0.5 * dt * dt * g[i].anga;
+ g[i].angv += 0.5 * dt * g[i].anga;
/* Zero forces */
g[i].fx = 0.0;
g[i].fy = 0.0;
- g[i].fth = 0.0;
+ g[i].t = 0.0;
g[i].p = 0.0;
}
}
t@@ -53,7 +53,7 @@ void interparticle_force(grain* g, int a, int b)
double vx_ab = g[a].vx - g[b].vy;
double vy_ab = g[a].vy - g[b].vy;
vn = vx_ab*xn + vy_ab*yn;
- vt = vx_ab*xt + vy_ab*yt - (g[a].R*g[a].vth + g[b].R*g[b].vth);
+ vt = vx_ab*xt + vy_ab*yt - (g[a].R*g[a].angv + g[b].R*g[b].angv);
/* Compute force in local axes */
fn = -kn * dn - nu * vn;
t@@ -70,12 +70,12 @@ void interparticle_force(grain* g, int a, int b)
/* Calculate sum of forces on a and b in global coordinates */
g[a].fx += fn * xn;
g[a].fy += fn * yn;
- g[a].fth += -ft*g[a].R;
+ g[a].t += -ft*g[a].R;
g[a].p += fn;
g[b].fx -= fn * xn;
g[b].fy -= fn * yn;
g[b].p += fn;
- g[b].fth += -ft*g[b].R;
+ g[b].t += -ft*g[b].R;
}
t@@ -105,9 +105,9 @@ void update_acc(grain* g)
int i;
#pragma omp parallel for shared(g) private (i)
for (i = 0; i < np; i++) {
- g[i].ax = g[i].fx / g[i].m;
- g[i].ay = g[i].fy / g[i].m - grav;
- g[i].ath = g[i].fth / g[i].I;
+ g[i].ax = g[i].fx / g[i].m;
+ g[i].ay = g[i].fy / g[i].m - grav;
+ g[i].anga = g[i].t / g[i].I;
}
}
t@@ -116,9 +116,9 @@ void correction(grain* g)
int i;
#pragma omp parallel for shared(g) private (i)
for (i = 0; i < np; i++) {
- g[i].vx += 0.5 * dt * g[i].ax;
- g[i].vy += 0.5 * dt * g[i].ay;
- g[i].vth += 0.5 * dt * g[i].ath;
+ g[i].vx += 0.5 * dt * g[i].ax;
+ g[i].vy += 0.5 * dt * g[i].ay;
+ g[i].angv += 0.5 * dt * g[i].anga;
}
}
(DIR) diff --git a/header.h b/header.h
t@@ -7,10 +7,10 @@ typedef struct
double m; /* Mass */
double R; /* Radius */
double I; /* Inertia */
- double x, y, th; /* Position */
- double vx, vy, vth; /* Velocities */
- double ax, ay, ath; /* Acceleration */
- double fx, fy, fth; /* Sum of forces, decomposed */
+ double x, y, ang; /* Position */
+ double vx, vy, angv; /* Velocities */
+ double ax, ay, anga; /* Acceleration */
+ double fx, fy, t; /* Sum of forces, decomposed */
double p; /* Pressure */
} grain;
(DIR) diff --git a/vtk_export.c b/vtk_export.c
t@@ -52,7 +52,7 @@ int vtk_export_grains(grain* g, int numfile)
fprintf(fout, "SCALARS Anpvel float 1\n");
fprintf(fout, "LOOKUP_TABLE default\n");
for (i = 0; i < np; i++)
- fprintf(fout, "%e\n", g[i].vth);
+ fprintf(fout, "%e\n", g[i].angv);
fclose(fout);
return 0;