当前位置: 首页>>代码示例>>Python>>正文


Python BDF.add_grid方法代码示例

本文整理汇总了Python中pyNastran.bdf.bdf.BDF.add_grid方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.add_grid方法的具体用法?Python BDF.add_grid怎么用?Python BDF.add_grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.bdf.BDF的用法示例。


在下文中一共展示了BDF.add_grid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_solids_ctetra10

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:36,代码来源:test_solids.py

示例2: test_solids_chexa

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:31,代码来源:test_solids.py

示例3: test_solids_ctetra4

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
 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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:23,代码来源:test_solids.py

示例4: test_cshear

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:39,代码来源:test_shells.py

示例5: test_solids_cpyram5

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
 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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:24,代码来源:test_solids.py

示例6: test_solids_cpenta

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
 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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:25,代码来源:test_solids.py

示例7: test_trax

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:72,代码来源:test_shells.py

示例8: test_shells

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:85,代码来源:test_shells.py

示例9: test_dvprel1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    def test_dvprel1(self):
        """tests a DESVAR, DVPREL1, DRESP1, DCONSTR"""
        model = BDF(debug=False)
        oid = 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, xyz=[0., 0., 0.])
        model.add_grid(2, xyz=[1., 0., 0.])
        model.add_grid(3, xyz=[1., 1., 0.])
        ctria3 = model.add_ctria3(eid, pid, nids, comment='ctria3')
        pshell = model.add_pshell(pid, mid1=30, t=0.1, comment='pshell')
        mat1 = 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(oid, Type, pid, pname_fid,
                                    desvar_ids, coeffs, p_min=None, p_max=1e20, c0=0.0,
                                    validate=True, comment='dvprel')

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

        dresp_id = 42
        label = 'STRESS1'
        response_type = 'STRESS'
        property_type = 'PSHELL'
        region = None
        atta = 9
        attb = None
        atti = pid
        dresp1 = model.add_dresp1(dresp_id, label, response_type,
                                 property_type, region,
                                 atta, attb, atti, validate=True, comment='dresp1')
        dconstr = model.add_dconstr(oid, dresp_id, lid=-1.e20, uid=1.e20,
                                   lowfq=0., highfq=1.e20, comment='dconstr')
        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)

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

        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()

        stringio = StringIO()
        model.write_bdf(stringio, close=False)
        stringio.getvalue()
开发者ID:saullocastro,项目名称:pyNastran,代码行数:93,代码来源:test_optimization.py

示例10: test_dvcrel1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    def test_dvcrel1(self):
        """tests a DVCREL"""
        model = BDF(debug=False)
        oid = 10
        eid = 100
        cp_min = 0.01
        cp_max = 1.
        desvar_id = 11
        desvar_ids = 11
        coeffs = 1.0
        dvcrel1 = model.add_dvcrel1(oid, 'CONM2', eid, 'X2', desvar_ids, coeffs,
                                    cp_min, cp_max, c0=0., validate=True, comment='')

        label = 'X2_MASS'
        xinit = 0.1
        xlb = 0.01
        xub = 1.0
        desvar = model.add_desvar(desvar_id, label, xinit, xlb, xub, comment='desvar')

        mass = 1.
        nid1 = 100
        nid2 = 101
        conm2 = model.add_conm2(eid, nid1, mass, cid=0, X=None, I=None,
                                comment='conm2')
        model.add_grid(100, xyz=[1., 2., 3.])
        model.add_grid(101, xyz=[2., 2., 4.])

        eid = 101
        pid = 102
        x = [1., 0., 0.]
        g0 = None
        cbar = model.add_cbar(eid, pid, nid1, nid2, x, g0, offt='GGG', pa=0, pb=0,
                              wa=None, wb=None, comment='cbar')

        oid = 11
        equation_id = 100
        dvcrel2 = model.add_dvcrel2(oid, 'CBAR', eid, 'X3', equation_id, desvar_ids, labels=None,
                                    cp_min=2., cp_max=4.,
                                    validate=True, comment='dvcrel2')

        mid = 1000
        dim = [1., 2., 0.1, 0.2]
        model.add_pbarl(pid, mid, 'T', dim, group='MSCBMLO', nsm=0.1,
                        comment='pbarl')
        E = 30.e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(mid, E, G, nu, rho=0.1, comment='mat1')

        name = 'fx2'
        eqs = ['fx2(x) = x + 10.']
        deqatn = model.add_deqatn(name, equation_id, eqs, comment='deqatn')

        dvcrel1.raw_fields()
        dvcrel2.raw_fields()
        dvcrel1.write_card(size=16)
        dvcrel2.write_card(size=16)

        dvcrel1.comment = ''
        dvcrel2.comment = ''
        desvar.comment = ''
        dvcrel1_msg = dvcrel1.write_card(size=8)
        dvcrel2_msg = dvcrel2.write_card(size=8)
        desvar_msg = desvar.write_card(size=8)


        model.validate()
        model.cross_reference()
        dvcrel1.raw_fields()
        dvcrel1.write_card(size=16)
        dvcrel1.write_card(size=8)

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

        assert cbar.Mass() > 0, cbar.Mass()

        #-------------------------------------------
        dvcrel1_lines = dvcrel1_msg.split('\n')
        dvcrel2_lines = dvcrel2_msg.split('\n')
        desvar_lines = desvar_msg.split('\n')
        model2 = BDF(debug=False)
        model2.add_card(dvcrel1_lines, 'DVCREL1', is_list=False)
        model2.add_card(dvcrel2_lines, 'DVCREL2', is_list=False)
        model2.add_card(desvar_lines, 'DESVAR', is_list=False)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:88,代码来源:test_optimization.py

示例11: test_ploadx1

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_grid [as 别名]
    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)
开发者ID:saullocastro,项目名称:pyNastran,代码行数:68,代码来源:test_loads.py


注:本文中的pyNastran.bdf.bdf.BDF.add_grid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。