コード例 #1
0
ファイル: test_dampers.py プロジェクト: numenic/pyNastran
    def test_pbusht(self):
        """tests CBUSH, PBUSH, PBUSHT"""
        model = BDF(debug=False, log=None, mode='msc')
        model.add_grid(10, [0., 0., 0.])
        model.add_grid(11, [0., 0., 0.])

        eid = 8
        pid = 8
        k = [1.0]
        b = [2.0]
        ge = [0.01]
        nids = [10, 11]
        x = [1., 0., 0.]
        g0 = None
        unused_cbush = model.add_cbush(eid, pid, nids, x, g0, cid=None, s=0.5,
                                       ocid=-1, si=None, comment='cbush')
        unused_pbush = model.add_pbush(pid, k, b, ge, rcv=None, mass=None,
                                       comment='pbush')

        k_tables = [2]
        b_tables = [2]
        ge_tables = [2]
        kn_tables = [2]
        pbusht = model.add_pbusht(pid, k_tables, b_tables, ge_tables, kn_tables,
                                  comment='')
        pbusht.raw_fields()
        model.validate()
        model._verify_bdf()
        model.cross_reference()
        model._verify_bdf()
        save_load_deck(model, xref='standard', punch=True)
コード例 #2
0
ファイル: test_solids.py プロジェクト: saullocastro/pyNastran
    def test_solids_ctetra10(self):
        """tests a CTETRA10"""
        eid = 10
        pid = 20
        mid = 30
        E = 3.e7
        G = None
        nu = 0.3
        model = BDF(debug=False)
        g110 = model.add_grid(110, xyz=[0., 0., 0.])
        g120 = model.add_grid(120, xyz=[1., 0., 0.])
        g130 = model.add_grid(130, xyz=[1., 1., 0.])
        g140 = model.add_grid(140, xyz=[0., 2., 0.])

        model.add_grid(111, xyz=g110.xyz+g120.xyz)
        model.add_grid(112, xyz=g120.xyz+g130.xyz)
        model.add_grid(113, xyz=g130.xyz+g110.xyz)

        model.add_grid(121, xyz=g110.xyz+g140.xyz)
        model.add_grid(122, xyz=g120.xyz+g140.xyz)
        model.add_grid(123, xyz=g130.xyz+g140.xyz)

        model.add_psolid(pid, mid)
        model.add_mat1(mid, E, G, nu)
        nids = [
            110, 120, 130, 140,
            111, 112, 113,
            121, 122, 123
        ]
        model.add_ctetra(eid, pid, nids, comment='ctetra')
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
コード例 #3
0
    def test_deqatn_11(self):
        """
        based off nast/tpl/ptdmi1.dat

        What's going on with this...
        """
        model = BDF(debug=None)
        deqatn_card = [
            'deqatn  2       f(x,y,z)= 1.;',
            '        L=x+y',
        ]
        model.add_card(deqatn_card, 'DEQATN', is_list=False)

        dessub_desglb = 5
        dconstr_cards = [
            [
                'dconstr,5,10,',
            ],
            [
                'dconstr,6,11,',
            ],
        ]
        dresp_cards = [
            [  # card1
                'dresp2,10,respA,2',
                ',desvar,100,101,102',
            ],
            [  # card2
                'dresp2,11,respB,2',
                ',desvar,100,101,102',
            ],
            ## TODO: support this...
            #[
            #'dresp2,11,respB,F(A,B)=A+B**2*SIN(A*B)'
            #',desvar,100,101',
            #],
        ]
        #model.add_desvar(100, 'varA', 100.1, xlb=-1e20, xub=1e20, delx=None, ddval=None, comment='')
        desvar_cards = [
            [
                'desvar,100,varA,100.1',
            ],
            [
                'desvar,101,varB,100.2',
            ],
            [
                'desvar,102,varC,100.3',
            ],
        ]

        for desvar in desvar_cards:
            model.add_card(desvar, 'DESVAR', is_list=False)
        for dconstr in dconstr_cards:
            model.add_card(dconstr, 'DCONSTR', is_list=False)
        for dresp in dresp_cards:
            model.add_card(dresp, 'DRESP2', is_list=False)
        model._verify_bdf()
        model.cross_reference()
        model._verify_bdf()
        save_load_deck(model)
コード例 #4
0
ファイル: test_solids.py プロジェクト: dsegroup22/pyNastran
    def test_solids_ctetra10(self):
        """tests a CTETRA10"""
        eid = 10
        pid = 20
        mid = 30
        E = 3.e7
        G = None
        nu = 0.3
        model = BDF(debug=False)
        g110 = model.add_grid(110, xyz=[0., 0., 0.])
        g120 = model.add_grid(120, xyz=[1., 0., 0.])
        g130 = model.add_grid(130, xyz=[1., 1., 0.])
        g140 = model.add_grid(140, xyz=[0., 2., 0.])

        model.add_grid(111, xyz=g110.xyz + g120.xyz)
        model.add_grid(112, xyz=g120.xyz + g130.xyz)
        model.add_grid(113, xyz=g130.xyz + g110.xyz)

        model.add_grid(121, xyz=g110.xyz + g140.xyz)
        model.add_grid(122, xyz=g120.xyz + g140.xyz)
        model.add_grid(123, xyz=g130.xyz + g140.xyz)

        model.add_psolid(pid, mid)
        model.add_mat1(mid, E, G, nu)
        nids = [110, 120, 130, 140, 111, 112, 113, 121, 122, 123]
        model.add_ctetra(eid, pid, nids, comment='ctetra')
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
コード例 #5
0
ファイル: test_solids.py プロジェクト: dsegroup22/pyNastran
    def test_solids_chexa(self):
        """tests a CHEXA8"""
        model = BDF(debug=False)
        eid = 10
        pid = 20
        mid = 30
        E = 3.e7
        G = None
        nu = 0.3
        model.add_grid(11, xyz=[0., 0., 0.])
        model.add_grid(12, xyz=[1., 0., 0.])
        model.add_grid(13, xyz=[1., 1., 0.])
        model.add_grid(14, xyz=[0., 1., 0.])

        model.add_grid(15, xyz=[0., 0., 2.])
        model.add_grid(16, xyz=[1., 0., 2.])
        model.add_grid(17, xyz=[1., 1., 2.])
        model.add_grid(18, xyz=[0., 1., 2.])
        model.add_psolid(pid, mid)
        model.add_mat1(mid, E, G, nu)
        nids = [11, 12, 13, 14, 15, 16, 17, 18]
        elem = model.add_chexa(eid, pid, nids, comment='chexa')
        elem.write_card(size=8)
        elem.write_card(size=16)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
コード例 #6
0
    def test_cbend(self):
        """tests a CBEND"""
        model = BDF(debug=False)

        eid = 7
        pid = 10
        nids = [2, 3]
        g0 = 5
        x = None
        geom = 1
        cbend = model.add_cbend(eid, pid, nids, g0, x, geom, comment='cbend')
        model.add_grid(2, [0., 0., 0.])
        model.add_grid(3, [0., 0., 0.])
        model.add_grid(5, [0., 0., 0.])
        #pbend = model.add_pbend(pid, mid, beam_type, A, i1, i2, j,
        #c1, c2, d1, d2, e1, e2, f1, f2,
        #k1, k2, nsm, rc, zc, delta_n, fsi,
        #rm, t, p, rb, theta_b, comment='')

        cbend.validate()
        cbend.raw_fields()
        cbend.write_card()
        cbend.write_card(size=16)

        model.validate()
        model._verify_bdf(xref=False)
        model.pop_parse_errors()
コード例 #7
0
ファイル: test_optimization.py プロジェクト: zbhfut/pyNastran
    def test_doptprm(self):
        """tests a doptprm"""
        #DOPTPRM    CONV1  .00001  DELOBJ .000001  DESMAX     100      P1       1
        #              P2      13
        model = BDF(debug=False)

        params = {
            'CONV1' : 0.0001,
            'DELOBJ' : 0.000001,
            'DESMAX' : 100,
            'P1' : 1,
            'P2' : 13,
        }
        doptprm = model.add_doptprm(params, comment='doptprm')
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        doptprm.comment = ''
        doptprm.raw_fields()
        doptprm.write_card(size=8)
        doptprm.write_card(size=16)
        doptprm.write_card(size=16, is_double=True)
        save_load_deck(model)
コード例 #8
0
ファイル: test_solids.py プロジェクト: saullocastro/pyNastran
    def test_solids_chexa(self):
        """tests a CHEXA8"""
        model = BDF(debug=False)
        eid = 10
        pid = 20
        mid = 30
        E = 3.e7
        G = None
        nu = 0.3
        model.add_grid(11, xyz=[0., 0., 0.])
        model.add_grid(12, xyz=[1., 0., 0.])
        model.add_grid(13, xyz=[1., 1., 0.])
        model.add_grid(14, xyz=[0., 1., 0.])

        model.add_grid(15, xyz=[0., 0., 2.])
        model.add_grid(16, xyz=[1., 0., 2.])
        model.add_grid(17, xyz=[1., 1., 2.])
        model.add_grid(18, xyz=[0., 1., 2.])
        model.add_psolid(pid, mid)
        model.add_mat1(mid, E, G, nu)
        nids = [11, 12, 13, 14, 15, 16, 17, 18]
        elem = model.add_chexa(eid, pid, nids, comment='chexa')
        elem.write_card(size=8)
        elem.write_card(size=16)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
コード例 #9
0
    def test_pmass(self):
        """CMASS1/PMASS"""
        log = get_logger(level='warning', encoding='utf-8')
        model = BDF(debug=False, log=log)
        eid1 = 101
        mass1 = 1.0
        mass2 = 2.0
        mass3 = 3.0
        nodes1 = [11, 12]
        model.add_grid(11, [0., 0., 0.])
        model.add_grid(12, [0., 0., 0.])
        pid1 = 1000
        pid2 = 2000
        pid3 = 3000
        card_lines = ['CMASS1', eid1, pid1] + nodes1
        model.add_card(card_lines,
                       'CMASS1',
                       comment='',
                       is_list=True,
                       has_none=True)

        card_lines = ['PMASS', pid1, mass1, pid2, mass2, pid3, mass3]
        model.add_card(card_lines,
                       'PMASS',
                       comment='',
                       is_list=True,
                       has_none=True)
        model.validate()
        model._verify_bdf()

        model.cross_reference()
        model._verify_bdf()
        save_load_deck(model)
コード例 #10
0
ファイル: test_dequatn.py プロジェクト: dsegroup22/pyNastran
    def test_deqatn_11(self):
        """
        per nast/tpl/ptdmi1.dat
        """
        model = BDF(debug=None)
        #model.cards_to_read.add('DEQATN')
        #model.test_deqatn = True
        deqatn_card = [
            'deqatn  2       f(x,y,z)= 1.;',
            '        L=x+y',
        ]
        model.add_card(deqatn_card, 'DEQATN', is_list=False)

        dessub_desglb = 5
        dconstr_cards = [
            [
                'dconstr,5,10,',
            ],
            [
                'dconstr,6,11,',
            ],
        ]
        dresp_cards = [
            [
                'dresp2,10,respA,2',
                'desvar,100,101,102',
            ],
            [
                'dresp2,11,respB,2',
                'desvar,100,101,102',
            ],
            #[
            #'dresp2,11,respB,F(A,B)=A+B**2*SIN(A*B)'
            #',desvar,100,101',
            #],
        ]
        desvar_cards = [
            [
                'desvar,100,varA,100.1',
            ],
            [
                'desvar,101,varB,100.2',
            ],
            [
                'desvar,102,varC,100.3',
            ],
        ]

        for desvar in desvar_cards:
            model.add_card(desvar, 'DESVAR', is_list=False)
        for dconstr in dconstr_cards:
            model.add_card(dconstr, 'DCONSTR', is_list=False)
        for dresp in dresp_cards:
            model.add_card(dresp, 'DRESP2', is_list=False)
        #for desvar in desvar_cards:
        #model.add_card(desvar, 'DESVAR', is_list=True)
        model.cross_reference()
        model._verify_bdf()
コード例 #11
0
    def test_msgmesh_1(self):
        """tests CGEN"""
        log = SimpleLogger(level='warning')
        model = BDF(log=log, debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(4, [0., 1., 0.])
        #feedge = model.add_feedge()

        Type = 10
        field_eid = 'cat'
        pid = 20
        field_id = 30
        th_geom_opt = 301.
        eidl = 40
        eidh = 50
        cgen = model.add_cgen(Type, field_eid, pid, field_id, th_geom_opt,
                              eidl, eidh)
        cgen.raw_fields()

        #----------------------------------------
        bdf_filename = StringIO()
        bdf_filename2 = StringIO()
        bdf_filename3 = StringIO()
        #bdf_filename4 = StringIO()

        model.validate()
        model._verify_bdf(xref=False)
        model.write_bdf(bdf_filename, encoding=None, size=8,
                        is_double=False,
                        interspersed=False,
                        enddata=None, close=False)

        model.cross_reference()
        model.pop_xref_errors()

        model._verify_bdf(xref=True)
        model.write_bdf(bdf_filename2, encoding=None, size=16,
                        is_double=False,
                        interspersed=False,
                        enddata=None, close=False)
        model.write_bdf(bdf_filename3, encoding=None, size=16,
                        is_double=True,
                        interspersed=False,
                        enddata=None, close=False)
        ##model.cross_reference()

        ##print(bdf_filename.getvalue())

        #bdf_filename2.seek(0)
        #model2 = read_bdf(bdf_filename2, xref=False)
        #print('---------------')
        #model2.safe_cross_reference()
        save_load_deck(model, run_convert=False, run_quality=False)
コード例 #12
0
    def test_cquadx(self):
        log = get_logger(level='warning')
        model = BDF(debug=False, log=log, mode='msc')
        model.add_grid(11, [0., 0., 0.])
        model.add_grid(12, [0., 0., 0.])
        model.add_grid(13, [0., 0., 0.])
        model.add_grid(14, [0., 0., 0.])
        nids = [11, 12, 13, 14,
                None, None, None, None,
                None]
        eid = 10
        pid = 20
        mid = 30
        model.add_cquadx(eid, pid, nids, theta_mcid=10., comment='cquadx_a')

        #PLPLANE or PAXSYMH
        model.add_cquadx(eid+1, pid, nids, theta_mcid=10, comment='cquadx_b')
        model.add_plplane(pid, mid, cid=0, stress_strain_output_location='GRID', comment='plplane')

        E = 3.0e7
        G = None
        nu = 0.3
        model.add_mat1(mid, E, G, nu)
        model.add_mathp(mid, a10=0., a01=0., d1=None, rho=0.,
                        av=0., tref=0., ge=0., na=1, nd=1,
                        a20=0., a11=0., a02=0., d2=0.,
                        a30=0., a21=0., a12=0., a03=0., d3=0.,
                        a40=0., a31=0., a22=0., a13=0., a04=0., d4=0.,
                        a50=0., a41=0., a32=0., a23=0., a14=0., a05=0., d5=0.,
                        tab1=None, tab2=None, tab3=None, tab4=None, tabd=None,
                        comment='mathp')
        #model.add_mathe(mid, model, bulk, rho, texp, mus, alphas, betas, mooney,
                        #sussbat, aboyce, comment='')
        sid = 1
        ring_id = 2
        hid = 0
        scale = 3.
        f_rtz = [0., 1., 2.]
        forceax = model.add_forceax(sid, ring_id, hid, scale, f_rtz, comment='forceax')

        pressure = 2.0
        rid1 = 2
        rid2 = 2
        presax = model.add_presax(sid, pressure, rid1, rid2, phi1=0., phi2=360., comment='prsax')
        forceax.raw_fields()
        presax.raw_fields()

        model.validate()
        model._verify_bdf()
        model.cross_reference()
        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model)
コード例 #13
0
ファイル: test_msgmesh.py プロジェクト: charlyDevor/pyNastran
    def test_msgmesh_1(self):
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        model.add_grid(4, xyz=[0., 1., 0.])
        #feedge = model.add_feedge()

        Type = 10
        field_eid = 'cat'
        pid = 20
        field_id = 30
        th_geom_opt = 301.
        eidl = 40
        eidh = 50
        cgen = model.add_cgen(Type, field_eid, pid, field_id, th_geom_opt,
                              eidl, eidh)
        cgen.raw_fields()

        #----------------------------------------
        bdf_filename = StringIO()
        bdf_filename2 = StringIO()
        bdf_filename3 = StringIO()
        bdf_filename4 = StringIO()

        model.validate()
        model._verify_bdf(xref=False)
        model.write_bdf(bdf_filename,
                        encoding=None,
                        size=8,
                        is_double=False,
                        interspersed=False,
                        enddata=None,
                        close=False)

        model.cross_reference()
        model.pop_xref_errors()

        model._verify_bdf(xref=True)
        model.write_bdf(bdf_filename2,
                        encoding=None,
                        size=16,
                        is_double=False,
                        interspersed=False,
                        enddata=None,
                        close=False)
        model.write_bdf(bdf_filename3,
                        encoding=None,
                        size=16,
                        is_double=True,
                        interspersed=False,
                        enddata=None,
                        close=False)
コード例 #14
0
ファイル: test_shells.py プロジェクト: xuliangyin/pyNastran
    def test_cshear(self):
        """tests a PSHEAR/CSHEAR"""
        log = get_logger(level='warning')
        model = BDF(log=log)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(4, [0., 1., 0.])

        eid = 10
        pid = 20
        mid = 30
        t = 0.1
        nids = [1, 2, 3, 4]

        cshear = model.add_cshear(eid, pid, nids, comment='cshear')
        pshear = model.add_pshear(pid, mid, t, nsm=0., f1=0., f2=0., comment='')

        dvids = [1]
        coeffs = 1.0
        model.add_dvprel1(1, 'PSHEAR', pid, 'T', dvids, coeffs,
                          p_min=None, p_max=1e20,
                          c0=0.0, validate=True,
                          comment='')
        model.add_desvar(1, 'T', 10.0)

        E = 30.e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')
        model.pop_parse_errors()
        model.validate()

        cshear.raw_fields()
        cshear.write_card(size=8)

        pshear.raw_fields()
        pshear.write_card(size=8)
        pshear.write_card(size=16)
        pshear.write_card(size=16, is_double=True)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
        model.mass_properties()

        cshear.write_card(size=8)
        pshear.write_card(size=8)
        model.update_model_by_desvars()
        save_load_deck(model)
コード例 #15
0
ファイル: test_shells.py プロジェクト: mnekkach/pyNastran
    def test_cplstn34(self):
        """tests a CPLSTN3, CPLSTN4/PSHELL/MAT8"""
        model = BDF(debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(4, [0., 1., 0.])
        pid = 4
        eid = 3
        nids = [1, 2, 3, 4]
        cplstn4 = model.add_cplstn4(eid, pid, nids, comment='cplstn4')
        cplstn4.flip_normal()

        eid = 5
        nids = [1, 2, 3]
        mid = 10
        cplstn3 = model.add_cplstn3(eid, pid, nids, comment='cplstn3')
        cplstn3.flip_normal()

        pplane = model.add_pplane(pid,
                                  mid,
                                  t=0.1,
                                  nsm=0.,
                                  formulation_option=0,
                                  comment='pplane')
        E = 1e7
        G = None
        nu = 0.3
        model.add_mat1(mid, E, G, nu)

        cplstn3.repr_fields()
        cplstn4.repr_fields()

        cplstn3.raw_fields()
        cplstn4.raw_fields()
        pplane.raw_fields()

        model.validate()
        model._verify_bdf(xref=False)
        cplstn3.write_card(size=8)
        cplstn4.write_card(size=8)
        pplane.write_card(size=8)
        model.cross_reference()
        model.pop_xref_errors()
        #cplstn3.write_card(size=8)
        #cplstn4.write_card(size=8)

        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model)
コード例 #16
0
    def test_bar_mass_2(self):
        """CBAR/PBARL"""
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[0., 1., 0.])

        mid = 1
        E = 3.0e7
        G = None
        nu = 0.3
        model.add_mat1(mid, E, G, nu, rho=1.)

        #---------------------------------------------------------------
        eid = 1
        pid = 101
        nids = [1, 2]
        x = [0., 0., 1.]
        g0 = None
        cbar = model.add_cbar(eid, pid, nids, x, g0, offt='GGG',
                              pa=0, pb=0, wa=None, wb=None,
                              comment='CBAR')
        Type = 'BOX'
        dim = [1., 2., 0.1, 0.1]
        #pbeaml = model.add_pbeaml(pid, mid, Type, xxb, dims, nsm=None,
                                  #so=None, comment='PBEAML')
        pbarl = model.add_pbarl(pid, mid, Type, dim, group='MSCBMLO', nsm=0.,
                                comment='PBARL')
        #---------------------------------------------------------------
        eid = 2
        pid = 102
        x = None
        g0 = 3
        cbar = model.add_cbar(eid, pid, nids, x, g0, offt='GGG',
                              pa=0, pb=0, wa=None, wb=None,
                              comment='CBAR')
        Type = 'BOX'
        dim = [1., 2., 0.1, 0.1]
        pbarl = model.add_pbarl(pid, mid, Type, dim, group='MSCBMLO', nsm=0.,
                                comment='PBARL')
        #---------------------------------------------------------------
        model.validate()
        model._verify_bdf(xref=False)
        model.pop_parse_errors()
        model.cross_reference()
        model.pop_xref_errors()

        model._verify_bdf(xref=True)
        model.uncross_reference()
コード例 #17
0
    def test_deqatn_11(self):
        """
        per nast/tpl/ptdmi1.dat
        """
        model = BDF(debug=None)
        #model.cards_to_read.add('DEQATN')
        #model.test_deqatn = True
        deqatn_card = [
            'deqatn  2       f(x,y,z)= 1.;',
            '        L=x+y',
        ]
        model.add_card(deqatn_card, 'DEQATN', is_list=False)

        dessub_desglb = 5
        dconstr_cards = [
            ['dconstr,5,10,',],
            ['dconstr,6,11,',],
        ]
        dresp_cards = [
            [
                'dresp2,10,respA,2',
                'desvar,100,101,102',
            ],
            [
                'dresp2,11,respB,2',
                'desvar,100,101,102',
            ],
            #[
                #'dresp2,11,respB,F(A,B)=A+B**2*SIN(A*B)'
                #',desvar,100,101',
            #],
        ]
        desvar_cards = [
            ['desvar,100,varA,100.1',],
            ['desvar,101,varB,100.2',],
            ['desvar,102,varC,100.3',],
        ]

        for desvar in desvar_cards:
            model.add_card(desvar, 'DESVAR', is_list=False)
        for dconstr in dconstr_cards:
            model.add_card(dconstr, 'DCONSTR', is_list=False)
        for dresp in dresp_cards:
            model.add_card(dresp, 'DRESP2', is_list=False)
        #for desvar in desvar_cards:
            #model.add_card(desvar, 'DESVAR', is_list=True)
        model.cross_reference()
        model._verify_bdf()
コード例 #18
0
ファイル: test_shells.py プロジェクト: murmlgrmpf/pyNastran
    def test_cplstn68(self):
        """tests a CPLSTN6, CPLSTN8/PSHELL/MAT8"""
        model = BDF(debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(5, [.5, 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(6, [1., .5, 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(7, [.5, 1., 0.])
        model.add_grid(4, [0., 1., 0.])
        model.add_grid(8, [0., .5, 0.])
        pid = 4
        eid = 3
        nids = [1, 2, 3, 4, 5, 6, 7, 8]
        cplstn8 = model.add_cplstn8(eid, pid, nids, comment='cplstn8')

        eid = 5
        nids = [1, 2, 3, 4, 5, 6]
        mid = 10
        cplstn6 = model.add_cplstn6(eid, pid, nids, comment='cplstn6')
        pplane = model.add_pplane(pid,
                                  mid,
                                  t=0.1,
                                  nsm=0.,
                                  formulation_option=0,
                                  comment='pplane')
        E = 1e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu)

        cplstn6.raw_fields()
        cplstn8.raw_fields()
        pplane.raw_fields()

        model.validate()
        model._verify_bdf(xref=False)
        cplstn6.write_card(size=8)
        cplstn8.write_card(size=8)
        pplane.write_card(size=8)
        model.cross_reference()
        model.pop_xref_errors()
        #cplstn3.write_card(size=8)
        #cplstn4.write_card(size=8)

        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model)
コード例 #19
0
ファイル: test_shells.py プロジェクト: mnekkach/pyNastran
    def test_ctriar_cquadr(self):
        """tests a CTRIAR/PSHELL/MAT8"""
        model = BDF(debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(4, [0., 1., 0.])
        eid = 6
        pid = 13
        nids = [1, 2, 3]
        ctriar = model.add_ctriar(eid, pid, nids, comment='ctriar')
        ctriar.raw_fields()
        ctriar.write_card(size=8, is_double=False)
        ctriar.write_card(size=16, is_double=False)
        ctriar.flip_normal()

        eid = 8
        nids = [1, 2, 3, 4]
        cquadr = model.add_cquadr(eid, pid, nids, comment='cquadr')
        cquadr.raw_fields()
        cquadr.write_card(size=8, is_double=False)
        cquadr.write_card(size=16, is_double=False)
        cquadr.flip_normal()

        mid = 42
        model.add_pshell(pid, mid1=mid, t=0.2)
        e11 = 1e7
        e22 = 1e6
        nu12 = 0.3
        model.add_mat8(mid, e11, e22, nu12)
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
        model.uncross_reference()
        model.safe_cross_reference()

        model.get_area_breakdown(property_ids=None, stop_if_no_area=True)
        model.get_mass_breakdown(property_ids=None,
                                 stop_if_no_mass=True,
                                 detailed=False)
        model.get_mass_breakdown(property_ids=None,
                                 stop_if_no_mass=True,
                                 detailed=True)
        model.get_volume_breakdown(property_ids=None, stop_if_no_volume=True)

        save_load_deck(model)
コード例 #20
0
    def test_springs_03(self):
        """tests CELAS1, CELAS2, PELAS, PELAST"""
        model = BDF(debug=False)
        eid = 1
        pid = 2
        nids = [3, 4]
        c1 = 1
        c2 = 1
        celas1 = model.add_celas1(eid, pid, nids, c1, c2, comment='celas1')
        celas1.raw_fields()
        celas1.write_card(size=8, is_double=False)

        k = 1.0e7
        ge = 0.0
        s = 0.
        pelas = model.add_pelas(pid, k, ge, s, comment='pelas')
        pelas.raw_fields()
        pelas.write_card(size=8, is_double=False)

        tkid = 10
        tgeid = 10
        tknid = 10
        pelast = model.add_pelast(pid, tkid, tgeid, tknid, comment='pealst')
        pelast.raw_fields()
        pelast.write_card(size=8, is_double=False)

        eid = 5
        celas2 = model.add_celas2(eid,
                                  k,
                                  nids,
                                  c1=0,
                                  c2=0,
                                  ge=0.,
                                  s=0.,
                                  comment='celas2')
        celas2.raw_fields()
        celas2.write_card(size=8, is_double=False)

        model.add_grid(3, xyz=[0., 0., 0.])
        model.add_grid(4, xyz=[0., 0., 0.])
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
        model.write_bdf('spring.bdf')
        model2 = read_bdf('spring.bdf', debug=False)
        os.remove('spring.bdf')
コード例 #21
0
ファイル: test_shells.py プロジェクト: murmlgrmpf/pyNastran
    def test_cshear(self):
        """tests a PSHEAR/CSHEAR"""
        model = BDF(debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(4, [0., 1., 0.])

        eid = 10
        pid = 20
        mid = 30
        t = 0.1
        nids = [1, 2, 3, 4]

        cshear = model.add_cshear(eid, pid, nids, comment='cshear')
        pshear = model.add_pshear(pid,
                                  mid,
                                  t,
                                  nsm=0.,
                                  f1=0.,
                                  f2=0.,
                                  comment='')

        E = 30.e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')
        model.pop_parse_errors()
        model.validate()

        cshear.raw_fields()
        cshear.write_card(size=8)

        pshear.raw_fields()
        pshear.write_card(size=8)
        pshear.write_card(size=16)
        pshear.write_card(size=16, is_double=True)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
        model.mass_properties()

        cshear.write_card(size=8)
        pshear.write_card(size=8)
コード例 #22
0
ファイル: test_shells.py プロジェクト: xuliangyin/pyNastran
    def test_ctrishell68(self):
        """tests a CPLSTN6, CPLSTN8/PSHELL/MAT8"""
        log = get_logger(level='warning')
        model = BDF(log=log)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(5, [.5, 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(6, [1., .5, 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_grid(7, [.5, 1., 0.])
        model.add_grid(4, [0., 1., 0.])
        model.add_grid(8, [0., .5, 0.])
        pid = 4
        eid = 3
        nids = [1, 2, 3, 4, 5, 6, 7, 8]
        cquad8 = model.add_cquad8(eid, pid, nids, comment='cquad8')

        eid = 5
        nids = [1, 2, 3, 4, 5, 6]
        mid = 10
        ctria6 = model.add_ctria6(eid, pid, nids, comment='ctria6')
        pplane = model.add_pplane(pid, mid, t=0.1, nsm=0.,
                                  formulation_option=0, comment='pplane')
        E = 1e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu)

        ctria6.raw_fields()
        cquad8.raw_fields()
        pplane.raw_fields()

        model.validate()
        model._verify_bdf(xref=False)
        ctria6.write_card(size=8)
        cquad8.write_card(size=8)
        pplane.write_card(size=8)
        model.cross_reference()
        model.pop_xref_errors()

        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model, run_test_bdf=False)
コード例 #23
0
ファイル: test_dampers.py プロジェクト: numenic/pyNastran
 def test_pdamp(self):
     """PDAMP"""
     log = get_logger(level='warning')
     model = BDF(log=log)
     eid1 = 10
     eid2 = 20
     eid3 = 30
     eid4 = 40
     b1 = 1.0
     b2 = 2.0
     b3 = 3.0
     b4 = 4.0
     #nodes1 = [10, 20]
     #nodes2 = [20, 30]
     card_lines = ['PDAMP', eid1, b1, eid2, b2, eid3, b3, eid4, b4]
     model.add_card(card_lines, 'PDAMP', comment='', is_list=True, has_none=True)
     model.validate()
     model._verify_bdf()
     save_load_deck(model)
コード例 #24
0
ファイル: test_solids.py プロジェクト: dsegroup22/pyNastran
 def test_solids_ctetra4(self):
     """tests a CTETRA4"""
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model = BDF(debug=False)
     model.add_grid(11, xyz=[0., 0., 0.])
     model.add_grid(12, xyz=[1., 0., 0.])
     model.add_grid(13, xyz=[1., 1., 0.])
     model.add_grid(15, xyz=[0., 2., 0.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [11, 12, 13, 15]
     model.add_ctetra(eid, pid, nids, comment='ctetra')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #25
0
ファイル: test_dampers.py プロジェクト: mnekkach/pyNastran
 def test_pdamp(self):
     """PDAMP"""
     model = BDF()
     eid1 = 10
     eid2 = 20
     eid3 = 30
     eid4 = 40
     b1 = 1.0
     b2 = 2.0
     b3 = 3.0
     b4 = 4.0
     nodes1 = [10, 20]
     nodes2 = [20, 30]
     card_lines = ['PDAMP', eid1, b1, eid2, b2, eid3, b3, eid4, b4]
     model.add_card(card_lines,
                    'PDAMP',
                    comment='',
                    is_list=True,
                    has_none=True)
     model.validate()
     model._verify_bdf()
コード例 #26
0
ファイル: test_solids.py プロジェクト: saullocastro/pyNastran
 def test_solids_ctetra4(self):
     """tests a CTETRA4"""
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model = BDF(debug=False)
     model.add_grid(11, xyz=[0., 0., 0.])
     model.add_grid(12, xyz=[1., 0., 0.])
     model.add_grid(13, xyz=[1., 1., 0.])
     model.add_grid(15, xyz=[0., 2., 0.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [11, 12, 13, 15]
     model.add_ctetra(eid, pid, nids, comment='ctetra')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #27
0
    def test_damper_02(self):
        """tests CDAMP1, CDAMP2, PDAMP, PDAMPT, GRID"""
        log = get_logger(level='warning')
        model = BDF(log=log)
        eid = 1
        pid = 2
        nids = [3, 4]
        c1 = 1
        c2 = 1
        celas1 = model.add_cdamp1(eid, pid, nids, c1, c2, comment='cdamp1')
        celas1.raw_fields()
        celas1.write_card(size=8, is_double=False)

        b = 1.0e7
        pdamp = model.add_pdamp(pid, b, comment='pdamp')
        pdamp.raw_fields()
        pdamp.write_card(size=8, is_double=False)

        tbid = 10
        pdampt = model.add_pdampt(pid, tbid, comment='pdampt')
        pdampt.raw_fields()
        pdampt.write_card(size=8, is_double=False)

        eid = 5
        cdamp2 = model.add_cdamp2(eid, b, nids, comment='cdamp2')
        cdamp2.raw_fields()
        cdamp2.write_card(size=8, is_double=False)

        model.add_grid(3, [0., 0., 0.])
        model.add_grid(4, [0., 0., 0.])
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        bdf_file = StringIO()
        model.write_bdf(bdf_file, close=False)
        bdf_file.seek(0)
        unused_model2 = read_bdf(bdf_file, punch=True, debug=False)
        save_load_deck(model)
コード例 #28
0
ファイル: test_solids.py プロジェクト: saullocastro/pyNastran
 def test_solids_cpyram5(self):
     """tests a CPYRAM5"""
     model = BDF(debug=False)
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model.add_grid(10, xyz=[0., 0., 0.])
     model.add_grid(20, xyz=[1., 0., 0.])
     model.add_grid(30, xyz=[1., 1., 0.])
     model.add_grid(40, xyz=[0., 0., 2.])
     model.add_grid(50, xyz=[1., 1., 2.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [10, 20, 30, 40, 50]
     model.add_cpyram(eid, pid, nids, comment='cpenta')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #29
0
ファイル: test_solids.py プロジェクト: dsegroup22/pyNastran
 def test_solids_cpyram5(self):
     """tests a CPYRAM5"""
     model = BDF(debug=False)
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model.add_grid(10, xyz=[0., 0., 0.])
     model.add_grid(20, xyz=[1., 0., 0.])
     model.add_grid(30, xyz=[1., 1., 0.])
     model.add_grid(40, xyz=[0., 0., 2.])
     model.add_grid(50, xyz=[1., 1., 2.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [10, 20, 30, 40, 50]
     model.add_cpyram(eid, pid, nids, comment='cpenta')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #30
0
    def test_cquadx(self):
        model = BDF(debug=True, log=None, mode='msc')
        model.add_grid(11, [0., 0., 0.])
        model.add_grid(12, [0., 0., 0.])
        model.add_grid(13, [0., 0., 0.])
        model.add_grid(14, [0., 0., 0.])
        nids = [11, 12, 13, 14,
                None, None, None, None,
                None]
        eid = 10
        pid = 20
        mid = 30
        model.add_cquadx(eid, pid, nids, theta_mcid=10., comment='cquadx_a')

        #PLPLANE or PAXSYMH
        model.add_cquadx(eid+1, pid, nids, theta_mcid=10, comment='cquadx_b')
        model.add_plplane(pid, mid, cid=0, stress_strain_output_location='GRID', comment='plplane')

        E = 3.0e7
        G = None
        nu = 0.3
        model.add_mat1(mid, E, G, nu)
        model.add_mathp(mid, a10=0., a01=0., d1=None, rho=0.,
                        av=0., tref=0., ge=0., na=1, nd=1,
                        a20=0., a11=0., a02=0., d2=0.,
                        a30=0., a21=0., a12=0., a03=0., d3=0.,
                        a40=0., a31=0., a22=0., a13=0., a04=0., d4=0.,
                        a50=0., a41=0., a32=0., a23=0., a14=0., a05=0., d5=0.,
                        tab1=None, tab2=None, tab3=None, tab4=None, tabd=None,
                        comment='mathp')
        #model.add_mathe(mid, model, bulk, rho, texp, mus, alphas, betas, mooney,
                        #sussbat, aboyce, comment='')
        model.validate()
        model._verify_bdf()
        model.cross_reference()
        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model)
コード例 #31
0
    def test_damper_02(self):
        """tests CELAS1, CELAS2, PDAMP, PDAMPT"""
        model = BDF(debug=False)
        eid = 1
        pid = 2
        nids = [3, 4]
        c1 = 1
        c2 = 1
        celas1 = model.add_cdamp1(eid, pid, nids, c1, c2, comment='cdamp1')
        celas1.raw_fields()
        celas1.write_card(size=8, is_double=False)

        b = 1.0e7
        pdamp = model.add_pdamp(pid, b, comment='pdamp')
        pdamp.raw_fields()
        pdamp.write_card(size=8, is_double=False)

        tbid = 10
        pdampt = model.add_pdampt(pid, tbid, comment='pdampt')
        pdampt.raw_fields()
        pdampt.write_card(size=8, is_double=False)

        eid = 5
        cdamp2 = model.add_cdamp2(eid, b, nids, comment='cdamp2')
        cdamp2.raw_fields()
        cdamp2.write_card(size=8, is_double=False)

        model.add_grid(3, xyz=[0., 0., 0.])
        model.add_grid(4, xyz=[0., 0., 0.])
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        bdf_file = StringIO()
        model.write_bdf(bdf_file, close=False)
        bdf_file.seek(0)
        model2 = read_bdf(bdf_file, punch=True, debug=False)
コード例 #32
0
ファイル: test_solids.py プロジェクト: dsegroup22/pyNastran
 def test_solids_cpenta(self):
     """tests a CPENTA6"""
     model = BDF(debug=False)
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model.add_grid(21, xyz=[0., 0., 0.])
     model.add_grid(22, xyz=[1., 0., 0.])
     model.add_grid(23, xyz=[1., 1., 0.])
     model.add_grid(24, xyz=[0., 0., 2.])
     model.add_grid(25, xyz=[1., 0., 2.])
     model.add_grid(26, xyz=[1., 1., 2.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [21, 22, 23, 24, 25, 26]
     model.add_cpenta(eid, pid, nids, comment='cpenta')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #33
0
ファイル: test_solids.py プロジェクト: saullocastro/pyNastran
 def test_solids_cpenta(self):
     """tests a CPENTA6"""
     model = BDF(debug=False)
     eid = 10
     pid = 20
     mid = 30
     E = 3.e7
     G = None
     nu = 0.3
     model.add_grid(21, xyz=[0., 0., 0.])
     model.add_grid(22, xyz=[1., 0., 0.])
     model.add_grid(23, xyz=[1., 1., 0.])
     model.add_grid(24, xyz=[0., 0., 2.])
     model.add_grid(25, xyz=[1., 0., 2.])
     model.add_grid(26, xyz=[1., 1., 2.])
     model.add_psolid(pid, mid)
     model.add_mat1(mid, E, G, nu)
     nids = [21, 22, 23, 24, 25, 26]
     model.add_cpenta(eid, pid, nids, comment='cpenta')
     model.validate()
     model._verify_bdf(xref=False)
     model.cross_reference()
     model._verify_bdf(xref=True)
コード例 #34
0
    def test_ctriar_cquadr(self):
        """tests a CTRIAR/PSHELL/MAT8"""
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        model.add_grid(4, xyz=[0., 1., 0.])
        eid = 6
        pid = 13
        nids = [1, 2, 3]
        ctriar = model.add_ctriar(eid, pid, nids, comment='ctriar')
        ctriar.raw_fields()
        ctriar.write_card(size=8, is_double=False)
        ctriar.write_card(size=16, is_double=False)
        ctriar.flip_normal()

        eid = 8
        nids = [1, 2, 3, 4]
        cquadr = model.add_cquadr(eid, pid, nids, comment='cquadr')
        cquadr.raw_fields()
        cquadr.write_card(size=8, is_double=False)
        cquadr.write_card(size=16, is_double=False)
        cquadr.flip_normal()

        mid = 42
        model.add_pshell(pid, mid1=mid, t=0.2)
        e11 = 1e7
        e22 = 1e6
        nu12 = 0.3
        model.add_mat8(mid, e11, e22, nu12)
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)
        model.uncross_reference()
        model.safe_cross_reference()
        save_load_deck(model)
コード例 #35
0
ファイル: test_shells.py プロジェクト: saullocastro/pyNastran
    def test_cshear(self):
        """tests a PSHEAR/CSHEAR"""
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        model.add_grid(4, xyz=[0., 1., 0.])

        eid = 10
        pid = 20
        mid = 30
        t = 0.1
        nids = [1, 2, 3, 4]

        cshear = model.add_cshear(eid, pid, nids, comment='cshear')
        pshear = model.add_pshear(pid, t, mid, nsm=0., f1=0., f2=0., comment='')

        E = 30.e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')

        cshear.raw_fields()
        cshear.write_card(size=8)

        pshear.raw_fields()
        pshear.write_card(size=8)
        pshear.write_card(size=16)
        pshear.write_card(size=16, is_double=True)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        cshear.write_card(size=8)
        pshear.write_card(size=8)
コード例 #36
0
    def test_doptprm(self):
        """tests a doptprm"""
        #DOPTPRM    CONV1  .00001  DELOBJ .000001  DESMAX     100      P1       1
        #              P2      13
        model = BDF(debug=False)

        params = {
            'CONV1' : 0.0001,
            'DELOBJ' : 0.000001,
            'DESMAX' : 100,
            'P1' : 1,
            'P2' : 13,
        }
        doptprm = model.add_doptprm(params, comment='doptprm')
        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        doptprm.comment = ''
        doptprm.raw_fields()
        doptprm.write_card(size=8)
        doptprm.write_card(size=16)
        doptprm.write_card(size=16, is_double=True)
コード例 #37
0
ファイル: test_loads.py プロジェクト: saullocastro/pyNastran
    def test_ploadx1(self):
        """tests a PLOADX1"""
        model = BDF(debug=False)
        sid = 10
        eid1 = 11
        pa = 200.
        ga = 1
        gb = 2
        ploadx1 = model.add_ploadx1(sid, eid1, pa, ga, gb, pb=None,
                                    theta=0., comment='ploadx1')
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])

        pid = 20
        nids = [1, 2, 3, None, None, None]
        ctriax = model.add_ctriax(eid1, pid, nids, theta_mcid=0., comment='ctriax')

        mid = 21
        plplane = model.add_plplane(pid, mid, cid=0,
                                    stress_strain_output_location='GRID',
                                    comment='plplane')

        #eid2 = 12
        #model.add_ctriax6(eid2, mid, nids, theta=0., comment='ctriax6')

        #E = 30.e7
        #G = None
        #nu = 0.3
        #mat1 = model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')
        #mathe = model.add_mathe(mid, model, bulk, rho, texp, mus, alphas,
                                #betas, mooney, sussbat, comment='mathe')
        mathp = model.add_mathp(mid, comment='mathp')


        ctriax.raw_fields()
        ctriax.write_card(size=8)
        ctriax.write_card(size=16)

        plplane.raw_fields()
        plplane.write_card(size=8)
        plplane.write_card(size=16)

        #mathe.raw_fields()
        #mathe.write_card(size=8)
        #mathe.write_card(size=16)

        mathp.raw_fields()
        mathp.write_card(size=8)
        mathp.write_card(size=16)

        ploadx1.raw_fields()
        ploadx1.write_card(size=8)
        ploadx1.write_card(size=16)
        ploadx1.write_card(size=16, is_double=True)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model._verify_bdf(xref=True)

        ctriax.write_card(size=8)
        plplane.write_card(size=8)
        #mathe.write_card(size=8)
        mathp.write_card(size=8)
        ploadx1.write_card(size=8)
コード例 #38
0
ファイル: test_optimization.py プロジェクト: zbhfut/pyNastran
    def test_dvprel1(self):
        """tests a DESVAR, DVPREL1, DVPREL2, DRESP1, DRESP2, DRESP3, DCONSTR, DSCREEN, DCONADD"""
        model = BDF(debug=False)
        dvprel1_id = 10
        desvar_id = 12
        desvar_ids = 12
        Type = 'PSHELL'
        pid = 20
        eid = 25
        mid = 30
        pname_fid = 'T'

        coeffs = 1.
        E = 30.e7
        G = None
        nu = 0.3
        nids = [1, 2, 3]

        label = 'T_SHELL'
        xinit = 0.1
        xlb = 0.01
        xub = 2.0

        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [1., 1., 0.])
        model.add_ctria3(eid, pid, nids, comment='ctria3')
        model.add_pshell(pid, mid1=30, t=0.1, comment='pshell')
        model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')
        desvar = model.add_desvar(desvar_id, label, xinit, xlb, xub, comment='desvar')
        dvprel1 = model.add_dvprel1(dvprel1_id, Type, pid, pname_fid,
                                    desvar_ids, coeffs, p_min=None, p_max=1e20, c0=0.0,
                                    validate=True, comment='dvprel')

        dvprel2_id = dvprel1_id + 1
        deqation = 100
        dvids = desvar_id
        labels = None
        dvprel2 = model.add_dvprel2(dvprel2_id, Type, pid, pname_fid, deqation,
                                    dvids, labels, p_min=None, p_max=1e20,
                                    validate=True, comment='')
        equation_id = 100
        eqs = ['fstress(x) = x + 10.']
        model.add_deqatn(equation_id, eqs, comment='deqatn')
        #print(deqatn.object_attributes())
        #print(deqatn.func_str)
        #print(deqatn)

        dresp1_id = 42
        label = 'STRESS1'
        response_type = 'STRESS'
        property_type = 'PSHELL'
        region = None
        atta = 9
        attb = None
        atti = pid
        dresp1 = model.add_dresp1(dresp1_id, label, response_type,
                                  property_type, region,
                                  atta, attb, atti, validate=True, comment='dresp1')
        dconstr = model.add_dconstr(dresp1_id, dresp1_id, lid=-1.e20, uid=1.e20,
                                    lowfq=0., highfq=1.e20, comment='dconstr')

        params = {
            (0, 'DRESP1') : [42],
            (1, 'DESVAR') : [12],
            (3, 'DNODE') : [[100, 101], [1, 2]],
        }
        dresp2_id = 43
        dequation = equation_id
        label = 'dresp2'
        region = None
        dresp2 = model.add_dresp2(dresp2_id, label, dequation, region, params,
                                  method='MIN', c1=100., c2=0.005, c3=None,
                                  comment='dresp2')

        dresp3_id = 44
        label = 'dresp3'
        group = 'cat'
        Type = 'dog'
        region = None
        params = {
            (0, 'DRESP1') : [42],
            (1, 'DESVAR') : [12],
            (2, 'DRESP2') : [dresp2_id],
            (2, 'DVPREL1') : [dvprel1_id],
            (3, 'DVPREL2') : [dvprel2_id],
            (3, 'DNODE') : [[100, 101], [1, 2]],
        }
        dresp3 = model.add_dresp3(dresp3_id, label, group, Type, region,
                                  params, comment='dresp3')
        dresp3.raw_fields()

        oid = 1001
        dconstr = model.add_dconstr(oid, dresp1_id, lid=-1.e20, uid=1.e20,
                                   lowfq=0., highfq=1.e20, comment='dconstr1')
        oid = 1002
        dconstr = model.add_dconstr(oid, dresp2_id, lid=-1.e20, uid=1.e20,
                                    lowfq=0., highfq=1.e20)
        oid = 1003
        dconstr = model.add_dconstr(oid, dresp3_id, lid=-1.e20, uid=1.e20,
                                    lowfq=0., highfq=1.e20)

        oid = 45
        dconstrs = [1001, 1002, 1003]
        dconadd = model.add_dconadd(oid, dconstrs, comment='dconadd')

        dscreen = model.add_dscreen('dunno', comment='dscreen')

        #print(dresp3)
        grid = model.add_grid(100, [0., 0., 0.])
        model.add_grid(101, [0., 0., 0.])
        model.pop_parse_errors()

        desvar.write_card(size=8)
        desvar.write_card(size=16)
        dvprel1.write_card(size=8)
        dvprel1.write_card(size=16)
        dconstr.write_card(size=8)
        dconstr.write_card(size=16)
        dresp1.write_card(size=8)
        dresp1.write_card(size=16)
        dresp1.write_card(size=16, is_double=True)
        dresp2.write_card(size=8)
        dresp2.write_card(size=16)
        dresp2.write_card(size=16, is_double=True)
        dresp3.write_card(size=8)
        dresp3.write_card(size=16)
        dresp3.write_card(size=16, is_double=True)
        dvprel2.write_card(size=8)
        dvprel2.write_card(size=16)
        dvprel2.write_card(size=16, is_double=True)
        dconadd.write_card(size=8)
        dconadd.write_card(size=16)
        dconadd.write_card(size=16, is_double=True)
        dscreen.write_card(size=8)
        dscreen.write_card(size=16)
        dscreen.write_card(size=16, is_double=True)

        model.validate()
        model._verify_bdf(xref=False)
        model.cross_reference()
        model.pop_xref_errors()

        desvar.write_card(size=8)
        desvar.write_card(size=16)
        desvar.raw_fields()
        dvprel1.write_card(size=8)
        dvprel1.write_card(size=16)
        dvprel1.raw_fields()
        dconstr.write_card(size=8)
        dconstr.write_card(size=16)
        dconstr.raw_fields()
        dresp1.write_card(size=8)
        dresp1.write_card(size=16)
        dresp1.raw_fields()
        dresp2.write_card(size=8)
        dresp2.write_card(size=16)
        dresp2.write_card(size=16, is_double=True)
        dresp3.write_card(size=8)
        dresp3.write_card(size=16)
        dresp3.write_card(size=16, is_double=True)
        dvprel2.write_card(size=8)
        dvprel2.write_card(size=16)
        dvprel2.write_card(size=16, is_double=True)
        dconadd.write_card(size=8)
        dconadd.write_card(size=16)
        dconadd.write_card(size=16, is_double=True)

        grid.nid = 200
        assert '200' in str(dresp3), dresp3

        save_load_deck(model)
コード例 #39
0
ファイル: test_shells.py プロジェクト: saullocastro/pyNastran
    def test_trax(self):
        """tests a CTRAX3/CTRAX6/???"""
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        model.add_grid(4, xyz=[0., 1., 0.])

        model.add_grid(5, xyz=[.5, 0., 0.])
        model.add_grid(6, xyz=[1., 0.5, 0.])
        model.add_grid(7, xyz=[.5, 1., 0.])
        model.add_grid(8, xyz=[0., .5, 0.])

        model.add_grid(9, xyz=[.5, .5, 0.])

        mid1 = 1
        E = 30.e7
        G = None
        nu = 0.3
        model.add_mat1(mid1, E, G, nu, rho=0.1)
        #model.add_mat1(2, E, G, nu, rho=0.1)
        #model.add_mat1(3, E, G, nu, rho=0.1)

        pid = 1
        nids = [1, 2, 3]
        ctrax3 = model.add_ctrax3(1, pid, nids, theta=0., comment='ctrax3')
        #model.add_pshell(pid, mid1=2, t=0.1)

        psolid = model.add_psolid(pid, mid1, cordm=0, integ=None, stress=None,
                                  isop=None, fctn='SMECH', comment='psolid')

        pid = 2
        nids = [1, 2, 3, 5, 6, 9]
        ctrax6 = model.add_ctrax6(2, pid, nids, theta=0., comment='ctrax6')

        plsolid = model.add_plsolid(pid, mid1, stress_strain='GRID', ge=0.,
                                    comment='plsolid')

        #assert pcomp.Thickness() == sum(thicknesses), thicknesses

        #pcomp.lam = 'SYM'
        #assert pcomp.Thickness() == sum(thicknesses)*2, thicknesses

        model.validate()

        ctrax6.raw_fields()
        ctrax6.write_card(size=8)


        psolid.raw_fields()
        psolid.write_card(size=8)
        #psolid.write_card(size=16)
        #psolid.write_card(size=16, is_double=True)

        plsolid.raw_fields()
        plsolid.write_card(size=8)
        #plsolid.write_card(size=16)
        #plsolid.write_card(size=16, is_double=True)

        model._verify_bdf(xref=False)

        #--------------------------------
        model.cross_reference()
        model._verify_bdf(xref=True)

        ctrax3.raw_fields()
        ctrax3.write_card(size=8)

        ctrax6.raw_fields()
        ctrax6.write_card(size=8)
コード例 #40
0
ファイル: test_shells.py プロジェクト: saullocastro/pyNastran
    def test_shells(self):
        """tests a CTRIA3/CQUAD4/PSHELL and CTRIA6/CQUAD8/CQUAD/PCOMP"""
        model = BDF(debug=False)
        model.add_grid(1, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        model.add_grid(4, xyz=[0., 1., 0.])

        model.add_grid(5, xyz=[.5, 0., 0.])
        model.add_grid(6, xyz=[1., 0.5, 0.])
        model.add_grid(7, xyz=[.5, 1., 0.])
        model.add_grid(8, xyz=[0., .5, 0.])

        model.add_grid(9, xyz=[.5, .5, 0.])

        E = 30.e7
        G = None
        nu = 0.3
        model.add_mat1(1, E, G, nu, rho=0.1)
        model.add_mat1(2, E, G, nu, rho=0.1)
        model.add_mat1(3, E, G, nu, rho=0.1)

        pid = 1
        nids = [1, 2, 3]
        model.add_ctria3(1, pid, nids)
        nids = [1, 2, 3, 4]
        model.add_cquad4(2, pid, nids)
        model.add_pshell(pid, mid1=2, t=0.1)

        pid = 2
        nids = [1, 2, 3, 5, 6, 9]
        ctria6 = model.add_ctria6(3, pid, nids, comment='ctria6')

        nids = [1, 2, 3, 4, 5, 6, 7, 8]
        cquad8 = model.add_cquad8(4, pid, nids, comment='cquad8')

        nids = [1, 2, 3, 4, 5, 6, 7, 8, 9]
        cquad = model.add_cquad(5, pid, nids, comment='cquad')

        mids = [1, 2, 3]
        thicknesses = [0.1, 0.2, 0.3]
        pcomp = model.add_pcomp(pid, mids, thicknesses)

        assert pcomp.Thickness() == sum(thicknesses), thicknesses

        pcomp.lam = 'SYM'
        assert pcomp.Thickness() == sum(thicknesses)*2, thicknesses

        model.validate()

        ctria6.raw_fields()
        ctria6.write_card(size=8)

        cquad8.raw_fields()
        cquad8.write_card(size=8)

        cquad.raw_fields()
        cquad.write_card(size=8)

        pcomp.raw_fields()
        pcomp.write_card(size=8)
        pcomp.write_card(size=16)
        pcomp.write_card(size=16, is_double=True)


        model._verify_bdf(xref=False)
        #--------------------------------
        model.cross_reference()
        model._verify_bdf(xref=True)

        ctria6.raw_fields()
        ctria6.write_card(size=8)

        cquad8.raw_fields()
        cquad8.write_card(size=8)

        cquad.raw_fields()
        cquad.write_card(size=8)

        pcomp.raw_fields()
        pcomp.write_card(size=8)
        pcomp.write_card(size=16)
        pcomp.write_card(size=16, is_double=True)
コード例 #41
0
    def test_bar_mass_01(self):
        model = BDF(debug=False)
        #model.case_control_deck = CaseControlDeck(case_control_lines)
        spc = ['SPC1', 123456, 123456, 1]
        grid1 = ['GRID', 1, None, 0., 0., 0.]
        grid2 = ['GRID', 2, None, 1., 0., 0.]
        grid3 = ['GRID', 3, None, 1., 0., 0.]
        force = ['FORCE', 100, 1, 0, 2., 3., 4.]
        cbar = [
            'CAR', 10, 11, 1, 2, 0., 1., 0., None,
        ]
        k1 = k2 = None
        area = 2.0
        rho = 3.
        nu = 0.3
        i1 = 2.1
        i2 = 1.2
        i12 = 0.1
        j = None
        nsm = 0.1
        pbar = [
            'PBAR', 11, 12, area, i1, i2, j, nsm,
            None, None, None, None, None, None, None, None,
            k1, k2, i12
        ]

        mat1 = ['MAT1', 12, 3.0e7, None, nu, rho]
        model.add_card(grid1, 'GRID')
        model.add_card(grid2, 'GRID')
        model.add_card(cbar, 'CBAR')
        model.add_card(pbar, 'PBAR')
        model.add_card(mat1, 'MAT1')
        model.add_card(spc, 'SPC1')
        model.add_card(force, 'FORCE')
        model.cross_reference()

        mass, cg, I = model.mass_properties(
            element_ids=None, mass_ids=None,
            reference_point=None,
            sym_axis=None,
            num_cpus=1,
            scale=None)
        #print('cg* =', cg)
        L = 1.0
        mass_per_length = area * rho + nsm
        mass = L * mass_per_length

        #xcg = (0.0 * mass_a + 1.0 * mass_b) / (mass_a + mass_b)
        #print(mass_a, mass_b, xcg, mass_a + mass_b)
        #print('mass =', mass)
        #cbar = CBEAM()
        cbar = model.elements[10]
        pbar = model.properties[11]
        assert pbar.Nu() == nu, 'pbar.Nu()=%s nu=%s' % (pbar.Nu(), nu)
        assert pbar.Rho() == rho, 'pbar.Rho()=%s rho=%s' % (pbar.Rho(), rho)
        assert allclose(cbar.Length(), 1.0), cbar.Length()
        #assert allclose(cbar.Mass(), 10.25), cbar.Mass()
        #assert allclose(cbar.MassPerLength(), 10.25), cbar.MassPerLength()
        #assert allclose(mass, 10.25), mass

        case_control_lines = (
            'SOL 101\n'
            'CEND\n'
            'SUBCASE 1\n'
            '    STRESS(PLOT,SORT1,REAL) = ALL\n'
            '    SPC = 123456\n'
            '    LOAD = 100\n'
            'BEGIN BULK\n'
            'PARAM,GRDPNT,0\n'
            'PARAM,POST,-1\n'
            'PARAM   POSTEXT YES\n'
        )
        with open('cbar.bdf', 'w') as bdf_file:
            bdf_file.write(case_control_lines)
            model.write_bdf(bdf_file, enddata=True)
        model2 = BDF(debug=False)
        model2.read_bdf('cbar.bdf')

        model2._verify_bdf(xref=True)
        if not os.path.exists('cbar.op2') and 0:
            os.system('nastran scr=yes bat=no old=no cbar.bdf')
        os.remove('cbar.bdf')

        if 0:
            from pyNastran.op2.op2 import OP2
            op2 = OP2()
            op2.read_op2('cbar.op2')
            #os.remove('cbar.op2')
            gpw = op2.grid_point_weight
            op2_mass = gpw.mass.max()
            assert allclose(op2_mass, mass), 'op2_mass=%s mass=%s' % (op2_mass, mass)
            #print('op2_mass=%s mass=%s' % (op2_mass, mass))
            op2_cg = gpw.cg

            cg = array([0.5, 0., 0.], dtype='float32')
コード例 #42
0
    def test_bar_mass_2(self):
        """CBAR/PBARL"""
        model = BDF(debug=False)
        model.add_grid(1, [0., 0., 0.])
        model.add_grid(2, [1., 0., 0.])
        model.add_grid(3, [0., 1., 0.])

        mid = 1
        E = 3.0e7
        G = None
        nu = 0.3
        model.add_mat1(mid, E, G, nu, rho=1.)

        #---------------------------------------------------------------
        eid = 1
        pid = 101
        nids = [1, 2]
        x = [0., 0., 1.]
        g0 = None
        cbar = model.add_cbar(eid,
                              pid,
                              nids,
                              x,
                              g0,
                              offt='GGG',
                              pa=0,
                              pb=0,
                              wa=None,
                              wb=None,
                              comment='CBAR')
        Type = 'BOX'
        dim = [1., 2., 0.1, 0.1]
        #pbeaml = model.add_pbeaml(pid, mid, Type, xxb, dims, nsm=None,
        #so=None, comment='PBEAML')
        pbarl = model.add_pbarl(pid,
                                mid,
                                Type,
                                dim,
                                group='MSCBMLO',
                                nsm=0.,
                                comment='PBARL')
        #---------------------------------------------------------------
        eid = 2
        pid = 102
        x = None
        g0 = 3
        cbar = model.add_cbar(eid,
                              pid,
                              nids,
                              x,
                              g0,
                              offt='GGG',
                              pa=0,
                              pb=0,
                              wa=None,
                              wb=None,
                              comment='CBAR')
        Type = 'BOX'
        dim = [1., 2., 0.1, 0.1]
        pbarl = model.add_pbarl(pid,
                                mid,
                                Type,
                                dim,
                                group='MSCBMLO',
                                nsm=0.,
                                comment='PBARL')
        #---------------------------------------------------------------
        eid = 3
        pid = 103
        #cbar = model.add_cbar(eid, pid, nids, x, g0, offt='GGG',
        #pa=42, pb=5, wa=None, wb=None,
        #comment='CBAR')
        pbar = model.add_pbar(pid,
                              mid,
                              A=1.,
                              i1=0.,
                              i2=0.,
                              i12=0.,
                              j=0.,
                              nsm=0.1,
                              c1=0.,
                              c2=0.,
                              d1=0.,
                              d2=0.,
                              e1=0.,
                              e2=0.,
                              f1=0.,
                              f2=0.,
                              k1=1.e8,
                              k2=1.e8,
                              comment='pbar')

        #G = 3.0e7
        #E = None
        #nu = 0.3
        #model.add_mat1(mid, E, G, nu, rho=0.0, a=0.0, tref=0.0, ge=0.0,
        #St=0.0, Sc=0.0, Ss=0.0, mcsid=0,
        #comment='')
        #---------------------------------------------------------------
        model.validate()
        model.pop_parse_errors()
        model._verify_bdf(xref=False)

        model.cross_reference()
        model.pop_xref_errors()

        model._verify_bdf(xref=True)
        model.uncross_reference()