def generate_vtk(fuselage, Nx, n_cp, N_chord=50, N_span=100): psi, eta = meshtools.meshparameterspace((N_chord, N_span), psi_spacing='linear', eta_spacing='linear') mesh = fuselage(psi, eta) network = np.dstack(mesh) generate_surface(network, "fuselage_%i_%i" % (Nx, n_cp))
def generate_vtk_lower(object, *args): try: N_chord, N_span = args except (ValueError): N_chord, N_span = [20, 50] psi, eta = meshtools.meshparameterspace((N_chord, N_span), psi_spacing='cosine', eta_spacing='cosine') mesh = object(psi, eta) network_wu = np.dstack(mesh) generate_surface(network_wu, "wing_lower")
def generate_vtk(self, filename='test'): self.wing_upper.generate_vtk('assembly_upper') self.wing_lower.generate_vtk('assembly_lower') self.fuselage.generate_vtk('assembly_fuselage') if self.intersections is not None: generate_points(self.intersections['upper'], 'upper_intersection') generate_points(self.intersections['lower'], 'lower_intersection') # Spar files spar_len = len(self.wing_upper.spars[0]) for i in range(len(self.wing_upper.spars)): spar_i = np.vstack( (self.wing_upper.spars[i], self.wing_lower.spars[i])) # Format data data = np.reshape(spar_i, [2, spar_len, 3]) # Generate vtk generate_surface(data=data, filename='spar-{}'.format(i + 1))
network_cap = np.zeros((N_chord, 2, 3)) network_cap[:, 0, :] = network_wu[:, -1, :] network_cap[:, 1, :] = network_wl[:, -1, :] # calculate wake wing_trailing_edge = network_wu[-1, :, :] fuselage_wake_boundary = network_fu[0, -N_tail:] inner_endpoint = np.copy(fuselage_wake_boundary[-1]) aoa = 0. n_wake_streamwise = len(fuselage_wake_boundary) spacing = meshtools.cosine_spacing() wake = meshtools.generate_wake(wing_trailing_edge, inner_endpoint[0], n_wake_streamwise, aoa, user_spacing=spacing) wingbody_wake = np.zeros((n_wake_streamwise, 2, 3)) wingbody_wake[:, 0] = fuselage_wake_boundary wingbody_wake[:, 1] = wake[:, 0] # Generating vtk files generate_surface(network_wu, "wingupper") generate_surface(network_wl, "winglower") generate_surface(network_fu, "fuselageupper") generate_surface(network_fl, "fuselagelower") generate_surface(network_cap, "wingcap") generate_surface(wake, "wake") generate_surface(wingbody_wake, "wingbody_wake")
def generate_vtk(self): for i, n in enumerate(self._networks): generate_surface(n, "surface" + str(i))
raw = raw[::80] x_raw, y_raw, z_raw = raw.T fuselage = pickle.load(open('fuselage_object.p', 'rb')) Nx = 4 n_cp = 4 fuselage.nx = [0.5, 0.5] study = fitting(object=fuselage, update=update, p1=np.linspace(10, 25, Nx), p2=np.linspace(10, 25, n_cp), p1_name='Berstein order for Ay', p2_name='Berstein order for Sx', x0=x0, raw=raw, calculate_points=calculate_points, callback=generate_vtk) study.convergence_study(parallel=True) study.plot_study() # Generating vtk files N_chord = 50 N_span = 100 psi_f, eta_f = meshtools.meshparameterspace((N_chord, N_span), psi_spacing='linear', eta_spacing='linear') mesh_f = fuselage(psi_f, eta_f) network_f = np.dstack(mesh_f) generate_surface(network_f, "fuselage_full")
body_wake_u = meshtools.generate_wake(network_fu[:, -1], inner_endpoint[0] + l_w, 2, aoa) wing_wake = meshtools.generate_wake(wing_trailing_edge, inner_endpoint[0] + l_w, n_wake_streamwise, aoa, user_spacing=cos_space_half) wingbody_wake = np.zeros((n_wake_streamwise, 2, 3)) wingbody_wake[:-1, 0] = fuselage_wake_boundary wingbody_wake[-1, 0] = body_wake_u[-1, 0] wingbody_wake[:, 1] = wing_wake[:, 0] # Generating vtk files generate_surface(network_wu1, "wingupper1") generate_surface(network_wu2, "wingupper2") generate_surface(network_wl1, "winglower1") generate_surface(network_wl2, "winglower2") generate_surface(network_fu, "fuselageupper") generate_surface(network_fl, "fuselagelower") generate_surface(network_wingcap, "wingcap") generate_surface(network_fusecap, "fusecap") generate_surface(wing_wake, "wake") generate_surface(body_wake_l, "body_wake_l") generate_surface(body_wake_u, "body_wake_u") generate_surface(wingbody_wake, "wingbody_wake") N_cut = 6 # run in Panair gamma = 1.4
def generate_vtk(self, filename='test'): # Format data data = np.reshape(self.mesh_surface, self.dimensions + [3]) # Generate vtk generate_surface(data=data, filename=filename)
N_chord = 50 N_span = 100 # find_edges(Ny, Ns) # f = open('fuselage_object.p', 'wb') # pickle.dump(fuselage, f) study = fitting(object=fuselage, update=update, p1=np.linspace(5, 30, 6), p2=np.linspace(5, 30, 6), p1_name='Berstein order for Sy', p2_name='Berstein order for shear', x0=x0, raw=raw, calculate_points=calculate_points) study.convergence_study(parallel=True) study.plot_study() # Store convergence data f = open('convergence_edges.p', 'wb') pickle.dump(study, f) # Plot it study.plot_fit() # Generating vtk files network = calculate_points(fuselage, raw) generate_surface(network, "fuselage_edges")