您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > AI人工智能 > 10-31-06 Python Scripting in ABAQUS
PythonScriptinginABAQUSKevinMaxwellTexasA&MUniversityAugust30,2006IntroductionABAQUSCAEprovidesagraphicaluserinterfacethatallowstheusertocreatefiniteelementmodelsthatcanthenbeanalyzedinABAQUSStandard.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.Anothersourceofinformationcanbefoundat¼ofthespecimenwasmodeled.Theentire2DmodelwasfirstcreatedinCAEandthenecessarycommandswerecopiedfromtherecoverfile.Theeasiestwaytodothisisbysplittingthemodelingprocessintosmallersegmentsandcopyingcommandsfromtherecoverorjournalfileattheendofeachsegment.TheresultingscriptcanthenberuninCAEsothatthenextsegmentcanbecreated.Figure1:¼ofCruciformSpecimenBeforestartingthemodeltypethefollowingcommandintothePythoneditorboxinCAE: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
本文标题:10-31-06 Python Scripting in ABAQUS
链接地址:https://www.777doc.com/doc-4195275 .html