예제 #1
0
def xfoil_get_retheta(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    retheta_a = xi.new_doublea(npoint)

    xi.xfoil_get_retheta(xdg, npoint_p, retheta_a)

    retheta = npoint * [0]
    for i in range(npoint):
        retheta[i] = xi.doublea_getitem(retheta_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(retheta_a)

    return retheta
예제 #2
0
def xfoil_get_wake_cp(xdg, nwake):

    nwake_p = xi.copy_intp(nwake)
    cp_a = xi.new_doublea(nwake)

    xi.xfoil_get_wake_cp(xdg, nwake_p, cp_a)

    cp = nwake * [0]
    for i in range(nwake):
        cp[i] = xi.doublea_getitem(cp_a, i)

    xi.delete_intp(nwake_p)
    xi.delete_doublea(cp_a)

    return cp
예제 #3
0
def xfoil_get_ampl(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    ampl_a = xi.new_doublea(npoint)

    xi.xfoil_get_ampl(xdg, npoint_p, ampl_a)

    ampl = npoint * [0]
    for i in range(npoint):
        ampl[i] = xi.doublea_getitem(ampl_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(ampl_a)

    return ampl
예제 #4
0
def xfoil_get_hk(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    hk_a = xi.new_doublea(npoint)

    xi.xfoil_get_hk(xdg, npoint_p, hk_a)

    hk = npoint * [0]
    for i in range(npoint):
        hk[i] = xi.doublea_getitem(hk_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(hk_a)

    return hk
예제 #5
0
def xfoil_get_diss(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    diss_a = xi.new_doublea(npoint)

    xi.xfoil_get_diss(xdg, npoint_p, diss_a)

    diss = npoint * [0]
    for i in range(npoint):
        diss[i] = xi.doublea_getitem(diss_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(diss_a)

    return diss
예제 #6
0
def xfoil_get_deltastar(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    deltastar_a = xi.new_doublea(npoint)

    xi.xfoil_get_deltastar(xdg, npoint_p, deltastar_a)

    deltastar = npoint * [0]
    for i in range(npoint):
        deltastar[i] = xi.doublea_getitem(deltastar_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(deltastar_a)

    return deltastar
예제 #7
0
def xfoil_get_uedge(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    uedge_a = xi.new_doublea(npoint)

    xi.xfoil_get_uedge(xdg, npoint_p, uedge_a)

    uedge = npoint * [0]
    for i in range(npoint):
        uedge[i] = xi.doublea_getitem(uedge_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(uedge_a)

    return uedge
예제 #8
0
def xfoil_get_cf(xdg, npoint):

    npoint_p = xi.copy_intp(npoint)
    cf_a = xi.new_doublea(npoint)

    xi.xfoil_get_cf(xdg, npoint_p, cf_a)

    cf = npoint * [0]
    for i in range(npoint):
        cf[i] = xi.doublea_getitem(cf_a, i)

    xi.delete_intp(npoint_p)
    xi.delete_doublea(cf_a)

    return cf
예제 #9
0
def xfoil_get_wake_geometry(xdg, nwake):

    nwake_p = xi.copy_intp(nwake)
    xw_a = xi.new_doublea(nwake)
    zw_a = xi.new_doublea(nwake)

    xi.xfoil_get_wake_geometry(xdg, nwake_p, xw_a, zw_a)

    xw = nwake * [0]
    zw = nwake * [0]
    for i in range(nwake):
        xw[i] = xi.doublea_getitem(xw_a, i)
        zw[i] = xi.doublea_getitem(zw_a, i)

    xi.delete_intp(nwake_p)
    xi.delete_doublea(xw_a)
    xi.delete_doublea(zw_a)

    return xw, zw
예제 #10
0
def xfoil_get_current_airfoil(xdg, npoint):

    xout_a = xi.new_doublea(npoint)
    zout_a = xi.new_doublea(npoint)
    npoint_p = xi.copy_intp(npoint)
    stat_p = xi.new_intp()

    xi.xfoil_get_current_airfoil(xdg, xout_a, zout_a, npoint_p, stat_p)

    xout = npoint * [0]
    zout = npoint * [0]
    for i in range(npoint):
        xout[i] = xi.doublea_getitem(xout_a, i)
        zout[i] = xi.doublea_getitem(zout_a, i)
    stat = xi.intp_value(stat_p)

    xi.delete_doublea(xout_a)
    xi.delete_doublea(zout_a)
    xi.delete_intp(npoint_p)
    xi.delete_intp(stat_p)

    return xout, zout, stat
예제 #11
0
def run_xfoil(npointin, xin, zin, geom_opts, noppoint, operating_points,
              op_modes, reynolds_numbers, mach_numbers, use_flap, x_flap,
              z_flap, z_flap_spec, flap_degrees, xfoil_opts, reinitialize,
              fix_unconverged):

    npointin_p = xi.copy_intp(npointin)
    xin_a = xi.new_doublea(npointin)
    zin_a = xi.new_doublea(npointin)
    noppoint_p = xi.copy_intp(noppoint)
    operating_points_a = xi.new_doublea(noppoint)
    op_modes_a = xi.new_inta(noppoint)
    reynolds_numbers_a = xi.new_doublea(noppoint)
    mach_numbers_a = xi.new_doublea(noppoint)
    use_flap_p = xi.copy_boolp(use_flap)
    if use_flap:
        x_flap_p = xi.copy_doublep(x_flap)
        z_flap_p = xi.copy_doublep(z_flap)
        z_flap_spec_p = xi.copy_intp(z_flap_spec)
    else:
        x_flap_p = xi.new_doublep()
        z_flap_p = xi.new_doublep()
        z_flap_spec_p = xi.new_intp()
    flap_degrees_a = xi.new_doublea(noppoint)
    reinitialize_p = xi.copy_boolp(reinitialize)
    fix_unconverged_p = xi.copy_boolp(fix_unconverged)
    lift_a = xi.new_doublea(noppoint)
    drag_a = xi.new_doublea(noppoint)
    moment_a = xi.new_doublea(noppoint)
    viscrms_a = xi.new_doublea(noppoint)
    alpha_a = xi.new_doublea(noppoint)
    xtrt_a = xi.new_doublea(noppoint)
    xtrb_a = xi.new_doublea(noppoint)
    stat_p = xi.new_intp()

    for i in range(npointin):
        xi.doublea_setitem(xin_a, i, xin[i])
        xi.doublea_setitem(zin_a, i, zin[i])
    for i in range(noppoint):
        xi.doublea_setitem(operating_points_a, i, operating_points[i])
        xi.inta_setitem(op_modes_a, i, op_modes[i])
        xi.doublea_setitem(reynolds_numbers_a, i, reynolds_numbers[i])
        xi.doublea_setitem(mach_numbers_a, i, mach_numbers[i])
        if use_flap:
            xi.doublea_setitem(flap_degrees_a, i, flap_degrees[i])

    xi.run_xfoil(npointin_p, xin_a, zin_a, geom_opts, noppoint_p,
                 operating_points_a, op_modes_a, reynolds_numbers_a,
                 mach_numbers_a, use_flap_p, x_flap_p, z_flap_p, z_flap_spec_p,
                 flap_degrees_a, xfoil_opts, reinitialize_p, fix_unconverged_p,
                 lift_a, drag_a, moment_a, viscrms_a, alpha_a, xtrt_a, xtrb_a,
                 stat_p)

    stat = xi.intp_value(stat_p)
    lift = noppoint * [0]
    drag = noppoint * [0]
    moment = noppoint * [0]
    viscrms = noppoint * [0]
    alpha = noppoint * [0]
    xtrt = noppoint * [0]
    xtrb = noppoint * [0]
    for i in range(noppoint):
        lift[i] = xi.doublea_getitem(lift_a, i)
        drag[i] = xi.doublea_getitem(drag_a, i)
        moment[i] = xi.doublea_getitem(moment_a, i)
        viscrms[i] = xi.doublea_getitem(viscrms_a, i)
        alpha[i] = xi.doublea_getitem(alpha_a, i)
        xtrt[i] = xi.doublea_getitem(xtrt_a, i)
        xtrb[i] = xi.doublea_getitem(xtrb_a, i)

    xi.delete_intp(npointin_p)
    xi.delete_doublea(xin_a)
    xi.delete_doublea(zin_a)
    xi.delete_intp(noppoint_p)
    xi.delete_doublea(operating_points_a)
    xi.delete_inta(op_modes_a)
    xi.delete_doublea(reynolds_numbers_a)
    xi.delete_doublea(mach_numbers_a)
    xi.delete_boolp(use_flap_p)
    xi.delete_doublep(x_flap_p)
    xi.delete_doublep(z_flap_p)
    xi.delete_intp(z_flap_spec_p)
    xi.delete_doublea(flap_degrees_a)
    xi.delete_doublea(lift_a)
    xi.delete_doublea(drag_a)
    xi.delete_doublea(moment_a)
    xi.delete_doublea(viscrms_a)
    xi.delete_doublea(alpha_a)
    xi.delete_doublea(xtrt_a)
    xi.delete_doublea(xtrb_a)
    xi.delete_intp(stat_p)

    return lift, drag, moment, viscrms, alpha, xtrt, xtrb, stat