Source code for bladedesigner.camberlines.joukowskicamberline
#!/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__ = ['JoukowskiCamberLine']
[docs]class JoukowskiCamberLine(bcls.AnalyticalCamberLine):
"""
The Joukowski-Camberline is characterized by the maximum camber.
Its geometry results from the Joukowski-Transformation, the camberline
is defined for small bulges in the following form:
"""
def __init__(self):
super(JoukowskiCamberLine, self).__init__()
# properties (initialized by user)
self.__max_camber = fdn.Uninit('max_camber')
# add user properties to initialization summary
self._properties.append('max_camber')
@property
def max_camber(self):
return self.__max_camber
@max_camber.setter
@fdn.restrict(new_max_camber=(int, float))
def max_camber(self, new_max_camber):
"""
Type: ``int or float``
"""
if self.__max_camber != new_max_camber:
self.__max_camber = new_max_camber
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)
return self.max_camber * (1 - 2 * x)
@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)
y = self.max_camber * x * (1 - x)
return np.reshape(np.append(x, y), (-1, 2), "F")