Python Scripting in ABAQUS.docx

上传人:b****4 文档编号:12187830 上传时间:2023-04-17 格式:DOCX 页数:27 大小:161.15KB
下载 相关 举报
Python Scripting in ABAQUS.docx_第1页
第1页 / 共27页
Python Scripting in ABAQUS.docx_第2页
第2页 / 共27页
Python Scripting in ABAQUS.docx_第3页
第3页 / 共27页
Python Scripting in ABAQUS.docx_第4页
第4页 / 共27页
Python Scripting in ABAQUS.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

Python Scripting in ABAQUS.docx

《Python Scripting in ABAQUS.docx》由会员分享,可在线阅读,更多相关《Python Scripting in ABAQUS.docx(27页珍藏版)》请在冰豆网上搜索。

Python Scripting in ABAQUS.docx

PythonScriptinginABAQUS

PythonScriptinginABAQUS

KevinMaxwell

TexasA&MUniversity

August30,2006

Introduction

ABAQUSCAEprovidesagraphicaluserinterfacethatallowstheusertocreatefiniteelementmodelsthatcanthenbeanalyzedinABAQUSStandard.ForeveryfeatureinCAE,thereisacorrespondingPythonscriptcommandthattheprogramuseswhencreatingthemodel.Ifthelanguageisunderstoodwellenough,anentiremodelcanbecreatedsimplybyrunningascriptfile.

Whileonecouldwriteanentirescriptfromscratch,ABAQUSprovidesseveraleasiermethodsthatautogeneratePythoncommands.WhenamodeliscreatedinCAE,twofilesareautomaticallycreatedintheworkdirectory.ThereplayfilerecordseveryactionthatisperformedinCAEincludingcamerazoom/panningcommandsandalsoanymistakesthatweremadeandthencorrected.Thisfilecanberunto“replay”alltheworkthathasbeendoneonthemodel.Therecoverfilerecordsonlytheminimumnecessarycommandstorecreatethemodel.IfanerroroccursandCAEcloseswithoutsaving,therecoverfilecanberuntorecreatethemodel.Whenamodelissaved,CAEusestherecoverfiletowriteajournalfile.Thejournalfileisacomprehensivescriptthatshowsallworksavedonthemodel.Notethattherecoverfileisdeletedwheneverthemodelissavedandallofitscommandsaretransferredtothejournalfile.TherecoverandjournalfilesprovideaneasyalternativetowritingPythonscriptsfromscratch.OnecansimplydefineamodelinCAEandthensavethePythoncommandsfromtherecoverorjournalfilesasaseparatescriptfile.

ThereareseveralvaluablesourcesofinformationpertainingtoscriptinginABAQUS.TheABAQUSScriptingUser’sManualandABAQUSScriptingReferenceManualareinvaluableresourcesthatareincludedintheABAQUSdocumentation.Theuser’smanualgivesanoverviewtoscriptingwhilethereferencemanualprovidesin-depthcoverageofeveryscriptingcommandusedinABAQUS.Anothersourceofinformationcanbefoundathttp:

//www.python.org.ThiswebsitecontainsnumerousresourcesdealingwiththePythonlanguageingeneral.

Example

Toillustratetheprocedureforauto-generatingPythonscripts,thecruciformspecimenusedforinterfacialnormalstrengthtestingwillbemodeled.ThisspecimenisshowninFigure1.Ascanbeseenfromthefigure,symmetryplaneswereexploitedsothatonly¼ofthespecimenwasmodeled.Theentire2DmodelwasfirstcreatedinCAEandthenecessarycommandswerecopiedfromtherecoverfile.Theeasiestwaytodothisisbysplittingthemodelingprocessintosmallersegmentsandcopyingcommandsfromtherecoverorjournalfileattheendofeachsegment.TheresultingscriptcanthenberuninCAEsothatthenextsegmentcanbecreated.

Figure1:

¼ofCruciformSpecimen

BeforestartingthemodeltypethefollowingcommandintothePythoneditorboxinCAE:

session.journalOptions.setValues(recoverGeometry=COORDINATE)

Thissetstherecoverandjournalfilestorecordgeometrycommandsintheformofcoordinatesinsteadofgeometricindices.Thisstepisveryhelpfulifanytypeofparameterizationwillbeusedwiththescript.

Next,thepartwillbesketchedandcreatedinCAE.ThecommandsusedtosketchthepartinFigure1arethencopiedfromtherecoverorjournalfile.Thesecommandsareshownbelow.

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))

delmdb.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=

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

0.03),),entity2=

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

))

mdb.models['Model-1'].sketches['__profile__'].FilletByRadius(curve1=

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

0.01825),),curve2=

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

0.0065),),nearPoint1=(0.0040139821358,0.00947074592113),nearPoint2=(

0.00570417288691,0.0064547881484),radius=0.006)

Oncethecommandsarecopied,theymayneedtobemodifiedsothatthepartismorerobustlydefined.Forinstance,insteadofusing(0,2.439999)todefineavertexpoint,itmayneedtobechangedto(0,2.44)oreven(0,r),where‘r’isavariablethatcanbedefinedandusedtoparameterizethemodel.Also,someofthecommandsgeneratedcanbecompletelyabandoned.Thehorizontal,vertical,perpendicular,etc..constraintcommandssometimescauseproblemswithscripting,sodeletingthemisusuallyagoodidea.Themodifiedversionofthegeneratedsketchcommandsaregivenbelow.

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__'].Line(point1=(0.015,0.0),point2=

(0.015,h))

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

point2=(w,h))

mdb.models['Model-1'].sketches['__profile__'].Line(point1=(w,h),

point2=(w,0.03))

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

point2=(0.0,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__'].FilletByRadius(curve1=

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

0.01825),),curve2=

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

0.0065),),nearPoint1=(w+r,h),nearPoint2=(

w,h+r),radius=r)

TherestofthemodelandscriptarethencreatedinCAEusingthesamestepsasabove.Specialcaremustbetakenwhenseedingandmeshingthepart.Thisisusuallythemostinvolvedpartoftheprocesssinceanythingotherthantrivialgeometriesrequiresamoderatetolargeamountofmodificationofthemeshseeds.Oncetheentiremodelhasbeencreateditisusuallyagoodideatorunasimpleanalysisjusttocheckforerrors.Thescriptcanthenbemodifiedtoachievethetaskathand(i.e.parameterization).Thefull,parameterizedcruciformscriptisgivenbelow.NotethatcommentsinPythonareprecededby‘#’andarealsohighlightedinthisdocument.Alsonotethepart,material,section,etc…importmodulecommandsthatprecedethescript.Therecoverandjournalfilesgeneratethesecommandsandtheymustbeincludedinthefinalscript.

frompartimport*

frommaterialimport*

fromsectionimport*

fromassemblyimport*

fromstepimport*

frominteractionimport*

fromloadimport*

frommeshimport*

fromjobimport*

fromsketchimport*

fromvisualizationimport*

fromconnectorBehaviorimport*

#TOVARYAPARAMETER,UNCOMMENTTHELISTVECTORFORTHESPECIFICPA

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 小学作文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1