Introduction
Introduction Statistics Contact Development Disclaimer Help
tstable behavior with elastic bond model - slidergrid - grid of elastic sliders…
git clone git://src.adamsgaard.dk/slidergrid
Log
Files
Refs
README
LICENSE
---
commit 29dcc40d11391606b585ee8c16d62ffab38d835d
parent 22987b940714da80cd5638c1bd3367747956b4ee
Author: Anders Damsgaard <[email protected]>
Date: Wed, 23 Mar 2016 12:11:05 -0700
stable behavior with elastic bond model
Diffstat:
M slidergrid/debug.h | 10 +++++++---
M slidergrid/main.c | 26 ++++++++++++++++++++++++--
M slidergrid/slider.c | 14 ++++++++++----
M slidergrid/slider.h | 2 +-
M test.c | 9 +++++----
5 files changed, 47 insertions(+), 14 deletions(-)
---
diff --git a/slidergrid/debug.h b/slidergrid/debug.h
t@@ -5,12 +5,16 @@
// slider-bond initialization function
//#define DEBUG_FIND_AND_BOND_TO_NEIGHBORS
+// if defined, verbose information to stdout will be shown about the individua…
+// components of the sum of forces
+//#define DEBUG_SLIDER_FORCE_COMPONENTS
+
// if defined, verbose information to stdout will be shown before the slider
// integration
#define DEBUG_SLIDER_FORCE_TORQUE_AND_NEIGHBORS
-// if defined, verbose information to stdout will be shown about the individua…
-// components of the sum of forces
-#define DEBUG_SLIDER_FORCE_COMPONENTS
+// if defined, verbose information to stdout will be shown after the slider
+// integration
+#define DEBUG_SLIDER_KINEMATICS
#endif
diff --git a/slidergrid/main.c b/slidergrid/main.c
t@@ -134,8 +134,10 @@ int main(int argc, char** argv)
sim.sliders[i].vel.y,
sim.sliders[i].vel.z);*/
- for (i=0; i<sim.N; i++)
+ for (i=0; i<sim.N; i++) {
project_slider_position(&sim.sliders[i], sim.dt, sim.iteration);
+ zero_slider_force_torque(&sim.sliders[i]);
+ }
/*for (i=0; i<sim.N; i++)
printf("%d: pos = %f %f %f, pos_future = %f %f %f\n", i,
t@@ -169,13 +171,33 @@ int main(int argc, char** argv)
for (j=0; j<MAX_NEIGHBORS; j++)
if (sim.sliders[i].neighbors[j] >= 0)
printf("%d ", sim.sliders[i].neighbors[j]);
- puts("\n");
+ //puts("\n");
+ puts("");
#endif
}
for (i=0; i<sim.N; i++)
update_kinematics(&sim.sliders[i], sim.dt, sim.iteration);
+#ifdef DEBUG_SLIDER_KINEMATICS
+ for (i=0; i<sim.N; i++) {
+ int j;
+ printf("main.c: Slider %d: pos = %f %f %f, vel = %f %f %f, "
+ "acc = %f %f %f\n",
+ i,
+ sim.sliders[i].pos.x,
+ sim.sliders[i].pos.y,
+ sim.sliders[i].pos.z,
+ sim.sliders[i].vel.x,
+ sim.sliders[i].vel.y,
+ sim.sliders[i].vel.z,
+ sim.sliders[i].acc.x,
+ sim.sliders[i].acc.y,
+ sim.sliders[i].acc.z);
+ }
+ puts("");
+#endif
+
if (time_since_file >= sim.file_interval) {
if (write_simulation_output(&sim, output_folder)) {
fprintf(stderr, "\nFatal error: Could not write one or more "
diff --git a/slidergrid/slider.c b/slidergrid/slider.c
t@@ -52,8 +52,11 @@ void project_slider_position(slider* s, Float dt, long int …
s->angpos.x + s->angvel.x*dt + 0.5*s->angacc.x*dt*dt,
s->angpos.y + s->angvel.y*dt + 0.5*s->angacc.y*dt*dt,
s->angpos.z + s->angvel.z*dt + 0.5*s->angacc.z*dt*dt);
+}
- // reset sum of forces and torques on slider
+// reset sum of forces and torques on slider
+void zero_slider_force_torque(slider* s)
+{
s->force = zeroes_float3();
s->torque = zeroes_float3();
}
t@@ -155,8 +158,11 @@ void slider_displacement(slider* s1, const slider s2,
// increment in inter-slider distance, divide by two to get displacement
// over 1 time step
- Float3 ddist = divide_float3_scalar(
- subtract_float3(dist_future, dist0), 2.0);
+ //const Float3 ddist = divide_float3_scalar(
+ //subtract_float3(dist_future, dist0), 2.0);
+
+ // Get displacement change from previous and current inter-slider distance
+ const Float3 ddist = subtract_float3(dist, dist0);
//if (iteration == 0)
//ddist = zeroes_float3();
t@@ -177,7 +183,7 @@ void slider_displacement(slider* s1, const slider s2,
s1->neighbor_relative_distance_velocity[idx_neighbor] =
multiply_float3_scalar(n, vel_n);
- printf("displacement = %f %f %f\n", ddist.x, ddist.y, ddist.z);
+ //printf("displacement = %f %f %f\n", ddist.x, ddist.y, ddist.z);
}
diff --git a/slidergrid/slider.h b/slidergrid/slider.h
t@@ -50,9 +50,9 @@ typedef struct {
void print_slider_position(slider s);
void initialize_slider_values(slider* s);
-//void check_slider_values(slider s);
void project_slider_position(slider* s, Float dt, long int iteration);
+void zero_slider_force_torque(slider* s);
void update_kinematics(slider* s, Float dt, long int iteration);
void slider_neighbor_interaction(
diff --git a/test.c b/test.c
t@@ -12,7 +12,8 @@ simulation setup_simulation()
sim.id = "test";
// initialize grid of sliders
- int nx = 10;
+ //int nx = 10;
+ int nx = 2;
int ny = 1;
int nz = 1;
sim.N = nx*ny*nz;
t@@ -28,17 +29,17 @@ simulation setup_simulation()
initialize_slider_values(&sim.sliders[i]);
// set custom values for certain parameters
- sim.sliders[i].mass = 1.0e3;
+ sim.sliders[i].mass = 1.0;
sim.sliders[i].moment_of_inertia = 1.0e3;
sim.sliders[i].bond_parallel_stiffness = 1.0e5;
//sim.sliders[i].bond_parallel_viscosity = 1.0e2;
}
- sim.sliders[0].vel.x = 1.0;
+ sim.sliders[0].vel.x = 0.1;
// set temporal parameters
sim.time = 0.0;
- sim.time_end = 1.0;
+ sim.time_end = 10.0;
sim.file_interval = 0.1;
return sim;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.