tfix normal-impact simulation parameters - 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 86fc15639894a4f2ebaaba73678afc6245e2d8e7
 (DIR) parent 8767c0aedd2863ea48fb447851a62fa232a9a8f1
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Fri, 15 Apr 2016 14:52:12 -0700
       
       fix normal-impact simulation parameters
       
       Diffstat:
         M slidergrid/debug.h                  |       8 ++++----
         M slidergrid/slider.c                 |      17 +++++++++--------
         A tests/elasticity/normal-2d.c        |      48 +++++++++++++++++++++++++++++++
         A tests/elasticity/normal-3d.c        |      49 +++++++++++++++++++++++++++++++
         M tests/elasticity/normal.c           |       9 ++++-----
         M tests/elasticity/shear.c            |      12 ++++++------
       
       6 files changed, 120 insertions(+), 23 deletions(-)
       ---
 (DIR) diff --git a/slidergrid/debug.h b/slidergrid/debug.h
       t@@ -6,18 +6,18 @@
        //#define DEBUG_FIND_AND_BOND_TO_NEIGHBORS
        
        // if defined, show information on the resolved inter-slider bond deformation
       -#define DEBUG_BOND_DEFORMATION
       +//#define DEBUG_BOND_DEFORMATION
        
        // if defined, verbose information to stdout will be shown about the individual 
        // components of the sum of forces
       -#define DEBUG_SLIDER_FORCE_COMPONENTS
       +//#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
       +//#define DEBUG_SLIDER_FORCE_TORQUE_AND_NEIGHBORS
        
        // if defined, verbose information to stdout will be shown after the slider 
        // integration
       -#define DEBUG_SLIDER_KINEMATICS
       +//#define DEBUG_SLIDER_KINEMATICS
        
        #endif
 (DIR) diff --git a/slidergrid/slider.c b/slidergrid/slider.c
       t@@ -256,13 +256,14 @@ void bond_normal_deformation(slider* s1, const slider s2,
            // total relative displacement in inter-slider distance
            s1->neighbor_relative_tangential_velocity[idx_neighbor] = vel_t;
        
       -    //*
       +#ifdef DEBUG_BOND_DEFORMATION
            printf("\t------\n"
       -            "tan_disp0_u = %f %f %f\n"
       -            "tan_disp0   = %f %f %f\n"
       -            "tan_disp    = %f %f %f\n"
       -            "dtan_disp   = %f %f %f\n"
       -            "vel_t       = %f %f %f\n"
       +            "\ttan_disp0_u = %f %f %f\n"
       +            "\ttan_disp0   = %f %f %f\n"
       +            "\ttan_disp    = %f %f %f\n"
       +            "\tdtan_disp   = %f %f %f\n"
       +            "\tvel_t       = %f %f %f\n"
       +            "\t------\n"
                    ,
                    tangential_displacement0_uncor.x,
                    tangential_displacement0_uncor.y,
       t@@ -279,7 +280,7 @@ void bond_normal_deformation(slider* s1, const slider s2,
                    vel_t.x,
                    vel_t.y,
                    vel_t.z);
       -            // */
       +#endif
        }
        
        
       t@@ -375,7 +376,7 @@ void bond_shear_kelvin_voigt(slider* s1, const slider s2,
                        s1->neighbor_relative_tangential_velocity[idx_neighbor]);
        
            // bond-parallel Kelvin-Voigt force, counteracts tension and compression
       -    const Float3 f_t = multiply_scalar_float3( 1.0, // TODO: test sign
       +    const Float3 f_t = multiply_scalar_float3( -1.0,
                    add_float3(f_t_elastic, f_t_viscous));
        
            // add bond-shear Kelvin-Voigt force to sum of forces on slider
 (DIR) diff --git a/tests/elasticity/normal-2d.c b/tests/elasticity/normal-2d.c
       t@@ -0,0 +1,48 @@
       +#include "../../slidergrid/simulation.h"
       +#include "../../slidergrid/grid.h"
       +#include "../../slidergrid/slider.h"
       +
       +#include <stdio.h>
       +
       +// test a regular, 2d, orthogonal grid of sliders
       +simulation setup_simulation()
       +{
       +    // create empty simulation structure with default values
       +    simulation sim = create_simulation();
       +    sim.id = "normal-2d";
       +
       +    // initialize grid of sliders
       +    int nx = 50;
       +    int ny = 50;
       +    int nz = 1;
       +    sim.N = nx*ny*nz;
       +    sim.sliders = create_regular_slider_grid(nx, ny, nz, 1.0, 1.0, 1.0);
       +
       +    sim.bond_length_limit = 1.5;
       +
       +    // set slider masses and moments of inertia
       +    int i;
       +    for (i=0; i<sim.N; i++) {
       +
       +        // set default values
       +        initialize_slider_values(&sim.sliders[i]);
       +
       +        // set custom values for certain parameters
       +        sim.sliders[i].mass = 10.0;
       +        sim.sliders[i].moment_of_inertia = 1.0e3;
       +        sim.sliders[i].bond_parallel_kv_stiffness = 1.0e4;
       +        //sim.sliders[i].bond_parallel_kv_viscosity = 1.0e2;
       +        sim.sliders[i].bond_shear_kv_stiffness = 1.0e5;
       +    }
       +
       +    sim.sliders[1250].vel.x = 1.0e1;
       +
       +    // set temporal parameters
       +    sim.time = 0.0;
       +    //sim.time_end = 100.0;
       +    //im.file_interval = 1.0;
       +    sim.time_end = 2.0;
       +    sim.file_interval = 1.0e-3;
       +
       +    return sim;
       +}
 (DIR) diff --git a/tests/elasticity/normal-3d.c b/tests/elasticity/normal-3d.c
       t@@ -0,0 +1,49 @@
       +#include "../../slidergrid/simulation.h"
       +#include "../../slidergrid/grid.h"
       +#include "../../slidergrid/slider.h"
       +
       +#include <stdio.h>
       +
       +// test a regular, 2d, orthogonal grid of sliders
       +simulation setup_simulation()
       +{
       +    // create empty simulation structure with default values
       +    simulation sim = create_simulation();
       +    sim.id = "normal-3d";
       +
       +    // initialize grid of sliders
       +    int nx = 20;
       +    int ny = 20;
       +    int nz = 20;
       +    sim.N = nx*ny*nz;
       +    sim.sliders = create_regular_slider_grid(nx, ny, nz, 1.0, 1.0, 1.0);
       +
       +    sim.bond_length_limit = 1.5;
       +
       +    // set slider masses and moments of inertia
       +    int i;
       +    for (i=0; i<sim.N; i++) {
       +
       +        // set default values
       +        initialize_slider_values(&sim.sliders[i]);
       +
       +        // set custom values for certain parameters
       +        sim.sliders[i].mass = 10.0;
       +        sim.sliders[i].moment_of_inertia = 1.0e3;
       +        sim.sliders[i].bond_parallel_kv_stiffness = 1.0e4;
       +        //sim.sliders[i].bond_parallel_kv_viscosity = 1.0e2;
       +        sim.sliders[i].bond_shear_kv_stiffness = 1.0e5;
       +    }
       +
       +    sim.sliders[200].vel.x = 1.0e1;
       +    sim.sliders[200].vel.z = 1.0e1;
       +
       +    // set temporal parameters
       +    sim.time = 0.0;
       +    //sim.time_end = 100.0;
       +    //im.file_interval = 1.0;
       +    sim.time_end = 2.0;
       +    sim.file_interval = 1.0e-3;
       +
       +    return sim;
       +}
 (DIR) diff --git a/tests/elasticity/normal.c b/tests/elasticity/normal.c
       t@@ -12,7 +12,7 @@ simulation setup_simulation()
            sim.id = "normal";
        
            // initialize grid of sliders
       -    int nx = 10;
       +    int nx = 20;
            //int nx = 2;
            int ny = 1;
            int nz = 1;
       t@@ -29,17 +29,16 @@ simulation setup_simulation()
                initialize_slider_values(&sim.sliders[i]);
        
                // set custom values for certain parameters
       -        sim.sliders[i].mass = 1.0;
       +        sim.sliders[i].mass = 10.0;
                sim.sliders[i].moment_of_inertia = 1.0e3;
       -        sim.sliders[i].bond_parallel_kv_stiffness = 1.0e5;
       +        sim.sliders[i].bond_parallel_kv_stiffness = 1.0e4;
                //sim.sliders[i].bond_parallel_kv_viscosity = 1.0e2;
                sim.sliders[i].bond_shear_kv_stiffness = 1.0e5;
            }
        
       -    sim.sliders[0].vel.x = 0.01;
       +    sim.sliders[0].vel.x = 1.0e1;
        
            // set temporal parameters
       -    sim.time = 0.0;
            sim.time_end = 100.0;
            sim.file_interval = 1.0;
        
 (DIR) diff --git a/tests/elasticity/shear.c b/tests/elasticity/shear.c
       t@@ -12,8 +12,8 @@ simulation setup_simulation()
            sim.id = "shear";
        
            // initialize grid of sliders
       -    //int nx = 10;
       -    int nx = 2;
       +    int nx = 20;
       +    //int nx = 2;
            int ny = 1;
            int nz = 1;
            sim.N = nx*ny*nz;
       t@@ -39,10 +39,10 @@ simulation setup_simulation()
            sim.sliders[0].vel.y = 0.1;
        
            // set temporal parameters
       -    //sim.time_end = 100.0;
       -    //sim.file_interval = 1.0;
       -    sim.time_end = 1.0;
       -    sim.file_interval = 1.0e-3;
       +    sim.time_end = 200.0;
       +    sim.file_interval = 0.1;
       +    //sim.time_end = 1.0;
       +    //sim.file_interval = 1.0e-3;
        
            return sim;
        }