Example #1
0
    def execute(self):
        """
        Default behaviour is to copy the input array

        derived classes need to overwrite this class with specific splines
        """

        if not self.init_called:
            self.initialize()

        self.P = self.Pbase + self.spline(self.x, self.Cx, self.C)
        self.dPds = curvature(np.array([self.x, self.P]).T)
Example #2
0
    def execute(self):
        """
        Default behaviour is to copy the input array

        derived classes need to overwrite this class with specific splines
        """

        if not self.init_called:
            self.initialize()

        self.P = self.Pbase + self.spline(self.x, self.Cx, self.C)
        self.dTds = curvature(np.array([self.x, self.P]).T)
Example #3
0
    def solve_nonlinear(self, params, unknowns, resids):
        """
        update the spline
        """
        C = params[self._name + '_C']

        if not self._init_called:
            self.set_spline(self.spline_options['spline_type'])
            # self.Pbase = self.base_spline(self.s, self.xinit, self.Pinit)
            self.spline.initialize(self.s, self.Cx, C)
        self._P = self.spline(self.s, self.Cx, C)
        P = self.Pinit + self._P * self.scaler
        curv = curvature(np.array([self.s, P]).T)
        unknowns[self._name] = P
        unknowns[self._name + '_curv'] = curv
Example #4
0
    def solve_nonlinear(self, params, unknowns, resids):
        """
        update the spline
        """
        C = params[self._name + '_C']

        if not self._init_called:
            self.set_spline(self.spline_options['spline_type'])
            # self.Pbase = self.base_spline(self.s, self.xinit, self.Pinit)
            self.spline.initialize(self.s, self.Cx, C)
        self._P = self.spline(self.s, self.Cx, C)
        P = self.Pinit + self._P * self.scaler
        curv = curvature(np.array([self.s, P]).T)
        unknowns[self._name] = P
        unknowns[self._name + '_curv'] = curv
Example #5
0
    def solve_nonlinear(self, params, unknowns, resids):
        """
        update the spline
        """

        C = params[self._name + "_C"]

        if not self._init_called:
            self.set_spline(self.spline_options["spline_type"])
            self.spline.initialize(self.s[self._iCx0 : self._iCx1], self.Cx, C)
        self._P = self.spline(self.s[self._iCx0 : self._iCx1], self.Cx, C)
        _P = np.zeros(self.Pinit.shape[0])
        _P[self._iCx0 : self._iCx1] = self._P
        P = self.Pinit + _P * self.scaler
        curv = curvature(np.array([self.s, P]).T)
        unknowns[self._name] = P
        unknowns[self._name + "_curv"] = curv
Example #6
0
    def computeLETE(self):
        """
        computes the leading and trailing edge of the airfoil.

        TE is computed as the mid-point between lower and upper TE points
        LE is computed as the point with maximum distance from the TE.
        """

        self.TE = np.array([np.average(self.points[[0, -1], 0]),
                            np.average(self.points[[0, -1], 1])])

        res = minimize(self._sdist, (0.5), method='SLSQP', bounds=[(0, 1)])
        self.sLE = res['x'][0]
        xLE = self.spline[0](self.sLE)
        yLE = self.spline[1](self.sLE)
        self.LE = np.array([xLE, yLE])
        self.curvLE = NaturalCubicSpline(self.s, curvature(self.points))(self.sLE)
        self.chord = np.linalg.norm(self.LE-self.TE)
Example #7
0
    def solve_nonlinear(self, params, unknowns, resids):
        """
        update the spline
        """

        C = params[self._name + '_C']

        if not self._init_called:
            self.set_spline(self.spline_options['spline_type'])
            self.spline.initialize(self.s[self._iCx0:self._iCx1], self.Cx, C)
        self._P = self.spline(self.s[self._iCx0:self._iCx1], self.Cx, C)
        _P = np.zeros(self.Pinit.shape[0])
        _P[self._iCx0:self._iCx1] = self._P

        P = self.Pinit + _P * self.scaler
        curv = curvature(np.array([self.s, P]).T)
        unknowns[self._name] = P
        unknowns[self._name + '_curv'] = curv
Example #8
0
    def computeLETE(self):
        """
        computes the leading and trailing edge of the airfoil.

        TE is computed as the mid-point between lower and upper TE points
        LE is computed as the point with maximum distance from the TE.
        """

        self.TE = np.array([
            np.average(self.points[[0, -1], 0]),
            np.average(self.points[[0, -1], 1])
        ])

        res = minimize(self._sdist, (0.5), method='SLSQP', bounds=[(0, 1)])
        self.sLE = res['x'][0]
        xLE = self.spline[0](self.sLE)
        yLE = self.spline[1](self.sLE)
        self.LE = np.array([xLE, yLE])
        self.curvLE = NaturalCubicSpline(self.s,
                                         curvature(self.points))(self.sLE)