如何更改 Abaqus 中的模型名称 wrt 数组列表?

How to change model names in Abaqus wrt an array list?

我正在尝试根据数组列表中的值更改 Abaqus 中的模型名称。起初,我创建了两个数组列表并将它们分开,但这不是一个好主意,因为稍后我将在 Beam_h 和 Beam_w 中有 100 个值,并且这些值会重复。如果我该怎么办我想让我的模型名称是:model20-10model30-10model50-10?另外,到目前为止我使用的循环给了我 model0model1model2。在循环中写什么以获得所需的模型名称?

#Here is the code,

Beam_h = [20, 30, 50] #Beam Height mm
Beam_w = [10, 10, 10] #Beam width mm 
divide_list = [x/y for x, y in zip(Beam_h, Beam_w)]  ##I do not want to divide.It's wrong

for values in divide_list:                                               ##looping not right
    mdb.Model(name='model'+str(values))
    BeamModel = mdb.Model(name='model'+str(values))

我想,你只需要弄清楚string concatenation

您还需要检查重复的型号名称。因为如果您创建具有重名的模型,Abaqus 会替换已经存在的模型。
要解决此问题,您可以按以下方式使用 dictionary 对象:

dup_Models = dict()  # To store the model names and repeating count
for x,y in zip(Beam_h,Beam_w):
    modelName = 'model%d-%d'%(x,y) # String concatenation - You can use other ways also!
    if modelName not in dup_Models:
        dup_Models[modelName] = 1
        umodelName = modelName      # Unique model name (No Duplication)
    else:
        dup_Models[modelName] += 1
        umodelName = '%s_%d'%(modelName,dup_Models[modelName])

    BeamModel = mdb.Model(name=umodelName)

最后一件事,您不能在模型名称中使用 .(点)(Abaqus 会抛出错误)。因此,如果 Beam_hBeam_w 的值不是整数,那么您必须以其他方式命名模型,例如。 w=10.5 and w=20.5 --> model10pt5-20pt5.