1 """Copyright (C) 2016 Joakim A. Taby 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. 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. 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
23 """ testing the coefficients module 28 alpha = np.array([-86.1*np.pi/180, 87.6*np.pi/180, 30.0*np.pi/180, -30.0*np.pi/180])
29 R = np.array([ 108.1e-3, 113e-3, 118.2e-3, 124.6e-3])
30 A = np.array([ 218.7e-6, 45.3e-6, 60e-6, 60e-6])
31 n = np.array([ 2, 2, 50, 53])
34 t = np.array([4.0e-3,4.0e-3,5.0e-3,5.0e-3])
35 sigma=np.array([[ 3.45189159e+08, 3.30322233e+08, 3.16835196e+08, 3.12779821e+08],
36 [ 3.37408352e+08, 3.22703186e+08, 3.58052949e+08, 3.54092508e+08],
37 [ -7.78080666e+06, -7.61904752e+06, 4.12177525e+07, 4.13126878e+07],
38 [ 3.74934599e+08, 3.58683549e+08, 3.72876786e+08, 3.68474047e+08],
39 [ 5.38704293e+08, 5.15502879e+08, 4.94454927e+08, 4.88126084e+08]])
42 equality_test=np.allclose(contactforce1,
43 [[ 4.70708766e+07, 1.57487585e+07, 6.38244872e+06, 3.02105496e+06],
44 [ 4.70708766e+07, 1.64120719e+07, 7.21908279e+06, 3.42008293e+06],
45 [ 3.69746936e-04, 6.63313434e+05, 8.36634074e+05, 3.99027981e+05],
46 [ 5.17575871e+07, 1.77110161e+07, 7.51513247e+06, 3.55899030e+06],
47 [ 7.34590952e+07, 2.45776079e+07, 9.96048816e+06, 4.71467668e+06]])
50 self.assertTrue(equality_test)
52 equality_test=np.allclose(contactforce2,
53 [[3.69746936e-04, 6.63313434e+05, 8.36634074e+05, 3.99027981e+05]])
54 self.assertTrue(equality_test)
58 errorfraction = 1.0e-6
60 lay_angle=[35, 45], layer_radii=[1, 2], comp_number=[1, 1])
62 contactforce = np.array([9, 19])
64 frictionfactors=np.array([0.1]))
65 self.assertAlmostEqual(critcurv.max(), 0.0, delta=errorfraction)
68 lay_angle=[45], layer_radii=[1, 2], comp_number=[1, 1])
70 frictionfactors=np.array([0.1]))
71 equality_test = np.allclose(critcurv, np.array([9.55146349e-14 - 1.21781917e-13]))
72 self.assertTrue(equality_test)
74 tens = np.array([5000])
77 comp_number=[51, 46], youngs_modulus=[210.0e9],
78 fric_fac=0.15, layer_radii=[46.925e-3, 41.775e-3])
79 contactforce = np.array([8399.06251, 15250.90005])
81 equality_test = np.allclose(critcurv, [ 1.08610516e-05, 7.00385091e-06])
82 self.assertTrue(equality_test)
86 bendcoeff = coefficients.local_bending_sympy(s)
87 self.assertEqual(len(bendcoeff[0]), 4)
92 comp_number=[51, 46], youngs_modulus=[210.0e9])
94 np.arange(0, 2 * np.pi, 2 * np.pi / 16).reshape(-1, 1),
95 np.arange(0, 2 * np.pi, 2 * np.pi / 16),
96 s.youngs_modulus, bend_model=
"tan")
97 self.assertEqual(np.max(np.max(bendcoeff[0])), 540750000.0)
99 np.arange(0, 2 * np.pi, 2 * np.pi / 16).reshape(-1, 1),
100 np.arange(0, 2 * np.pi, 2 * np.pi / 16),
102 self.assertAlmostEqual(np.max(np.max(bendcoeff[0])), 567579730.86247504, delta=0.0001)
105 t_eff = np.array([0.0, 220.6e3, 220.6e3, 131.1e3, 0])
106 p_int =np.array([46.2e6, 46.2e6, 0.0, 50.8e6, 72.1e6])
107 p_ext = np.array([ 0.0, 0.0, 0.0 , 0.0, 0.0])
109 alpha = np.array([-86.1*np.pi/180, 87.6*np.pi/180, 30.0*np.pi/180, -30.0*np.pi/180])
110 R = np.array([ 108.1e-3, 113e-3, 118.2e-3, 124.6e-3])
111 thick = np.array([ 0.0, 0.0, 0.0, 0.0])
112 A = np.array([ 218.7e-6, 45.3e-6, 60e-6, 60e-6])
113 E = np.array([ 200.0e9, 200.0e9, 200.0e9, 200.0e9])
114 n = np.array([ 2, 2, 50, 53])
117 equality_test = np.allclose(stresshist,
118 np.array([[ 3.45189159e+08, 3.30322233e+08, 3.16835196e+08, 3.12779821e+08],
119 [ 3.37408352e+08, 3.22703186e+08, 3.58052949e+08, 3.54092508e+08],
120 [ -7.78080666e+06, -7.61904752e+06, 4.12177525e+07, 4.13126878e+07],
121 [ 3.74934599e+08, 3.58683549e+08, 3.72876786e+08, 3.68474047e+08],
122 [ 5.38704293e+08, 5.15502879e+08, 4.94454927e+08, 4.88126084e+08]]))
123 self.assertTrue(equality_test)
126 curvhist = (-0.5 + np.random.random([15, 2])) * 0.05
128 s =
slenders.Slender([[5.15e-3 / 2.0, 10e-3], [5.15e-3 / 2.0, 10e-3]], lay_angle=[20],
129 comp_number=[51, 46], youngs_modulus=[210.0e9])
131 nphi=16, bend_model=
"tan")
132 self.assertEqual(stresshist[0].shape, (15, 8, 4))
135 comp_number=[51, 46], youngs_modulus=[210.0e9])
137 nphi=8, bend_model=
"tan")
138 self.assertEqual(stresshist[0].shape, (15, 8, 8))
140 curvhist = np.array([[1, 0], [0, 1]])
143 self.assertEqual(stresshist[0][0, 0, 0], stresshist[1][1, 2, 0])
def local_bending(thickness, width, alpha, theta, phi, e, r, type, bend_model="Savik")
def analytical_contact_pressures(sigma, alpha, n, A, R, t, p_int, p_ext)
def test_critical_curvature(self)
def test_bendingstresshist(self)
def test_local_bending_sympy(self)
def bending_stress_history(slenderobject, curvhist, ntheta=16, nphi=16, bend_model="Savik")
def test_tensstresshist(self)
def test_analytical_contact_pressures(self)
def test_local_bending(self)
def tension_stress_history(t_eff, p_int, p_ext, alpha, R, thick, A, E, n)
def critical_curvature(slenderobject, contact_pressure, frictionfactors=np.array([5, 5, 5]))