2 #GNUPLOT file to plot graphs of biomechanical brain tests in Budday et al 2017
3 # **** cycles must be separated in the .sol file by two blank lines ****
4 # UNITS CONSIDERED: g - mm - s
7 # >> show palette colornames
9 #To see line style, line width, etc.:
10 # >> set terminal wxt enhanced dashed
14 set datafile separator ","
15 set term png size 400,300 enhanced font 'Verdana,12'
19 set style line 1 lw 1.5 lc rgb "black" dt 1
20 set style line 2 lw 1.5 lc rgb "blue" dt 1
21 set style line 3 lw 1.5 lc rgb "red" dt 1
22 set style line 4 lw 1.5 lc rgb "dark-turquoise" dt 1
23 set style line 5 lw 1.5 lc rgb "dark-red" dt 1
25 set style line 100 lt 1 lw 1 lc rgb "gray" dt 3
26 set style line 101 lt 1 lw 1 lc rgb "red"
29 set grid xtics ytics ls 100
31 # -------------------- PROBLEM DATA --------------------------------------------------------------------------------------
32 #length of specimen along loading direction to compute stretch [mm]
35 #area of loading surface to computre reaction force [mm²]
36 area = length * length #cube
37 #area = 3.1416 * (length/2) * (length/2) #cylinder
39 #length to compute pressure gradient [mm]
42 #pressure at drained boundary to compute pressure gradient [Pa]
46 #dynamic (shear) fluid viscosity [Pa·s]
48 #effective fluid density [g/mm³]
50 #kinematic fluid viscosity [mm²/s]
53 #time step to compute numerical dissipation [s]
57 # -------------------- Stress vs stretch ---------------------------------------------------------------------------------
58 stretch(x) = (length + x) / length
59 nominal(y) = -y / (area*1000) #compression [10⁻⁶ N / mm² = Pa]
60 #nominal(y) = y / (area) #tension
62 set xlabel 'stretch [-]' font 'Verdana,14'
63 set ylabel 'nominal stress [kPa]' font 'Verdana,14'
65 set key on box inside top left font 'Verdana,12' spacing 1.0 maxcols 1 width -0.2
67 set xrange [1.0:0.89] reverse #compression
71 set xtics 0.02 rotate by 45 right
76 set output "brain_cube_stress-stretch-poro-visco-COMP.png"
77 plot 'data-for-gnuplot.sol' index 0 using (stretch($7)):(nominal($15)) every 1 with lines ls 1 title '1^{st} cycle', \
78 'data-for-gnuplot.sol' index 1 using (stretch($7)):(nominal($15)) every 1 with lines ls 2 title '2^{nd} cycle', \
79 'data-for-gnuplot.sol' index 2 using (stretch($7)):(nominal($15)) every 1 with lines ls 3 title '3^{rd} cycle'
81 # -------------------- Accumulated exiting fluid vs time --------------------------------------------------------------------------
82 set xrange [] noreverse
83 set yrange [] noreverse
84 set xtics 30 norotate nooffset
90 set xlabel 'time [s]' font 'Verdana,14'
91 set ylabel sprintf("accumulated fluid\n outside the sample [mm^3]") font 'Verdana,14'
95 y_axis(y) = (a=a+y*timestep,a)
97 set output "brain_cube_fluid-time-poro-visco-COMP.png"
98 plot 'data-for-gnuplot.sol' index 0 using ($1):(y_axis($22)) every 1 with lines ls 1 title '1^{st} cycle', \
99 'data-for-gnuplot.sol' index 1 using ($1):(y_axis($22)) every 1 with lines ls 2 title '2^{nd} cycle', \
100 'data-for-gnuplot.sol' index 2 using ($1):(y_axis($22)) every 1 with lines ls 3 title '3^{rd} cycle'
102 # -------------------- Accumulated exiting fluid vs reaction pressure ---------------------------------------------------------------
103 set xlabel 'fluid reaction pressure [kPa]' font 'Verdana,14'
104 set ylabel sprintf("accumulated fluid\n outside the sample [mm^3]") font 'Verdana,14'
105 set key on box outside above right font 'Verdana,12' spacing 1.0 maxcols 1 width -0.2
111 y_axis(y) = (a=a+y*timestep,a)
113 set output "brain_cube_fluid-reac_p-poro-visco-COMP.png"
114 plot 'data-for-gnuplot.sol' index 0 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 1 title '1^{st} cycle', \
115 'data-for-gnuplot.sol' index 1 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 2 title '2^{nd} cycle', \
116 'data-for-gnuplot.sol' index 2 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 3 title '3^{rd} cycle'
118 # -------------------- Pressure and displ. vs time -------------------------------------------------------------------------
119 set term png size 600,380 enhanced font 'Verdana,12'
123 set xtics 30 norotate nooffset
125 set xlabel 'time [s]' font 'Verdana,14'
126 set ylabel 'displacement [mm]' font 'Verdana,14'
127 set y2label 'pressure [kPa]' font 'Verdana,14'
128 set ytics 0.1 nomirror
131 set output "brain_cube_pres-displ-vs-time-poro-visco-COMP.png"
132 plot 'data-for-gnuplot.sol' using ($1):($8)/1000 every 1 with lines ls 5 axes x1y2 title 'pressure at central column', \
133 'data-for-gnuplot.sol' using ($1):($7) every 1 with lines ls 4 axes x1y1 title 'vertical displacement of top surface'
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams