本文整理汇总了Python中pyNastran.bdf.bdf.BDF.add_deqatn方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.add_deqatn方法的具体用法?Python BDF.add_deqatn怎么用?Python BDF.add_deqatn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.bdf.BDF
的用法示例。
在下文中一共展示了BDF.add_deqatn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dvprel1
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_deqatn [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()
示例2: test_dvcrel1
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import add_deqatn [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)