# importsfromabaqusimport*fromabaqusConstantsimport*fromcaeModulesimport*fromdriverUtilsimportexecuteOnCaeStartup# setupexecuteOnCaeStartup()# Create modelmodel=mdb.Model(name="Model A")# creating sketchs=myModel.ConstrainedSketch(name="__profile__",sheetSize=200.0)# Drawing model sketchs.Line(point1=(0.0,0.0),point2=(0.0,1.0))s.Line(point1=(0.0,1.0),point2=(1.0,1.0))s.Line(point1=(1.0,1.0),point2=(1.0,0.0))s.Line(point1=(1.0,0.0),point2=(0.0,0.0))# Creating part objectp=(model.Part(name="rect_beam",dimensionality=THREE_D,type=DEFORMABLE_BODY))# extrude sketch to get the partp.BaseSolidExtrude(sketch=s,depth=20.0)s.unsetPrimaryObject()# setting part to the viewport(session.viewports["Viewport: 1"].setValues(displayedObject=p))# cleardelmodel.sketches["__profile__"]
# importsfromabaqusimport*fromabaqusConstantsimport*importvisualizatino# opening the dbmy_odb=(visualization.openOdb(path="beam_model.odb"))viewport=session.viewports[session.currentViewPortName](viewport.setValues(displayedObject=my_odb))# accessing the step-1 from the ODBmystep=my_obd.steps["Step-1"]# accessing the frames of step1frame1=mystep.frames[-1]frame2=mystep.frames[-2]disp1=frame1.fieledOutputs["U"]disp2=frame2.fieledOutputs["U"]stress1=frame1.fieledOutputs["S"]stress2=frame2.fieledOutputs["S"]deltaDisp=disp2-disp1deltaStress=stress2-stress1(viewport.obdDisplay.setDeformedVariables(deltaDisp))# Plotting thecontour for the new data(viewport.obdDisplay.setPrimaryVariable(field=deltaStress,outputPosition=INTEGRATION_POINT,refinement=(INVARIANT,"Mises")))viewport.odbDispaly.display.setValues(plotState=(CONTOURS_ON_DEF))
# saving data to a text filewithopen("delta_displacement.dat","w")asfout:fout.write("%8d, %15.8E, %15.8E, %15.8E\n"%tuple([value.nodeLabel,]+list(value.data)))