PyFlex  1.0
Riser cross section analysis
test_analytical_input.py
Go to the documentation of this file.
1 """Copyright (C) 2016 Joakim A. Taby
2 
3  This program is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program. If not, see <http://www.gnu.org/licenses/>."""
14 from unittest import TestCase
15 
16 import pyflex
17 
18 __author__ = 'jtab'
19 
20 
21 class TestAnalyticalInput(TestCase):
23  inputfile = "test_inputfile.dat"
24  delimiter = "\t"
25  commentchar = "#"
26  errorfraction = 1e-6
27  s = pyflex.analytical_input(inputfile, delimiter, commentchar)
28  # Checking type of object values
29  self.assertIsInstance(s.comp_number, list)
30  self.assertIsInstance(s.fricfac, list)
31  self.assertIsInstance(s.lay_angle, list)
32  self.assertIsInstance(s.layer_radii, list)
33  self.assertIsInstance(s.layergeometry, list)
34  self.assertIsInstance(s.tendon_area, list)
35  self.assertIsInstance(s.typical_curvature, float)
36  self.assertIsInstance(s.typical_tension, float)
37  self.assertIsInstance(s.youngs_modulus, list)
38  # Checking the values themselves
39  self.assertEqual(s.comp_number[0], 51)
40  self.assertEqual(s.comp_number[1], 41)
41  self.assertAlmostEqual(s.fricfac[0], 0.1, delta=0.1 * errorfraction)
42  self.assertAlmostEqual(s.fricfac[1], 0.5, delta=0.5 * errorfraction)
43  self.assertAlmostEqual(s.lay_angle[0], 0.715584993317675, delta=0.715584993317675 * errorfraction)
44  self.assertAlmostEqual(s.lay_angle[1], -0.715584993317675, delta=-0.715584993317675 * errorfraction)
45  self.assertAlmostEqual(s.layer_radii[0], 125.0, delta=125.0)
46  self.assertAlmostEqual(s.layer_radii[1], 123.0, delta=123.0)
47  self.assertAlmostEqual(s.layergeometry[0][0], 5.15, delta=5.15 * errorfraction)
48  self.assertAlmostEqual(s.layergeometry[1][0], 15.0, delta=15.0 * errorfraction)
49  self.assertAlmostEqual(s.layergeometry[1][1], 5.0, delta=5.0 * errorfraction)
50  self.assertAlmostEqual(s.tendon_area[0], 83.3228911548353, delta=83.3228911548353 * errorfraction)
51  self.assertAlmostEqual(s.tendon_area[1], 75.0, delta=75.0 * errorfraction)
52  self.assertAlmostEqual(s.typical_curvature, 1e-5, delta=1e-5 * errorfraction)
53  self.assertAlmostEqual(s.typical_tension, 10.0, delta=10.0)
54  self.assertAlmostEqual(s.youngs_modulus[0], 207, delta=207 * errorfraction)
55  self.assertAlmostEqual(s.youngs_modulus[1], 210, delta=210 * errorfraction)
def analytical_input(inputfile, delimiter, commentchar)
Definition: pyflex.py:18