Source code for bladedesigner.camberlines.d3pcamberline

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

# ***************************************************************************
# *   Copyright (C) 2011-2012 by Andreas Kührmann [kuean@users.sf.net]      *
# *                                                                         *
# *                                                                         *
# *   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.foundation as fdn

from d2pcamberline import D2PCamberLine


__all__ = ['D3PCamberLine']


[docs]class D3PCamberLine(D2PCamberLine): """ some documentation """ def __init__(self): super(D3PCamberLine, self).__init__() # properties (initialized by user) self.__angle_of_outflow = fdn.Uninit('angle_of_outflow') # add user properties to initialization summary self._properties.append('angle_of_outflow') @property def angle_of_outflow(self): r""" Type: ``int or float`` - values between (exclusive) 0 and :math:`\pi` only """ return self.__angle_of_outflow @angle_of_outflow.setter @fdn.restrict(new_angle_of_outflow=fdn.OpenInterval(0, np.pi))
[docs] def angle_of_outflow(self, new_angle_of_outflow): if self.__angle_of_outflow != new_angle_of_outflow: self.__angle_of_outflow = new_angle_of_outflow self.update()
def __get_coefficients(self): self._check_initialization('angle_of_inflow', 'angle_of_outflow') slop_inlet = np.tan(self.angle_of_inflow - np.pi / 2.) slop_outlet = np.tan(np.pi / 2. - self.angle_of_outflow) a_3 = slop_inlet - np.tan(slop_outlet) a_2 = -slop_inlet - a_3 a_1 = slop_inlet return a_1, a_2, a_3 @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) a_1, a_2, a_3 = self.__get_coefficients() return x * (x * 3 * a_3 + 2 * a_2) + a_1
@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) a_1, a_2, a_3 = self.__get_coefficients() y = x * (x * (x * a_3 + a_2) + a_1) return np.reshape(np.append(x, y), (-1, 2), "F")