Esempio n. 1
0
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.)
Esempio n. 2
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.)
Esempio n. 3
0
'''
for full documentation, see tutorial 3
'''

import numpy as np
from pyPanair.preprocess import wgs_creator

# Init
wgs = wgs_creator.LaWGS("main")

# Airfoil
root_airfoil = wgs_creator.read_airfoil("AGARDB/mwe.csv",
                                        y_coordinate=0.5,
                                        expansion_ratio=2.598)
root_airfoil = root_airfoil.shift((4.5, 0., 0.))
tip_airfoil = root_airfoil.replace(x=7.098, y=2., z=0.)
wing = root_airfoil.linspace(tip_airfoil, num=20)
wgs.append_network("wing", wing, 1)

# Nose + Forebody
n_nose = 5  # number of points in the line
x_nose = np.linspace(0., 3., num=n_nose)  # x-coordinates of the line
y_nose = x_nose / 3 * (1 - 1 / 9 * (x_nose)**2 + 1 / 54 *
                       (x_nose)**3)  # y-coordinates of the line
nose_line = wgs_creator.Line(np.zeros((n_nose, 3)))  # create an array of zeros
nose_line[:, 0] = x_nose
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=4.5)