tfix divide by zero error, remove object files in source folder - slidergrid - grid of elastic sliders on a frictional surface
(HTM) git clone git://src.adamsgaard.dk/slidergrid
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ffce95073aabb7c780a4ccb40e3c16cc8cb35a1e
(DIR) parent 4dec9bb3157cedd9272eb7b2a9938c12ededcd24
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Tue, 22 Mar 2016 13:16:13 -0700
fix divide by zero error, remove object files in source folder
Diffstat:
M Makefile | 2 +-
M slidergrid/debug.h | 2 +-
M slidergrid/slider.c | 14 ++++++--------
3 files changed, 8 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -31,4 +31,4 @@ clean:
@$(RM) $(BIN)
@$(RM) -r $(BIN)-output
@$(RM) *.o
- @$(RM) $(SRCFOLDER)*.o
+ @$(RM) $(SRCFOLDER)/*.o
(DIR) diff --git a/slidergrid/debug.h b/slidergrid/debug.h
t@@ -3,7 +3,7 @@
// if defined, verbose information to stdout will be shown during the
// slider-bond initialization function
-#define DEBUG_FIND_AND_BOND_TO_NEIGHBORS
+//#define DEBUG_FIND_AND_BOND_TO_NEIGHBORS
// if defined, verbose information to stdout will be shown before the slider
// integration
(DIR) diff --git a/slidergrid/slider.c b/slidergrid/slider.c
t@@ -158,13 +158,12 @@ void slider_interaction(slider* s1, const slider s2, const int idx_neighbor)
// differs from Potyondy & Stack 2004, eq. 6.
const Float bond_parallel_stiffness =
2.*s1->bond_parallel_stiffness*s2.bond_parallel_stiffness/
- (s1->bond_parallel_stiffness + s2.bond_parallel_stiffness);
+ (s1->bond_parallel_stiffness + s2.bond_parallel_stiffness + 1.0e-40);
// determine the bond viscosity from the harmonic mean.
const Float bond_parallel_viscosity =
2.*s1->bond_parallel_viscosity*s2.bond_parallel_viscosity/
- (s1->bond_parallel_viscosity + s2.bond_parallel_viscosity);
-
+ (s1->bond_parallel_viscosity + s2.bond_parallel_viscosity + 1.0e-40);
// bond-parallel elasticity
const Float3 f_n_elastic =
t@@ -179,6 +178,9 @@ void slider_interaction(slider* s1, const slider s2, const int idx_neighbor)
// bond-parallel force, counteracts tension and compression
const Float3 f_n = multiply_float3(f_n_elastic, f_n_viscous);
+ // add bond-parallel force to sum of forces on slider
+ s1->force = add_float3(s1->force, f_n);
+
printf("f_n = %f %f %f, f_n_elastic = %f %f %f, f_n_viscous = %f %f %f\n",
f_n.x,
f_n.y,
t@@ -189,9 +191,6 @@ void slider_interaction(slider* s1, const slider s2, const int idx_neighbor)
f_n_viscous.x,
f_n_viscous.y,
f_n_viscous.z);
-
- // add bond-parallel force to sum of forces on slider
- s1->force = add_float3(s1->force, f_n);
}
t@@ -217,8 +216,7 @@ void slider_neighbor_interaction(
slider_interaction(
s, sliders[s->neighbors[idx_neighbor]], idx_neighbor);
- printf("%d, %d: F = %f %f %f, T = %f %f %f\n",
- s, sliders[s->neighbors[idx_neighbor]],
+ printf("F = %f %f %f, T = %f %f %f\n\n",
s->force.x,
s->force.y,
s->force.z,