Example #1
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()
Example #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()
Example #3
0
def create_default_avl(*args, **kwargs):
    avl = AVL(cwd=runs_dir)
    avl.load_case_from_file(join(runs_dir, 'vanilla.avl'))
    from pyavl.runutils import RunConfig
    rc = RunConfig(runcase=RunCase.get_case_from_avl(avl.avl))
    runoutput = rc.run(progressbar=False)
    avl.run_cases[0].runoutput = runoutput
    return avl
Example #4
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'
Example #5
0
 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()
Example #6
0
 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()
Example #7
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)
Example #8
0
                                              editable=False),
                         show_label=False),
                    Item('object.matrix.matrix',
                         editor=TabularEditor(adapter=EigenMatrixAdapter(),
                                              operations=[],
                                              editable=False),
                         show_label=False)),
                resizable=True)


if __name__ == '__main__':
    from pyavl.avl import AVL
    from pyavl.runutils import RunConfig
    from pyavl import runs_dir, join
    avl = AVL(cwd=runs_dir)
    filename = join(runs_dir, 'allegro.avl')
    avl.load_case_from_file(filename)
    rv = RunConfig(runcase=RunCase.get_case_from_avl(avl.avl))
    print rv.configure_traits(kind='livemodal')
    print 'rv configured'
    output = rv.run()
    print output
    print 'rv ran'
    opv = OutputPlotViewer(runoutput=output)
    opv.configure_traits()

    ovv = OutputVariablesViewer(runoutput=output)
    ovv.configure_traits()

    osv = OutputSystemViewer(runoutput=output)
    osv.configure_traits()
Example #9
0
 def setUp(self):
     self.avl = avl.AVL(cwd=runs_dir)
     self.filename = join(runs_dir, 'allegro.avl')
Example #10
0
            renderer.value_mapper.range.high = 3 / 8.
        self.plot = plot

    view = View(Item(
        'plot',
        editor=ComponentEditor(),
        show_label=False,
        resizable=True,
    ),
                resizable=True)


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()
Example #11
0
        self.update()

    def _root_object_items_changed(self, list_event):
        """Trait handler called when the items of the list change."""
        self._root_object_changed(self.root_object)

    def _on_dclick(self, obj):
        """Callback that is called when nodes are double-clicked."""
        if hasattr(obj, 'object') and hasattr(obj.object, 'edit_traits'):
            object = obj.object
            view = object.trait_view()
            view.handler = UICloseHandler(browser=self)
            #object.on_trait_change(self.render)
            ui = object.edit_traits(view=view)

    #view = View()


if __name__ == '__main__':
    from pyavl import runs_dir, join
    file = open(join(runs_dir, 'vanilla.avl'))
    avl = AVL(cwd=runs_dir)
    avl.load_case_from_file(join(runs_dir, 'vanilla.avl'))
    #tv = AVLTreeView(avl=avl)
    tv = AVLTreeBrowser(avl)
    #gui = GUI()
    #tv.show()
    #gui.start_event_loop()

    tv.configure_traits(view=tv.view)
Example #12
0
 def setUp(self):
     self.avl = avl.AVL(cwd=runs_dir)
     self.filename = join(runs_dir, 'allegro.avl')
Example #13
0
            renderer.value_mapper.stretch_data = False

            renderer.index_mapper.range.low = 0
            renderer.index_mapper.range.high = 1
            renderer.value_mapper.range.low = -3 / 8.0
            renderer.value_mapper.range.high = 3 / 8.0
        self.plot = plot

    view = View(Item("plot", editor=ComponentEditor(), show_label=False, resizable=True), resizable=True)


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()
Example #14
0
    view = View(Item('run_number', editor=RangeEditor(mode='spinner')),
                Group(Item('modes_array',
                     editor=TabularEditor(adapter=ModesAdapter(), operations=[], editable=False),
                     show_label=False),
                Item('object.matrix.matrix',
                     editor=TabularEditor(adapter=EigenMatrixAdapter(), operations=[], editable=False),
                     show_label=False)),
                resizable=True
                )

if __name__ == '__main__':
    from pyavl.avl import AVL
    from pyavl.runutils import RunConfig
    from pyavl import runs_dir, join
    avl = AVL(cwd=runs_dir)
    filename = join(runs_dir, 'allegro.avl')
    avl.load_case_from_file(filename)
    rv = RunConfig(runcase=RunCase.get_case_from_avl(avl.avl))
    print rv.configure_traits(kind='livemodal')
    print 'rv configured'
    output = rv.run()
    print output
    print 'rv ran'
    opv = OutputPlotViewer(runoutput=output)
    opv.configure_traits()
    
    ovv = OutputVariablesViewer(runoutput=output)
    ovv.configure_traits()
    
    osv = OutputSystemViewer(runoutput=output)
    osv.configure_traits()
Example #15
0
 def create_default_runoutput(*args, **kwargs):
     avl = AVL(cwd=runs_dir)
     avl.load_case_from_file(join(runs_dir, "vanilla.avl"))
     return avl
Example #16
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)
Example #17
0
    def _root_object_items_changed(self, list_event):
        """Trait handler called when the items of the list change."""
        self._root_object_changed(self.root_object)
    
    def _on_dclick(self, obj):
        """Callback that is called when nodes are double-clicked."""
        if hasattr(obj, 'object') and hasattr(obj.object, 'edit_traits'):
            object = obj.object
            view = object.trait_view()
            view.handler = UICloseHandler(browser=self)
            #object.on_trait_change(self.render)
            ui = object.edit_traits(view=view)
            
    #view = View()


if __name__ == '__main__':
    from pyavl import runs_dir, join
    file = open(join(runs_dir, 'vanilla.avl'))
    avl = AVL(cwd=runs_dir)
    avl.load_case_from_file(join(runs_dir, 'vanilla.avl'))
    #tv = AVLTreeView(avl=avl)
    tv = AVLTreeBrowser(avl)
    #gui = GUI()
    #tv.show()
    #gui.start_event_loop()
    
    tv.configure_traits(view=tv.view)