-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_rg2014.py
49 lines (42 loc) · 1.48 KB
/
test_rg2014.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
from tests.base_test import BaseTest
from rg_dst_umf import calc_beta, calc_t_e
class RG2014TestCase(BaseTest):
"""
Tests to ensure correct implementation of RG splashing model.
Reference values where calculated with great care using
analytical expressions and Mathematica.
Test examples are found in `BaseTest` class.
"""
def test_t_e(self):
""" Test that ejection time is calculated correctly and respects high Oh limit """
# Test single drop impact
np.testing.assert_almost_equal(calc_t_e(self.x_vector), 0.00792398)
# Test list of drop impacts
np.testing.assert_array_almost_equal(
calc_t_e(self.x_matrix),
np.array([
0.00792398,
0.0147641,
0.00792398,
0.0147641,
0.0467184, # High Oh limit
0.0660698, # High Oh limit
])
)
def test_beta(self):
""" Test that splashing factor beta is calculated correctly """
# Test single drop impact
np.testing.assert_almost_equal(calc_beta(self.x_vector), 0.2367353239)
# Test list of drop impacts
np.testing.assert_array_almost_equal(
calc_beta(self.x_matrix),
np.array([
0.2367353239,
0.158211258,
0.1308765051,
0.1003368678,
0.3683646504,
0.216364554,
])
)