参考资料:

1. pyabaqus库使用指引(官方):GitHub - haiiliin/pyabaqus: Type hints for Abaqus/Python scripting (The repo has been transferred to https://github.com/haiiliin/abqpy).Type hints for Abaqus/Python scripting (The repo has been transferred to https://github.com/haiiliin/abqpy). - GitHub - haiiliin/pyabaqus: Type hints for Abaqus/Python scripting (The repo has been transferred to https://github.com/haiiliin/abqpy).https://github.com/haiiliin/pyabaqus2. abaqus使用指南:Abaqus 6.14 Documentationhttp://wufengyun.com:888/

3. 注意事项:

1. 安装python3.9及以上版本;我使用的是3.9.2。

2. 安装abaqus;我使用的是abaqus2022。

3. 安装pyabaqus库,注意这个库需要与自己的abaqus版本对应;例:我安装的是abaqus2022,那么我需要安装pyabaqus==2022这个版本的库。可以使用两种方式安装库:

①在命令行窗口输入:pip install pyabaqus==2022

②在参考资料1的github链接里面找到Source code(tar.gz)(或者直接单击这个链接)下载。完了之后,在文件夹显示,命令行方式打开该文件夹,pip install 全部文件名

4. 安装完成后,需要设置环境变量。依次点击 右键此电脑-属性-高级系统设置-环境变量-新建系统变量,输入如下:变量值要指向在abaqus安装目录中的abaqus.bat文件。自己找找就好。输入完了,直接一直确定保存就好。

5. 以上完成了,就能在命令行窗口直接调用abaqus的内核进行计算处理了(无需打开abaqus)。调用示例:cmd进入相应的文件夹,使用命令执行如下,前面不变,xuanbiliang.py是文件名,自己可以根据自己的写。

注意文件夹路径,不要含有中文!!!

 

这个odb结果文件可以直接在abaqus中查看,或者继续用python写一些后处理的逻辑,直接输出csv或者txt等文件都是可以的。

悬臂梁测试参考代码如下(来源于参考文件2-Abaqus Scripting User's Guide-8.1节):

"""
beamExample.pyReproduce the cantilever beam example from the
Appendix of the Getting Started with
Abaqus: Interactive Edition Manual.
"""from abaqus import *
from abaqusConstants import *
backwardCompatibility.setValues(includeDeprecated=True,reportDeprecated=False)# Create a model.myModel = mdb.Model(name='Beam')# Create a new viewport in which to display the model
# and the results of the analysis.myViewport = session.Viewport(name='Cantilever Beam Example',origin=(20, 20), width=150, height=120)#-----------------------------------------------------import part# Create a sketch for the base feature.mySketch = myModel.ConstrainedSketch(name='beamProfile',sheetSize=250.)# Create the rectangle.mySketch.rectangle(point1=(-100,10), point2=(100,-10))# Create a three-dimensional, deformable part.myBeam = myModel.Part(name='Beam', dimensionality=THREE_D,type=DEFORMABLE_BODY)# Create the part's base feature by extruding the sketch
# through a distance of 25.0.myBeam.BaseSolidExtrude(sketch=mySketch, depth=25.0)#-----------------------------------------------------import material# Create a material.mySteel = myModel.Material(name='Steel')# Create the elastic properties: youngsModulus is 209.E3
# and poissonsRatio is 0.3elasticProperties = (209.E3, 0.3)
mySteel.Elastic(table=(elasticProperties, ) )#-------------------------------------------------------import section# Create the solid section.mySection = myModel.HomogeneousSolidSection(name='beamSection',material='Steel', thickness=1.0)# Assign the section to the region. The region refers
# to the single cell in this model.region = (myBeam.cells,)
myBeam.SectionAssignment(region=region,sectionName='beamSection')#-------------------------------------------------------import assembly# Create a part instance.myAssembly = myModel.rootAssembly
myInstance = myAssembly.Instance(name='beamInstance',part=myBeam, dependent=OFF)#-------------------------------------------------------import step# Create a step. The time period of the static step is 1.0,
# and the initial incrementation is 0.1; the step is created
# after the initial step. myModel.StaticStep(name='beamLoad', previous='Initial',timePeriod=1.0, initialInc=0.1,description='Load the top of the beam.')#-------------------------------------------------------import load# Find the end face using coordinates.endFaceCenter = (-100,0,12.5)
endFace = myInstance.faces.findAt((endFaceCenter,) )# Create a boundary condition that encastres one end
# of the beam.endRegion = (endFace,)
myModel.EncastreBC(name='Fixed',createStepName='beamLoad',region=endRegion)# Find the top face using coordinates.topFaceCenter = (0,10,12.5)
topFace = myInstance.faces.findAt((topFaceCenter,) )# Create a pressure load on the top face of the beam.topSurface = ((topFace, SIDE1), )
myModel.Pressure(name='Pressure', createStepName='beamLoad',region=topSurface, magnitude=0.5)#-------------------------------------------------------import mesh# Assign an element type to the part instance.region = (myInstance.cells,)
elemType = mesh.ElemType(elemCode=C3D8I, elemLibrary=STANDARD)
myAssembly.setElementType(regions=region, elemTypes=(elemType,))# Seed the part instance.myAssembly.seedPartInstance(regions=(myInstance,), size=10.0)# Mesh the part instance.myAssembly.generateMesh(regions=(myInstance,))# Display the meshed beam.myViewport.assemblyDisplay.setValues(mesh=ON)
myViewport.assemblyDisplay.meshOptions.setValues(meshTechnique=ON)
myViewport.setValues(displayedObject=myAssembly)#-------------------------------------------------------import job# Create an analysis job for the model and submit it.jobName = 'beam_tutorial'
myJob = mdb.Job(name=jobName, model='Beam',description='Cantilever beam tutorial')# Wait for the job to complete.myJob.submit()
myJob.waitForCompletion()#-------------------------------------------------------import visualization# Open the output database and display a
# default contour plot.myOdb = visualization.openOdb(path=jobName + '.odb')
myViewport.setValues(displayedObject=myOdb)
myViewport.odbDisplay.display.setValues(plotState=CONTOURS_ON_DEF)myViewport.odbDisplay.commonOptions.setValues(renderStyle=FILLED)

4. 说说体会:

pyabaqus库不需要在python文件中import,实际执行python文件的方式是在cmd窗口里面用原始dos命令行的方式,用设置的系统变量 abaqus cae -noGUI 文件名.py 的方式执行,全程无需打开abaqus。这个方式实际上是pyabaqus实现了调用abaqus计算内核模块(像这种大型有限元软件的各个模块是独立开发和工作的。),执行abaqus支持的python语法进而计算。所以实际上计算的python文件只需要满足参考文件2里面的相关规范书写,保证能跑通就行。后期也可以想些方法在python执行中job计算完直接输出需要的图和表格。

使用python命令建abaqus模型并后处理输出结果,全程无需打开abaqus,只要有代码就能自动计算。为实时计算结构受力提供了接口可能性。

python操作abaqus建模教程①相关推荐

  1. Python三维地址建模教程【Gempy】

    Gempy 是一个开源 Python 库,用于生成完整的 3D 结构地质模型.该库是从界面.断层和层方向创建地质模型的完整开发,它还关联地质层序列以表示岩石侵入和断层顺序. 地质建模算法基于通用协同克 ...

  2. python操作docx入门教程

    在实习工作中,遇到用python制作word模板的任务,其实说白了就是python-docx的使用.目前网上对这一个库的介绍得很少,很零散,所以很多功能我是尽量参考其官网,但是官网上面很多功能目前只有 ...

  3. python参数化建模加工图_基于Python的ABAQUS层压板参数化建模

    唐维 康泽毓 杨婷 曾凤 蒋莉 摘要:为了提高层压板在ABAQUS仿真中建模的效率与准确性,提出利用Python语言对ABAQUS二次开发进行层压板参数化建模的方法.基于ABAQUS有限元软件,采用P ...

  4. python 对docker的操作 :docker-py教程

    python 对docker的操作 :docker-py教程 见官方文档: https://docker-py.readthedocs.io/en/latest/

  5. python操作excel-python操作excel(内附python教程分享)

    今天学习了下xlwings这个库,目的是为了让计算机自动化操作excel表,当某天需要做一些很繁琐的事情,就可以派上用场啦. python操作excel(内附python教程分享) 基本对象 网上刮来 ...

  6. python使用方法-在Python中使用next()方法操作文件的教程

    next()方法当一个文件被用作迭代器,典型例子是在一个循环中被使用,next()方法被反复调用.此方法返回下一个输入行,或引发StopIteration异常EOF时被命中. 与其它文件的方法,如Re ...

  7. python脚本怎么使用_在Python中使用next()方法操作文件的教程

    next()方法当一个文件被用作迭代器,典型例子是在一个循环中被使用,next()方法被反复调用.此方法返回下一个输入行,或引发StopIteration异常EOF时被命中. 与其它文件的方法,如Re ...

  8. 菜鸟教程python3 mysql_python基础教程使用Python操作MySQL的小技巧

    1.获取插入数据的主键id import pymysql database = pymysql.connect( host="127.0.0.1", port=3306, user ...

  9. Python学习入门基础教程(learning Python)--5.6 Python读文件操作高级

    前文5.2节和5.4节分别就Python下读文件操作做了基础性讲述和提升性介绍,但是仍有些问题,比如在5.4节里涉及到一个多次读文件的问题,实际上我们还没有完全阐述完毕,下面这个图片的问题在哪呢? 问 ...

最新文章

  1. 顺序表应用4:元素位置互换之逆置算法
  2. 获取网址中参数的方式
  3. 4)机器学习基石笔记 Lecture4:Feasibility of Learning
  4. 不入oracle数据库,Oracle数据库之操作符及函数
  5. 2597 团伙(并查集就是好用!)
  6. 必知必会!常用矩阵求导和重要的矩阵
  7. activeMQ 问题
  8. python不调包实现sobel_python利用百度云接口实现车牌识别的示例
  9. Linux中GoogleChrome谷歌浏览器安装好了打不开怎么办?
  10. HTML CSS JS 网页设计作业「我的家乡」汉口5页 带留言表单
  11. HTML+CSS+移动端前端
  12. Java测试工程师技术面试题库【持续补充更新】
  13. 绿地五里桥 设计原型_绿地 · 黄浦滨江项目设计
  14. 【数学问题2】向量微分
  15. centos rpm漏洞补丁下载
  16. Python opencv 在图片上写字
  17. 利用手机相机实现表面缺陷检测学习【缺陷检测_01】
  18. 老虎证券开放api期货合约建立
  19. 零基础入门Jetson Nano——MediaPipe双版本(CPU+GPU)的安装与使用
  20. 货币转换 I----Python

热门文章

  1. 西班牙语dele等级_2019年西班牙语dele考试各等级要求
  2. Ubuntu安装升级glibc
  3. Swift将改变一切
  4. 【2SAT+Trie】Gym101190B [NEERC2016] Binary Code
  5. 聊聊四方支付通道那些事
  6. FileUpload的使用
  7. flash builder对代码进行调试 下载flash player debug软件
  8. 基于51单片机的简易电子琴设计
  9. laravel框架 WhereNotExists Eloquent
  10. 2022-2000-1978:世纪前后22年