| timprove functionality for determining shear stresses - sphere - GPU-based 3D d… | |
| git clone git://src.adamsgaard.dk/sphere | |
| Log | |
| Files | |
| Refs | |
| LICENSE | |
| --- | |
| commit af3ff5f94fe8c7134db7b7e7614fa7759368cacb | |
| parent 69c1afc4ac0f4239d9f3b875c96a2962fae2076a | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Tue, 24 Feb 2015 10:51:51 +0100 | |
| improve functionality for determining shear stresses | |
| Diffstat: | |
| M python/sphere.py | 27 +++++++++++++++++++-------- | |
| 1 file changed, 19 insertions(+), 8 deletions(-) | |
| --- | |
| diff --git a/python/sphere.py b/python/sphere.py | |
| t@@ -5793,24 +5793,35 @@ class sim: | |
| ''' | |
| self.ndem = numpy.asarray(ndem) | |
| - def shearStress(self): | |
| + def shearStress(self, type='effective'): | |
| ''' | |
| Calculates the sum of shear stress values measured on any moving | |
| particles with a finite and fixed velocity. | |
| + :param type: Find the 'defined' or 'effective' (default) shear stress | |
| + :type type: str | |
| + | |
| :returns: The shear stress in Pa | |
| :return type: numpy.array | |
| ''' | |
| - fixvel = numpy.nonzero(self.fixvel > 0.0) | |
| - force = numpy.zeros(3) | |
| + if type == 'defined': | |
| + return self.w_tau_x[0] | |
| - # Summation of shear stress contributions | |
| - for i in fixvel[0]: | |
| - if self.vel[i,0] > 0.0: | |
| - force += -self.force[i,:] | |
| + elif type == 'effective': | |
| - return force/(self.L[0]*self.L[1]) | |
| + fixvel = numpy.nonzero(self.fixvel > 0.0) | |
| + force = numpy.zeros(3) | |
| + | |
| + # Summation of shear stress contributions | |
| + for i in fixvel[0]: | |
| + if self.vel[i,0] > 0.0: | |
| + force += -self.force[i,:] | |
| + | |
| + return force/(self.L[0]*self.L[1]) | |
| + | |
| + else: | |
| + raise Exception('Shear stress type ' + type + ' not understood') | |
| def visualize(self, method='energy', savefig=True, outformat='png', |