openLaval.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:OpenLaval 作者: istellartech 项目源码 文件源码
def make_interpolate_curve(self):
        """ interpolate contour curves """
        lcx = np.zeros(0)
        lcy = np.zeros(0)
        lcx = np.append(lcx, np.array(self.lower_concave_in_x)[::-1])
        lcx = np.append(lcx, self.lower_arc_x)
        lcx = np.append(lcx, np.array(self.lower_concave_out_x))
        lcy = np.append(lcy, np.array(self.lower_concave_in_y)[::-1])
        lcy = np.append(lcy, self.lower_arc_y)
        lcy = np.append(lcy, np.array(self.lower_concave_out_y))
        self.lower_curve_x = lcx
        self.lower_curve_y = lcy
        self.lower_curve_x_shift = lcx
        self.lower_curve_y_shift = lcy + self.shift

        ucx = np.zeros(0)
        ucy = np.zeros(0)
        ucx = np.append(ucx, np.array(self.edge_straight_in_x))
        ucx = np.append(ucx, np.array(self.upper_straight_in_x))
        ucx = np.append(ucx, np.array(self.upper_convex_in_x)[::-1])
        ucx = np.append(ucx, self.upper_arc_x)
        ucx = np.append(ucx, np.array(self.upper_convex_out_x))
        ucx = np.append(ucx, np.array(self.upper_straight_out_x))
        ucx = np.append(ucx, np.array(self.edge_straight_out_x))

        ucy = np.append(ucy, np.array(self.edge_straight_in_y))
        ucy = np.append(ucy, np.array(self.upper_straight_in_y))
        ucy = np.append(ucy, np.array(self.upper_convex_in_y)[::-1])
        ucy = np.append(ucy, self.upper_arc_y)
        ucy = np.append(ucy, np.array(self.upper_convex_out_y))
        ucy = np.append(ucy, np.array(self.upper_straight_out_y))
        ucy = np.append(ucy, np.array(self.edge_straight_out_y))
        self.upper_curve_x = ucx
        self.upper_curve_y = ucy

        print(len(ucx),len(ucy))

        x = np.linspace(ucx.min(), ucx.max(), self.num_output_points)
        lcy_func = interp1d(self.lower_curve_x, self.lower_curve_y)
        lcy_shift_func = interp1d(self.lower_curve_x_shift, self.lower_curve_y_shift)
        ucy_func = interp1d(self.upper_curve_x, self.upper_curve_y)
        self.lower_curve_x_interp = x
        self.lower_curve_y_interp = lcy_func(x)
        self.lower_curve_x_shift_interp = x
        self.lower_curve_y_shift_interp = lcy_shift_func(x)
        self.upper_curve_x_interp = x
        self.upper_curve_y_interp = ucy_func(x)

        # make pandas DataFrame to save contour
        tmp = [x, self.lower_curve_y_shift_interp,
               self.upper_curve_y_interp, self.lower_curve_y_interp]
        self.dfc = pd.DataFrame(tmp, index = ["x", "lower curve1", "upper curve", "lower curve2"])
        if(self.is_save_excel):
            """ save contour in Excel file """
            writer = pd.ExcelWriter("result/turbine_contour_" + self.name + ".xlsx")
            self.dfc.T.to_excel(writer, "contour")
            writer.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号