textend elasticity testing - 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 56d818be2914d596c94e0b4968a04f37ca20a759
(DIR) parent d5fcc2684a0bcfda20f1d29e2aab1b830c0190d7
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Tue, 5 Apr 2016 13:55:53 -0700
extend elasticity testing
Diffstat:
M Makefile | 10 ++++++++--
M slidergrid/main.c | 13 ++++++-------
M slidergrid/slider.c | 24 ++++++++++++++++++------
M slidergrid/slider.h | 3 ++-
M tests/Makefile | 3 +++
M tests/elasticity/Makefile | 7 ++++---
M tests/elasticity/normal.c | 10 +++++-----
7 files changed, 46 insertions(+), 24 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -10,12 +10,17 @@ ESSENTIALOBJS=$(SRCFOLDER)/main.o \
$(SRCFOLDER)/simulation.o
BIN=example
-default: example tests
+default: example tests run-example
+
+run-example: $(BIN)
+ ./$(BIN)
+ ./postprocessing.py --plot-kinetic-energy $(BIN)-output
+ @#./postprocessing.py --plot-sliders $(BIN)-output
example: example.o $(ESSENTIALOBJS)
$(CC) $(LDLIBS) $^ -o $@
-tests:
+test:
make -C tests/
debug: $(BIN)
t@@ -26,3 +31,4 @@ clean:
@$(RM) -r $(BIN)-output
@$(RM) *.o
@$(RM) $(SRCFOLDER)/*.o
+ @make -C tests clean
(DIR) diff --git a/slidergrid/main.c b/slidergrid/main.c
t@@ -217,12 +217,10 @@ int main(int argc, char** argv)
time_since_file = 0.0;
}
- if (verbose) {
- if (time_since_status > sim.dt*100. ||
- time_since_status >= sim.file_interval) {
- print_status(sim);
- time_since_status = 0.;
- }
+ if (verbose && time_since_status > sim.dt*100. ||
+ time_since_status >= sim.file_interval) {
+ print_status(sim);
+ time_since_status = 0.;
}
sim.iteration++;
t@@ -230,7 +228,8 @@ int main(int argc, char** argv)
time_since_file += sim.dt;
}
- print_status(sim);
+ if (verbose)
+ print_status(sim);
puts("");
// end program
(DIR) diff --git a/slidergrid/slider.c b/slidergrid/slider.c
t@@ -43,7 +43,8 @@ void initialize_slider_values(slider* s)
s->neighbor_distance[i] = zeroes_float3();
s->neighbor_relative_distance_displacement[i] = zeroes_float3();
s->neighbor_relative_distance_velocity[i] = zeroes_float3();
- s->neighbor_tangential_displacment[i] = zeroes_float3();
+ s->neighbor_relative_tangential_displacement[i] = zeroes_float3();
+ s->neighbor_relative_tangential_velocity[i] = zeroes_float3();
}
}
t@@ -213,7 +214,7 @@ void bond_normal_deformation(slider* s1, const slider s2,
tangential_displacement0_uncor = zeroes_float3();
else
tangential_displacement0_uncor =
- s1->neighbor_tangential_displacment[idx_neighbor];
+ s1->neighbor_relative_tangential_displacement[idx_neighbor];
// Correct previous tangential displacement vector if the contact plane is
// reoriented
t@@ -227,12 +228,23 @@ void bond_normal_deformation(slider* s1, const slider s2,
const Float3 tangential_displacement_future =
add_float3(tangential_displacement0, dtangential_displacement);
- // determine dtangential_displacement by central differences
+ // get current tangential displacement from central differences
+ const Float3 tangential_displacement = divide_float3_scalar(
+ subtract_float3(tangential_displacement_future,
+ tangential_displacement0), 2.0);
+ // total relative displacement in inter-slider distance
+ if (iteration == 0)
+ s1->neighbor_relative_tangential_displacement[idx_neighbor] =
+ tangential_displacement;
+ else
+ s1->neighbor_relative_distance_displacement[idx_neighbor] =
+ add_float3(
+ s1->neighbor_relative_tangential_displacement[idx_neighbor],
+ dtangential_displacement);
- // use dtangential_displacement for elastic response on shear motion
-
- // use vel_t for viscous response on shear motion
+ // total relative displacement in inter-slider distance
+ s1->neighbor_relative_tangential_velocity[idx_neighbor] = vel_t;
}
(DIR) diff --git a/slidergrid/slider.h b/slidergrid/slider.h
t@@ -53,7 +53,8 @@ typedef struct {
Float3 neighbor_distance[MAX_NEIGHBORS];
Float3 neighbor_relative_distance_displacement[MAX_NEIGHBORS];
Float3 neighbor_relative_distance_velocity[MAX_NEIGHBORS];
- Float3 neighbor_tangential_displacment[MAX_NEIGHBORS];
+ Float3 neighbor_relative_tangential_displacement[MAX_NEIGHBORS];
+ Float3 neighbor_relative_tangential_velocity[MAX_NEIGHBORS];
} slider;
(DIR) diff --git a/tests/Makefile b/tests/Makefile
t@@ -1,2 +1,5 @@
all:
make -C elasticity
+
+clean:
+ make -C elasticity clean
(DIR) diff --git a/tests/elasticity/Makefile b/tests/elasticity/Makefile
t@@ -2,7 +2,8 @@ CC=gcc
#CFLAGS=-Wall -O3 -march=native
CFLAGS=-Wall -g -pg
LDLIBS=-lm
-SRCFOLDER=../../slidergrid
+ROOT=../../
+SRCFOLDER=$(ROOT)/slidergrid
ESSENTIALOBJS=$(SRCFOLDER)/main.o \
$(SRCFOLDER)/slider.o \
$(SRCFOLDER)/grid.o \
t@@ -14,8 +15,8 @@ default: run-test
run-test: normal
./$< --verbose
- @#python postprocessing.py --plot-sliders $<-output
- @#rsync -rav test-output /var/www/html/
+ python $(ROOT)postprocessing.py --plot-kinetic-energy $<-output
+ python $(ROOT)postprocessing.py --plot-sliders $<-output
normal: normal.o $(ESSENTIALOBJS)
$(CC) $(LDLIBS) $^ -o $@
(DIR) diff --git a/tests/elasticity/normal.c b/tests/elasticity/normal.c
t@@ -9,11 +9,11 @@ simulation setup_simulation()
{
// create empty simulation structure with default values
simulation sim = create_simulation();
- sim.id = "test";
+ sim.id = "normal";
// initialize grid of sliders
- //int nx = 10;
- int nx = 2;
+ int nx = 10;
+ //int nx = 2;
int ny = 1;
int nz = 1;
sim.N = nx*ny*nz;
t@@ -39,8 +39,8 @@ simulation setup_simulation()
// set temporal parameters
sim.time = 0.0;
- sim.time_end = 10.0;
- sim.file_interval = 0.1;
+ sim.time_end = 1000.0;
+ sim.file_interval = 1.0;
return sim;
}