Search code examples
pythonabaqusodb

How to update nodal value of Abaqus odb file using python script?


I want to update nodal values of an existing Abaqus odb file using python script. I already have new nodal valued, but don't how to put them into odb file instead of previous data.


Solution

  • I might be wrong about this, but there is no way of calling some method to replace the existing values in the odb. What you can do, though, is to create a new step and frame (or just a frame in an existing step) and then create a new field output object with the new values.

    If you can live with this approach, check documentation for FieldOutput object. You would probably do something like this:

    odb = session.odbs['yourOdbName']
    instance = odb.rootAssembly.instances['nameOfYourInstance']
    
    field_output = odb.steps['stepName'].frames[frameId].FieldOutput(
        name='DefineTheName', description='WhatItRepresents',
        type=SCALAR # or whatever other type you need
    )
    
    field.addData(
        position=NODAL, instance=instance, labels=your_node_labels,
        data=your_data
    )
    

    After you're done with this, or even better before, try calling the following:

    odb = session.odbs['yourOdbName']
    del odb.steps['stepWithResults'].frames[frameId].fieldOutputs['variableName']
    

    This is a wild guess but it might work. If it does, you can simply delete the existing field output, create a new one and then save the odb.

    Whatever you choose, make sure not to open odb in read-only mode and save the odb and then open it because probably nothing will be visible in the current session.