- 积分
- 3
- 注册时间
- 2005-10-27
- 仿真币
-
- 最后登录
- 1970-1-1
|
[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
查看全部评分
-
|