示例#1
0
def test_Sim_ass_3():
	#####From assignment 3####
	laminate_q1 = Laminate('p10/90/0_2/p50s',
                       materialID = 1)
	laminate_q1.compute_all()
	load = numpy.array([450000,-110000,-130000],dtype=float)
	load = load*10**-6
	off_stress_norm = load*10**-3
	off_strain = laminate_q1.a.dot(off_stress_norm).reshape((3,1))
	on_strain = numpy.empty((14,3))
	on_stress = numpy.empty((14,3))
	for i in range(14):
		layer = laminate_q1.layers[i]
		on_strain[i,:] = transform_strain(off_strain,'off',layer.theta)
		on_stress[i,:] = laminate_q1.layers[0].Q_on.dot(on_strain[i,:])
	######
	######From new Sim####
	#####
	my_sim = Sim(layup = 'p10/90/0_2/p50s', materialID = 1)
	my_sim.apply_N(numpy.array([[0.4500],[-0.1100],[-0.1300]])*ureg.MNperm)
	my_sim.solve()
	sim_off_strain = numpy.vstack(my_sim.off_strain)
	sim_on_strain = numpy.vstack(my_sim.on_strain)
	sim_on_stress = numpy.vstack(my_sim.on_stress)
	# sim_off_stress = numpy.vstack(my_sim.off_stress)
	for row in sim_off_strain:
		# print row
		array_assert_error(row,off_strain,tol = 0.001)
	# for row in sim_on_strain:
	# 	array_assert_error(row,on_strain,tol=0.001)
	array_assert(sim_on_strain[0::2,:],on_strain,precision = 10)
	array_assert(sim_on_strain[1::2,:],on_strain,precision = 10)
	array_assert(sim_on_stress[0::2,:],on_stress,precision = 10)
	array_assert(sim_on_stress[1::2,:],on_stress,precision = 10)
示例#2
0
def test_Sim_ass_3():
    #####From assignment 3####
    laminate_q1 = Laminate('p10/90/0_2/p50s', materialID=1)
    laminate_q1.compute_all()
    load = numpy.array([450000, -110000, -130000], dtype=float)
    load = load * 10**-6
    off_stress_norm = load * 10**-3
    off_strain = laminate_q1.a.dot(off_stress_norm).reshape((3, 1))
    on_strain = numpy.empty((14, 3))
    on_stress = numpy.empty((14, 3))
    for i in range(14):
        layer = laminate_q1.layers[i]
        on_strain[i, :] = transform_strain(off_strain, 'off', layer.theta)
        on_stress[i, :] = laminate_q1.layers[0].Q_on.dot(on_strain[i, :])
    ######
    ######From new Sim####
    #####
    my_sim = Sim(layup='p10/90/0_2/p50s', materialID=1)
    my_sim.apply_N(numpy.array([[0.4500], [-0.1100], [-0.1300]]) * ureg.MNperm)
    my_sim.solve()
    sim_off_strain = numpy.vstack(my_sim.off_strain)
    sim_on_strain = numpy.vstack(my_sim.on_strain)
    sim_on_stress = numpy.vstack(my_sim.on_stress)
    # sim_off_stress = numpy.vstack(my_sim.off_stress)
    for row in sim_off_strain:
        # print row
        array_assert_error(row, off_strain, tol=0.001)
    # for row in sim_on_strain:
    # 	array_assert_error(row,on_strain,tol=0.001)
    array_assert(sim_on_strain[0::2, :], on_strain, precision=10)
    array_assert(sim_on_strain[1::2, :], on_strain, precision=10)
    array_assert(sim_on_stress[0::2, :], on_stress, precision=10)
    array_assert(sim_on_stress[1::2, :], on_stress, precision=10)
示例#3
0
def test_smart_q_s_on_uniform():
    my_smart = Laminate('90_2/p40/p20/0s', 2)
    my_smart.compute_all(method='smart')

    Q_on_0 = my_smart.layers[0].Q_on
    S_on_0 = my_smart.layers[0].S_on
    for layer in my_smart.layers:
        array_assert(layer.Q_on, Q_on_0)
        array_assert(layer.S_on, S_on_0)
示例#4
0
def test_smart_q_s_on_uniform():
	my_smart = Laminate('90_2/p40/p20/0s',2)
	my_smart.compute_all(method='smart')

	Q_on_0 = my_smart.layers[0].Q_on
	S_on_0 = my_smart.layers[0].S_on
	for layer in my_smart.layers:
		array_assert(layer.Q_on, Q_on_0)
		array_assert(layer.S_on,S_on_0)
示例#5
0
def test_quasi_isotropic():
    import numpy
    my_lam = Laminate('0/p60s', 1)
    my_lam.compute_all()

    A = my_lam.A_vec
    array_assert(A[0], A[1])
    array_assert(A[-1], 0.0)
    array_assert(A[-2], 0.0)
    array_assert((A[0] - A[2]) / 2, A[3])
示例#6
0
def test_quasi_isotropic():
	import numpy
	my_lam = Laminate('0/p60s',1)
	my_lam.compute_all()

	A = my_lam.A_vec
	array_assert(A[0],A[1])
	array_assert(A[-1],0.0)
	array_assert(A[-2],0.0)
	array_assert((A[0]-A[2])/2, A[3])
示例#7
0
def test_d_cross_m_4():
    import numpy
    layup = '0_4/90_4s'
    my_cross = Laminate(layup, 1)
    my_cross.compute_all()
    D_desired = numpy.array([[106.9, 1.93, 0.0], [1.93, 21.18, 0.0],
                             [0.0, 0.0, 4.78]])
    d_desired = numpy.array([[9.36, -0.85, 0], [-0.85, 47.27, 0],
                             [0.0, 0.0, 209.2]])
    array_assert(my_cross.D * 10**9, D_desired, precision=1)
    array_assert(my_cross.d * 10**-6, d_desired, precision=1)
示例#8
0
def test_values_p56_30degrees():
    import numpy
    my_lam = Laminate('p30', 1)
    my_lam.compute_all()

    A = numpy.array(my_lam.A_vec) / my_lam.total_thickness
    A_desired = [109.3, 23.6, 32.46, 36.73, 0, 0]
    a = numpy.array(my_lam.a_vec) * my_lam.total_thickness * 1000
    a_desired = [15.42, 71.36, -21.18, 27.22, 0, 0]
    array_assert(A, A_desired, precision=1)
    array_assert(a, a_desired, precision=1)
示例#9
0
def test_angle_ply():
    import numpy
    my_lam = Laminate('p45s', 2)
    my_lam.compute_all()

    should_be_zero = numpy.absolute(
        numpy.array([my_lam.A_vec[-2:], my_lam.a_vec[-2:]]).reshape(4, ))
    zeros = [0] * 4
    print should_be_zero
    print zeros
    array_assert(should_be_zero, zeros)
示例#10
0
def test_values_p56_30degrees():
	import numpy
	my_lam = Laminate('p30',1)
	my_lam.compute_all()

	A = numpy.array(my_lam.A_vec)/my_lam.total_thickness
	A_desired = [109.3,23.6, 32.46, 36.73, 0, 0]
	a = numpy.array(my_lam.a_vec)*my_lam.total_thickness*1000
	a_desired = [15.42, 71.36, -21.18, 27.22, 0, 0]
	array_assert(A,A_desired,precision = 1)
	array_assert(a,a_desired,precision = 1)
示例#11
0
def test_smart_vs_dumb():
    my_dumb = Laminate('90_2/p40/p20/0s', 2)
    my_dumb.compute_all(method='dumb')

    my_smart = Laminate('90_2/p40/p20/0s', 2)
    my_smart.compute_all(method='smart')
    print len(my_smart.layers)
    for i in range(len(my_smart.layers)):
        for j in parse_request('QS'):
            smart = getattr(my_smart.layers[i], j)
            dumb = getattr(my_dumb.layers[i], j)
            array_assert(smart, dumb)
示例#12
0
def test_smart_vs_dumb():
	my_dumb = Laminate('90_2/p40/p20/0s',2)
	my_dumb.compute_all(method='dumb')

	my_smart = Laminate('90_2/p40/p20/0s',2)
	my_smart.compute_all(method='smart')
	print len(my_smart.layers)
	for i in range(len(my_smart.layers)):
		for j in parse_request('QS'):
			smart = getattr(my_smart.layers[i],j)
			dumb = getattr(my_dumb.layers[i],j)
			array_assert(smart,dumb)
示例#13
0
def test_angle_ply():
	import numpy
	my_lam = Laminate('p45s',2)
	my_lam.compute_all()

	should_be_zero = numpy.absolute(numpy.array([my_lam.A_vec[-2:],
																							my_lam.a_vec[-2:]
																							]).reshape(4,))
	zeros = [0]*4
	print should_be_zero
	print zeros
	array_assert(should_be_zero,zeros) 
示例#14
0
def test_values_p56_75degrees():
    import numpy
    my_lam = Laminate('m75', 1)
    my_lam.compute_all()
    print my_lam.layup
    print my_lam.A_vec

    A = numpy.array(my_lam.A_vec) / my_lam.total_thickness
    A_desired = [11.9, 160.4, 12.75, 17.02, 0, 0]
    a = numpy.array(my_lam.a_vec) * my_lam.total_thickness * 1000
    a_desired = [91.21, 6.80, -7.24, 58.73, 0, 0]
    array_assert(A, A_desired, precision=1)
    array_assert(a, a_desired, precision=1)
示例#15
0
def test_values_p56_75degrees():
	import numpy
	my_lam = Laminate('m75',1)
	my_lam.compute_all()
	print my_lam.layup
	print my_lam.A_vec

	A = numpy.array(my_lam.A_vec)/my_lam.total_thickness
	A_desired = [11.9,160.4, 12.75, 17.02, 0, 0]
	a = numpy.array(my_lam.a_vec)*my_lam.total_thickness*1000
	a_desired = [91.21, 6.80, -7.24, 58.73, 0, 0]
	array_assert(A,A_desired,precision = 1)
	array_assert(a,a_desired,precision = 1)
示例#16
0
def test_d_cross_m_4():
	import numpy
	layup = '0_4/90_4s'
	my_cross = Laminate(layup,1)
	my_cross.compute_all()
	D_desired = numpy.array([[106.9,1.93,0.0],
													[1.93,21.18,0.0],
													[0.0,0.0,4.78]
													])
	d_desired = numpy.array([[9.36,-0.85,0],
													[-0.85,47.27,0],
													[0.0,0.0,209.2]
													])
	array_assert(my_cross.D*10**9 , D_desired,precision = 1)
	array_assert(my_cross.d*10**-6 , d_desired,precision = 1)
示例#17
0
def test_computed():
    layup = '0_4/90_4s'
    my_lam = Laminate(layup, 1)
    assert (my_lam.computed == False)
    assert (my_lam.compute_all() == True)
    assert (my_lam.compute_all() == False)
示例#18
0
def test_computed():
	layup = '0_4/90_4s'
	my_lam = Laminate(layup,1)
	assert(my_lam.computed == False)
	assert(my_lam.compute_all() == True)
	assert(my_lam.compute_all() == False)