def main(x1, x2, y1, y2, y3, aoas=(7.42), target_dir=""): """ create a LaWGS file for twisted rectangular wing reference case 3""" wgs = wgs_creator.LaWGS("ADODG_case3") n_wing_x = 30 n_wing_y = 30 n_wing_z = 8 chord_wing = 1. halfspan_wing = chord_wing * 3 # define twist distribution cv = np.array(((0, 0), (x1, y1), (x2, y2), (1, y3))) twist_func = bspline(cv, degree=3, periodic=False) twist_xy = twist_func(np.linspace(0, 1, 150)) twist_dist = interp1d(twist_xy[:,0] * halfspan_wing, twist_xy[:,1]) # create wing base_airfoil = wgs_creator.naca4digit("0010", num=n_wing_x, chord=chord_wing) wing = list() span_pos = np.linspace(0, halfspan_wing, n_wing_y) for y in span_pos: rot_foil = base_airfoil.roty(base_airfoil[0], twist_dist(y)) rot_foil.shift((0, y, 0), inplace=True) wing.append(rot_foil) wing = wgs_creator.Network(wing) wgs.append_network("wing", wing, 1) # create wingtip degs = np.linspace(0, -180, n_wing_z) wingtipu, _ = base_airfoil.shift((0, halfspan_wing, 0)).split_half() wingtip = [wingtipu.rotx(wingtipu[0], d) for d in degs] wingtip = wgs_creator.Network(wingtip) wingtip = wingtip.roty(wingtipu[0], twist_dist(halfspan_wing)) wgs.append_network("wingtip", wingtip, 1) # add wake wake_length = chord_wing * 50. wingwake = wing.make_wake(3, wake_length) wgs.append_network("wingwake", wingwake, 18) wgs.create_wgs(os.path.join(target_dir, "ADODG_case3.wgs")) span = halfspan_wing * 2 sref = chord_wing * span xref = chord_wing * 0.25 aux_name = os.path.join(target_dir, "ADODG_case3.aux") wgs.create_aux(filename=aux_name, alpha=aoas, mach=0.5, cbar=chord_wing, span=span, sref=sref, xref=xref, zref=0.)
def main(twist_func, aoas=(7.42), target_dir=""): """ create a LaWGS file for twisted rectangular wing reference case 3""" wgs = wgs_creator.LaWGS("ADODG_case3") n_wing_x = 40 n_wing_y = 40 n_wing_z = 12 chord_wing = 100. halfspan_wing = chord_wing * 3 # define twist distribution twist_xy = twist_func(np.linspace(0, 1, 150)) twist_dist = interp1d(twist_xy[:, 0] * halfspan_wing, twist_xy[:, 1]) # create wing base_airfoil = wgs_creator.naca4digit("0010", num=n_wing_x, chord=chord_wing) wing = list() span_pos = np.linspace(0, halfspan_wing, n_wing_y) for y in span_pos: twist = twist_dist(y) rot_foil = base_airfoil.roty(base_airfoil[0], twist) local_chord = np.max(rot_foil[:, 0]) - np.min(rot_foil[:, 0]) rot_foil *= chord_wing / local_chord rot_foil.shift((0, y, 0), inplace=True) wing.append(rot_foil) wing = wgs_creator.Network(wing) wgs.append_network("wing", wing, 1) # create wingtip degs = np.linspace(0, -180, n_wing_z) wingtipu, _ = base_airfoil.shift((0, 0, 0)).split_half() wingtip = [wingtipu.rotx(wingtipu[0], d) for d in degs] wingtip = wgs_creator.Network(wingtip) twist = twist_dist(y) wingtip = wingtip.roty(wingtipu[0], twist_dist(halfspan_wing)) local_chord = np.max(wingtip[0, :, 0]) - np.min(wingtip[0, :, 0]) wingtip *= chord_wing / local_chord wingtip.shift((0, halfspan_wing, 0), inplace=True) wgs.append_network("wingtip", wingtip, 1) # add wake wake_length = chord_wing * 50. wingwake = wing.make_wake(3, wake_length) wgs.append_network("wingwake", wingwake, 18) wgs.create_wgs(os.path.join(target_dir, "ADODG_case3.wgs")) span = halfspan_wing * 2 sref = chord_wing * span / 100 # multiply aerodynamic coefficients by 100 xref = chord_wing * 0.25 aux_name = os.path.join(target_dir, "ADODG_case3.aux") wgs.create_aux(filename=aux_name, alpha=aoas, mach=0.5, cbar=chord_wing, span=span, sref=sref, xref=xref, zref=0.)
fbody_p1 = wgs_creator.Point( nose_line[-1]) # point at the end of the nose_line fbody_p2 = fbody_p1.replace(x=4.5) fbody_line = fbody_p1.linspace(fbody_p2, num=3) # interpolate fbody_p1 and fbody_p2 nose_fbody_line = nose_line.concat( fbody_line) # concatenate nose_line & fbody_line nose_fbody_up = list() for i in np.linspace(0, 90, 7): line = nose_fbody_line.rotx( rotcenter=nose_fbody_line[0], angle=i ) # create a copy of nose_fbody_line and rotate it around the x-axis nose_fbody_up.append(line) nose_fbody_up = wgs_creator.Network( nose_fbody_up) # create a Network object from a list of Lines nose_fbody_low = list() for i in np.linspace(-90, 0, 7): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_low.append(line) nose_fbody_low = wgs_creator.Network(nose_fbody_low) wgs.append_network("n_fb_up", nose_fbody_up, 1) wgs.append_network("n_fb_low", nose_fbody_low, 1) # Midbody wingroot_up, wingroot_low = root_airfoil.split_half() mbody_line = wingroot_up.replace(z=0.) mbody_up = list()
nose_line[:, 1] = y_nose fbody_p1 = wgs_creator.Point( nose_line[-1]) # point at the end of the nose_line fbody_p2 = fbody_p1.replace(x=5731.49) fbody_line = fbody_p1.linspace( fbody_p2, num=body_panels) # interpolate fbody_p1 and fbody_p2 nose_fbody_line = nose_line.concat( fbody_line) # concatenate nose_line & fbody_line nose_fbody_1 = list() for i in np.linspace(0, 120, 10): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_1.append(line) nose_fbody_1 = wgs_creator.Network(nose_fbody_1) nose_fbody_2 = list() for i in np.linspace(120, 240, 10): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_2.append(line) nose_fbody_2 = wgs_creator.Network(nose_fbody_2) nose_fbody_3 = list() for i in np.linspace(-120, -0, 10): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_3.append(line) nose_fbody_3 = wgs_creator.Network(nose_fbody_3) ''' ATTACHMENT BETWEEN FIN AREA AND NOSE BODY '''
nose_line[:, 1] = y_nose fbody_p1 = wgs_creator.Point( nose_line[-1]) # point at the end of the nose_line fbody_p2 = fbody_p1.replace(x=86.84) fbody_line = fbody_p1.linspace( fbody_p2, num=body_panels) # interpolate fbody_p1 and fbody_p2 nose_fbody_line = nose_line.concat( fbody_line) # concatenate nose_line & fbody_line nose_fbody_up_1 = list() for i in np.linspace(0, 45, 6): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_up_1.append(line) nose_fbody_up_1 = wgs_creator.Network(nose_fbody_up_1) nose_fbody_up_2 = list() for i in np.linspace(45, 90, 6): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_up_2.append(line) nose_fbody_up_2 = wgs_creator.Network(nose_fbody_up_2) nose_fbody_low_1 = list() for i in np.linspace(-90, -45, 6): line = nose_fbody_line.rotx(rotcenter=nose_fbody_line[0], angle=i) nose_fbody_low_1.append(line) nose_fbody_low_1 = wgs_creator.Network(nose_fbody_low_1) nose_fbody_low_2 = list() for i in np.linspace(-45, 0, 6):