PySDM_examples.Arabas_et_al_2015.spin_up

 1from PySDM.dynamics import Collision, Displacement
 2
 3
 4class SpinUp:
 5    def __init__(self, particulator, spin_up_steps):
 6        self.spin_up_steps = spin_up_steps
 7        particulator.observers.append(self)
 8        self.particulator = particulator
 9        self.set(Collision, "enable", False)
10        self.set(Displacement, "enable_sedimentation", False)
11
12    def notify(self):
13        if self.particulator.n_steps == self.spin_up_steps:
14            self.set(Collision, "enable", True)
15            self.set(Displacement, "enable_sedimentation", True)
16
17    def set(self, dynamic, attr, value):
18        key = dynamic.__name__
19        if key in self.particulator.dynamics:
20            setattr(self.particulator.dynamics[key], attr, value)
class SpinUp:
 5class SpinUp:
 6    def __init__(self, particulator, spin_up_steps):
 7        self.spin_up_steps = spin_up_steps
 8        particulator.observers.append(self)
 9        self.particulator = particulator
10        self.set(Collision, "enable", False)
11        self.set(Displacement, "enable_sedimentation", False)
12
13    def notify(self):
14        if self.particulator.n_steps == self.spin_up_steps:
15            self.set(Collision, "enable", True)
16            self.set(Displacement, "enable_sedimentation", True)
17
18    def set(self, dynamic, attr, value):
19        key = dynamic.__name__
20        if key in self.particulator.dynamics:
21            setattr(self.particulator.dynamics[key], attr, value)
SpinUp(particulator, spin_up_steps)
 6    def __init__(self, particulator, spin_up_steps):
 7        self.spin_up_steps = spin_up_steps
 8        particulator.observers.append(self)
 9        self.particulator = particulator
10        self.set(Collision, "enable", False)
11        self.set(Displacement, "enable_sedimentation", False)
spin_up_steps
particulator
def notify(self):
13    def notify(self):
14        if self.particulator.n_steps == self.spin_up_steps:
15            self.set(Collision, "enable", True)
16            self.set(Displacement, "enable_sedimentation", True)
def set(self, dynamic, attr, value):
18    def set(self, dynamic, attr, value):
19        key = dynamic.__name__
20        if key in self.particulator.dynamics:
21            setattr(self.particulator.dynamics[key], attr, value)