tadd function for particle surface area - 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 650db723c333740a197689e865e8a2302278078d
(DIR) parent 7cb426cb6a266a898a9f0a60ffe2a7bcb4f4ca3b
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Fri, 24 Apr 2015 02:03:53 +0200
add function for particle surface area
Diffstat:
M python/sphere.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -3798,6 +3798,17 @@ class sim:
else:
raise Exception('Normal stress type ' + type + ' not understood')
+ def surfaceArea(self, idx):
+ '''
+ Returns the surface area of a particle.
+
+ :param idx: Particle index
+ :type idx: int
+ :returns: The surface area of the particle [m^2]
+ :return type: float
+ '''
+ return 4.0*numpy.pi*self.radius[idx]**2
+
def volume(self, idx):
'''
Returns the volume of a particle.
t@@ -3808,7 +3819,7 @@ class sim:
:return type: float
'''
return V_sphere(self.radius[idx])
-
+
def mass(self, idx):
'''
Returns the mass of a particle.
t@@ -7272,7 +7283,6 @@ def cleanup(sim):
subprocess.call("rm -f ../output/" + sim.sid + "-conv.png", shell=True)
subprocess.call("rm -f ../output/" + sim.sid + "-conv.log", shell=True)
-
def V_sphere(r):
'''
Calculates the volume of a sphere with radius r