np.set_printoptions(precision=5) # Results from Abaqus abaqus_data = pickle.load(open('neutral_line.p', 'rb')) # Beam properties bp = properties() bc = boundary_conditions(load=np.array([ [0, -1], ])) EB_solution = bc.concentrated_load[0][1]/(6*bp.young*bp.inertia) * \ np.array([0, 0, 3, -1]) mesh = mesh_1D(mesh_n=11, alpha=[1, 1], alpha_nodes=[0, 1]) curve_parent = poly(a=[0, 0, 0, 0]) curve_child = poly(a=EB_solution) beam = structure(curve_parent, curve_child, mesh, bp, bc) beam.calculate_position() eulerBernoulle = beam.r_c # Find stable solution bounds = np.array(((-0.02, 0.02), (-0.02, 0.02))) x, fun = beam.find_stable(beam.g_c.a[2:4], bounds=bounds, input_type='Geometry', loading_condition='plane_stress', input_function=input_function) beam.g_c.a = input_function(x)
from aeropy.geometry.parametric import poly, frame import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.colors import Normalize import numpy as np curve = poly() z1 = np.linspace(0, 1) z2 = curve.z2(z1) colors = ['r', 'g', 'k', 'b', 'm'] plt.figure() plt.plot(z1, z2, label='geometry') r1 = curve.r(z1, diff=[0, 1, 0, 0]) r2 = curve.r(z1, diff=[0, 0, 1, 0]) plt.plot(r1[0], r1[1], label='a1') plt.plot(r2[0], r2[1], label='a2') z1 = np.linspace(.1, 1, 6) i = 0 x1 = curve.x1(z1) for x2 in np.linspace(-.3, .3, 5): g1 = curve.g(1, z1, x2) g2 = curve.g(2, z1, x2) r = curve.r(z1, x2) Q = plt.quiver(r[0], r[1], g1[0], g1[1],
coefficients = np.array([0, 0, 0, 0]) beam_properties = properties() bc = boundary_conditions(load=np.array([ [0, 0], ])) analytical_solution = bc.concentrated_load[0][0] / (beam_properties.young * beam_properties.area) mesh = mesh_1D(alpha=[ 1 + analytical_solution, 1 + analytical_solution, 1 + analytical_solution ], alpha_nodes=[0, .5, 1], mesh_n=10) curve_parent = poly(coefficients) curve_child = poly(coefficients) beam = structure(curve_parent, curve_child, mesh, beam_properties, bc) strain = beam.strain() stress = beam.stress() n = 10 problem = DOE(levels=n, driver='Full Factorial') problem.add_variable('a1', lower=0, upper=.001, type=float) problem.add_variable('a2', lower=0, upper=.001, type=float) problem.define_points() print(problem.domain) strain_matrix = np.array( list(zip(problem.domain['a1'], problem.domain['a2'],
))) abq_x, abq_y, abq_u1, abq_u2 = abaqus_data.T abq_y = -abq_y + .005 abq_u2 = -abq_u2 # Convert log strains into engineering strain abaqus_secondary['LE11'] = np.exp(np.array(abaqus_secondary['LE11'])) - 1 abaqus_secondary['LE12'] = np.exp(np.array(abaqus_secondary['LE12'])) - 1 abaqus_secondary['LE22'] = np.exp(np.array(abaqus_secondary['LE22'])) - 1 coefficients = np.array([0, 0, 0, 0]) bp = properties() bc = boundary_conditions(load=np.array([[0, -1]])) analytical_solution = bc.concentrated_load[0][1]/(6*bp.young*bp.inertia) * \ np.array([-1, 3, 0, 0]) mesh = mesh_1D(mesh_n=10) curve_parent = poly(a=[0, 0, 0, 0]) curve_child = poly(a=analytical_solution) beam = structure(curve_parent, curve_child, mesh, bp, bc) beam.calculate_position() strain = beam.strain() stress = beam.stress(loading_condition='plane_stress') # Plot beam results plt.figure() u = beam.u() u1 = beam.u(diff='x1') u2 = beam.u(diff='x2') plt.plot(beam.r_p[0], beam.r_p[1], label='parent') plt.scatter(beam.r_p[0], beam.r_p[1], label='parent') plt.plot(beam.r_c[0], beam.r_c[1], label='child')
def __init__(self, curve=poly(), frame='Frenet-Serret', z1=np.linspace(0, 1, 11)): self.curve = poly() self.frame = frame self.z1 = z1 self.z2 = self.curve.z2(z1)
x2 = 0 b = 0.01 h = 0.01 P = 10000 L = 1 E = 70e9 Area = h * b Inertia = b * h**3 / 12. # For Euler Bernouille # a = P/(6*E*Inertia)*np.array([-1, 3*L, 0, 0]) # For axial deformation a = np.array([0, 0, 0, 0]) alpha = [1 + P / Area / E] curve_parent = poly(a, config='parent') curve_child = poly(a, alpha, config='child') r_p = curve_parent.r(x1, x2) r_c = curve_child.r(x1, x2) beam = structure(curve_parent, curve_child, area=Area, young=E, load=P) u = beam.u(x1) strain = beam.strain(x1) stress = beam.stress() # print('strain', strain) # print('target', beam.load/beam.area/beam.young) # # plt.figure() # plt.plot(r_p[0], r_p[1], label='parent', color='r') # plt.plot(r_c[0], r_c[1], label='child', color='b') # Q = plt.quiver(r_p[0], r_p[1], u[0], u[1], angles='xy', scale_units='xy', # scale=1, width=0.005, color='0.5')