IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Python知识库 -> Abaqus-python-二次开发学习笔记-单向长纤维RVE -> 正文阅读

[Python知识库]Abaqus-python-二次开发学习笔记-单向长纤维RVE

前言

从未打开过Abaqus开始的二次开发。参考书籍《Abaqus Python二次开发攻略》,书里写的很详细。
参考RVE教程:https://www.bilibili.com/video/BV1c64y1b7dz?spm_id_from=333.337.search-card.all.click
Abaqus版本:2020

初始rpy文件

# -*- coding: mbcs -*-
#
# Abaqus/CAE Release 2020 replay file
# Internal Version: 2019_09_14-01.49.31 163176
# Run by Administrator on Thu May 19 11:05:34 2022
#

# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=250.050506591797, 
    height=145.686111450195)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
    referenceRepresentation=ON)

4个import导入必要的模块;
其余行生成Viewport:1用于显示。

RVE建立

模型建立

GUI操作,建立一个边长10的正方体作为基体
在这里插入图片描述

s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', 
    sheetSize=200.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(0.0, 0.0), point2=(10.0, 10.0))
p = mdb.models['Model-1'].Part(name='MATRIX', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['MATRIX']
p.BaseSolidExtrude(sketch=s, depth=10.0)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['MATRIX']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']

前5行建立草图对象s;
6-10行使用草图s生成Solid部件p;
最后两行书上没说,但看意思大概就是设定一下当前显示对象,然后删掉草图。可以看到,草图对象是在mdb.models仓库里的。

GUI操作,创建纤维,其实就是在方体一个面上画圆,后期算法主要针对这里的圆圈生成
在这里插入图片描述

p = mdb.models['Model-1'].parts['MATRIX']
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f[4], sketchUpEdge=e[7], 
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, origin=(5.0, 5.0, 10.0))
s1 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', 
    sheetSize=34.64, gridSpacing=0.86, transform=t)
g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
s1.setPrimaryObject(option=SUPERIMPOSE)
p = mdb.models['Model-1'].parts['MATRIX']
p.projectReferencesOntoSketch(sketch=s1, filter=COPLANAR_EDGES)
s1.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(1.72, 0.0))
p = mdb.models['Model-1'].parts['MATRIX']
f1, e1 = p.faces, p.edges
p.SolidExtrude(sketchPlane=f1[4], sketchUpEdge=e1[7], sketchPlaneSide=SIDE1, 
    sketchOrientation=RIGHT, sketch=s1, depth=10.0, flipExtrudeDirection=ON, 
    keepInternalBoundaries=ON)
s1.unsetPrimaryObject()
del mdb.models['Model-1'].sketches['__profile__']

材料属性

GUI操作,分别为基体和纤维创建材料属性,FIBER属性与MATRIX类似
在这里插入图片描述

session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON, 
    engineeringFeatures=ON)
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
    referenceRepresentation=OFF)
mdb.models['Model-1'].Material(name='MATRIX')
mdb.models['Model-1'].materials['MATRIX'].Elastic(table=((7000.0, 0.38), ))
mdb.models['Model-1'].Material(name='FIBER')
mdb.models['Model-1'].materials['FIBER'].Elastic(table=((220000.0, 0.2), ))

创建截面

为纤维和基体创建两个截面,并赋予

mdb.models['Model-1'].HomogeneousSolidSection(name='FIBER-SEC', 
    material='FIBER', thickness=None)
mdb.models['Model-1'].HomogeneousSolidSection(name='MATRIX-SET', 
    material='MATRIX', thickness=None)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#1 ]', ), )
region = p.Set(cells=cells, name='Set-1')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='FIBER-SEC', offset=0.0, 
    offsetType=MIDDLE_SURFACE, offsetField='', 
    thicknessAssignment=FROM_SECTION)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#2 ]', ), )
region = p.Set(cells=cells, name='Set-2')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='MATRIX-SET', offset=0.0, 
    offsetType=MIDDLE_SURFACE, offsetField='', 
    thicknessAssignment=FROM_SECTION)

创建装配体

在这里插入图片描述

a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    optimizationTasks=OFF, geometricRestrictions=OFF, stopConditions=OFF)
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['MATRIX']
a.Instance(name='MATRIX-1', part=p, dependent=OFF)

Mesh

在这里插入图片描述
布种为0.5
在这里插入图片描述

session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
a = mdb.models['Model-1'].rootAssembly
c1 = a.instances['MATRIX-1'].cells
pickedRegions = c1.getSequenceFromMask(mask=('[#3 ]', ), )
a.setMeshControls(regions=pickedRegions, elemShape=WEDGE)
a = mdb.models['Model-1'].rootAssembly
partInstances =(a.instances['MATRIX-1'], )
a.seedPartInstance(regions=partInstances, size=0.5, deviationFactor=0.1, 
    minSizeFactor=0.1)
a = mdb.models['Model-1'].rootAssembly
partInstances =(a.instances['MATRIX-1'], )
a.generateMesh(regions=partInstances)
session.viewports['Viewport: 1'].enableMultipleColors()
session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD')
cmap=session.viewports['Viewport: 1'].colorMappings['Material']
session.viewports['Viewport: 1'].setColor(colorMapping=cmap)
session.viewports['Viewport: 1'].disableMultipleColors()

EasyPBC

这里模型名字一定要输入对,之所以Instance name不是Part-1-1是因为之前的装配体名字搞成MATRIX-1了。不过名字什么的无所谓。
在这里插入图片描述

import sys
sys.path.insert(8, r'e:/CAE/abaqus_plugins/EasyPBC V.1.4')
import easypbc
easypbc.feasypbc(part='Model-1', inst='MATRIX-1', meshsens=1E-07, CPU=1, 
    E11=True, E22=True, E33=False, G12=True, G13=False, G23=False, 
    onlyPBC=False, CTE=False, intemp=0, fntemp=100)
#: ----------------------------------
#: -------- Start of EasyPBC --------
#: ----------------------------------
#: ------ End of Sets Creation ------
#: Job job-E11: Analysis Input File Processor completed successfully.
#: Job job-E11: Abaqus/Standard completed successfully.
#: Job job-E11 completed successfully. 
#: 模型: E:/CAE/job-E11.odb
#: 装配件个数:         1
#: 装配件实例个数: 0
#: 部件实例的个数:     1
#: 网格数:             2
#: 单元集合数:       3
#: 结点集合数:          5298
#: 分析步的个数:              1
#: Job job-E22: Analysis Input File Processor completed successfully.
#: Job job-E22: Abaqus/Standard completed successfully.
#: Job job-E22 completed successfully. 
#: 模型: E:/CAE/job-E22.odb
#: 装配件个数:         1
#: 装配件实例个数: 0
#: 部件实例的个数:     1
#: 网格数:             2
#: 单元集合数:       3
#: 结点集合数:          5298
#: 分析步的个数:              1
#: Job job-G12: Analysis Input File Processor completed successfully.
#: Job job-G12: Abaqus/Standard completed successfully.
#: Job job-G12 completed successfully. 
#: 模型: E:/CAE/job-G12.odb
#: 装配件个数:         1
#: 装配件实例个数: 0
#: 部件实例的个数:     1
#: 网格数:             2
#: 单元集合数:       3
#: 结点集合数:          5302
#: 分析步的个数:              1
#: ----------------------------------------------------
#: ----------------------------------------------------
#: The homogenised elastic properties:
#: E11=9143.64375 Stress units
#: V12=0.522747412324 ratio
#: V13=0.123966928571 ratio
#: E22=9144.00390625 Stress units
#: V21=0.522768005729 ratio
#: V23=0.123966354877 ratio
#: E33=N/A Stress units
#: V31=N/A ratio
#: V32=N/A ratio
#: G12=2924.36738281 Stress units
#: G13=N/A Stress units
#: G23=N/A Stress units
#: CTE X=N/A N/A
#: CTE Y=N/A N/A
#: CTE Z=N/A N/A
#: ----------------------------------------------------
#: Total mass=None Mass units
#: Homogenised density=0 Density units
#: ----------------------------------------------------
#: Processing duration 199.296000004 seconds
#: ----------------------------------------------------
#: The homogenised elastic properties are saved in ABAQUS Work Directory under Model-1_elastic_properties.txt
#: Citation: Omairey S, Dunning P, Sriramula S (2018) Development of an ABAQUS plugin tool for periodic RVE homogenisation.
#: Engineering with Computers. https://doi.org/10.1007/s00366-018-0616-4
#: ----------------------------------------------------
#: ---------------------------------------
#: --------- End of EasyPBC (3D) ---------
#: ---------------------------------------

结束之后文件结果如图
在这里插入图片描述

一个简单的二次开发

对于本案例,改改纤维直径、材料属性参数就可以了

fiberR = 2
matrixE = 2000
matrixV = 0.4
fiberE = 220000
fiberV = 0.2

from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=250.050506591797, 
    height=145.686111450195)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
    referenceRepresentation=ON)

s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', 
    sheetSize=200.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(0.0, 0.0), point2=(10.0, 10.0))
p = mdb.models['Model-1'].Part(name='MATRIX', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['MATRIX']
p.BaseSolidExtrude(sketch=s, depth=10.0)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['MATRIX']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
p = mdb.models['Model-1'].parts['MATRIX']
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f[4], sketchUpEdge=e[7], 
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, origin=(5.0, 5.0, 10.0))
s1 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', 
    sheetSize=34.64, gridSpacing=0.86, transform=t)
g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
s1.setPrimaryObject(option=SUPERIMPOSE)
p = mdb.models['Model-1'].parts['MATRIX']
p.projectReferencesOntoSketch(sketch=s1, filter=COPLANAR_EDGES)
s1.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(fiberR, 0.0))
p = mdb.models['Model-1'].parts['MATRIX']
f1, e1 = p.faces, p.edges
p.SolidExtrude(sketchPlane=f1[4], sketchUpEdge=e1[7], sketchPlaneSide=SIDE1, 
    sketchOrientation=RIGHT, sketch=s1, depth=10.0, flipExtrudeDirection=ON, 
    keepInternalBoundaries=ON)
s1.unsetPrimaryObject()
del mdb.models['Model-1'].sketches['__profile__']
session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON, 
    engineeringFeatures=ON)
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
    referenceRepresentation=OFF)
mdb.models['Model-1'].Material(name='MATRIX')
mdb.models['Model-1'].materials['MATRIX'].Elastic(table=((matrixE, matrixV), ))
mdb.models['Model-1'].Material(name='FIBER')
mdb.models['Model-1'].materials['FIBER'].Elastic(table=((fiberE, fiberV), ))
mdb.models['Model-1'].HomogeneousSolidSection(name='FIBER-SEC', 
    material='FIBER', thickness=None)
mdb.models['Model-1'].HomogeneousSolidSection(name='MATRIX-SET', 
    material='MATRIX', thickness=None)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#1 ]', ), )
region = p.Set(cells=cells, name='Set-1')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='FIBER-SEC', offset=0.0, 
    offsetType=MIDDLE_SURFACE, offsetField='', 
    thicknessAssignment=FROM_SECTION)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#2 ]', ), )
region = p.Set(cells=cells, name='Set-2')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='MATRIX-SET', offset=0.0, 
    offsetType=MIDDLE_SURFACE, offsetField='', 
    thicknessAssignment=FROM_SECTION)
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    optimizationTasks=OFF, geometricRestrictions=OFF, stopConditions=OFF)
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['MATRIX']
a.Instance(name='MATRIX-1', part=p, dependent=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
a = mdb.models['Model-1'].rootAssembly
c1 = a.instances['MATRIX-1'].cells
pickedRegions = c1.getSequenceFromMask(mask=('[#3 ]', ), )
a.setMeshControls(regions=pickedRegions, elemShape=WEDGE)
a = mdb.models['Model-1'].rootAssembly
partInstances =(a.instances['MATRIX-1'], )
a.seedPartInstance(regions=partInstances, size=0.5, deviationFactor=0.1, 
    minSizeFactor=0.1)
a = mdb.models['Model-1'].rootAssembly
partInstances =(a.instances['MATRIX-1'], )
a.generateMesh(regions=partInstances)
session.viewports['Viewport: 1'].enableMultipleColors()
session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD')
cmap=session.viewports['Viewport: 1'].colorMappings['Material']
session.viewports['Viewport: 1'].setColor(colorMapping=cmap)
session.viewports['Viewport: 1'].disableMultipleColors()
import sys
sys.path.insert(8, r'e:/CAE/abaqus_plugins/EasyPBC V.1.4')
import easypbc
easypbc.feasypbc(part='Model-1', inst='MATRIX-1', meshsens=1E-07, CPU=1, 
    E11=True, E22=True, E33=False, G12=True, G13=False, G23=False, 
    onlyPBC=False, CTE=False, intemp=0, fntemp=100)

运行结果如下,可以看到结果有所不同
在这里插入图片描述
在这里插入图片描述

  Python知识库 最新文章
Python中String模块
【Python】 14-CVS文件操作
python的panda库读写文件
使用Nordic的nrf52840实现蓝牙DFU过程
【Python学习记录】numpy数组用法整理
Python学习笔记
python字符串和列表
python如何从txt文件中解析出有效的数据
Python编程从入门到实践自学/3.1-3.2
python变量
上一篇文章      下一篇文章      查看所有文章
加:2022-05-24 18:07:23  更:2022-05-24 18:09:50 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 13:42:50-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码