PyFlex  1.0
Riser cross section analysis
test_Slender.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 slenders
17 
18 import numpy as np
19 
20 
21 # noinspection PyUnresolvedReferences
22 class TestSlender(TestCase):
23  def test_initiation(self):
24  errorfraction = 1.0e-6
25  s = slenders.Slender(["5.14e-3"])
26  self.assertIsInstance(s.comp_number, list)
27  self.assertIsInstance(s.fricfac, list)
28  self.assertIsInstance(s.lay_angle, list)
29  self.assertIsInstance(s.layer_radii, list)
30  self.assertIsInstance(s.layergeometry, list)
31  self.assertIsInstance(s.tendon_area, list)
32  self.assertIsInstance(s.typical_curvature, float)
33  self.assertIsInstance(s.typical_tension, float)
34  self.assertIsInstance(s.youngs_modulus, list)
35  self.assertEqual(s.comp_number[0], 0)
36  self.assertAlmostEqual(s.tendon_area[0], 8.299962127078088e-05, s.tendon_area[0] * errorfraction)
37  s = slenders.Slender([["5.14e-3"], ["0.1", "0.15"]], lay_angle=[35])
38  self.assertAlmostEqual(s.lay_angle[0], -s.lay_angle[1], delta=s.lay_angle[0])