0

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.

Siamak Malek
  • 45
  • 2
  • 11

1 Answers1

1

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.

hgazibara
  • 1,832
  • 1
  • 19
  • 22
  • I'll try your solution and as soon as I get a write answer, I'll let you know if it will work or not. – Siamak Malek Feb 17 '15 at 19:39
  • I cannot use `del` command in order to delete an existing field output. Do I have to import specific package to do this? – Siamak Malek Feb 21 '15 at 06:18
  • As I said, that was only a wild guess and it's probably not even possible; no module will help you. You'll just have to create another field as I had described. Of course, you can always create a new odb with the same geometry, but different data, but that's another topic... – hgazibara Feb 21 '15 at 09:17