Beispiel #1
0
    def __init__(self,
                 twist,
                 chord,
                 radius,
                 n_blades,
                 r,
                 y,
                 dr,
                 dy,
                 Clalpha,
                 solidity=None,
                 airfoils=None):
        """
        :param twist: Twist distribution, numpy array
        :param chord: Chord distribution, numpy array
        :param radius: blade radius, float
        :param n_blades: number of blades, integer
        :param r: non-dimensional radial element locations
        :param y: dimensional radial element locations
        :param dr: non-dimensional distance between elements
        :param dy: dimensional distance between elements
        :param Clalpha: linear lift curve slope, usually 2*pi
        :param solidity: optional argument for use in test cases where solidity is constant along the blade
        :param airfoils: in the form (('airfoil1', r_start, r_end), ('airfoil2', r_start, r_end), etc)
        :return:
        """
        if solidity is None:
            self.chord = chord
            self.solidity = n_blades * chord / (2 * np.pi * y)
        else:
            # Handle case for when we just want to pass a solidity
            self.solidity = solidity
            self.chord = solidity * np.pi * radius / n_blades

        if airfoils is None:
            self.airfoils = (('simple', 0, 1), )
        else:
            self.airfoils = airfoils
            self.Cl_tables = {}
            self.Cd_tables = {}
            for airfoil in self.airfoils:
                alpha, Re, CL, CD = create_table(airfoil[0])

                self.Cl_tables[airfoil[0]] = ((alpha, Re), CL)
                self.Cd_tables[airfoil[0]] = ((alpha, Re), CD)

        self.twist = twist
        self.radius = radius
        self.n_blades = n_blades
        self.r = r
        self.y = y
        self.dr = dr
        self.dy = dy
        self.Clalpha = Clalpha

        # airfoil_fun_r is a list of airfoil names where airfoil_fun_r[0] is the airfoil section at r = 0 and
        # airfoil_fun_r[-1] is the airfoil section name at r = 1
        self.airfoil_fun_r = []
        for r_loc in self.r:
            self.airfoil_fun_r.append(self.get_airfoil(r_loc))
Beispiel #2
0
def create_Cl_Cd_table(airfoil):
    """
    Create "tables" (really these are tuples of the form ((angle of attack, Reynolds number), Cl)) of lift and drag
    coefficient as a function of angle of attack and Reynolds number.
    :param airfoil: The name of the airfoil. This name should have a corresponding folder in BEMT/bemt/airfoil_data with
    output from XFOIL.
    :return: The Cl and Cd "tables" as described above.
    """
    alphas, Re, CL, CD, Clmax = lookup_table.create_table(airfoil)
    Cl_table = ((alphas, Re), CL)
    Cd_table = ((alphas, Re), CD)
    return Cl_table, Cd_table, Clmax
Beispiel #3
0
    def __init__(self, twist, chord, radius, n_blades, r, y, dr, dy, solidity=None, airfoils=None, Cl_tables={},
                 Cd_tables={}):
        """
        :param twist: Twist distribution, numpy array
        :param chord: Chord distribution, numpy array
        :param radius: blade radius, float
        :param n_blades: number of blades, integer
        :param r: non-dimensional radial element locations
        :param y: dimensional radial element locations
        :param dr: non-dimensional distance between elements
        :param dy: dimensional distance between elements
        :param solidity: optional argument for use in test cases where solidity is constant along the blade
        :param airfoils: in the form (('airfoil1', r_start, r_end), ('airfoil2', r_start, r_end), etc)
        :return:
        """
        # Initialize propeller chord and solidity
        if solidity is None:
            self.chord = chord
            self.solidity = n_blades*chord/np.pi/radius
        else:
            # Handle case for when we just want to pass a solidity
            self.solidity = solidity
            self.chord = solidity*np.pi*radius/n_blades

        # Initialize propeller Cl and Cd tables as copies as the argument values. This can either be an empty dict or
        # a dictionary with keys corresponding to the airfoil that makes up the propeller.
        self.Cl_tables = Cl_tables
        self.Cd_tables = Cd_tables

        # Handle case where user does not specify airfoils and use simple case.
        if airfoils is None:
            self.airfoils = (('simple', 0., 1.),)
            self.Cl_tables[self.airfoils[0][0]] = ()
            self.Cd_tables[self.airfoils[0][0]] = ()

        # Handle case where the airfoil is specified as simple (Cl = 2*pi*alpha, Cd = quadratic wrt alpha)
        elif sorted(airfoils) == sorted((('simple', 0.0, 1.0),)):
            self.airfoils = airfoils
            self.Cl_tables[self.airfoils[0][0]] = ()
            self.Cd_tables[self.airfoils[0][0]] = ()

        # Handle case where the airfoil is something other than simple. For these cases we assume either the Cl and Cd
        # tables have been created outside of the optimization (i.e., the Cl_tables and Cd_tables arguments are not
        # empty) in which case the attribute variables have already been initialized to the input variables. If the
        # input variables are empty, create the tables from the airfoil data in BEMT/bemt/airfoil_data.
        else:
            self.airfoils = airfoils
            if not Cl_tables:
                for airfoil in self.airfoils:
                    # The alpha values returned from create_table are in degrees, therefore the table will need to be
                    # queried in degrees
                    alpha, Re, CL, CD = create_table(airfoil[0])
                    self.Cl_tables[airfoil[0]] = ((alpha, Re), CL)
                    self.Cd_tables[airfoil[0]] = ((alpha, Re), CD)

        self.twist = twist
        self.radius = radius
        self.n_blades = n_blades
        self.r = r
        self.y = y
        self.dr = dr
        self.dy = dy

        # airfoil_fun_r is a list of airfoil names where airfoil_fun_r[0] is the airfoil section at r = 0 and
        # airfoil_fun_r[-1] is the airfoil section name at r = 1
        self.airfoil_fun_r = []
        for r_loc in self.r:
            self.airfoil_fun_r.append(self.get_airfoil(r_loc))
Beispiel #4
0
from lookup_table import create_table, interpolate, interpolate_griddata, interp_weights
from scipy.interpolate import griddata, interp2d
import numpy as np
import matplotlib.pyplot as plt


airfoil = 'SDA1075_494p'
this_Re = 90000
alpha, Re, CL, CD = create_table(airfoil)

Cl_table = ((alpha, Re), CL)
Cd_table = ((alpha, Re), CD)

# Cl_table = interp2d(alpha, Re, CL)
# Cd_table = interp2d(alpha, Re, CD)

this_Re = [10940.86555083, 13419.20972376, 21080.74104361, 29969.83072693, 36438.89917782, 41373.73264073,
           45842.63697827, 50839.13217244, 55877.23014428, 60612.78159125, 65482.99369756, 70332.56842598,
           75197.56024198, 80340.67175443, 85377.27859881, 90330.64760795, 89890.63129127, 8576.42658423]

this_alpha = [18.64167177, 24.07602684, 22.66423279, 17.7874695, 15.73267543, 14.17419872, 13.62414577, 13.25507582,
              12.86662159, 12.49683968, 12.0619762, 11.66907308, 11.28712304, 10.99017599, 10.7326172, 10.53891917,
              8.73624857, 1.69642724]

# Cl_vec = [getCl(this_alpha[i], this_Re[i]) for i in xrange(len(this_Re))]
# Cd_vec = [getCd(this_alpha[i], this_Re[i]) for i in xrange(len(this_Re))]
# print "Cl = " + str(Cl_vec)
# print "Cd = " + str(Cd_vec)


# this_alphas = [alpha[i] for i in xrange(len(alpha)) if abs(Re[i] - this_Re) < 0.05]
Beispiel #5
0
from flask import Flask
import os
import lookup_table as table
from os import listdir
from os.path import isfile, join
import pickle

if __name__ == '__main__':

    # grabbing all the species names from kmz
    onlyfiles = [
        f for f in listdir("/nfs/range_shapefiles")
        if isfile(join("range_shapefiles", f))
    ]
    all_species = [name.split(",")[0] for name in onlyfiles if name]
    grid_cells = table.create_table()
    file_Name = "gridtable"
    fileObject = open(file_Name, 'wb')
    pickle.dump(grid_cells, fileObject)
    fileObject.close()
Beispiel #6
0
from lookup_table import create_table
from matplotlib import pyplot as plt
import numpy as np

alphas, reynolds_numbers, CLs, CDs, Clmax = create_table('SDA1075_494p')

Re20k_CL = []
Re20k_CD = []
Re20k_alpha = []

Re30k_CL = []
Re30k_CD = []
Re30k_alpha = []

Re40k_CL = []
Re40k_CD = []
Re40k_alpha = []

Re50k_CL = []
Re50k_CD = []
Re50k_alpha = []

Re60k_CL = []
Re60k_CD = []
Re60k_alpha = []

Re100k_CL = []
Re100k_CD = []
Re100k_alpha = []

Re250k_CL = []
Beispiel #7
0
def create_Cl_Cd_table(airfoil):
    alphas, Re, CL, CD, Clmax = lookup_table.create_table(airfoil)
    Cl_table = ((alphas, Re), CL)
    Cd_table = ((alphas, Re), CD)
    return Cl_table, Cd_table, Clmax