RE: Post processing relative displacmeent from different data base.
Posted: Sun Sep 28, 2025 9:51 pm
Hi,
I want to post-process my results for visualisation in the STKO posprocessor.
From one of your seminars, a code was provided to process the calculated displacements to incremental displacements relative to the end of the previous Stage, of the same database.
This is the initial code I got from the webinar:
from PyMpc import *
import numpy as np
doc = App.postDocument ()
db =doc.getDatabase(1)
U1 = db.getNodalResult('Displacement', time=MpcOdbVirtualResult.stageEnd(4))
U = db.getNodalResult('Displacement') - U1
print(U)
U.setDisplayName('Delta Disp (Stage 5-1)')
U.setComponentLabels(['dUx', 'dUy', 'dUz'])
db.addVirtualResult(U)
I want to rewrite the code so that it shows the incremental displacement relative to the end of the stage of the first database instead. So basically, I want the incremental displacement of the 2nd database relative to the end of Stage 1 of the first database.
I tried rewriting the code to suit my needs; however, I keep getting this error:
Cannot add the virtual results due to the following errors:
Nodal result with id (1) belongs to a different parent DB
I'm not very familiar with the code titles used in PyMPC. How do I edit the initial code to find the incremental displacements from one database relative to another? Could you provide me with an example and assist me with this issue? Thank you; your help is appreciated.
I want to post-process my results for visualisation in the STKO posprocessor.
From one of your seminars, a code was provided to process the calculated displacements to incremental displacements relative to the end of the previous Stage, of the same database.
This is the initial code I got from the webinar:
from PyMpc import *
import numpy as np
doc = App.postDocument ()
db =doc.getDatabase(1)
U1 = db.getNodalResult('Displacement', time=MpcOdbVirtualResult.stageEnd(4))
U = db.getNodalResult('Displacement') - U1
print(U)
U.setDisplayName('Delta Disp (Stage 5-1)')
U.setComponentLabels(['dUx', 'dUy', 'dUz'])
db.addVirtualResult(U)
I want to rewrite the code so that it shows the incremental displacement relative to the end of the stage of the first database instead. So basically, I want the incremental displacement of the 2nd database relative to the end of Stage 1 of the first database.
I tried rewriting the code to suit my needs; however, I keep getting this error:
Cannot add the virtual results due to the following errors:
Nodal result with id (1) belongs to a different parent DB
I'm not very familiar with the code titles used in PyMPC. How do I edit the initial code to find the incremental displacements from one database relative to another? Could you provide me with an example and assist me with this issue? Thank you; your help is appreciated.