Abaqus自带RSG插件实例
一款可以上手的实例,讲解整个RSG插件的强大地方,避免重复工作。
如上图所示,圆柱电芯建模和阵列所有尺寸都列出,其中R 圆柱半径、L 圆柱长度、Numx x方向阵列数、Numy y方向阵列数量、DistanceX x方向阵列距离,其它部分为创建材料,分析类型,接触类型,载荷工况,网格划分,提交作业。
另外,还附带DB和plugin文件,写上一个icon进行,p.py文件将三个文件输出pyc加密文件:
具体代码为:(其中py_compile为python自带模块,无需下载安装)
import py_compile
py_compile.compile('a_plugin.py')
py_compile.compile('aDB.py')
py_compile.compile('aModul.py')
def creatcellFunction(R,L,Numx,Numy,DistanceX,DistanceY,Meshsize,E,mu,Density):
Mdb()
s1 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',sheetSize=200.0)
g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
s1.setPrimaryObject(option=STANDALONE)
#cell 半径
s1.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(R, 0.0))
p = mdb.models['Model-1'].Part(name='cell', dimensionality=THREE_D,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['cell']
#cell长度
p.BaseSolidExtrude(sketch=s1, depth=L)
s1.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['cell']
del mdb.models['Model-1'].sketches['__profile__']
#创建材料
mdb.models['Model-1'].Material(name='Material-1')
mdb.models['Model-1'].materials['Material-1'].Density(table=((Density, ), ))
mdb.models['Model-1'].materials['Material-1'].Elastic(table=((E,mu), ))
mdb.models['Model-1'].HomogeneousSolidSection(name='Section-1',material='Material-1', thickness=None)
# 创建set和赋予几何材料属性
c = p.cells
cells = c.getSequenceFromMask(mask=('[#1 ]', ), )
region = p.Set(cells=cells, name='Set-1')
p = mdb.models['Model-1'].parts['cell']
p.SectionAssignment(region=region, sectionName='Section-1', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='',
thicknessAssignment=FROM_SECTION)
#cell 阵列
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['cell']
a.Instance(name='cell-1', part=p, dependent=ON)
a = mdb.models['Model-1'].rootAssembly
a.LinearInstancePattern(instanceList=('cell-1', ), direction1=(1, 0, 0),
direction2=(0, 1, 0), number1=Numx, number2=Numy, spacing1=DistanceX,
spacing2=DistanceY)
#创建分析步
mdb.models['Model-1'].StaticStep(name='Step-1', previous='Initial',
maxNumInc=10000, initialInc=0.01, minInc=1e-15, maxInc=0.1, nlgeom=ON)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Step-1')
#创建接触属性
mdb.models['Model-1'].ContactProperty('IntProp-1')
mdb.models['Model-1'].interactionProperties['IntProp-1'].TangentialBehavior(
formulation=PENALTY, directionality=ISOTROPIC, slipRateDependency=OFF,
pressureDependency=OFF, temperatureDependency=OFF, dependencies=0, table=((
0.15, ), ), shearStressLimit=None, maximumElasticSlip=FRACTION,
fraction=0.005, elasticSlipStiffness=None)
mdb.models['Model-1'].interactionProperties['IntProp-1'].NormalBehavior(
pressureOverclosure=HARD, allowSeparation=ON,
constraintEnforcementMethod=DEFAULT)
#: The interaction property "IntProp-1" has been created.
#创建通用接触
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Initial')
mdb.models['Model-1'].ContactStd(name='Int-1', createStepName='Initial')
mdb.models['Model-1'].interactions['Int-1'].includedPairs.setValuesInStep(
stepName='Initial', useAllstar=ON)
mdb.models['Model-1'].interactions['Int-1'].contactPropertyAssignments.appendInStep(
stepName='Initial', assignments=((GLOBAL, SELF, 'IntProp-1'), ))
#: The interaction "Int-1" has been created.
#创建全局重力(默认z方向9810)
mdb.models['Model-1'].Gravity(name='Load-1', createStepName='Step-1',
comp3=9810.0, distributionType=UNIFORM, field='')
#网格尺寸
p.seedPart(size=Meshsize, deviationFactor=0.1, minSizeFactor=0.1)
c = p.cells
pickedRegions = c.getSequenceFromMask(mask=('[#1 ]', ), )
# 中轴网格算法
p.setMeshControls(regions=pickedRegions, algorithm=MEDIAL_AXIS)
p.generateMesh()
#创建job文件
mdb.Job(name='Job-1', model='Model-1', description='', type=ANALYSIS,
atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90,
memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True,
explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF,
modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='',
scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=10,
numDomains=10, numGPUs=0)