Beispiel #1
0
class Test(unittest.TestCase):

    def setUp(self):
        geometry = Geometry()
        surface1 = Surface('surface 1', (20,1.0), scale=2.0)
        geometry.surfaces[surface1.name] = surface1
        self.case = Case(casename='testCase', mach_no=0.0, symmetry=(0,0,0.0), ref_area=9.0, ref_chord=0.9, ref_span=10.0, ref_cg=(0.5,0.0,0.0), geometry=geometry)
        self.test_avl_case = 'ow'

    def tearDown(self):
        pass


    def test_file_write(self):
        file = open(self.test_avl_case+'.avl', 'w')
        self.case.write_input_file(file)
    
    def test_file_read(self):
        file = open(join(runs_dir, self.test_avl_case+'.avl'))
        case = Case.case_from_input_file(file)
        file.close()
        file = open('read_test_write.avl', 'w')
        case.write_input_file(file)
        file.close()
    
    def test_filter_lines(self):
        file = open(join(runs_dir, self.test_avl_case+'.avl'))
        lines = filter_lines(file.readlines())
        f2 = open('filter_lines.avl', 'w')
        f2.write('\n'.join(lines))
        f2.close()
        file.close()
        file = open('filter_test.avl','w')
        file.write('\n'.join(lines))
        file.close()
Beispiel #2
0
 def test_file_read(self):
     file = open(join(runs_dir, self.test_avl_case + '.avl'))
     case = Case.case_from_input_file(file)
     file.close()
     file = open('read_test_write.avl', 'w')
     case.write_input_file(file)
     file.close()
Beispiel #3
0
 def setUp(self):
     geometry = Geometry()
     surface1 = Surface(name='surface 1', cvortices=[20,1.0], scale=[1.0,1.0,1.0], index=1, yduplicate=1.0)
     section1data = SectionAFILEData(filename=join(runs_dir, 'ag42d.dat'))
     section1 = Section(type='airfoil data file', data=section1data)
     geometry.surfaces.append(surface1)
     self.case = Case(name='testCase', mach_no=0.0, symmetry=[0,0,0.0], ref_area=9.0, ref_chord=0.9, ref_span=10.0, ref_cg=[0.5,0.0,0.0], geometry=geometry)
     self.test_avl_case = 'allegro'
Beispiel #4
0
 def setUp(self):
     geometry = Geometry()
     surface1 = Surface('surface 1', (20, 1.0), scale=2.0)
     geometry.surfaces[surface1.name] = surface1
     self.case = Case(casename='testCase',
                      mach_no=0.0,
                      symmetry=(0, 0, 0.0),
                      ref_area=9.0,
                      ref_chord=0.9,
                      ref_span=10.0,
                      ref_cg=(0.5, 0.0, 0.0),
                      geometry=geometry)
     self.test_avl_case = 'ow'
Beispiel #5
0
class Test(unittest.TestCase):

    def setUp(self):
        geometry = Geometry()
        surface1 = Surface(name='surface 1', cvortices=[20,1.0], scale=[1.0,1.0,1.0], index=1, yduplicate=1.0)
        section1data = SectionAFILEData(filename=join(runs_dir, 'ag42d.dat'))
        section1 = Section(type='airfoil data file', data=section1data)
        geometry.surfaces.append(surface1)
        self.case = Case(name='testCase', mach_no=0.0, symmetry=[0,0,0.0], ref_area=9.0, ref_chord=0.9, ref_span=10.0, ref_cg=[0.5,0.0,0.0], geometry=geometry)
        self.test_avl_case = 'allegro'

    def tearDown(self):
        pass

    def test_file_write(self):
        file = open(self.test_avl_case+'.avl', 'w')
        self.case.write_input_file(file)
    
    def test_file_read(self):
        file = open(join(runs_dir, self.test_avl_case+'.avl'))
        case = Case.case_from_input_file(file)
        file.close()
        file = open('read_test_write.avl', 'w')
        case.write_input_file(file)
        file.close()
    
    def test_filter_lines(self):
        file = open(join(runs_dir, self.test_avl_case+'.avl'))
        lines = filter_lines(file.readlines())
        f2 = open('filter_lines.avl', 'w')
        f2.write('\n'.join(lines))
        f2.close()
        file.close()
        file = open('filter_test.avl','w')
        file.write('\n'.join(lines))
        file.close()
    
    def test_ui(self):
        file = open(join(runs_dir, self.test_avl_case+'.avl'))
        self.case = Case.case_from_input_file(file)
        import sys
        self.case.configure_traits()
        #self.case.geometry.surfaces[0].write_to_file(sys.stdout)
        
        #self.case.geometry.configure_traits()
        #self.case.geometry.surfaces[0].configure_traits()
        #self.case.geometry.write_to_file(sys.stdout)
        from pyavl.ui.geometry_viewer import GeometryViewer
        g = GeometryViewer(geometry=self.case.geometry)
        g.configure_traits(scrollable=True)
Beispiel #6
0
 def test_file_read(self):
     file = open(join(runs_dir, self.test_avl_case+'.avl'))
     case = Case.case_from_input_file(file)
     file.close()
     file = open('read_test_write.avl', 'w')
     case.write_input_file(file)
     file.close()
Beispiel #7
0
 def load_case_from_file(self, filename):
     self.avl.sendline('load %s' % filename)
     self.case_filename = filename
     if os.path.isabs(filename):
         f = open(filename)
     else:
         f = open(os.path.join(self.cwd, filename))
     self.case = Case.case_from_input_file(f, cwd=self.cwd)
     f.close()
     AVL.goto_state(self.avl)
     self.populate_runcases()
Beispiel #8
0
class Test(unittest.TestCase):
    def setUp(self):
        geometry = Geometry()
        surface1 = Surface('surface 1', (20, 1.0), scale=2.0)
        geometry.surfaces[surface1.name] = surface1
        self.case = Case(casename='testCase',
                         mach_no=0.0,
                         symmetry=(0, 0, 0.0),
                         ref_area=9.0,
                         ref_chord=0.9,
                         ref_span=10.0,
                         ref_cg=(0.5, 0.0, 0.0),
                         geometry=geometry)
        self.test_avl_case = 'ow'

    def tearDown(self):
        pass

    def test_file_write(self):
        file = open(self.test_avl_case + '.avl', 'w')
        self.case.write_input_file(file)

    def test_file_read(self):
        file = open(join(runs_dir, self.test_avl_case + '.avl'))
        case = Case.case_from_input_file(file)
        file.close()
        file = open('read_test_write.avl', 'w')
        case.write_input_file(file)
        file.close()

    def test_filter_lines(self):
        file = open(join(runs_dir, self.test_avl_case + '.avl'))
        lines = filter_lines(file.readlines())
        f2 = open('filter_lines.avl', 'w')
        f2.write('\n'.join(lines))
        f2.close()
        file.close()
        file = open('filter_test.avl', 'w')
        file.write('\n'.join(lines))
        file.close()
Beispiel #9
0
 def test_ui(self):
     file = open(join(runs_dir, self.test_avl_case+'.avl'))
     self.case = Case.case_from_input_file(file)
     import sys
     self.case.configure_traits()
     #self.case.geometry.surfaces[0].write_to_file(sys.stdout)
     
     #self.case.geometry.configure_traits()
     #self.case.geometry.surfaces[0].configure_traits()
     #self.case.geometry.write_to_file(sys.stdout)
     from pyavl.ui.geometry_viewer import GeometryViewer
     g = GeometryViewer(geometry=self.case.geometry)
     g.configure_traits(scrollable=True)
Beispiel #10
0
        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
    traits_view = View('span','chord','number_of_cells','anhedral_angle',
                       Item('object.sectiondata.filename',label='section data file'),
                       'inlet_height','cut_angle')

if __name__ == '__main__':
    import sys
    from pyavl.case import Case
    from pyavl import runs_dir, join
    file = open(join(runs_dir, 'bd.avl'))
    case = Case.case_from_input_file(file)
    pw = ParafoilWizard()
    pw.configure_traits()
    surface = pw.get_surface()
    #surface.configure_traits()
    geometry = Geometry(surfaces=[surface])
    #geometry.configure_traits()
    g = GeometryViewer(geometry=geometry)
    g.configure_traits()
    surface.write_to_file(sys.stdout)
Beispiel #11
0
 def setUp(self):
     geometry = Geometry()
     surface1 = Surface('surface 1', (20,1.0), scale=2.0)
     geometry.surfaces[surface1.name] = surface1
     self.case = Case(casename='testCase', mach_no=0.0, symmetry=(0,0,0.0), ref_area=9.0, ref_chord=0.9, ref_span=10.0, ref_cg=(0.5,0.0,0.0), geometry=geometry)
     self.test_avl_case = 'ow'