Пример #1
0
    def test_ugrid_01(self):
        """tests solid_bending.bdf"""
        nastran_filename1 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.bdf')
        ugrid_filename = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.b8.ugrid')
        log = get_logger(level='warning')

        unused_ugrid_model = nastran_to_ugrid(
            nastran_filename1, ugrid_filename_out=ugrid_filename,
            properties=None, check_shells=False, check_solids=True, log=log)
        assert os.path.exists(ugrid_filename), ugrid_filename

        nastran_filename2 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending2.bdf')
        ugrid_model = ugrid3d_to_nastran(
            ugrid_filename, nastran_filename2,
            include_shells=True, include_solids=True,
            convert_pyram_to_penta=False,
            encoding=None, size=16,
            is_double=False, log=log)
        argv = ['format_converter', 'ugrid', ugrid_filename,
                'nastran', 'shell_solid_bending.bdf']
        cmd_line_format_converter(argv=argv, quiet=True)

        nastran_filename3 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending3.bdf')
        tris, quads = ugrid_model.skin_solids()
        ugrid_model.tris = tris
        ugrid_model.quads = quads
        ugrid_model.pids = np.ones(len(tris) + len(quads))

        ugrid_model.write_bdf(nastran_filename3)

        unused_bdf_model = read_bdf(nastran_filename3, log=log)
        #print(bdf_model.get_bdf_stats())
        assert os.path.exists(nastran_filename3), nastran_filename3

        #tecplot_filename1 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.plt')
        #ugrid3d_to_tecplot_filename(model, tecplot_filename1)
        #assert os.path.exists(tecplot_filename1), tecplot_filename1

        tecplot_filename2 = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending2.plt')
        tecplot, unused_zone = ugrid_to_tecplot(ugrid_model, log=log)
        tecplot.write_tecplot(tecplot_filename2, res_types=None,
                              adjust_nids=True)
        assert os.path.exists(tecplot_filename2), tecplot_filename2

        ugrid_filename_out = os.path.join(NASTRAN_PATH, 'solid_bending', 'solid_bending.b8.ugrid_out')
        pshell_pids_to_remove = []
        merge_ugrid3d_and_bdf_to_ugrid3d_filename(
            ugrid_filename, nastran_filename3, ugrid_filename_out,
            pshell_pids_to_remove,
            update_equivalence=True, tol=0.01, log=log)
        assert os.path.exists(ugrid_filename_out), ugrid_filename_out
        os.remove(nastran_filename2)
        os.remove(nastran_filename3)
        os.remove(tecplot_filename2)
        os.remove(ugrid_filename)
        os.remove(ugrid_filename_out)
        os.remove('shell_solid_bending.bdf')
Пример #2
0
    def test_ugrid_01(self):
        """tests solid_bending.bdf"""
        nastran_filename1 = os.path.join(nastran_path, 'solid_bending',
                                         'solid_bending.bdf')
        ugrid_filename = os.path.join(nastran_path, 'solid_bending',
                                      'solid_bending.b8.ugrid')
        log = get_logger(level='warning')

        nastran_to_ugrid(nastran_filename1,
                         ugrid_filename_out=ugrid_filename,
                         properties=None,
                         check_shells=False,
                         check_solids=True,
                         log=log)
        assert os.path.exists(ugrid_filename), ugrid_filename

        nastran_filename2 = os.path.join(nastran_path, 'solid_bending',
                                         'solid_bending2.bdf')
        model = ugrid3d_to_nastran(ugrid_filename,
                                   nastran_filename2,
                                   include_shells=True,
                                   include_solids=True,
                                   convert_pyram_to_penta=False,
                                   encoding=None,
                                   size=16,
                                   is_double=False,
                                   log=log)
        model.skin_solids()
        assert os.path.exists(nastran_filename2), nastran_filename2

        #tecplot_filename1 = os.path.join(nastran_path, 'solid_bending', 'solid_bending.plt')
        #ugrid3d_to_tecplot_filename(model, tecplot_filename1)
        #assert os.path.exists(tecplot_filename1), tecplot_filename1

        tecplot_filename2 = os.path.join(nastran_path, 'solid_bending',
                                         'solid_bending2.plt')
        tecplot = ugrid_to_tecplot(model)
        tecplot.write_tecplot(tecplot_filename2,
                              res_types=None,
                              is_points=True,
                              adjust_nids=True)
        assert os.path.exists(tecplot_filename2), tecplot_filename2