commit ffb275d4bbd029b7884129340ebfcbddc74b2852
parent 6cb6fc35f0aa16cadba133b4bd63f7376c7cdc58
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 5 Apr 2019 20:38:56 +0200
Finish visualization
Diffstat:
9 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/1d_fd_simple_shear.gp b/1d_fd_simple_shear.gp
@@ -0,0 +1,28 @@
+#!/usr/bin/env gnuplot
+
+#set terminal epslatex color size 8.6 cm, 7.6 cm
+#set output "plots/sheardisp.tex"
+#set terminal pdfcairo color size 8.6 cm, 7.6 cm
+#set output "plots/sheardisp.pdf"
+#set terminal pngcairo color size 8.6 cm, 7.6 cm
+set terminal pngcairo color size 18.6 cm, 17.6 cm
+set output "1d_fd_simple_shear.png"
+set xlabel "Horizontal velocity, v_x [m]"
+set ylabel "Vertical position, x_3 [m]" offset 2
+
+#set grid
+
+set yrange [0.0:0.73]
+
+set key bottom right #samplen 0.9
+
+set style line 1 linetype 1 linewidth 3 pointtype 1 pointsize 1
+set style line 2 linetype 2 linewidth 3 pointtype 2 pointsize 1
+
+plot "1d_fd_simple_shear_P10kPa.txt" u 2:1 w lp lt 1 lw 2 title "P_{wall} = 10 kPa", \
+ "1d_fd_simple_shear_P20kPa.txt" u 2:1 w lp lt 2 lw 2 title "P_{wall} = 20 kPa", \
+ "1d_fd_simple_shear_P40kPa.txt" u 2:1 w lp lt 3 lw 2 title "P_{wall} = 40 kPa", \
+ "1d_fd_simple_shear_P80kPa.txt" u 2:1 w lp lt 4 lw 2 title "P_{wall} = 80 kPa", \
+ "1d_fd_simple_shear_P120kPa.txt" u 2:1 w lp lt 5 lw 2 title "P_{wall} = 120 kPa"
+
+set xtics norotate # Restore defaults
diff --git a/1d_fd_simple_shear.png b/1d_fd_simple_shear.png
Binary files differ.
diff --git a/1d_fd_simple_shear_damsgaard2013.h b/1d_fd_simple_shear_damsgaard2013.h
@@ -16,11 +16,11 @@ struct simulation init_sim(void)
sim.G = 9.81;
- sim.P_wall = 10e3; /* larger normal stress deepens the shear depth */
+ sim.P_wall = 120e3; /* larger normal stress deepens the shear depth */
sim.mu_wall = 0.40;
sim.v_x_bot = 0.0;
- sim.nz = 10;
+ sim.nz = 100;
/* lower values of A mean that the velocity curve can have sharper curves,
* e.g. at the transition from μ ≈ μ_s */
diff --git a/Makefile b/Makefile
@@ -17,11 +17,28 @@ default: 1d_fd_simple_shear
1d_fd_simple_shear: $(OBJ) $(HDR)
$(CC) $(LDFLAGS) $(OBJ) -o $@
+1d_fd_simple_shear.png: 1d_fd_simple_shear 1d_fd_simple_shear.gp
+ sed -i 's/P_wall = .*;/P_wall = 10e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P10kPa.txt
+ sed -i 's/P_wall = .*;/P_wall = 20e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P20kPa.txt
+ sed -i 's/P_wall = .*;/P_wall = 40e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P40kPa.txt
+ sed -i 's/P_wall = .*;/P_wall = 60e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P60kPa.txt
+ sed -i 's/P_wall = .*;/P_wall = 80e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P80kPa.txt
+ sed -i 's/P_wall = .*;/P_wall = 120e3;/' 1d_fd_simple_shear_damsgaard2013.h
+ rm main.o && make $< && ./$< > $<_P120kPa.txt
+ gnuplot $<.gp > $@
+
.PHONY: watch
watch:
echo $(SRC) $(HDR) | tr ' ' '\n' | entr -s 'make && ./1d_fd_simple_shear'
clean:
$(RM) *.png
+ $(RM) *.txt
$(RM) *.o
$(RM) 1d_fd_simple_shear
+ $(RM) 1d_fd_simple_shear.png
diff --git a/arrays.c b/arrays.c
@@ -109,6 +109,13 @@ void print_arrays(const double* a, const double* b, const int n)
printf("%.17g\t%.17g\n", a[i], b[i]);
}
+void print_arrays_2nd_normalized(const double* a, const double* b, const int n)
+{
+ double max_b = max(b, n);
+ for (int i=0; i<n; ++i)
+ printf("%.17g\t%.17g\n", a[i], b[i]/max_b);
+}
+
void copy_values(const double* in, double* out, const int n)
{
for (int i=0; i<n; ++i)
diff --git a/arrays.h b/arrays.h
@@ -27,6 +27,7 @@ double min(const double* a, const int n);
void print_array(const double* a, const int n);
void print_arrays(const double* a, const double* b, const int n);
+void print_arrays_2nd_normalized(const double* a, const double* b, const int n);
void copy_values(const double* in, double* out, const int n);
diff --git a/1d_fd_simple_shear.jl b/julia/1d_fd_simple_shear.jl
diff --git a/1d_fd_simple_shear.png b/julia/1d_fd_simple_shear.png
Binary files differ.
diff --git a/main.c b/main.c
@@ -30,7 +30,7 @@ int main(int argc, char** argv) {
compute_shear_strain_rate_plastic(&sim);
compute_shear_velocity(&sim);
- print_arrays(sim.z, sim.v_x, sim.nz);
+ print_arrays_2nd_normalized(sim.z, sim.v_x, sim.nz);
free_arrays(&sim);
return 0;