RE: Post processing relative displacmeent from different data base.

Post Reply
ryancwl95
Posts: 91
Joined: Mon Sep 25, 2023 12:42 am

RE: Post processing relative displacmeent from different data base.

Post by ryancwl95 » 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.

STKO Team
Posts: 2920
Joined: Tue Oct 29, 2019 8:45 am

Re: RE: Post processing relative displacmeent from different data base.

Post by STKO Team » Mon Oct 06, 2025 8:03 am

Nodal result with id (1) belongs to a different parent DB
This error says that you cannot perform "virtual result" operations among different databases. If your databases belong to the same analyses, why do you separe them? are you using something like remove-recorder + record several times?

ryancwl95
Posts: 91
Joined: Mon Sep 25, 2023 12:42 am

Re: RE: Post processing relative displacmeent from different data base.

Post by ryancwl95 » Mon Oct 06, 2025 4:30 pm

Hi,

In my analysis, I am using two material models: one for stage 1 of the analysis and another material is added for the subsequent analysis stages (2 materials now in stage 2). When I save the results in a single MPCO recorder that incorporates both model stages, I can only view the stress-strain color map for one of the materials, not the other.

However, I was previously advised in this forum to create separate MPCO recorders for each analysis stage, so that I can view the stress-strain data for both materials in the second stage. As such, I have separated my different stages into separate databases. And yes, I am using emove-recorder + record several times.

Is there a way to perform "virtual result" operations across different databases when two different databases are uploaded?
How do i edit the given code to suit this need?

regards,
ryan

STKO Team
Posts: 2920
Joined: Tue Oct 29, 2019 8:45 am

Re: RE: Post processing relative displacmeent from different data base.

Post by STKO Team » Tue Oct 07, 2025 8:31 am

Currently it's not possible because this limitation is written in the core c++ part of the code.

If you share your model we can see if there is a way to keep 1 single database for your analsyis

ryancwl95
Posts: 91
Joined: Mon Sep 25, 2023 12:42 am

Re: RE: Post processing relative displacmeent from different data base.

Post by ryancwl95 » Wed Oct 15, 2025 5:33 pm

I am currently using STKO for post-processing.

I have another question: I am also utilizing OpenSees' built-in recorder system. One reason I use the "remove recorder" command is that I want to separate my text results between different stages of analysis into separate text files. Is there a way to remove all the recorders by OpenSees while keeping the MPCO recorder at the first stage?

STKO Team
Posts: 2920
Joined: Tue Oct 29, 2019 8:45 am

Re: RE: Post processing relative displacmeent from different data base.

Post by STKO Team » Wed Oct 22, 2025 8:13 am

Is there a way to remove all the recorders by OpenSees while keeping the MPCO recorder at the first stage?
Try this small example:

Code: Select all

model basic -ndm 2 -ndf 2
node 1 0.0 0.0
set R1 [recorder Node -file nodal_1.txt -time -node 1 -dof 1 disp]
set R2 [recorder Node -file nodal_2.txt -time -node 1 -dof 2 disp]
record
remove recorder $R1
record
remove recorder $R2
You will see that the first one has only one record (row), while the second file has two records.

Post Reply