好文档 - 专业文书写作范文服务资料分享网站

10-31-06-Python-Scripting-in-ABAQUS (2)

天下 分享 时间: 加入收藏 我要投稿 点赞

Python Scripting in ABAQUS

Kevin Maxwell Texas A&M University August 30, 2006

Introduction

ABAQUS CAE provides a graphical user interface that allows the user to create finite element models that can then be analyzed in ABAQUS Standard. For every feature in CAE, there is a corresponding Python script command that the program uses when creating the model. If the language is understood well enough, an entire model can be created simply by running a script file.

While one could write an entire script from scratch, ABAQUS provides several easier methods that autogenerate Python commands. When a model is created in CAE, two files are automatically created in the work directory. The replay file records every action that is performed in CAE including camera zoom/panning commands and also any

mistakes that were made and then corrected. This file can be run to “replay” all the work that has been done on the model. The recover file records only the minimum necessary commands to recreate the model. If an error occurs and CAE closes without saving, the recover file can be run to recreate the model. When a model is saved, CAE uses the recover file to write a journal file. The journal file is a comprehensive script that shows all work saved on the model. Note that the recover file is deleted whenever the model is saved and all of its commands are transferred to the journal file. The recover and journal files provide an easy alternative to writing Python scripts from scratch. One can simply define a model in CAE and then save the Python commands from the recover or journal files as a separate script file.

There are several valuable sources of information pertaining to scripting in ABAQUS. The ABAQUS Scripting User’s Manual and ABAQUS Scripting Reference Manual are invaluable resources that are included in the ABAQUS documentation. The user’s manual gives an overview to scripting while the reference manual provides in-depth coverage of every scripting command used in ABAQUS. Another source of information can be found at http://www.python.org . This website contains numerous resources dealing with the Python language in general.

Example

To illustrate the procedure for auto-generating Python scripts, the cruciform specimen used for interfacial normal strength testing will be modeled. This specimen is shown in Figure 1. As can be seen from the figure, symmetry planes were exploited so that only ? of the specimen was modeled. The entire 2D model was first created in CAE and the necessary commands were copied from the recover file. The easiest way to do this is by splitting the modeling process into smaller segments and copying commands from the recover or journal file at the end of each segment. The resulting script can then be run in CAE so that the next segment can be created.

Figure 1: ? of Cruciform Specimen

Before starting the model type the following command into the Python editor box in CAE:

session.journalOptions.setValues(recoverGeometry=COORDINATE)

This sets the recover and journal files to record geometry commands in the form of coordinates instead of geometric indices. This step is very helpful if any type of parameterization will be used with the script.

Next, the part will be sketched and created in CAE. The commands used to sketch the part in Figure 1 are then copied from the recover or journal file. These commands are shown below.

mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.1) mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues( decimalPlaces=3)

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.0, 0.0), point2=( 0.015, 0.0065))

del mdb.models['Model-1'].sketches['__profile__']

mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.1) mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues( decimalPlaces=3)

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.0, 0.0), point2=( 0.015, 0.0))

mdb.models['Model-1'].sketches['__profile__'].HorizontalConstraint(entity= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0075, 0.0), ))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.015, 0.0), point2= (0.015, 0.0065))

mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(entity= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.015, 0.00325), ))

mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(entity1= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0075, 0.0), ), entity2=

mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.015, 0.00325), ))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.015, 0.0065), point2=(0.004, 0.0065))

mdb.models['Model-1'].sketches['__profile__'].HorizontalConstraint(entity= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0095, 0.0065), ))

mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(entity1= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.015, 0.00325), ), entity2=

mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0095, 0.0065), ))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.004, 0.0065), point2=(0.004, 0.03))

mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(entity= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.004, 0.01825), ))

mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(entity1= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0095, 0.0065), ), entity2=

mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.004, 0.01825), ))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.004, 0.03), point2=(0.0, 0.03))

mdb.models['Model-1'].sketches['__profile__'].HorizontalConstraint(entity= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.002, 0.03), ))

mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(entity1= mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.004, 0.01825), ), entity2=

mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.002, 0.03), ))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.0, 0.03), point2=( 0.0, 0.0))

mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(entity=

mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.015), ))

mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(entity1=

10-31-06-Python-Scripting-in-ABAQUS (2)

PythonScriptinginABAQUSKevinMaxwellTexasA&MUniversityAugust30,2006IntroductionABAQUSCAEprovidesagraphicaluserinterfacethatallowsth
推荐度:
点击下载文档文档为doc格式
00foa5pr9y2cg5h8ins237lyd0yjij015uk
领取福利

微信扫码领取福利

微信扫码分享