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 compute 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-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 # -------------------- Extra stress vs stretch ---------------------------------------------------------------------------------
82 stretch(x) = (length + x) / length
83 nominal(y) = -y / (area*1000) #compression [10⁻⁶ N / mm² = Pa]
84 #nominal(y) = y / (area) #tension
86 set xlabel 'stretch [-]' font 'Verdana,14'
87 set ylabel 'solid nominal stress [kPa]' font 'Verdana,14'
89 set key on box inside top left font 'Verdana,12' spacing 1.0 maxcols 1 width -0.2
91 set xrange [1.0:0.89] reverse #compression
95 set xtics 0.02 rotate by 45 right
100 set output "brain_cube_solid-stress-stretch-poro-COMP.png"
101 plot 'data-for-gnuplot.sol' index 0 using (stretch($7)):(nominal($21)) every 1 with lines ls 1 title '1^{st} cycle', \
102 'data-for-gnuplot.sol' index 1 using (stretch($7)):(nominal($21)) every 1 with lines ls 2 title '2^{nd} cycle', \
103 'data-for-gnuplot.sol' index 2 using (stretch($7)):(nominal($21)) every 1 with lines ls 3 title '3^{rd} cycle'
105 # -------------------- Accumulated exiting fluid vs time --------------------------------------------------------------------------
106 set xrange [] noreverse
107 set yrange [] noreverse
108 set xtics 30 norotate nooffset
114 set xlabel 'time [s]' font 'Verdana,14'
115 set ylabel sprintf("accumulated fluid\n outside the sample [mm^3]") font 'Verdana,14'
119 y_axis(y) = (a=a+y*timestep,a)
121 set output "brain_cube_fluid-time-poro-COMP.png"
122 plot 'data-for-gnuplot.sol' index 0 using ($1):(y_axis($22)) every 1 with lines ls 1 title '1^{st} cycle', \
123 'data-for-gnuplot.sol' index 1 using ($1):(y_axis($22)) every 1 with lines ls 2 title '2^{nd} cycle', \
124 'data-for-gnuplot.sol' index 2 using ($1):(y_axis($22)) every 1 with lines ls 3 title '3^{rd} cycle'
126 # -------------------- Accumulated exiting fluid vs reaction pressure ---------------------------------------------------------------
127 set xlabel 'fluid reaction pressure [kPa]' font 'Verdana,14'
128 set ylabel sprintf("accumulated fluid\n outside the sample [mm^3]") font 'Verdana,14'
129 set key on box outside above right font 'Verdana,12' spacing 1.0 maxcols 1 width -0.2
135 y_axis(y) = (a=a+y*timestep,a)
137 set output "brain_cube_fluid-reac_p-poro-COMP.png"
138 plot 'data-for-gnuplot.sol' index 0 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 1 title '1^{st} cycle', \
139 'data-for-gnuplot.sol' index 1 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 2 title '2^{nd} cycle', \
140 'data-for-gnuplot.sol' index 2 using (-($18)/1000):(y_axis($22)) every 1 with lines ls 3 title '3^{rd} cycle'
142 # -------------------- Pressure and displ. vs time -------------------------------------------------------------------------
143 set term png size 600,380 enhanced font 'Verdana,12'
147 set xtics 30 norotate nooffset
149 set xlabel 'time [s]' font 'Verdana,14'
150 set ylabel 'displacement [mm]' font 'Verdana,14'
151 set y2label 'pressure [kPa]' font 'Verdana,14'
152 set ytics 0.1 nomirror
155 set output "brain_cube_pres-displ-vs-time-poro-COMP.png"
156 plot 'data-for-gnuplot.sol' using ($1):($8)/1000 every 1 with lines ls 5 axes x1y2 title 'pressure at central column', \
157 '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