tresolve twist on bond - slidergrid - grid of elastic sliders on a frictional s… | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bbf7010bcf7ceae41f9d8bf35c2f7d1f1e66ae78 | |
parent d852181baa63f618bea35aa6d8d6053763688920 | |
Author: Anders Damsgaard Christensen <[email protected]> | |
Date: Mon, 18 Apr 2016 16:06:46 -0700 | |
resolve twist on bond | |
Diffstat: | |
M slidergrid/slider.c | 63 ++++++++++++++++++++++++++++-… | |
1 file changed, 57 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/slidergrid/slider.c b/slidergrid/slider.c | |
t@@ -135,7 +135,7 @@ void update_kinematics(slider* s, Float dt, long int itera… | |
// determine time step increment bond-parallel deformation (tension or | |
// compression) | |
-void bond_parallel_deformation(slider* s1, const slider s2, | |
+void bond_tensile_deformation(slider* s1, const slider s2, | |
const int idx_neighbor, const int iteration) | |
{ | |
// vector pointing from neighbor (s2) position to this slider position (s1) | |
t@@ -192,9 +192,8 @@ void bond_parallel_deformation(slider* s1, const slider s2, | |
} | |
-// determine time step increment bond-oblique deformation (shear, bending, | |
-// and/or twist) | |
-void bond_normal_deformation(slider* s1, const slider s2, | |
+// determine time step increment bond-shear deformation | |
+void bond_shear_deformation(slider* s1, const slider s2, | |
const int idx_neighbor, const int iteration, const Float dt) | |
{ | |
// vector pointing from neighbor (s2) position to this slider position (s1) | |
t@@ -287,13 +286,65 @@ void bond_normal_deformation(slider* s1, const slider s2, | |
#endif | |
} | |
+// determine time step increment bond twist deformation | |
+void bond_twist_deformation(slider* s1, const slider s2, | |
+ const int idx_neighbor, const int iteration, const Float dt) | |
+{ | |
+ // vector pointing from neighbor (s2) position to this slider position (s1) | |
+ const Float3 dist = subtract_float3(s1->pos, s2.pos); | |
+ | |
+ // length of inter-slider vector | |
+ const Float dist_norm = norm_float3(dist); | |
+ | |
+ // unit vector pointing from neighbor (s2) to slider s1 | |
+ const Float3 n = divide_float3_scalar(dist, dist_norm); | |
+ | |
+ // Get the relative angular velocity | |
+ const Float3 angvel_rel = subtract_float3(s2.angvel, s1->angvel); | |
+ | |
+ // Isolate the relative angular velocity component parallel to the bond | |
+ const Float twist_vel = dot_float3(angvel_rel, n); | |
+ | |
+ // Twist displacement happening in one time step | |
+ const Float dtwist = twist_vel*dt; | |
+ | |
+ // total relative displacement in inter-slider distance | |
+ if (iteration == 0) | |
+ s1->neighbor_relative_twist[idx_neighbor] = dtwist; | |
+ else | |
+ s1->neighbor_relative_twist[idx_neighbor] += dtwist; | |
+ | |
+ // total relative displacement in inter-slider distance | |
+ s1->neighbor_relative_twist_velocity[idx_neighbor] = twist_vel; | |
+ | |
+#ifdef DEBUG_BOND_DEFORMATION | |
+ printf("\t------\n" | |
+ "\ttwist = %f %f %f\n" | |
+ "\tdtwist = %f %f %f\n" | |
+ "\ttwist_vel = %f %f %f\n" | |
+ "\t------\n" | |
+ , | |
+ twist.x, | |
+ twist.y, | |
+ twist.z, | |
+ dtwist.x, | |
+ dtwist.y, | |
+ dtwist.z, | |
+ twist_vel.x, | |
+ twist_vel.y, | |
+ twist_vel.z); | |
+#endif | |
+} | |
+ | |
+ | |
// Find the bond deformation | |
void bond_deformation(slider* s1, const slider s2, | |
const int idx_neighbor, const int iteration, const Float dt) | |
{ | |
- bond_parallel_deformation(s1, s2, idx_neighbor, iteration); | |
- bond_normal_deformation(s1, s2, idx_neighbor, iteration, dt); | |
+ bond_tensile_deformation(s1, s2, idx_neighbor, iteration); | |
+ bond_shear_deformation(s1, s2, idx_neighbor, iteration, dt); | |
+ bond_twist_deformation(s1, s2, idx_neighbor, iteration, dt); | |
} | |