我无法在 Abaqus 中使用 Part Object 的 Element() 构造函数创建元素。Node() 构造函数没有问题,但是当您尝试使用先前生成的节点创建元素时,它会向您显示以下错误警告:
在运行脚本之前,零件网格在 Abaqus CAE 树(零件 Recuadro)中显示为空,并且在运行脚本后不再为空,所以我知道网格已经生成。
这是我的脚本:
import sys
import mesh
import part
from abaqus import *
from odbAccess import *
from abaqusConstants import *
from caeModules import *
from driverUtils import executeOnCaeStartup
#
# Función que da el número del nodo en función de las fila y columna de elementos
#
def nnodo(i,j,ne):
n = (2*ne+1)*(i-1)+j
return n
filecae= 'E:\ESI\Fatiga\Cotacto Cilindrico\ABQ\CC-Crack-0.cae'
openMdb(filecae)
# Coordenadas del arranque de la grieta en "Recuadro"
x0 =0.0
y0 = -0.002
z0 = 0.0
delta=[0]
# Dimensiones del recuadro x € [x0-a,x0+a] y € [y0-b, y0]
a=0.2
b=0.2
# Tamaño deseado de los elementos ~ le x le
le = 0.05
# Tamaño inicial de los elementos ~ dx x dy
Nex = 2*int(a/le)
Ney = int(b/le)
Nnx = 2*Nex+1
Nny = 2*Ney+1
dx = 2*a/Nex
dy = b/Ney
Nnodos = Nnx*Nny
Nelems = Nex*Ney
inod = range(Nnodos-1)
ielm = range(Nelems-1)
for i in range(Nny):
delta.append(0)
# Coordenadas de los nodos de la malla inicial
recuadro=mdb.models['P22'].parts['Recuadro']
recuadro1=mdb.models['P22'].rootAssembly.instances['Recuadro-1']
recuadro.generateMesh(regions=(recuadro.faces[0],))
for i in range(1,Nny+1):
dx1 = (Nex*dx/2 - delta[i])/Nex
dx2 = (Nex*dx/2 + delta[i])/Nex
y = y0 - (i-1)*dy/2
for j in range(1,Nnx+1):
if float(i)/2. <> int(float(i)/2. ) or float(j)/2. <>int(float(j)/2. ):
k = (2*Nex+1)*(i-1)+j
if j<=Nex+1:
x = x0 - Nex*dx/2 + (j-1)*dx1
else:
x = x0 - delta[i] + (j-Nex-1)*dx2
recuadro.Node(label = k, coordinates=(x, y, 0.))
# Conectividades de los elementos de la malla inicial
for i in range(1,Ney+1):
for j in range(1,Nex+1):
k = Nex*(i-1)+j
n1 = recuadro.nodes[nnodo(2*i+1, 2*j-1, Nex)]
n2 = recuadro.nodes[nnodo(2*i+1, 2*j , Nex)]
n3 = recuadro.nodes[nnodo(2*i+1, 2*j+1, Nex)]
n4 = recuadro.nodes[nnodo(2*i , 2*j+1, Nex)]
n5 = recuadro.nodes[nnodo(2*i-1, 2*j+1, Nex)]
n6 = recuadro.nodes[nnodo(2*i-1, 2*j , Nex)]
n7 = recuadro.nodes[nnodo(2*i-1, 2*j-1, Nex)]
n8 = recuadro.nodes[nnodo(2*i , 2*j-1, Nex)]
recuadro.Element(label = k, elemShape= QUAD8, nodes=(n1, n2, n3, n4, n5, n6, n7, n8))