tadjust xlimits in plots - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit f34daf137fe86ec9eb9b4b446f58b200f9e159d6
(DIR) parent f9d94ab1d001ee9827d0cb9ef9910c5b43d93f30
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Mon, 16 Feb 2015 13:21:48 +0100
adjust xlimits in plots
Diffstat:
M python/halfshear-darcy-strength-di… | 7 +++++--
M python/sphere.py | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/python/halfshear-darcy-strength-dilation-rate.py b/python/halfshear-darcy-strength-dilation-rate.py
t@@ -209,14 +209,17 @@ ax1.legend(loc='upper right', prop={'size':18}, fancybox=True,
#ax4.legend(loc='best', prop={'size':18}, fancybox=True,
#framealpha=legend_alpha)
-ax1.set_xlim([0.0, 0.2])
+ax1.set_xlim([0.0, 0.09])
+ax2.set_xlim([0.0, 0.09])
+#ax2.set_xlim([0.0, 0.2])
+
ax1.set_ylim([-7, 45])
-ax2.set_xlim([0.0, 0.2])
ax2.set_ylim([0.0, 0.8])
#ax1.set_ylim([0.0, 1.0])
if pressures:
#ax3.set_ylim([-1400, 900])
ax3.set_ylim([-490, 490])
+ ax3.set_xlim([0.0, 0.09])
plt.tight_layout()
plt.subplots_adjust(hspace=0.05)
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -6139,13 +6139,26 @@ class sim:
ax = plt.subplot(1,1,1)
pres /= 1000.0 # Pa to kPa
+
+ if xlim:
+ sb.readstep(10,verbose=False)
+ gamma_per_i = sb.shearStrain()/10.0
+ i_min = int(xlim[0]/gamma_per_i)
+ i_max = int(xlim[1]/gamma_per_i)
+ pres = pres[:,i_min:i_max]
+ else:
+ i_min = 0
+ i_max = sb.status()
# use largest difference in p from 0 as +/- limit on colormap
+ print i_min, i_max
p_ext = numpy.max(numpy.abs(pres))
if sb.wmode[0] == 3:
x = t
else:
x = shear_strain
+ if xlim:
+ x = x[i_min:i_max]
im1 = ax.pcolormesh(
x, zpos_c, pres,
cmap=matplotlib.cm.get_cmap('bwr'),
t@@ -6167,13 +6180,12 @@ class sim:
#ax.set_title(sb.id())
if xlim:
- ax.set_xlim(xlim)
+ ax.set_xlim([x[0], x[-1]])
cb = plt.colorbar(im1)
cb.set_label('$p_\\text{f}$ [kPa]')
cb.solids.set_rasterized(True)
plt.tight_layout()
- plt.subplots_adjust(wspace = .05)
elif method == 'porosity':