def setUp(self): m = TransverseIsotropicPlyMaterial(name='IMA_M21E_MG', E11=154000., E22=8500., G12=4200., nu12=0.35, t=0.127, a11t=0.15e-6, a22t=28.7e-6, F11t=2000., F11c=1000., F22t=50., F22c=200., F12s=100.) #sseq = [(a, m) for a in [45,-45,0,90,0,90,0,-45,45]] sseq = [(a, m) for a in [-30, 90, 30, -30, 30, 30, -30, 30, 90, -30]] self.lam = Laminate(sseq) self.mlam = MembraneLaminate(sseq) self.load6 = np.array([-100, -50, 34, -21, 56, 63]) self.load3 = np.array([-100, 0, 0]) self.dtemp = -160
class GenericTest: half_sseq = NotImplemented # to be defined on subclass em_desired = 52900 # membrane modulus, same for all ef_desired = NotImplemented # to be defined on subclass def setUp(self): ss = make_symm_stacking(self.half_sseq, MAT) self.lam = Laminate(ss) def test_symm(self): self.assertTrue(self.lam.is_symmetric()) def test_em(self): em_actual = self.lam.Ex() delta = abs(em_actual - self.em_desired) / self.em_desired print(em_actual, self.ef_desired, delta) self.assertLessEqual(delta, TOL) def test_ef(self): ef_actual = self.lam.Exf() delta = abs(ef_actual - self.ef_desired) / self.ef_desired print(ef_actual, self.ef_desired, delta) self.assertLessEqual(delta, TOL)
class TestProgressiveFailure(unittest.TestCase): def setUp(self): m = TransverseIsotropicPlyMaterial(name='IMA_M21E_MG', E11=154000., E22=8500., G12=4200., nu12=0.35, t=0.127, a11t=0.15e-6, a22t=28.7e-6, F11t=2000., F11c=1000., F22t=50., F22c=200., F12s=100.) #sseq = [(a, m) for a in [45,-45,0,90,0,90,0,-45,45]] sseq = [(a, m) for a in [-30, 90, 30, -30, 30, 30, -30, 30, 90, -30]] self.lam = Laminate(sseq) self.mlam = MembraneLaminate(sseq) self.load6 = np.array([-100, -50, 34, -21, 56, 63]) self.load3 = np.array([-100, 0, 0]) self.dtemp = -160 def test_A(self): print(self.lam.A()) def test_solution(self): sol = self.lam.get_linear_response([100, 0, 0, 0, 0, 0], self.dtemp) print(sol.eps_kappa()) def test_flex_hashina(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'Hashin A') def test_flex_hashinb(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'Hashin B') def test_flex_Puck(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'Puck') def test_flex_modpuck(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'ModPuck') def test_flex_puckC(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'Puck C') def test_flex_maxstress(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'MaxStress') def test_flex_maxstrain(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'MaxStrain') def test_flex_airbus(self): plainstrength.failure_analysis_c(self.lam, self.load6, self.dtemp, 'Airbus') def test_memb_hashina(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'Hashin A') def test_memb_hashinb(self): r, hist = plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'Hashin B') print(r, hist) def test_memb_puck(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'Puck') def test_memb_modpuck(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'ModPuck') def test_memb_puckC(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'Puck C') def test_memb_maxstress(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'MaxStress') def test_memb_maxstrain(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'MaxStrain') def test_memb_airbus(self): plainstrength.failure_analysis_c(self.mlam, self.load3, self.dtemp, 'Airbus')
def setUp(self): self.lam = Laminate(SSEQ) load = np.zeros(6) self.dtemp = -160 self.sol = self.lam.get_linear_response(load, self.dtemp)
class MTS006_ExampleV93(unittest.TestCase): def setUp(self): self.lam = Laminate(SSEQ) load = np.zeros(6) self.dtemp = -160 self.sol = self.lam.get_linear_response(load, self.dtemp) def test_a(self): """Verify the laminate stiffness matrix.""" expect = np.array([[55580, 16420, 0], [16420, 55580, 0], [0, 0, 19560]]) result = self.lam.A() assert_allclose(result, expect, atol=20) def test_ntunit(self): """Test the unit thermal forces.""" expect = 10 * np.array([6.232e-3, 6.232e-3, 0, 0, 0, 0]) result = self.lam.thermal_force(1) assert_allclose(result, expect[:3], atol=1e-4) def test_mtunit(self): """Test the unit thermal forces.""" expect = 10 * np.array([6.232e-3, 6.232e-3, 0, 0, 0, 0]) result = self.lam.thermal_moment(1) assert_allclose(result, expect[3:], atol=1e-4) def test_global_deformation(self): """Verify global strains and curvatures, eps_0 and kappa.""" expect = np.array([-138.5, -138.5, 0, 0, 0, 0]) # microstrains result = self.sol.eps_kappa() * 1e6 assert_allclose(result, expect, atol=0.2) def test_stress_0(self): """Verify total stresses in 0 deg layer.""" expect = np.array([-28.8, 28.8, 0]) # MPa result = self.sol.sigma_l(self.lam.layers[0]) assert_allclose(result, expect, atol=0.1) def test_stress_45(self): layer = self.lam.layers[1] expect = self.sol.sigma_l(layer) result = self.sol.sigma_l_r(layer) assert_allclose(expect, result, atol=1e-6) def test_strain_45(self): layer = self.lam.layers[1] expect = self.sol.eps_l(layer) result = self.sol.eps_l_r(layer) assert_allclose(expect, result, atol=1e-6) def test_stress_m45(self): layer = self.lam.layers[5] expect = self.sol.sigma_l(layer) result = self.sol.sigma_l_r(layer) assert_allclose(expect, result, atol=1e-6) def test_strain_m45(self): layer = self.lam.layers[5] expect = self.sol.eps_l(layer) result = self.sol.eps_l_r(layer) assert_allclose(expect, result, atol=1e-6) def test_stress_90(self): layer = self.lam.layers[3] expect = self.sol.sigma_l(layer) result = self.sol.sigma_l_r(layer) assert_allclose(expect, result, atol=1e-6) def test_strain_90(self): layer = self.lam.layers[3] expect = self.sol.eps_l(layer) result = self.sol.eps_l_r(layer) assert_allclose(expect, result, atol=1e-6)
def setUp(self): ss = make_symm_stacking(self.half_sseq, MAT) self.lam = Laminate(ss)