Is there anyway to plot excess pore water pressure ratio?
-
yuweihwang
- Posts: 38
- Joined: Wed Apr 29, 2020 4:54 am
Re: Is there anyway to plot excess pore water pressure ratio?
Hello,
Many thanks for your help, can I check more details with you?
(1) I found that if I have PDMY02 and uniaxial material (zerolength element) in the same model, it will have two "stress" labels (please see E3 and E4 in Figure 1)
If I use the following code
S = db.getElementalResult("stress", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = stage_id
opt.step = step_id
opt.extrapolate = True
opt.smooth = True
element_field = S.evaluate(opt)
I will get errors like this Error: cannot evalute dataset for result: "material.stress (Lines; 1 Components {σ11}; S)"
Is there any way to figure this out?
(2) if I want to get the initial mean stress,(S11+S22+S33)/3, for each node at the initial step of the last stage, should I do something like this?
S = db.getElementalResult("stress", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = stage_id
opt.step = step_id
opt.extrapolate = True
opt.smooth = True
SS= S.evaluate(opt)
Initial_meanStress= (SS.setComponentLabels("S22")+2*SS.setComponentLabels("S11"))/3
Many thanks for your help, can I check more details with you?
(1) I found that if I have PDMY02 and uniaxial material (zerolength element) in the same model, it will have two "stress" labels (please see E3 and E4 in Figure 1)
If I use the following code
S = db.getElementalResult("stress", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = stage_id
opt.step = step_id
opt.extrapolate = True
opt.smooth = True
element_field = S.evaluate(opt)
I will get errors like this Error: cannot evalute dataset for result: "material.stress (Lines; 1 Components {σ11}; S)"
Is there any way to figure this out?
(2) if I want to get the initial mean stress,(S11+S22+S33)/3, for each node at the initial step of the last stage, should I do something like this?
S = db.getElementalResult("stress", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = stage_id
opt.step = step_id
opt.extrapolate = True
opt.smooth = True
SS= S.evaluate(opt)
Initial_meanStress= (SS.setComponentLabels("S22")+2*SS.setComponentLabels("S11"))/3
- Attachments
-
- Figure1.png (255.68 KiB) Viewed 3215 times
Re: Is there anyway to plot excess pore water pressure ratio?
It's because when you use ("stress", match = MpcOdb.Contains) STKO will pick the first result that CONTAINS the string stress in the result name.
Try to use ("stress (Volume", match = MpcOdb.Contains)
Try to use ("stress (Volume", match = MpcOdb.Contains)
-
yuweihwang
- Posts: 38
- Joined: Wed Apr 29, 2020 4:54 am
Re: Is there anyway to plot excess pore water pressure ratio?
Hello Sir,
Thank you for your help,
I used the following codes to get the stress value at each node.
S = db.getElementalResult("stress (Volume", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = 1
opt.step = 4
opt.extrapolate = True
opt.smooth = True
element_field = S.evaluate(opt)
Can you guide me on how to find Sigma_22 for each node from the element_field?
The data type of PWP results is PyMpc.MpcOdbVirtualResult, while the type of element_field is PyMpc.MpcOdbResultField.
Can I calculate the ratio of PWP at every time point at each node over by the Sigma_22 at the first step?
Many many thanks for your kind help,
Yu-Wei Hwang
Thank you for your help,
I used the following codes to get the stress value at each node.
S = db.getElementalResult("stress (Volume", match = MpcOdb.Contains)
opt = MpcOdbVirtualResultEvaluationOptions()
opt.stage = 1
opt.step = 4
opt.extrapolate = True
opt.smooth = True
element_field = S.evaluate(opt)
Can you guide me on how to find Sigma_22 for each node from the element_field?
The data type of PWP results is PyMpc.MpcOdbVirtualResult, while the type of element_field is PyMpc.MpcOdbResultField.
Can I calculate the ratio of PWP at every time point at each node over by the Sigma_22 at the first step?
Many many thanks for your kind help,
Yu-Wei Hwang
Re: Is there anyway to plot excess pore water pressure ratio?
Hi YuWei,
So what you want to calculate is PWP/Sigma_22 ?
Could you give me the exact equation you want to implement so that I can give you an example?
Also, do you want to visualize this result in a STKO Plot, or do you just want to extract data at nodes programmatically in python?
So what you want to calculate is PWP/Sigma_22 ?
Could you give me the exact equation you want to implement so that I can give you an example?
Also, do you want to visualize this result in a STKO Plot, or do you just want to extract data at nodes programmatically in python?
-
yuweihwang
- Posts: 38
- Joined: Wed Apr 29, 2020 4:54 am
Re: Is there anyway to plot excess pore water pressure ratio?
Hello sir,
Thank you for your help. I want to visualize this result in a STKO Plot.
I want to calculate the EPWP/initial value of S22 (so EPWP will be a time history but S22 will be the value obtained from the first stage and first step) for each node.
Here is the code I calculate EPWP.
from PyMpc import *
from PyMpc import MpcOdbVirtualResult as vr
import numpy as np
App.clearTerminal()
# get document
doc = App.postDocument()
# get first database
if len(doc.databases) == 0:
raise Exception("You need a database with ID = 1 for this test")
db = doc.getDatabase(1)
# create evaluation options
# here we want to extract data for all steps of the last stage
all_stages = db.getStageIDs() # get all model stages
last_stage = all_stages[-1] # get the last stage (pushover)
first_stage = all_stages[0] # get the first stage
all_stage1_steps = db.getStepIDs(first_stage)
all_stage1_times = db.getStepTimes(first_stage)
all_steps = db.getStepIDs(last_stage) # get all steps of the last stage
all_times = db.getStepTimes(last_stage) # get all step times of the last stage
step = all_stage1_steps[-1]
InitialPWP = db.getNodalResult("Pressure", match = MpcOdb.Contains, time = vr.stageEnd(1))
App.processEvents()
# initialize the evaluation options with the last stage
PWP = db.getNodalResult("Pressure", match = MpcOdb.Contains)
EPWP = PWP - InitialPWP
print(type(EPWP))
EPWP.setDisplayName("EPWP2")
EPWP.setComponentLabels(["EPWP"])
# add the new result to the database
db.addVirtualResult(EPWP)
Many thanks for your help!
Yu-Wei
Thank you for your help. I want to visualize this result in a STKO Plot.
I want to calculate the EPWP/initial value of S22 (so EPWP will be a time history but S22 will be the value obtained from the first stage and first step) for each node.
Here is the code I calculate EPWP.
from PyMpc import *
from PyMpc import MpcOdbVirtualResult as vr
import numpy as np
App.clearTerminal()
# get document
doc = App.postDocument()
# get first database
if len(doc.databases) == 0:
raise Exception("You need a database with ID = 1 for this test")
db = doc.getDatabase(1)
# create evaluation options
# here we want to extract data for all steps of the last stage
all_stages = db.getStageIDs() # get all model stages
last_stage = all_stages[-1] # get the last stage (pushover)
first_stage = all_stages[0] # get the first stage
all_stage1_steps = db.getStepIDs(first_stage)
all_stage1_times = db.getStepTimes(first_stage)
all_steps = db.getStepIDs(last_stage) # get all steps of the last stage
all_times = db.getStepTimes(last_stage) # get all step times of the last stage
step = all_stage1_steps[-1]
InitialPWP = db.getNodalResult("Pressure", match = MpcOdb.Contains, time = vr.stageEnd(1))
App.processEvents()
# initialize the evaluation options with the last stage
PWP = db.getNodalResult("Pressure", match = MpcOdb.Contains)
EPWP = PWP - InitialPWP
print(type(EPWP))
EPWP.setDisplayName("EPWP2")
EPWP.setComponentLabels(["EPWP"])
# add the new result to the database
db.addVirtualResult(EPWP)
Many thanks for your help!
Yu-Wei
Re: Is there anyway to plot excess pore water pressure ratio?
Dear Yu-Wei,
In the current version of STKO (2.0.4), you can create a virtual result from operations involving similar results:
nodal results with nodal results
elemental results with elemental results.
Unfortunately, water pore pressure is a nodal result, while the S22 is a component of the stress tensor which is an elemental result.
To do this operation we need to implement new operations for Virtual Results:
1) Convert an elemental result to a nodal result doing nodal average
2) Convert a multi-component result to a scalar one
We will implement them as soon as possible.
In the current version of STKO (2.0.4), you can create a virtual result from operations involving similar results:
nodal results with nodal results
elemental results with elemental results.
Unfortunately, water pore pressure is a nodal result, while the S22 is a component of the stress tensor which is an elemental result.
To do this operation we need to implement new operations for Virtual Results:
1) Convert an elemental result to a nodal result doing nodal average
2) Convert a multi-component result to a scalar one
We will implement them as soon as possible.
-
yuweihwang
- Posts: 38
- Joined: Wed Apr 29, 2020 4:54 am
Re: Is there anyway to plot excess pore water pressure ratio?
Hello Sir,
Thank you for your response. Then, if I don't use nodal results,
May I ask you will it do the surface plot for a ratio like this?
ratio=(S22(t)-S22(t=0))/S22(t=0)
If it is possible, can you guide me on how to do this?
Many thanks for all your help
Best,
Yu-Wei
Thank you for your response. Then, if I don't use nodal results,
May I ask you will it do the surface plot for a ratio like this?
ratio=(S22(t)-S22(t=0))/S22(t=0)
If it is possible, can you guide me on how to do this?
Many thanks for all your help
Best,
Yu-Wei
Re: Is there anyway to plot excess pore water pressure ratio?
HI Yu Wei,
here is the Python code that you can use to compute the stress ratio. It will produce a stress tensor whose components are the ratio of the current_component-initial_component/initial_component
Then in post-processing, you can just visualize the second (S22) component.
Note: In version 2.0.4 we detected a small BUG (that will be fixed in version 2.0.5 soon). If the above function gives you an error you need to change the MpcOdb.Contains property with the integer 3 (example: change match=MpcOdb.Contains with match=3).
Here is the integer value corresponding to each Match Type:
ExactMatch = 0
StartsWith = 1
EndsWith = 2
Contains = 3
RegEx = 4
here is the Python code that you can use to compute the stress ratio. It will produce a stress tensor whose components are the ratio of the current_component-initial_component/initial_component
Then in post-processing, you can just visualize the second (S22) component.
Code: Select all
from PyMpc import *
from PyMpc import MpcOdbVirtualResult as vr
doc = App.postDocument()
db = doc.getDatabase(1)
# get stress at initial stage
initial_stage = 1
S0 = db.getElementalResult('stress (Volumes', match = MpcOdb.Contains, time = vr.stageEnd(initial_stage))
# it will be the denominator of the ratio, so make sure to replace any zero value with a small tolerance
S0 += (S0 == 0.0)*1.0e-12
# get stress at each step
S = db.getElementalResult('stress (Volumes', match = MpcOdb.Contains)
# compute ratio
Sratio = (S-S0)/S0
Sratio.setDisplayName('Stress Ratio (S-S0)/S0)')
Sratio.setComponentLabels(['R11', 'R22', 'R12'])
db.addVirtualResult(Sratio)
Here is the integer value corresponding to each Match Type:
ExactMatch = 0
StartsWith = 1
EndsWith = 2
Contains = 3
RegEx = 4