找回密码
 注册
Simdroid-非首页
查看: 474|回复: 11

[资料分享] 一个Patran参数化建模工具的应用

[复制链接]
发表于 2008-6-13 23:10:38 | 显示全部楼层 |阅读模式 来自 上海


[PATRAN NEWS
] – Parametric Modelling Toolbox



Dear Patran user,

This week I want to discuss a tool that is very powerful for analysts wanting to quickly investigate multiple variations of a parametric based design. Using the Parametric Modeling tool in Patran, you start by defining variables which you then use to build your geometry model. You then mesh the geometry, apply loads and boundary conditions, set up materials and define properties. You then run the analysis and review the results. Once you have done this once, you can create a session file that uses a configuration file to change the model variables and re-run the analysis. I will demonstrate this through a simple example of a cantilever beam with a distributed load applied to the top of the beam. Parameters will be setup to vary the size of the beam.



STEP 1: Setting Up Parametric Model
1. To begin, we’ll create a new database with the Nastran preference and default tolerances. For this example, I’m using Patran 2007r2, but Parametric Modeling is available from Patran 2003 onwards.

2. The Parametric Modeling toolbox can be accessed from the main menu under Tools > Pre Release > Parametric Modeling



3. We will start by creating some variables that we will use to create our geometry: Create > Variables. I’ll start with a beam that is 1200 mm long, 100 mm high and 50 mm wide. I’ll also create two variables to define the element size.

width = 50
height = 100
length = 1200
element_size_length = 50
element_size_section = 25



4. Next I need to create a number of macros that will calculate further variables based on the base variables: Create > Macros. I will create macros for the area on the top face of the beam, the pressure load (based on 1500 N load) and mesh seed values.

NOTE: For the mesh seed values I need to calculate an integer value so I include “mth_nint” in front of the macro definition to convert the answer to an integer.

area = ~length~ * ~width~
pressure_loading = 1500/~area~
mesh_seed_length = mth_nint (~length~ / ~element_size_length)
mesh_seed_width = mth_nint (~width~ / ~element_size_section)
mesh_seed_height = mth_nint (~height~ / ~element_size_section)



5. Next I will create the solid geometry of the beam based on the variables I’ve created: Geometry > Create > Solid > XYZ and for the vector coordinates enter the variables for length, height and width.

NOTE: The parameters must be enclosed by the ` symbol – this is located at the top left (above the tab key and left of 1) on a standard keyboard.



6. Constrain one end of the beam by fixing all translational degrees of freedom and selecting a face at the end of the beam: Loads/BCs > Create > Displacement > Nodal

    



7. Apply a pressure load to the top face of the beam: Loads/BCs > Create > Pressure > Element Uniform.

    



7. Create a material called steel with properties of E = 210 GPa and nu = 0.3: Materials > Create > Isotropic > Manual Input.



8. Create a solid property and apply it to the beam geometry: Properties > Create > 3D > Solid.

   


9. Now to create some mesh seeds using the mesh seed macros we created earlier: Elements > Create > Mesh Seed > Uniform.

`mesh_seed_length()`
`mesh_seed_height()`
`mesh_seed_width()`



10. Then we can mesh the beam with HEX elements: Elements > Create > Mesh > Solid > Hex



11. The model is now ready to run, so I will run a full analysis: Analysis > Analyze > Entire Model > Full Run.

NOTE: For the analysis to run from Patran, you need to ensure that your p3_trans.ini file defines the location of the Nastran solver executable.

12. The analysis will be complete in a few seconds and then we can attach the XDB results: Analysis > Access Results > Attach XDB > Result Entities and select the XDB file.

13. Finally, we can use the Parametric Modeling toolbox to scan the model and report on key results: Tools > Pre Release > Parametric Modeling > Create > Outputs. For this example I want to know the maximum deformation of the beam and the maximum stress.



STEP 2: Generating Session File
Now that we’ve analysed our initial design, we can close the model and create a session file that can be replayed over and over.

14. After quitting Patran, look in your working directory and find the last patran.ses file. This file contains a list of all the commands to generate the model, run the analysis and report on maximum stress and displacement. Rename this file as parametric.ses and then open the file in a text editor.

15. At the top of the session file you will need to add two lines to define your configuration file (with parameters) and the name of the output file.

parametric_modeling_util.define_user_config_file ("config.dat")
parametric_modeling_util.define_user_output_file ("output.dat")

16. At the very bottom of the session file you will need to add two lines – one to write the results to the output file and one to close the model.

parametric_modeling_util.print_all_output()
uil_file_close.go(  )

17. Next we need to create a configuration file that defines the new parameters. In a text editor, create a file called config.dat and enter your required parameters. For example:

height=150
width=40
length=1000
element_size_length=50
element_size_section=25

18. Now you can run the session file for the updated parameters. Start Patran and go to File > Session > Play, and select your session file parametric.ses. Patran will now replay the session file but read in the updated variables from config.dat. It will build the model, apply properties and boundary conditions, run the analysis and report the results to the output.dat file.

Here’s an example of the output.dat file:

!
! VARIABLES
!
Real height = 100 !
Real width = 50 !
Real length = 1200 !
Real element_size_length = 50 !
Real element_size_section = 25 !
!
! MACROS
!
area() = 60000.
pressure_loading() = 0.025
mesh_seed_length() = 24.
mesh_seed_width() = 2.
mesh_seed_height() = 4.
!
! OUTPUTS
!
Real max_displacement = -3.684597E-1 ---> At Node 125 !
Real max_stress = 1.063215E+1 ---> At Element 169 !

STEP 3: Runing Multiple Analyses in Batch Mode
19. Once you’ve verified that your session file works, you can run multiple analyses in batch mode. This is done on the command line as follows:

> patran –psf –b parametric.ses

All you need to do is edit your config.dat before each analysis and then run patran in batch mode which will run everything in the background and generate an output.dat file.

Example Files
Here attached a zip file that contains two text files – parametric.ses and config.dat. These files are designed to be run from the c:\temp directory on Windows using Patran 2007r2 installed in the default location. Instructions are included in the session file to help you change the working directory or installation directory of Patran.

You can either start Patran in the working directory and play the session file or run Patran in batch mode. The session file is commented to help you understand how it works.

This is just a very basic example and the process can be easily used to look at any problem where the model can be built parametrically. Other real life examples include automotive wheels, an aircraft fuselage or a multi-level building. Please contact MSC China Representative Offices if you have any questions about parametric modeling or this example.


Until next time,

MSC.Software China

Web: http://www.mscsoftware.com.cn/
NOTE: The current version of Patran is v2007r2 available for download from http://mscsoftware.subscribenet.com/
Patran 2008r1 is due for release during June!


[ 本帖最后由 dmap 于 2008-6-13 23:15 编辑 ]

评分

1

查看全部评分

 楼主| 发表于 2008-6-13 23:13:07 | 显示全部楼层 来自 上海
Simdroid开发平台
图片显示不出来,不知道怎么弄法
贴到附件里面吧

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

发表于 2010-3-22 20:24:52 | 显示全部楼层 来自 上海闸北区
谢谢LZ了,关于这个例子,我研究了一天,始终不知如何输出output文件。
回复 不支持

使用道具 举报

发表于 2010-3-22 22:44:06 | 显示全部楼层 来自 湖北武汉
这么好的贴不顶对不住楼主
回复 不支持

使用道具 举报

发表于 2010-4-20 22:49:39 | 显示全部楼层 来自 广东惠州
严重感谢楼主的分享
回复 不支持

使用道具 举报

发表于 2010-5-11 09:15:57 | 显示全部楼层 来自 北京航空航天大学
谢谢楼主分享,非常3x
回复 不支持

使用道具 举报

发表于 2011-9-30 09:17:20 | 显示全部楼层 来自 山东烟台
haodongdong!!!!!!!!!!!!
回复 不支持

使用道具 举报

发表于 2011-10-10 15:56:37 | 显示全部楼层 来自 江苏南京
我在18步出错了,新了一个了config.dat文件,然后在Start Patran and go to File > Session > Play时出错了,说是“Non ascii data read from play file”,请问高手们这是怎么回事?
回复 不支持

使用道具 举报

发表于 2011-10-13 20:51:41 | 显示全部楼层 来自 江苏南京
很好……
回复 不支持

使用道具 举报

发表于 2014-2-13 08:46:16 | 显示全部楼层 来自 黑龙江哈尔滨
请问这个output.dat file里的内容写什么,是下面的吗,为什么我写了不好用那

!
! VARIABLES
!
Real height = 100 !
Real width = 50 !
Real length = 1200 !
Real element_size_length = 50 !
Real element_size_section = 25 !
!
! MACROS
!
area() = 60000.
pressure_loading() = 0.025
mesh_seed_length() = 24.
mesh_seed_width() = 2.
mesh_seed_height() = 4.
!
! OUTPUTS
!
Real max_displacement = -3.684597E-1 ---> At Node 125 !
Real max_stress = 1.063215E+1 ---> At Element 169 !
回复 不支持

使用道具 举报

发表于 2014-10-15 22:18:49 | 显示全部楼层 来自 陕西西安
好贴,严重支持
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-8 07:04 , Processed in 0.059734 second(s), 17 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表