Generating a orphan mesh from scratch in abaqus with python

2.1k views Asked by At

I am trying to generate an orphan mesh with python in Abaqus 6.13. Meaning I want to specify the coordinate locations of each of the nodes, and then another function creating the elements using the previously created nodes.

I have created a list of nodes, and elements already, but I don't know what methods I should use to add them into abaqus.

This creates nodes

p = mdb.models[nameModel].parts[namePart]
for z in range (0, z_max+1):
    for y in range (0, y_max+1):
        for x in range (0, x_max+1):
            listNode.append(p.Node(coordinates=(x*x_div, y*y_div, z*z_div)))

This creates the elements

p = mdb.models[nameModel].parts[namePart]
    #p.setElementType(ElemType(elemCode=C3D8R,elemLibrary=STANDARD))
    for z in range (0, z_max):
        for y in range (0, y_max):
            for x in range (0, x_max):
                listNodeNum=[]
                listNodeObj=[]
                listNodeNum.append(x+y*(x_max+1)+z*(x_max+1)*(y_max+1))
                listNodeNum.append(x+y*(x_max+1)+z*(x_max+1)*(y_max+1)+1)
                listNodeNum.append(x+(y+1)*(x_max+1)+z*(x_max+1)*(y_max+1)+1)
                listNodeNum.append(x+(y+1)*(x_max+1)+z*(x_max+1)*(y_max+1))
                listNodeNum.append(x+y*(x_max+1)+(z+1)*(x_max+1)*(y_max+1))
                listNodeNum.append(x+y*(x_max+1)+(z+1)*(x_max+1)*(y_max+1)+1)
                listNodeNum.append(x+(y+1)*(x_max+1)+(z+1)*(x_max+1)*(y_max+1)+1)
                listNodeNum.append(x+(y+1)*(x_max+1)+(z+1)*(x_max+1)*(y_max+1))
                for num in listNodeNum:
                    listNodeObj.append(listNode[num])
                listElem.append(p.Element(nodes=listNodeObj,elemShape=HEX8))
    return listElem

There is no error and the list lengths are correct, but I just can't see anything happening in abaqus.

Any ideas? I am probably missing something real simple.

Thanks, Tim

-----EDIT------

The previous problem is solved be creating a new part using PartFromMesh.

Now the problem is that when I try to go into the load module, the mesh disappears again. When I try to click on load, the error message reass "The assembly does not contain any part instances ..., a part must be instanced ..."

Ideas?

1

There are 1 answers

0
Rémy On

The orphan mesh facility has a very specific usage.
If you just want to create a mesh as you would do in CAE, the Python command is .generateMesh():

mdb.models['YourModel'].parts['PartToBeMeshed'].generateMesh()

If generating and using an orphan mesh is really what you want to do: setting the location of each node, importing certain parts...

The answer has been given in the comments:

  1. Create a part from the mesh you created with the .PartFromMesh() command. It takes the name of the new part (string) as a required argument and copySets if you need the sets/surfaces/attributes to be carried over:

    mdb.models['YourModel'].parts['PartToBeCopied'].PartFromMesh(name='NewPartName', copySets=True)  
    
  2. You just created a new part containing only 1 feature and a mesh. You now need to instantiate it in the assembly with the following command:

    mdb.models['YourModel'].rootAssembly.Instance(name='YourInstanceName', part=mdb.models['YourModel'].parts['NewPartName'], dependent=True)
    

    Dependent has to be set to True since you want the mesh to be defined at a part level.

The Part module is there to work on the geometry. The assembly module helps you create an assembly of one or several parts interacting with each other. In order to define a Load, one needs an Assembly containing at least one Part, a Set of vertice/edge/surface/and/or/cells to which the load will be applied and a Step in which the load will be applied.