Abaqus python二次开发2-扭转弹簧刚度计算

1、定义弹簧参数

# -*- coding: mbcs -*-
from abaqus import *
from abaqusConstants import *
from caeModules import *
from math import *
from odbAccess import *

wireR=1.0#
SpringR=15.0#
NN=8
GapR=0.3
angle=5.0#degree
Spitch=wireR*(2.0+GapR)/cos(angle/180.0*pi)#
DR=wireR+SpringR
RatioRr=SpringR/wireR
ur2 = pi

2、绘制弹簧

2.1、绘制弹簧截面

inpName='SoildSpring_Rr'+str(int(RatioRr))
Mdb()
TheModel = mdb.models['Model-1']
s = TheModel .ConstrainedSketch(name='springSection', 
    sheetSize=200.0)
s.ConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0))
s.CircleByCenterPerimeter(center=(DR, 0.0), point1=(DR+wireR, 0.0))

在这里插入图片描述

2.12、绘制弹簧实体part(螺旋旋转截面)

p = TheModel .Part(name='spring', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p.BaseSolidRevolve(sketch=s, angle=360.0*(NN+1), flipRevolveDirection=OFF, 
    pitch=Spitch, flipPitchDirection=OFF, moveSketchNormalToPath=ON)

在这里插入图片描述

3、设置材料、截面属性、并赋给弹簧(set)

TheMaterial = TheModel .Material(name='steel')
TheMaterial.Elastic(table=((210000.0, 0.3), ))
TheModel .HomogeneousSolidSection(name='SteelSection', 
    material='steel', thickness=None)
c = p.cells
secSet = p.Set(name='secSet', cells=c)
p.SectionAssignment(region=secSet, sectionName='SteelSection', offset=0.0, 
    offsetType=MIDDLE_SURFACE, offsetField='', 
        thicknessAssignment=FROM_SECTION)

在这里插入图片描述

4、创建组件的坐标系、参考点和instance(弹簧)

a = TheModel .rootAssembly
a.DatumCsysByDefault(CARTESIAN)
a.Instance(name='spring-1', part=p, dependent=ON)
p1=a.ReferencePoint(point=(0.0,0.0,0.0))
p2=a.ReferencePoint(point=(0.0,-1.0*(NN+1)*Spitch,0.0))

在这里插入图片描述

5、用 findAt() 找到边界面,并设置边界面集合和参考点集合

xx1=SpringR*cos(0.5*pi)
zz1=SpringR*sin(0.5*pi)
yy1=-0.25*Spitch
xx2=SpringR*cos((NN+0.75)*2.0*pi)
zz2=SpringR*sin((NN+0.75)*2.0*pi)
yy2=-1.0*(NN+0.75)*Spitch
f = a.instances['spring-1'].faces
faces1 = f.findAt(((xx2, yy2, zz2),),)
Setfix=a.Set(faces=faces1, name='Set-fix')
faces1 = f.findAt(((xx1, yy1, zz1),),)
Settwist=a.Set(faces=faces1, name='Set-twist')
r1 = a.referencePoints
SetfixRP=a.Set(referencePoints=(r1[p2.id],), name='Set-fixRP')
SettwistRP=a.Set(referencePoints=(r1[p1.id],), name='Set-twistRP')

在这里插入图片描述

6、设置step、场输出(支反力等)、RB2、约束边界BC及变更(转半圈)

TheModel .StaticStep(name='Step-twist', previous='Initial',
    initialInc=0.05, minInc=1e-06, maxInc=0.2, maxNumInc=1000, nlgeom=ON)
TheModel .fieldOutputRequests['F-Output-1'].setValues(variables=
    ('S', 'LE', 'U', 'RF', 'RM', 'CF'), numIntervals=10, timeMarks=OFF)
TheModel .Coupling(name='Constraint-fix', controlPoint=SetfixRP,
    surface=Setfix, influenceRadius=WHOLE_SURFACE, couplingType=KINEMATIC, 
    localCsys=None, u1=ON, u2=ON, u3=ON, ur1=ON, ur2=ON, ur3=ON)
TheModel .Coupling(name='Constraint-twist', controlPoint=SettwistRP, 
    surface=Settwist, influenceRadius=WHOLE_SURFACE,
    couplingType=KINEMATIC, localCsys=None, u1=ON, u2=ON, u3=ON, ur1=ON,
    ur2=ON, ur3=ON)
TheModel .DisplacementBC(name='BC-fix', createStepName='Initial',
    region=SetfixRP, u1=SET, u2=SET, u3=SET, ur1=SET, ur2=SET, ur3=SET, 
    amplitude=UNSET, distributionType=UNIFORM, fieldName='', localCsys=None)
TheModel .DisplacementBC(name='BC-twist',
    createStepName='Initial', region=SettwistRP, u1=SET, u2=SET, u3=SET,
    ur1=SET, ur2=SET, ur3=SET, amplitude=UNSET, distributionType=UNIFORM,
    fieldName='', localCsys=None)
TheModel .boundaryConditions['BC-twist'].setValuesInStep(stepName=
    'Step-twist', ur2=ur2)

在这里插入图片描述

7、网格划分

7.1、按曲线长度归类(比较边getSize()与圆周长),圆为一类(布16节点),扫描线为一类(按长度布点)

c = p.cells
p.setMeshControls(regions=c, technique=SWEEP)
NSize=16
LSize=DR*pi*2/64
e = p.edges
NEdges, LEdges, CriL = [], [], 2.0*pi*wireR
for i in range(len(e)):
    if abs(e[i].getSize()-CriL)/CriL<0.02:
        NEdges.append(e[i])
    else:
        LEdges.append(e[i])

7.2、布种子、画网格

p.seedEdgeByNumber(edges=NEdges, number=NSize, constraint=FIXED)
p.seedEdgeBySize(edges=LEdges, size=LSize, deviationFactor=0.1,
    constraint=FINER)
elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, 
    kinematicSplit=AVERAGE_STRAIN, secondOrderAccuracy=OFF, 
    hourglassControl=DEFAULT, distortionControl=DEFAULT)
elemType2 = mesh.ElemType(elemCode=C3D6, elemLibrary=STANDARD)
elemType3 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD)
p.setElementType(regions=(c,), elemTypes=(elemType1, 
    elemType2, elemType3))
p.generateMesh()
a.regenerate()

在这里插入图片描述

8、新建Job、计算

mdb.Job(name=inpName, model='Model-1', description='', type=ANALYSIS, 
    atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=50, 
    memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, 
    explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF, 
    modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='', 
    scratch='', multiprocessingMode=DEFAULT, numCpus=1)
mdb.jobs[inpName].submit(consistencyChecking=OFF)
mdb.jobs[inpName].waitForCompletion()

在这里插入图片描述

9、从ODB看支反力矩

mdb.Job(name=inpName, model='Model-1', description='', type=ANALYSIS, 
    atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=50, 
    memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, 
    explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF, 
    modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='', 
    scratch='', multiprocessingMode=DEFAULT, numCpus=1)
mdb.jobs[inpName].submit(consistencyChecking=OFF)
mdb.jobs[inpName].waitForCompletion()
odbPath=inpName+'.odb'
odb = openOdb(odbPath)
nset = odb.rootAssembly.nodeSets['ASSEMBLY_CONSTRAINT-TWIST_REFERENCE_POINT']
frame=odb.steps.values()[-1].frames[-1]
foutput=frame.fieldOutputs['RM']
fvalues=foutput.getSubset(region=nset).values[0].data[1]
odb.close()
print fvalues

print fvalues
593.892

相关推荐

  1. 鸿蒙开发-UI-动画-弹簧曲线动画

    2024-04-24 13:42:03       26 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-24 13:42:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-24 13:42:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-24 13:42:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-24 13:42:03       20 阅读

热门阅读

  1. fluent数据处理+python

    2024-04-24 13:42:03       13 阅读
  2. 工厂设计模式

    2024-04-24 13:42:03       13 阅读
  3. docker常用命令

    2024-04-24 13:42:03       11 阅读
  4. go 这样做就是python

    2024-04-24 13:42:03       12 阅读
  5. Typora使用的一些记录(自用)

    2024-04-24 13:42:03       16 阅读
  6. 薪酬沟通培训:加强沟通培训,提高员工认识

    2024-04-24 13:42:03       12 阅读
  7. 【c++qt】&说明

    2024-04-24 13:42:03       16 阅读
  8. Day10 React———— 第十天

    2024-04-24 13:42:03       13 阅读
  9. 关于TC简单编程的AB爪爪的几点东西

    2024-04-24 13:42:03       17 阅读
  10. React 19 的新增功能:Action Hooks

    2024-04-24 13:42:03       16 阅读
  11. 云安全和传统安全之间有什么区别?

    2024-04-24 13:42:03       15 阅读
  12. react经验13:使用非react封装的富文本组件

    2024-04-24 13:42:03       15 阅读
  13. 让php开发更优雅-ThinkPHP篇

    2024-04-24 13:42:03       15 阅读
  14. 传感器在机械自动化中的应用有哪些?

    2024-04-24 13:42:03       12 阅读
  15. SQL查询

    SQL查询

    2024-04-24 13:42:03      14 阅读