tadd methods to set damping and show ratio to critical value - 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 2ab7999778e52cdc6d2f2de30200439705627042
(DIR) parent 26b198fb064b787573cbc94563dfb1e9f2365fe2
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Fri, 20 Jun 2014 13:53:39 +0200
add methods to set damping and show ratio to critical value
Diffstat:
M python/shortening.py | 11 ++---------
M python/sphere.py | 54 +++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/python/shortening.py b/python/shortening.py
t@@ -82,13 +82,8 @@ sim.g[0] = 0
sim.g[1] = -9.81
sim.g[2] = 0
-sim.gamma_wn[0] = 1.0e4
-sim.mu_ws[0] = 0.0
-sim.mu_wd[0] = 0.0
-
-sim.gamma_n[0] = 1.0e2
-sim.mu_s[0] = 0.0
-sim.mu_d[0] = 0.0
+sim.setDampingNormal(1.0e4)
+sim.setDampingTangential(1.0e4)
sim.periodicBoundariesX()
sim.uniaxialStrainRate(wvel = 0.0)
t@@ -102,7 +97,6 @@ sim.run()
sim.writeVTKall()
-'''
## Shortening
sim = sphere.sim('shortening-relaxation', nw=1)
sim.readlast()
t@@ -129,4 +123,3 @@ sim.uniaxialStrainRate(wvel = -compressional_strain*Lx/sim.time_total[0])
sim.run(dry=True)
sim.run()
sim.writeVTKall()
-'''
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -2609,6 +2609,38 @@ class sim:
# Debonding distance
self.db[0] = (1.0 + theta/2.0) * self.V_b**(1.0/3.0)
+ def setDampingNormal(self, gamma):
+ '''
+ Set the dampening coefficient (gamma) in the normal direction of the
+ particle-particle contact model. The function will print the fraction
+ between the chosen damping and the critical damping value.
+
+ :param gamma: The viscous damping constant [N/(m/s)]
+ :type gamma: float
+
+ :see also:`func:setDampingTangential(gamma)`
+ '''
+ self.gamma_n[0] = gamma
+ gamma_crit = 2.0*numpy.sqrt(self.smallestMass() * self.k_n[0])
+ print('Info: The chosen normal damping is ' + str(gamma/gamma_crit)
+ + ' the critical damping value.')
+
+ def setDampingTangential(self, gamma):
+ '''
+ Set the dampening coefficient (gamma) in the tangential direction of the
+ particle-particle contact model. The function will print the fraction
+ between the chosen damping and the critical damping value.
+
+ :param gamma: The viscous damping constant [N/(m/s)]
+ :type gamma: float
+
+ :see also:`func:setDampingNormal(gamma)`
+ '''
+ self.gamma_t[0] = gamma
+ gamma_crit = 2.0*numpy.sqrt(self.smallestMass() * self.k_t[0])
+ print('Info: The chosen tangential damping is ' + str(gamma/gamma_crit)
+ + ' the critical damping value.')
+
def bond(self, i, j):
'''
Create a bond between particles with index i and j
t@@ -2686,6 +2718,28 @@ class sim:
'''
return self.rho[0]*self.volume(idx)
+ def smallestMass(self):
+ '''
+ Returns the mass of the leightest particle.
+
+ :param idx: Particle index
+ :type idx: int
+ :returns: The mass of the particle [kg]
+ :return type: float
+ '''
+ return V_sphere(numpy.min(self.radius))
+
+ def largestMass(self):
+ '''
+ Returns the mass of the heaviest particle.
+
+ :param idx: Particle index
+ :type idx: int
+ :returns: The mass of the particle [kg]
+ :return type: float
+ '''
+ return V_sphere(numpy.max(self.radius))
+
def momentOfInertia(self, idx):
'''
Returns the moment of inertia of a particle.