| tadd shear test - slidergrid - grid of elastic sliders on a frictional surface | |
| git clone git://src.adamsgaard.dk/slidergrid | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit bb119cc1c3bf9c0fe083b7137eadd76e39f0d0f5 | |
| parent 0f0bccee849d4eb219805af002c0877ab961c8d6 | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Tue, 5 Apr 2016 14:04:40 -0700 | |
| add shear test | |
| Diffstat: | |
| M tests/elasticity/Makefile | 23 ++++++++++++----------- | |
| A tests/elasticity/shear.c | 48 +++++++++++++++++++++++++++++… | |
| 2 files changed, 60 insertions(+), 11 deletions(-) | |
| --- | |
| diff --git a/tests/elasticity/Makefile b/tests/elasticity/Makefile | |
| t@@ -9,11 +9,16 @@ ESSENTIALOBJS=$(SRCFOLDER)/main.o \ | |
| $(SRCFOLDER)/grid.o \ | |
| $(SRCFOLDER)/vector_math.o \ | |
| $(SRCFOLDER)/simulation.o | |
| -BIN=normal | |
| +BINS=normal shear | |
| -default: run-test | |
| +default: normal-output shear-output | |
| -run-test: normal | |
| +normal-output: normal | |
| + ./$< --verbose | |
| + python $(ROOT)postprocessing.py --plot-kinetic-energy $<-output | |
| + #python $(ROOT)postprocessing.py --plot-sliders $<-output | |
| + | |
| +shear-output: shear | |
| ./$< --verbose | |
| python $(ROOT)postprocessing.py --plot-kinetic-energy $<-output | |
| #python $(ROOT)postprocessing.py --plot-sliders $<-output | |
| t@@ -21,14 +26,10 @@ run-test: normal | |
| normal: normal.o $(ESSENTIALOBJS) | |
| $(CC) $(LDLIBS) $^ -o $@ | |
| -profile: $(BIN) | |
| - @gprof $< > $<-profile.txt | |
| - @less $<-profile.txt | |
| - | |
| -debug: $(BIN) | |
| - @gdb $< | |
| +shear: shear.o $(ESSENTIALOBJS) | |
| + $(CC) $(LDLIBS) $^ -o $@ | |
| clean: | |
| - @$(RM) $(BIN) | |
| - @$(RM) -r $(BIN)-output | |
| + @$(RM) $(BINS) | |
| + @$(RM) -r *-output | |
| @$(RM) *.o | |
| diff --git a/tests/elasticity/shear.c b/tests/elasticity/shear.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 = "shear"; | |
| + | |
| + // 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.y = 0.01; | |
| + | |
| + // set temporal parameters | |
| + sim.time = 0.0; | |
| + //sim.time_end = 1000.0; | |
| + //sim.file_interval = 1.0; | |
| + sim.time_end = 100.0; | |
| + sim.file_interval = 0.1; | |
| + | |
| + return sim; | |
| +} |