Source code for bladedesigner.camberlines.n16scamberline

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# ***************************************************************************
# *   Copyright (C) 2011-2013 by Andreas Kührmann [kuean@users.sf.net] and  *
# *   Fabian Schäffer                                                       *
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU General Public License as published by  *
# *   the Free Software Foundation; either version 3 of the License, or     *
# *   (at your option) any later version.                                   *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU General Public License for more details.                          *
# *                                                                         *
# *   You should have received a copy of the GNU General Public License     *
# *   along with this program; if not, write to the                         *
# *   Free Software Foundation, Inc.,                                       *
# *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
# ***************************************************************************


import numpy as np

import bladedesigner.baseclasses as bcls
import bladedesigner.foundation as fdn


__all__ = ['N16SCamberLine']


[docs]class N16SCamberLine(bcls.AnalyticalCamberLine): """ The camberline of the NACA-16-Serie is dictated by a contant pressure-distribution above the total length. """ def __init__(self): super(N16SCamberLine, self).__init__() # properties (initialized by user) self.__lift_coefficient = fdn.Uninit('lift_coefficient') # add user properties to initialization summary self._properties.append('lift_coefficient') @property def lift_coefficient(self): return self.__lift_coefficient @lift_coefficient.setter @fdn.restrict(new_lift_coefficient=(int, float)) def lift_coefficient(self, new_lift_coefficient): """ Type: ``int or float`` """ if self.__lift_coefficient != new_lift_coefficient: self.__lift_coefficient = new_lift_coefficient self.update() @fdn.memoize
[docs] def get_derivations(self): """ get_derivations() Returns: ``ndarray`` Calculates camber line derivations and returns them in an array. .. note:: **Note** The return value will be cached. Recalling this method returns the cached value, if the attribues are unchanged. """ self._check_initialization() self._cached = True x = self.distribution(self.sample_rate) z = np.log(x[1:-1]) dydx = np.empty(x.shape) dydx[0] = np.inf dydx[1:-1] = -self.lift_coefficient / 4 / np.pi * (z - z[::-1]) dydx[-1] = -np.inf return dydx
@fdn.memoize
[docs] def as_array(self): """ as_array() Returns: ``ndarray`` Calculates camber line coordinates and returns them in an array. .. note:: **Note** The return value will be cached. Recalling this method returns the cached value, if the attribues are unchanged. """ self._check_initialization() self._cached = True x = self.distribution(self.sample_rate) z = x[1:-1] * np.log(x[1:-1]) y = np.empty(x.shape) y[1:-1] = -self.lift_coefficient * .079577472 * (z[::-1] + z) y[0] = y[-1] = 0 return np.reshape(np.append(x, y), (-1, 2), "F")