import matplotlib.cm as cm import numpy as np from optimization_tools.DOE import DOE 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()
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)
abaqus_primary['U'][:, 1], ))) 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')