1

I am trying to use abaqus-ython scripting to extract the nodal coordinates. in doing so i first extract the original nodal positions and then add the displacement value.

But for 1 of my abaqus models i notice that the displacement values i extract are different from the ones i find in abaqus (see attached pictures)

i have no idea how or why this is happening. Can someone helpe me? You can find my code below.

    for ODBname in os.listdir("D:/r0333338/Documents/MP/nodal_files_genereren/OBD"): # directory van waar alle .odb bestanden zitten, hier worden ze allemaal 
    print 'Current File: '+ODBname #checken welke file er gebruikt wordt
    ODBnamefull = 'D:/r0333338/Documents/MP/nodal_files_genereren/OBD/'+ODBname   # Volledig pad naar de .odb file. ander wordt de file in de default work directory gezocht.
    odb = openOdb(path=ODBnamefull)  #openen van het ODB bestand

    ODBalleenNaam = ODBname.rstrip('.odb') #om .odb weg te knippen
    NodalName = ODBalleenNaam + '-nodal.txt' #naam ven het te schrijven bestand

    for name, instance in odb.rootAssembly.instances.items(): #'name' is naam van elke part van in de assembly, zo kan de nodal coordinaten van het onvervormde testobject (part) achterhaald worden
        print name
        type(name)
        name2 = 'DISK-1'
        if name == name2:

            numNodesTotal = len( instance.nodes ) #aantal nodes

            frame = odb.steps[ 'Step-1' ].frames[-1]  #informatie van de laatste frame van Step-1 gebruiken

            dispField = frame.fieldOutputs['U']  #verplaatsingsveld van laatste frame van step-1


            print 'total numer of nodes: '+ str(numNodesTotal)    #checken hoeveel nodes er zijn

            for i in range( numNodesTotal ):   #voor elke node :
                curNode = instance.nodes[i]  #informatie van de huidige node
                #print curNode.label          #nummer van de huidige node

                #2D verplaatsing omzetten naar 3D verplaatsing
                U1 = dispField.values[i].data[0]       #X-verplaatsing aan U1 geven
                U2 = dispField.values[i].data[1]       #Y-verplaatsing aan U2 geven
                array = []                             #maken van een lege array voor invullen van de coordinaten
                array.append(U1)                       #X-verplaatsing toevoegen
                array.append(U2)                       #Y-verplaatsing toevoegen
                array.append(0)                        #Z-verplaatsing toevoegen
                print 'node: '
                print curNode.label
                print 'displacement: '
                print array #checken van 3D verplaatsing
                print 'coordinates: '
                print curNode.coordinates

            odb.close()
        else:
            print 'name is not DISK-1 but: ' + str(name)

Abaqus displacement

python extracted displacement

Theodoor
  • 77
  • 1
  • 7
  • Also, see [this](https://stackoverflow.com/questions/47333525/extract-nodal-coordinates-from-the-deformed-testsubject-abaqus-python) question – Daniel F Jan 11 '18 at 14:39

2 Answers2

1

you should pull the node label directly from the field data:

     curNodeLabel=dispField.values[i].nodeLabel

you then need to use that to get the node:

     curNode=instance.getNodeFromLabel(curNodeLabel)

don't assume the node indexing is the same as the field data indexing.

I'd further for consistency make the for loop:

 for i in range( len(dispField.values)  ):
agentp
  • 6,849
  • 2
  • 19
  • 37
  • 1
    Better yet, extract `COORDS` during the analysis and use that. – Daniel F Jan 11 '18 at 14:37
  • Using "curNodeLabel=dispField.values[i].nodeLabel" and "instance.getNodeFromLabel(curNodeLabel)" does help. but now i get multiple nodes with label 1 for the same part – Theodoor Jan 17 '18 at 10:11
0

Despite the title, I am assuming that you want the final coordinates and not the displacement. As Daniel F mentioned, you should add COORDS as a field output. In that case the code bellow should be helpful.

def findCoordSet(OdbName,StepName,InstanceName,SetName):
    """
    This ODB reading script does the following:
    -Retrieves coordinates at SetName
    """
    Coordinates={'x':[],'y':[]}
    # Open the output database.
    odbName = OdbName + '.odb'

    odb = visualization.openOdb(odbName)
    lastFrame = odb.steps[StepName].frames[-1]

    coordset = odb.rootAssembly.instances[InstanceName.upper()].nodeSets[SetName.upper()]

    # Retrieve Y-displacements at the splines/connectors
    dispField = lastFrame.fieldOutputs['COORD']

    dFieldpTip = dispField.getSubset(region=coordset)

    for i in range(len(dFieldpTip.values)):
        Coordinates['x'].append(dFieldpTip.values[i].data[0])
        Coordinates['y'].append(dFieldpTip.values[i].data[1])
    odb.close()

    return Coordinates
leal26
  • 86
  • 1
  • 6