Exemple #1
0
    def load_tecplot_geometry(self,
                              tecplot_filename,
                              dirname,
                              name='main',
                              plot=True):
        #key = self.case_keys[self.icase]
        #case = self.result_cases[key]

        skip_reading = self._remove_old_cart3d_geometry(tecplot_filename)
        if skip_reading:
            return

        if 0:
            fnames = os.listdir('time20000')
            fnames = [os.path.join('time20000', fname) for fname in fnames]
            model = merge_tecplot_files(fnames,
                                        tecplot_filename_out=None,
                                        log=self.log)
        else:
            model = Tecplot(log=self.log, debug=False)
            model.read_tecplot(tecplot_filename)

        self.model_type = 'tecplot'
        #self.model_type = model.model_type
        self.nNodes = model.nnodes

        #self._make_tecplot_geometry(model, self.nNodes, quads_only=True) # cart3d
        is_surface = self._make_tecplot_geometry(model, quads_only=False)

        #self._create_cart3d_free_edegs(model, nodes, elements)

        # loadCart3dResults - regions/loads
        self.turn_text_on()
        self.scalarBar.VisibilityOn()
        self.scalarBar.Modified()

        loads = []
        assert loads is not None
        if 'Mach' in loads:
            avgMach = mean(loads['Mach'])
            note = ':  avg(Mach)=%g' % avgMach
        else:
            note = ''
        self.iSubcaseNameMap = {1: ['Tecplot%s' % note, '']}
        cases = {}
        ID = 1

        form, cases = self._fill_tecplot_case(cases, ID, model, is_surface)
        self._finish_results_io2(form, cases)

        if 0:
            # http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/AppendFilter
            points = vtkAppendFilter()
            #if VTK_MAJOR_VERSION <= 5:
            #appendFilter.AddInput(polydata)
            #appendFilter.AddInput(ug)
            #else:
            appendFilter.AddInputData(polydata)
            appendFilter.AddInputData()
            appendFilter.Update()
    def load_tecplot_geometry(self, tecplot_filename, dirname, plot=True):
        #key = self.caseKeys[self.iCase]
        #case = self.resultCases[key]

        skip_reading = self._remove_old_cart3d_geometry(tecplot_filename)
        if skip_reading:
            return

        if 0:
            fnames = os.listdir('time20000')
            fnames = [os.path.join('time20000', fname) for fname in fnames]
            model = merge_tecplot_files(fnames, tecplot_filename_out=None, log=self.log)
        else:
            model = Tecplot(log=self.log, debug=False)
            model.read_tecplot(tecplot_filename)

        self.modelType = 'tecplot'
        #self.modelType = model.modelType
        self.nNodes = model.nnodes

        #self._make_tecplot_geometry(model, self.nNodes, quads_only=True) # cart3d
        is_surface = self._make_tecplot_geometry(model, quads_only=False)

        #self._create_cart3d_free_edegs(model, nodes, elements)


        # loadCart3dResults - regions/loads
        self.TurnTextOn()
        self.scalarBar.VisibilityOn()
        self.scalarBar.Modified()

        loads = []
        assert loads is not None
        if 'Mach' in loads:
            avgMach = mean(loads['Mach'])
            note = ':  avg(Mach)=%g' % avgMach
        else:
            note = ''
        self.iSubcaseNameMap = {1: ['Tecplot%s' % note, '']}
        cases = {}
        ID = 1

        form, cases = self._fill_tecplot_case(cases, ID, model, is_surface)
        self._finish_results_io2(form, cases)

        if 0:
            # http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/AppendFilter
            points = vtkAppendFilter()
            #if VTK_MAJOR_VERSION <= 5:
                #appendFilter.AddInput(polydata)
                #appendFilter.AddInput(ug)
            #else:
            appendFilter.AddInputData(polydata)
            appendFilter.AddInputData()
            appendFilter.Update()
def process_tecplot(tecplot_filename: str, fmt2: str, fname2: str,
                    log: SimpleLogger,
                    data: Optional[Dict[str, Any]]=None,
                    quiet: bool=False) -> None:
    """
    Converts Tecplot to Tecplot

    Globs all input tecplot files (e.g. tecplot*.plt)
    """
    assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2
    if '*' in tecplot_filename:
        tecplot_filenames = glob.glob(tecplot_filename)
    else:
        tecplot_filenames = [tecplot_filename]
    assert len(tecplot_filenames) > 0, tecplot_filename
    from pyNastran.converters.tecplot.utils import merge_tecplot_files
    from pyNastran.converters.tecplot.tecplot_to_nastran import tecplot_to_nastran_filename
    from pyNastran.converters.tecplot.tecplot_to_cart3d import tecplot_to_cart3d_filename

    model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None, log=log)
    #if fmt2 == 'cart3d':
        #tecplot_to_cart3d(model, fname2)
    #elif fmt2 == 'stl':
        #tecplot_to_stl(model, fname2)
    # elif fmt2 == 'ugrid':
        # tecplot_to_ugrid(model, fname2)
    res_types = data['RESTYPE']
    unused_is_points = not data['--block']
    if fmt2 == 'tecplot':
        if not quiet:  # pragma: no cover
            print(data)
        element_slice(model, data)

        # this is a good way to merge files
        model.write_tecplot(fname2, res_types=res_types) # is_points=is_points
    elif fmt2 == 'nastran':
        tecplot_to_nastran_filename(model, fname2)
    elif fmt2 == 'stl':
        cart3d_filename = fname2 + '.tri'
        tecplot_to_cart3d_filename(model, cart3d_filename, log=log)
        process_cart3d(cart3d_filename, fmt2, fname2, log, data=data, quiet=quiet)
        os.remove(cart3d_filename)
        #tecplot_to_nastran_filename(model, fname2 + '.bdf')
        #process_nastran(fname2 + '.bdf', fmt2, fname2, log, data=data, quiet=quiet)
    elif fmt2 == 'cart3d':
        # supports tris/quads, not loads
        #tecplot_to_nastran_filename(model, fname2 + '.bdf')
        #process_nastran(fname2 + '.bdf', fmt2, fname2, log, data=data, quiet=quiet)

        # supports quads/loads, not tris
        tecplot_to_cart3d_filename(model, fname2, log=log)
    else:
        raise NotImplementedError('fmt2=%s is not supported by process_tecplot' % fmt2)
Exemple #4
0
def process_tecplot(tecplot_filename, fmt2, fname2, data=None):
    """
    Converts Tecplot to Tecplot

    Globs all input tecplot files (e.g. tecplot*.plt)
    """
    assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2
    if '*' in tecplot_filename:
        tecplot_filenames = glob.glob(tecplot_filename)
    else:
        tecplot_filenames = [tecplot_filename]
    assert len(tecplot_filenames) > 0, tecplot_filename
    from pyNastran.converters.tecplot.utils import merge_tecplot_files
    from pyNastran.converters.tecplot.tecplot_to_nastran import tecplot_to_nastran_filename
    from pyNastran.converters.tecplot.tecplot_to_cart3d import tecplot_to_cart3d_filename

    model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None)
    #if fmt2 == 'cart3d':
        #tecplot_to_cart3d(model, fname2)
    #elif fmt2 == 'stl':
        #tecplot_to_stl(model, fname2)
    # elif fmt2 == 'ugrid':
        # tecplot_to_ugrid(model, fname2)
    res_types = data['RESTYPE']
    is_points = not data['--block']
    if fmt2 == 'tecplot':
        print(data)
        element_slice(model, data)

        # this is a good way to merge files
        model.write_tecplot(fname2, res_types=res_types, is_points=is_points)
    elif fmt2 == 'nastran':
        tecplot_to_nastran_filename(model, fname2)
    elif fmt2 == 'stl':
        tecplot_to_nastran_filename(model, fname2 + '.bdf')
        process_nastran(fname2 + '.bdf', fmt2, fname2, data=data)
    elif fmt2 == 'cart3d':
        # supports tris/quads, not loads
        tecplot_to_nastran_filename(model, fname2 + '.bdf')
        process_nastran(fname2 + '.bdf', fmt2, fname2, data=data)

        # supports quads/loads, not tris
        #tecplot_to_cart3d_filename(model, fname2)
    else:
        raise NotImplementedError(fmt2)
Exemple #5
0
def process_tecplot(tecplot_filename, fmt2, fname2, data=None):
    """
    Converts Tecplot to Tecplot

    Globs all input tecplot files (e.g. tecplot*.plt)
    """
    assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2
    if '*' in tecplot_filename:
        tecplot_filenames = glob.glob(tecplot_filename)
    else:
        tecplot_filenames = [tecplot_filename]
    assert len(tecplot_filenames) > 0, tecplot_filename
    model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None)
    #if fmt2 == 'cart3d':
        #tecplot_to_cart3d(model, fname2)
    #elif fmt2 == 'stl':
        #tecplot_to_stl(model, fname2)
    # elif fmt2 == 'ugrid':
        # tecplot_to_ugrid(model, fname2)
    res_types = data['RESTYPE']
    is_points = not data['--block']
    if fmt2 == 'tecplot':
        print(data)
        element_slice(model, data)

        # this is a good way to merge files
        model.write_tecplot(fname2, res_types=res_types, is_points=is_points)
    elif fmt2 == 'nastran':
        tecplot_to_nastran_filename(model, fname2)
    elif fmt2 == 'stl':
        tecplot_to_nastran_filename(model, fname2 + '.bdf')
        process_nastran(fname2 + '.bdf', fmt2, fname2, data=data)
    elif fmt2 == 'cart3d':
        # supports tris/quads, not loads
        tecplot_to_nastran_filename(model, fname2 + '.bdf')
        process_nastran(fname2 + '.bdf', fmt2, fname2, data=data)

        # supports quads/loads, not tris
        #tecplot_to_cart3d_filename(model, fname2)
    else:
        raise NotImplementedError(fmt2)
Exemple #6
0
def main():
    plt = Tecplot()
    fnames = os.listdir(r'Z:\Temporary_Transfers\steve\output\time20000')


    datai = [
        'n=3807, e=7443',
        'n=3633, e=7106',
        'n=3847, e=7332',
        'n=3873, e=6947',
        'n=4594, e=8131',
        'n=4341, e=7160',
        'n=4116, e=8061',
        'n=4441, e=8105',
        'n=4141, e=8126',
        'n=4085, e=8053',
        'n=4047, e=8215',
        'n=4143, e=8123',
        'n=4242, e=7758',
        'n=3830, e=7535',
        'n=3847, e=7936',
        'n=3981, e=7807',
        'n=3688, e=7415',
        'n=4222, e=8073',
        'n=4164, e=7327',
        'n=3845, e=8354',
        'n=4037, e=6786',
        'n=3941, e=8942',
        'n=4069, e=7345',
        'n=4443, e=8001',
        'n=3895, e=7459',
        'n=4145, e=7754',
        'n=4224, e=8152',
        'n=4172, e=7878',
        'n=4138, e=8864',
        'n=3801, e=7431',
        'n=3984, e=6992',
        'n=4195, e=7967',
        'n=4132, e=7992',
        'n=4259, e=7396',
        'n=4118, e=7520',
        'n=4176, e=7933',
        'n=4047, e=8098',
        'n=4064, e=8540',
        'n=4144, e=8402',
        'n=4144, e=7979',
        'n=3991, e=6984',
        'n=4080, e=8465',
        'n=3900, e=7981',
        'n=3709, e=8838',
        'n=4693, e=8055',
        'n=4022, e=7240',
        'n=4028, e=8227',
        'n=3780, e=7551',
        'n=3993, e=8671',
        'n=4241, e=7277',
        'n=4084, e=6495',
        'n=4103, e=8165',
        'n=4496, e=5967',
        'n=3548, e=8561',
        'n=4143, e=7749',
        'n=4136, e=8358',
        'n=4096, e=7319',
        'n=4209, e=8036',
        'n=3885, e=7814',
        'n=3800, e=8232',
        'n=3841, e=7837',
        'n=3874, e=7571',
        'n=3887, e=8079',
        'n=3980, e=7834',
        'n=3763, e=7039',
        'n=4287, e=7130',
        'n=4110, e=8336',
        'n=3958, e=7195',
        'n=4730, e=7628',
        'n=4087, e=8149',
        'n=4045, e=8561',
        'n=3960, e=7320',
        'n=3901, e=8286',
        'n=4065, e=7013',
        'n=4160, e=7906',
        'n=3628, e=7140',
        'n=4256, e=8168',
        'n=3972, e=8296',
        'n=3661, e=7879',
        'n=3922, e=8093',
        'n=3972, e=6997',
        'n=3884, e=7603',
        'n=3609, e=6856',
        'n=4168, e=7147',
        'n=4206, e=8232',
        'n=4631, e=8222',
        'n=3970, e=7569',
        'n=3998, e=7617',
        'n=3855, e=7971',
        'n=4092, e=7486',
        'n=4407, e=7847',
        'n=3976, e=7627',
        'n=3911, e=8483',
        'n=4144, e=7919',
        'n=4033, e=8129',
        'n=3976, e=7495',
        'n=3912, e=7739',
        'n=4278, e=8522',
        'n=4703, e=8186',
        'n=4230, e=7811',
        'n=3971, e=7699',
        'n=4081, e=8242',
        'n=4045, e=7524',
        'n=4532, e=5728',
        'n=4299, e=8560',
        'n=3885, e=7531',
        'n=4452, e=8405',
        'n=4090, e=7661',
        'n=3937, e=7739',
        'n=4336, e=7612',
        'n=4101, e=7461',
        'n=3980, e=8632',
        'n=4523, e=7761',
        'n=4237, e=8463',
        'n=4013, e=7856',
        'n=4219, e=8013',
        'n=4248, e=8328',
        'n=4529, e=8757',
        'n=4109, e=7496',
        'n=3969, e=8026',
        'n=4093, e=8506',
        'n=3635, e=7965',
        'n=4347, e=8123',
        'n=4703, e=7752',
        'n=3867, e=8124',
        'n=3930, e=7919',
        'n=4247, e=7154',
        'n=4065, e=8125',
    ]
    fnames = [os.path.join(r'Z:\Temporary_Transfers\steve\output\time20000', fname)
              for fname in fnames]
    tecplot_filename_out = None
    #tecplot_filename_out = 'tecplot_joined.plt'
    from pyNastran.converters.tecplot.utils import merge_tecplot_files
    model = merge_tecplot_files(fnames, tecplot_filename_out)

    y0 = 0.0
    model.extract_y_slice(y0, tol=0.014, slice_filename='slice.plt')

    return
    for iprocessor, fname in enumerate(fnames):
        nnodes, nelements = datai[iprocessor].split(',')
        nnodes = int(nnodes.split('=')[1])
        nelements = int(nelements.split('=')[1])

        ip = iprocessor + 1
        tecplot_filename = 'model_final_meters_part%i_tec_volume_timestep20000.plt' % ip
        print(tecplot_filename)
        try:
            plt.read_tecplot_binary(tecplot_filename, nnodes=nnodes, nelements=nelements)
            plt.write_tecplot('processor%i.plt' % ip)
        except:
            raise
Exemple #7
0
def main():  # pragma: no cover
    #plt = Tecplot()
    fnames = os.listdir(r'Z:\Temporary_Transfers\steve\output\time20000')


    datai = [
        'n=3807, e=7443',
        'n=3633, e=7106',
        'n=3847, e=7332',
        'n=3873, e=6947',
        'n=4594, e=8131',
        'n=4341, e=7160',
        'n=4116, e=8061',
        'n=4441, e=8105',
        'n=4141, e=8126',
        'n=4085, e=8053',
        'n=4047, e=8215',
        'n=4143, e=8123',
        'n=4242, e=7758',
        'n=3830, e=7535',
        'n=3847, e=7936',
        'n=3981, e=7807',
        'n=3688, e=7415',
        'n=4222, e=8073',
        'n=4164, e=7327',
        'n=3845, e=8354',
        'n=4037, e=6786',
        'n=3941, e=8942',
        'n=4069, e=7345',
        'n=4443, e=8001',
        'n=3895, e=7459',
        'n=4145, e=7754',
        'n=4224, e=8152',
        'n=4172, e=7878',
        'n=4138, e=8864',
        'n=3801, e=7431',
        'n=3984, e=6992',
        'n=4195, e=7967',
        'n=4132, e=7992',
        'n=4259, e=7396',
        'n=4118, e=7520',
        'n=4176, e=7933',
        'n=4047, e=8098',
        'n=4064, e=8540',
        'n=4144, e=8402',
        'n=4144, e=7979',
        'n=3991, e=6984',
        'n=4080, e=8465',
        'n=3900, e=7981',
        'n=3709, e=8838',
        'n=4693, e=8055',
        'n=4022, e=7240',
        'n=4028, e=8227',
        'n=3780, e=7551',
        'n=3993, e=8671',
        'n=4241, e=7277',
        'n=4084, e=6495',
        'n=4103, e=8165',
        'n=4496, e=5967',
        'n=3548, e=8561',
        'n=4143, e=7749',
        'n=4136, e=8358',
        'n=4096, e=7319',
        'n=4209, e=8036',
        'n=3885, e=7814',
        'n=3800, e=8232',
        'n=3841, e=7837',
        'n=3874, e=7571',
        'n=3887, e=8079',
        'n=3980, e=7834',
        'n=3763, e=7039',
        'n=4287, e=7130',
        'n=4110, e=8336',
        'n=3958, e=7195',
        'n=4730, e=7628',
        'n=4087, e=8149',
        'n=4045, e=8561',
        'n=3960, e=7320',
        'n=3901, e=8286',
        'n=4065, e=7013',
        'n=4160, e=7906',
        'n=3628, e=7140',
        'n=4256, e=8168',
        'n=3972, e=8296',
        'n=3661, e=7879',
        'n=3922, e=8093',
        'n=3972, e=6997',
        'n=3884, e=7603',
        'n=3609, e=6856',
        'n=4168, e=7147',
        'n=4206, e=8232',
        'n=4631, e=8222',
        'n=3970, e=7569',
        'n=3998, e=7617',
        'n=3855, e=7971',
        'n=4092, e=7486',
        'n=4407, e=7847',
        'n=3976, e=7627',
        'n=3911, e=8483',
        'n=4144, e=7919',
        'n=4033, e=8129',
        'n=3976, e=7495',
        'n=3912, e=7739',
        'n=4278, e=8522',
        'n=4703, e=8186',
        'n=4230, e=7811',
        'n=3971, e=7699',
        'n=4081, e=8242',
        'n=4045, e=7524',
        'n=4532, e=5728',
        'n=4299, e=8560',
        'n=3885, e=7531',
        'n=4452, e=8405',
        'n=4090, e=7661',
        'n=3937, e=7739',
        'n=4336, e=7612',
        'n=4101, e=7461',
        'n=3980, e=8632',
        'n=4523, e=7761',
        'n=4237, e=8463',
        'n=4013, e=7856',
        'n=4219, e=8013',
        'n=4248, e=8328',
        'n=4529, e=8757',
        'n=4109, e=7496',
        'n=3969, e=8026',
        'n=4093, e=8506',
        'n=3635, e=7965',
        'n=4347, e=8123',
        'n=4703, e=7752',
        'n=3867, e=8124',
        'n=3930, e=7919',
        'n=4247, e=7154',
        'n=4065, e=8125',
    ]
    fnames = [os.path.join(r'Z:\Temporary_Transfers\steve\output\time20000', fname)
              for fname in fnames]
    tecplot_filename_out = None
    #tecplot_filename_out = 'tecplot_joined.plt'
    from pyNastran.converters.tecplot.utils import merge_tecplot_files
    model = merge_tecplot_files(fnames, tecplot_filename_out)

    y0 = 0.0
    model.extract_y_slice(y0, tol=0.014, slice_filename='slice.plt')

    return