gpt4 book ai didi

python - 更改 Abaqus 中的默认元素类型

转载 作者:太空宇宙 更新时间:2023-11-03 14:36:41 26 4
gpt4 key购买 nike

Abaqus 选择的默认元素是 C3D8R,我想将其更改为 C3D8I。我知道如何在 CAE 中更改元素类型,甚至使用 Python 递归更改元素类型,但不知道如何更改默认值。

问题是,当我分区和重新网格化时,我之前的选择被覆盖并生成默认的 C3D8R。

谢谢

R。

编辑:感谢 Simulia 社区的 Fernando C.,可以使用以下调整。但仍在寻找更好的解决方案!

Remy,

I think the default element is hard-coded and so we don't have a setting that you can change.

But don't despair. You can use methodCallback to change it automatically after the part/instance is created.

You can put this in an abaqus_v6.env file so it is always doing that.

import methodCallback

from abaqus import *

from abaqusConstants import *

def changeDefaultElementType(callingObject, arguments, keywordArguments, userData):

print 'Changing the default element type'

p = getMethodReturnValue()

p.setElementType(

elemTypes=(

ElemType(elemCode=C3D8I, elemLibrary=STANDARD, secondOrderAccuracy=OFF, distortionControl=DEFAULT),

ElemType(elemCode=C3D6, elemLibrary=STANDARD),

ElemType(elemCode=C3D4, elemLibrary=STANDARD)

),

regions=(p.cells.getSequenceFromMask(('[#1 ]', ), ), )

)

methodCallback.addCallback(ModelType, 'Part', changeDefaultElementType, callAfter=True)

The example is a little rough, you might want to polish it a little more (For example changing the element type only for 3d parts, etc).

最佳答案

Abaqus/CAE 2018 中将提供更改默认单元类型。

同时,可以将以下函数添加到custom_v6.env中。 (C:\Program Files\Dassault Systemes\SimulationServices\V6R2017x\Abaqus\win_b64\SMA\site\custom_v6.env)

def onCaeStartup():
import methodCallback
from mesh import ElemType
from job import ModelJobType

## Function to be called when an input file is written
def checkElementType(callingObject, arguments, keywordArguments, userData):
print 'Checking element types in the model'

# Get the name of the job from the command
a = str(callingObject).split("jobs['")[1]
job = a.split("']")[0]

model = mdb.jobs[job].model
ra = mdb.models[model].rootAssembly

# Query the Element Types in the assembly and display them
elemType=[]
for instance in ra.instances.keys():
for cell in ra.instances[instance].cells:
if ra.getElementType(region=cell,elemShape=HEX).elemCode not in elemType:
elemType.append(ra.getElementType(region=cell,elemShape=HEX).elemCode)
print 'INSTANCE: '+instance +' = '+ ra.getElementType(region=cell,elemShape=HEX).elemCode

# Define the callback. When the writeInput method is called on a ModelJobType object, the function checkElementType is executed.
methodCallback.addCallback(ModelJobType, 'writeInput', checkElementType)

关于python - 更改 Abaqus 中的默认元素类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46889296/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com