tAdded error handling if visualization method is called with empty self.radius … | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 874be72bf7a0fa969d777e4ad5e24061e6c7047a | |
parent 5b0fa442b5e122f0f574ba1f14b1c9fc83c5f601 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 31 Mar 2014 13:39:23 +0200 | |
Added error handling if visualization method is called with empty self.radius | |
Diffstat: | |
M python/sphere.py | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/python/sphere.py b/python/sphere.py | |
t@@ -4191,6 +4191,9 @@ class sim: | |
# dilation in number of mean particle diameters | |
d_bar = numpy.mean(self.radius)*2.0 | |
+ if numpy.isnan(d_bar): | |
+ raise Exception("Error, d_bar is NaN. Please check that th… | |
+ + " radii are initialized.") | |
dilation[i] = (sb.w_x[0] - w_x0)/d_bar | |
# Test if this was the max. shear stress | |
t@@ -4218,7 +4221,8 @@ class sim: | |
ax2 = plt.subplot2grid((2,1),(1,0)) | |
ax2.set_xlabel('Shear strain [-]') | |
#ax2.set_ylabel('Dilation [m]') | |
- ax2.set_ylabel('Dilation [%]') | |
+ #ax2.set_ylabel('Dilation [%]') | |
+ ax2.set_ylabel('Dilation, $\Delta h/(2\\bar{r})$ [m]') | |
ax2.plot(xdisp/w_x0, dilation, '+-') | |
ax2.grid() | |