第五章 HyperMesh的求解器接口和模板
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
hm_getentityvalue mats 11 "\$E" 0
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习:从卡片中自动获取数据
• • 在OptirStruct模板中获取ID号为1的MAT1类型的材料的Young’s Modulus (E), Shear Modulus (G), Poisson’s ratio (Nu), 和 density (Rho) 显示获得的这些值
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习
练习 5a 描述: 创建一个PSHELL类型的属性,用户输入一个厚度值,并将这个厚度值更新进去 用到的命令: hm_errormessage *collectorcreateonly *attributeupdatedouble hm_getfloat set if *createmark *dictionaryload hm_getmark
求解器的卡片
• OptiStruct MAT1类型材料的卡片示例:
• 上图中每一个输入项都对应了optistruct模型中的一个属性和数据名,这个模型 在:
<altair_home>/templates/feoutput/common_nas_os/attribs
• 其中的一部分定义如下:
*defineattribute(E,1,real,none) *defineattribute(G,2,real,none) *defineattribute(Nu,3,real,none) *defineattribute(Rho,4,real,none)
• 当我们创建一个新的名称为steel MAT1类型的材料时,command.cmf文件记 录下的HyperMesh的命令:
*collectorcreate(materials,"steel","",11) *createmark(materials,2) "steel" *dictionaryload(materials,2,"C:/Altair/hw10.0/templates/feo utput/optistruct/optistruct","MAT1") *attributeupdateint(materials,1,3240,1,2,0,1) *attributeupdatedouble(materials,1,1,1,1,0,210000) *attributeupdatedouble(materials,1,2,1,0,0,0) *attributeupdatedouble(materials,1,3,1,1,0,0.3) *attributeupdatedouble(materials,1,4,1,1,0,7.85e-009) *attributeupdatedouble(materials,1,5,1,0,0,0) *attributeupdatedouble(materials,1,6,1,0,0,0) *attributeupdatedouble(materials,1,7,1,0,0,0) *attributeupdatedouble(materials,1,341,1,0,0,0) *attributeupdatedouble(materials,1,343,1,0,0,0) *attributeupdatedouble(materials,1,345,1,0,0,0) *attributeupdateint(materials,1,5237,1,2,0,0)
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
例子: 自动定义和更新一组材料 • 创建下面三个材料,并定义材料的参数:
NAME aluminum altairium steel E 10 1000 2.00E+06 G 20 200 1.00E+06 NU 0.3 0.3 0.3 RHO 40 400 7.80E-09
用到的命令:
hm_getentityvalue set return \ proc tk_messageBox
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
给求解器有关的属性赋值
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
HyperMesh的求解器接口和模板
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
• These commands use a data_name_string to access a particular piece of data.
• 每一个属性都有一个名称和ID号。例如,我们之前将的MAT1类型的材料的几 个常用的属性:
*defineattribute(E,1,real,none) *defineattribute(G,2,real,none) *defineattribute(Nu,3,real,none) *defineattribute(Rho,4,real,none) • 得到一个ID号为11的材料的弹性模型E的值:
• 我们再去看 optistruct attribs 模板,就会发现这里ID号为1的属性代表的是弹性 模型E或者叫 Young’s Modulus
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
给求解器有关的属性赋值
• 我们看其中的一条命令:
*attributeupdatedouble(materials,1,1,1,1,0,210000) 这里: materials 拥有这个属性的实体类型 1 is the ID of the entity 1 is the ID of the attribute 1 is the solver number of the attribute 1 is the status of the attribute 0 is the behavior of the attribute 210000 is the value of the attribute
创建一个可以反复使用的用于创建材料的函数
proc mat_create { name color E Nu Rho } { if {[hm_entityinfo exist mats $name –byname]} { hm_errormessage "Material $name already exists" return; } else { *collectorcreate materials "$name" "" $color; *createmark materials 2 "$name"; #Retrieve material ID for use below; set mat_id [hm_getmark mats 2]; *dictionaryload materials 2 "[hm_info exporttemplate]“"MAT1"; *attributeupdateint materials $mat_id 3240 1 2 0 1; *attributeupdatedouble materials $mat_id 1 1 1 0 $E; *attributeupdatedouble materials $mat_id 3 1 1 0 $Nu; *attributeupdatedouble materials $mat_id 4 1 1 0 $Rho; return; } }
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习:创建一个材料并定义材料
• 假设已经打开了OptiStruct模板,创建一个MAT1类型的材料,并且把下面这 些属性添加进去:
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
查找求解器有关的属性
• 求解器有关的属性可以用 hm_getentityvalue, hm_attributearrayvalue 和 hm_attributearray2dvalue 命令来查找
HyperMesh的求解器接口和模板概览
关键点: • • • • • • • • 求解器的卡片 查找求解器有关的属性 练习:从卡片中自动获取数据 给求解器有关的属性赋值 创建一个可以反复使用的用于创建材料的函数 练习:创建一个材料并定义材料 更新求解器有关的属性 例子: 自动定义和更新一组材料
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
更新求解器有关的属性
• 我们也可以更新已经存在的材料的属性
proc mat_update { mat_id E Nu Rho } { if {![hm_entityinfo exist mats $mat_id –byid]} { hm_errormessage "Material $mat_id does not exist" return; } else { *createmark materials 2 "by id" "$mat_id"; *dictionaryload materials 2 "[hm_info exporttemplate]" \ "MAT1"; *attributeupdatedouble materials $mat_id 1 1 1 0 $E; *attributeupdatedouble materials $mat_id 3 1 1 0 $Nu; *attributeupdatedouble materials $mat_id 4 1 1 0 $Rho; return; } }
Βιβλιοθήκη Baidu• • Young’s Modulus (E) 210000 Poisson’s ratio (Nu) 0.30
•
density (Rho)
7.85e- 9
•
可以使用我们之前定义的创建材料的函数
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习:从卡片中自动获取数据
• • 在OptirStruct模板中获取ID号为1的MAT1类型的材料的Young’s Modulus (E), Shear Modulus (G), Poisson’s ratio (Nu), 和 density (Rho) 显示获得的这些值
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习
练习 5a 描述: 创建一个PSHELL类型的属性,用户输入一个厚度值,并将这个厚度值更新进去 用到的命令: hm_errormessage *collectorcreateonly *attributeupdatedouble hm_getfloat set if *createmark *dictionaryload hm_getmark
求解器的卡片
• OptiStruct MAT1类型材料的卡片示例:
• 上图中每一个输入项都对应了optistruct模型中的一个属性和数据名,这个模型 在:
<altair_home>/templates/feoutput/common_nas_os/attribs
• 其中的一部分定义如下:
*defineattribute(E,1,real,none) *defineattribute(G,2,real,none) *defineattribute(Nu,3,real,none) *defineattribute(Rho,4,real,none)
• 当我们创建一个新的名称为steel MAT1类型的材料时,command.cmf文件记 录下的HyperMesh的命令:
*collectorcreate(materials,"steel","",11) *createmark(materials,2) "steel" *dictionaryload(materials,2,"C:/Altair/hw10.0/templates/feo utput/optistruct/optistruct","MAT1") *attributeupdateint(materials,1,3240,1,2,0,1) *attributeupdatedouble(materials,1,1,1,1,0,210000) *attributeupdatedouble(materials,1,2,1,0,0,0) *attributeupdatedouble(materials,1,3,1,1,0,0.3) *attributeupdatedouble(materials,1,4,1,1,0,7.85e-009) *attributeupdatedouble(materials,1,5,1,0,0,0) *attributeupdatedouble(materials,1,6,1,0,0,0) *attributeupdatedouble(materials,1,7,1,0,0,0) *attributeupdatedouble(materials,1,341,1,0,0,0) *attributeupdatedouble(materials,1,343,1,0,0,0) *attributeupdatedouble(materials,1,345,1,0,0,0) *attributeupdateint(materials,1,5237,1,2,0,0)
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
例子: 自动定义和更新一组材料 • 创建下面三个材料,并定义材料的参数:
NAME aluminum altairium steel E 10 1000 2.00E+06 G 20 200 1.00E+06 NU 0.3 0.3 0.3 RHO 40 400 7.80E-09
用到的命令:
hm_getentityvalue set return \ proc tk_messageBox
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
给求解器有关的属性赋值
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
HyperMesh的求解器接口和模板
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
• These commands use a data_name_string to access a particular piece of data.
• 每一个属性都有一个名称和ID号。例如,我们之前将的MAT1类型的材料的几 个常用的属性:
*defineattribute(E,1,real,none) *defineattribute(G,2,real,none) *defineattribute(Nu,3,real,none) *defineattribute(Rho,4,real,none) • 得到一个ID号为11的材料的弹性模型E的值:
• 我们再去看 optistruct attribs 模板,就会发现这里ID号为1的属性代表的是弹性 模型E或者叫 Young’s Modulus
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
给求解器有关的属性赋值
• 我们看其中的一条命令:
*attributeupdatedouble(materials,1,1,1,1,0,210000) 这里: materials 拥有这个属性的实体类型 1 is the ID of the entity 1 is the ID of the attribute 1 is the solver number of the attribute 1 is the status of the attribute 0 is the behavior of the attribute 210000 is the value of the attribute
创建一个可以反复使用的用于创建材料的函数
proc mat_create { name color E Nu Rho } { if {[hm_entityinfo exist mats $name –byname]} { hm_errormessage "Material $name already exists" return; } else { *collectorcreate materials "$name" "" $color; *createmark materials 2 "$name"; #Retrieve material ID for use below; set mat_id [hm_getmark mats 2]; *dictionaryload materials 2 "[hm_info exporttemplate]“"MAT1"; *attributeupdateint materials $mat_id 3240 1 2 0 1; *attributeupdatedouble materials $mat_id 1 1 1 0 $E; *attributeupdatedouble materials $mat_id 3 1 1 0 $Nu; *attributeupdatedouble materials $mat_id 4 1 1 0 $Rho; return; } }
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
练习:创建一个材料并定义材料
• 假设已经打开了OptiStruct模板,创建一个MAT1类型的材料,并且把下面这 些属性添加进去:
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
查找求解器有关的属性
• 求解器有关的属性可以用 hm_getentityvalue, hm_attributearrayvalue 和 hm_attributearray2dvalue 命令来查找
HyperMesh的求解器接口和模板概览
关键点: • • • • • • • • 求解器的卡片 查找求解器有关的属性 练习:从卡片中自动获取数据 给求解器有关的属性赋值 创建一个可以反复使用的用于创建材料的函数 练习:创建一个材料并定义材料 更新求解器有关的属性 例子: 自动定义和更新一组材料
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.
更新求解器有关的属性
• 我们也可以更新已经存在的材料的属性
proc mat_update { mat_id E Nu Rho } { if {![hm_entityinfo exist mats $mat_id –byid]} { hm_errormessage "Material $mat_id does not exist" return; } else { *createmark materials 2 "by id" "$mat_id"; *dictionaryload materials 2 "[hm_info exporttemplate]" \ "MAT1"; *attributeupdatedouble materials $mat_id 1 1 1 0 $E; *attributeupdatedouble materials $mat_id 3 1 1 0 $Nu; *attributeupdatedouble materials $mat_id 4 1 1 0 $Rho; return; } }
Βιβλιοθήκη Baidu• • Young’s Modulus (E) 210000 Poisson’s ratio (Nu) 0.30
•
density (Rho)
7.85e- 9
•
可以使用我们之前定义的创建材料的函数
Copyright © 2009 Altair Engineering, Inc. Proprietary and Confidential. All rights reserved.