def get_surface(self): num_sections = (self.number_of_cells + 1) // 2 anhedral_angle_r = self.anhedral_angle * numpy.pi / 180 r = self.span / 2.0 / numpy.sin(anhedral_angle_r) sections = [] y = numpy.linspace(self.number_of_cells % 2, self.number_of_cells, num_sections) / self.number_of_cells sectiondata = SectionAIRFOILData.get_clipped_section_data(self.sectiondata, self.inlet_height, self.cut_angle) filename = 'parafoil.dat' filename = os.path.abspath(filename) sectiondata.write_airfoil_file(filename, 'parafoil') if self.number_of_cells%2==1: le = numpy.zeros((3,)) sectionafile = SectionAFILEData(filename=filename) sections.append(Section(leading_edge=le, chord=self.chord, type=sectionafile.type, data=sectionafile)) for i, theta in enumerate(anhedral_angle_r * y): le = numpy.array([0, r * numpy.sin(theta), r * (numpy.cos(theta) - 1)]) sectionafile = SectionAFILEData(filename=filename) sections.append(Section(leading_edge=le, chord=self.chord, type=sectionafile.type, data=sectionafile)) surface = Surface(name='Parafoil', yduplicate=0, sections=sections) return surface
if __name__ == '__main__': from pyavl.case import Case from pyavl import runs_dir, join file = open(join(runs_dir, 'ow.avl')) case = Case.case_from_input_file(file) #g = GeometryViewer(geometry=case.geometry) #g.configure_traits() #print g.surfaces[2].sectiondata sections = case.geometry.surfaces[2].sections section = sections[0] section.type = 'NACA' section.data.number = 4412 #for s in sections: # if s.type == 'airfoil data file': # section = s # break #print section, [s.data for s in sections] sv = SectionViewer(section=section) sv.configure_traits() #section = sections[0] sectiondata = SectionAIRFOILData.get_clipped_section_data( section.data, 0.1, 135) section2 = Section(type=sectiondata.type) section2.data = sectiondata #section.type = sectiondata.type #section.data = sectiondata sv = SectionViewer(section=section2) sv.configure_traits()
if __name__ == "__main__": from pyavl.case import Case from pyavl import runs_dir, join file = open(join(runs_dir, "ow.avl")) case = Case.case_from_input_file(file) # g = GeometryViewer(geometry=case.geometry) # g.configure_traits() # print g.surfaces[2].sectiondata sections = case.geometry.surfaces[2].sections section = sections[0] section.type = "NACA" section.data.number = 4412 # for s in sections: # if s.type == 'airfoil data file': # section = s # break # print section, [s.data for s in sections] sv = SectionViewer(section=section) sv.configure_traits() # section = sections[0] sectiondata = SectionAIRFOILData.get_clipped_section_data(section.data, 0.1, 135) section2 = Section(type=sectiondata.type) section2.data = sectiondata # section.type = sectiondata.type # section.data = sectiondata sv = SectionViewer(section=section2) sv.configure_traits()