def test_laminate_applied_force_for_laminae_midplane_stress(self):
     """Apply a force to a laminate and determine the midplane stresses 
           of the laminae in the laminate.
           
         'Fiber-Reinforced Composites' by Mallick (3rd edition), 
             Example 3.13
             
         Test will look at the midplane stresses of the two laminae in
         the laminate.
     """
     
     ply = Ply(E1=133.4e9, E2=8.78e9, nu12=0.26, G12=3.254e9, h=0.006)   # h is in [mm]
     
     laminae_pos45 = Laminae(ply=ply, theta_rad=(45.0*np.pi/180.0))
     laminae_neg45 = Laminae(ply=ply, theta_rad=(-45.0*np.pi/180.0))
     
     laminae_list = [laminae_pos45, laminae_neg45]
     laminate = Laminate(laminae_list)
     
     N = np.matrix.transpose(np.matrix([100.0e3, 0.0, 0.0]));    # N[0] is in [N/m]
     M = np.matrix.transpose(np.matrix([0.0, 0.0, 0.0]));
     strain_dictionary = laminate.applied_stress(N,M)
     
     Epsilon = strain_dictionary['Epsilon']
     Kappa = strain_dictionary['Kappa']
     
     laminae_midplane_strains = laminate.laminae_midplane_strain(Epsilon, Kappa)  
     
     laminae_midplane_stresses = laminate.laminae_stress(Epsilon, Kappa)
     
     laminae_midplane_stress_expected = np.power(10.0,6.0)*np.matrix.transpose(np.matrix([8.33, 0.0, 2.09]))
     self.assertMatrixAlmostEqualPercent(laminae_midplane_stresses[0],laminae_midplane_stress_expected)
     
     laminae_midplane_stress_expected = np.power(10.0,6.0)*np.matrix.transpose(np.matrix([8.33, 0.0, -2.09]))
     self.assertMatrixAlmostEqualPercent(laminae_midplane_strains[1],laminae_midplane_stress_expected)
 def test_laminate_applied_force_for_strains(self):
     """Apply a force and calculate the resultant laminate midplane strains.
     
         'Fiber-Reinforced Composites' by Mallick (3rd edition), 
             Example 3.13
             
         Test will check that the resultant strains match the expected 
         strains from example 3.13 with a maximum normalized error of
         2 decimal places (< 1% error)
     """
     
     ply = Ply(E1=133.4e9, E2=8.78e9, nu12=0.26, G12=3.254e9, h=0.006)   # h is in [mm]
     
     laminae_pos45 = Laminae(ply=ply, theta_rad=(45.0*np.pi/180.0))
     laminae_neg45 = Laminae(ply=ply, theta_rad=(-45.0*np.pi/180.0))
     
     laminae_list = [laminae_pos45, laminae_neg45]
     laminate = Laminate(laminae_list)
     
     N = np.matrix.transpose(np.matrix([100.0e3, 0.0, 0.0]));    # N[0] is in [N/m]
     M = np.matrix.transpose(np.matrix([0.0, 0.0, 0.0]));
     strain_dictionary = laminate.applied_stress(N,M)
     
     Epsilon = strain_dictionary['Epsilon']
     Kappa = strain_dictionary['Kappa']
     
     Epsilon_expected = np.matrix.transpose(np.matrix([77.385e-5, -50.715e-5, 0.0]))
     Kappa_expected = np.matrix.transpose(np.matrix([0.0, 0.0, 0.060354]))
     
     Epsilon_diff_norm_max = np.nanmax(np.abs(Epsilon_expected -Epsilon)/Epsilon)
     Kappa_diff_norm_max = np.nanmax(np.abs(Kappa_expected -Kappa)/Kappa)
     
     max_norm_diff = np.nanmax([Epsilon_diff_norm_max, Kappa_diff_norm_max])
     
     self.assertAlmostEqual(max_norm_diff,0.0,places=2)