在Abaqus中更改默认元素类型

时间:2017-10-23 12:24:31

标签: python abaqus

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

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

谢谢,

R上。

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

  

雷米,

     

我认为默认元素是硬编码的,因此我们没有可以更改的设置。

     

但不要绝望。您可以使用methodCallback在创建零件/实例后自动更改它。

     

你可以将它放在一个abaqus_v6.env文件中,这样就可以了。

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)
     

这个例子有点粗糙,你可能想稍微抛光一下   更多(例如,仅为3d部件更改元素类型等)。

1 个答案:

答案 0 :(得分:1)

更改默认元素类型将在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)