Skip to content

Commit 36811d9

Browse files
authored
terminal velocity: add docstring to PowerSeries module, simplify code (#1660)
1 parent a84e39a commit 36811d9

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

PySDM/dynamics/terminal_velocity/power_series.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
"""
2-
Power series expression
2+
Power series expression - a simple and mutable power-law (where the coefficients are specified
3+
by the user), which is a form used in many more complex terminal velocity parameterizations
4+
such as Rogers & Yau. This formulation emerges from balancing drag and gravitational forces on
5+
a spherical object, and the power depends on the drag coefficient (and thus the Reynolds number
6+
and flow regime). Rogers and Yau distinguishes different power law parameters for three regimes,
7+
whereas this much simpler formulation applies across the full range of particle sizes.
8+
It is introduced it as a simple option for comparison against bulk methods, think of it as the
9+
terminal-velocity analogue to the Geometric collision kernel.
310
"""
411

512
import numpy as np
613

7-
from PySDM.physics import constants as const
14+
from PySDM.physics import si, constants as const
815

916

1017
class PowerSeries: # pylint: disable=too-few-public-methods
1118
def __init__(self, particulator, *, prefactors=None, powers=None):
12-
si = const.si
1319
self.particulator = particulator
14-
prefactors = prefactors or [2.0e-1 * si.m / si.s / np.sqrt(si.m)]
15-
self.prefactors = np.array(prefactors)
16-
powers = powers or [1 / 6]
17-
self.powers = np.array(powers)
18-
for i, p in enumerate(self.powers):
19-
self.prefactors[i] *= (4 / 3 * const.PI) ** (p)
20-
self.prefactors[i] /= (1 * si.um**3) ** (p)
20+
self.prefactors = np.array(prefactors or [2.0e-1 * si.m / si.s / np.sqrt(si.m)])
21+
self.powers = np.array(powers or [1 / 6])
2122
assert len(self.prefactors) == len(self.powers)
23+
for i, p in enumerate(self.powers):
24+
self.prefactors[i] *= const.PI_4_3**p / si.um ** (3 * p)
2225

2326
def __call__(self, output, radius):
2427
self.particulator.backend.power_series(

0 commit comments

Comments
 (0)