Example #1
0
def test_by_hand():
	import numpy
	from math import cos, sin, radians
	load = numpy.array([1,0,0])
	angle = 30
	tet = radians(float(angle))
	my_layer = Layer(2,angle)
	my_layer.compute_all()

	off_strain_fast = my_layer.S_off.dot(load)
	
	#On-axis stress
	on_stress_auto = transform_stress(load, 'off',angle)
	
	m = cos(tet)	
	n = sin(tet)
	sigma_x = m**2*load[0] + n**2*load[1] + 2*m*n*load[2]
	sigma_y = n**2*load[0] + m**2*load[1] -2*m*n*load[2]
	sigma_s = -m*n*load[0] + m*n*load[1]+(m**2 - n**2)*load[2]
	sigma_on = numpy.array([sigma_x, sigma_y, sigma_s])

	array_assert(sigma_on,on_stress_auto)

	#On-axis strain
	on_strain_auto = my_layer.S_on.dot(on_stress_auto)
	
	ex = my_layer.PROPS['ex']
	ey = my_layer.PROPS['ey']
	es = my_layer.PROPS['es']
	nuy = my_layer.PROPS['nuy']
	nux = my_layer.PROPS['nux']
	epsx = sigma_on[0]/ex + sigma_on[1]*(-nuy)/ey
	epsy = sigma_on[0]*(-nux)/ex + sigma_on[1]/ey 
	epss = + sigma_on[2]/es
	eps_on = numpy.array([epsx,epsy,epss])

	array_assert(eps_on,on_strain_auto)
	print eps_on
	print on_strain_auto

	#Off-axis strain
	off_strain_auto = transform_strain(on_strain_auto,'on',angle)

	m = cos(-tet)
	n = sin(-tet)
	eps1 = m**2*epsx+n**2*epsy+m*n*epss
	eps2 = n**2*epsx+m**2*epsy-m*n*epss
	eps6 = -2*m*n*epsx + 2*m*n*epsy + (m**2-n**2)*epss
	eps_off = numpy.array([eps1,eps2,eps6])

	print eps_off
	print off_strain_auto
	array_assert(eps_off,off_strain_auto)

	#Long auto vs short auto
	print off_strain_auto
	print off_strain_fast
	array_assert(off_strain_auto,off_strain_fast)
Example #2
0
def test_off_stress_to_off_strain():
	off_stress = numpy.array([10,20,30]) #input
	angle = 40
	my_layer = Layer(2,angle)
	my_layer.compute_all()

	off_strain_fast = my_layer.S_off.dot(off_stress)

	on_stress = transform_stress(off_stress,'off',angle)
	on_strain = my_layer.S_on.dot(on_stress)
	off_strain = transform_strain(on_strain,'on',angle)

	array_assert(off_strain,off_strain_fast)
Example #3
0
def test_stress_ninety():
	on_axis = numpy.array([200,200,100],dtype=float)
	off_axis = transform_stress(on_axis,'on',90)
	off_axis[2] *= -1
	array_assert(on_axis, off_axis)
Example #4
0
def test_stress_zero():
	on_axis = numpy.array([420,-165,-135])
	off_axis = transform_stress(on_axis,'on',0)
	array_assert(off_axis, on_axis)
Example #5
0
def test_stress_on_to_off_to_on():
	on_axis_og = [420,-165,-135]
	off_axis = transform_stress(on_axis_og,'on','45.3')
	on_axis = transform_stress(off_axis,'off','45.3')
	array_assert(on_axis_og,on_axis)
Example #6
0
def test_stress_ninety():
    on_axis = numpy.array([200, 200, 100], dtype=float)
    off_axis = transform_stress(on_axis, 'on', 90)
    off_axis[2] *= -1
    array_assert(on_axis, off_axis)
Example #7
0
def test_stress_zero():
    on_axis = numpy.array([420, -165, -135])
    off_axis = transform_stress(on_axis, 'on', 0)
    array_assert(off_axis, on_axis)
Example #8
0
def test_stress_on_to_off_to_on():
    on_axis_og = [420, -165, -135]
    off_axis = transform_stress(on_axis_og, 'on', '45.3')
    on_axis = transform_stress(off_axis, 'off', '45.3')
    array_assert(on_axis_og, on_axis)