tadd example simulation, remove extra ignores - slidergrid - grid of elastic sl… | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f5386a896ba503a6afe938bdb950890b44bb1727 | |
parent dbdc108fdbb4c7ac7367ca6d93b5987ce0707d44 | |
Author: Anders Damsgaard Christensen <[email protected]> | |
Date: Tue, 19 Apr 2016 16:06:20 -0700 | |
add example simulation, remove extra ignores | |
Diffstat: | |
M .gitignore | 2 -- | |
A example.c | 46 +++++++++++++++++++++++++++++… | |
2 files changed, 46 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/.gitignore b/.gitignore | |
t@@ -13,5 +13,3 @@ tags | |
*.log | |
*.out | |
*.run.xml | |
-*.aux | |
-*.aux | |
diff --git a/example.c b/example.c | |
t@@ -0,0 +1,46 @@ | |
+#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 = "example"; | |
+ | |
+ // initialize grid of sliders | |
+ //int nx = 10; | |
+ int nx = 2; | |
+ int ny = 1; | |
+ 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 = 1.0; | |
+ sim.sliders[i].moment_of_inertia = 1.0e3; | |
+ sim.sliders[i].bond_parallel_kv_stiffness = 1.0e5; | |
+ //sim.sliders[i].bond_parallel_kv_viscosity = 1.0e2; | |
+ } | |
+ | |
+ sim.sliders[0].vel.x = 0.01; | |
+ | |
+ // set temporal parameters | |
+ sim.time = 0.0; | |
+ sim.time_end = 10.0; | |
+ sim.file_interval = 0.1; | |
+ | |
+ return sim; | |
+} |