Access to material properties
-
dudchenkoav
- Posts: 47
- Joined: Mon Feb 17, 2020 3:27 pm
Access to material properties
Hello STKO Team!
We started verification of material models for various concrete failure mechanisms. As a consequence, I would like to parameterise the computations in terms of material parameters. However, I have not found the way I can access the parameters of e.g. TC3D model using python and change them. Could you please give me a guide how it can be performed?
Best Regards,
Aleksandr
We started verification of material models for various concrete failure mechanisms. As a consequence, I would like to parameterise the computations in terms of material parameters. However, I have not found the way I can access the parameters of e.g. TC3D model using python and change them. Could you please give me a guide how it can be performed?
Best Regards,
Aleksandr
Re: Access to material properties
Ok, so if you send me a list of value that you want to parametrize I will create a Python script you can start working with
Re: Access to material properties
Dear Aleksandr,
If you are asking how to change the parameters of a Physical Property already created in the work Tree through your Python API here is a small example script.
If you already created an instance of a material, let's lay Concrete 02, you can define a function that will have the id of the property as an argument, plus all the attributes you wish to modify:
def makeConcrete02 (id,fpc,epsc0,fpcu,epsU,unload,ft,Ets):
p = doc.getPhysicalProperty(id)
p.XObject.getAttribute('fpc').quantityScalar.value = fpc
p.XObject.getAttribute('epsc0').real = epsc0
p.XObject.getAttribute('fpcu').quantityScalar.value = fpcu
p.XObject.getAttribute('epsU').real = epsU
p.XObject.getAttribute('lambda').real = unload
p.XObject.getAttribute('ft').quantityScalar.value = ft
p.XObject.getAttribute('Ets').quantityScalar.value = Ets
p.commitXObjectChanges()
Then you can define the appropriate input parameters, for example:
fpc = -35.0*MPa
epsc0 = -0.002
fpcu = 0.2*fpc
epsU = -0.01
unload = 0.1
ft = -0.14*fpc
Ets = ft/abs(epsc0)
And use your function.
makeConcrete02(1,fpc,epsc0,fpcu,epsU,unload,ft,Ets)
For DamageTC3D you can do the same. As you may have noticed different attributes have different types. To check the type of a specific attribute you can go into this folder on your computer:
C:\Program Files\STKO\external_solvers\opensees
And search for the python file related to the XObject of interest. For example, as you see in the image below, the young modulus is a quantityScalar, while the Compressive law shape parameters are QuantityScalar.
With this you can access the properties, the parametrization is a further step, I am sure Dr. Petracca can help you with that.
Let us know how it goes and enjoy your programming!
Francesca
If you are asking how to change the parameters of a Physical Property already created in the work Tree through your Python API here is a small example script.
If you already created an instance of a material, let's lay Concrete 02, you can define a function that will have the id of the property as an argument, plus all the attributes you wish to modify:
def makeConcrete02 (id,fpc,epsc0,fpcu,epsU,unload,ft,Ets):
p = doc.getPhysicalProperty(id)
p.XObject.getAttribute('fpc').quantityScalar.value = fpc
p.XObject.getAttribute('epsc0').real = epsc0
p.XObject.getAttribute('fpcu').quantityScalar.value = fpcu
p.XObject.getAttribute('epsU').real = epsU
p.XObject.getAttribute('lambda').real = unload
p.XObject.getAttribute('ft').quantityScalar.value = ft
p.XObject.getAttribute('Ets').quantityScalar.value = Ets
p.commitXObjectChanges()
Then you can define the appropriate input parameters, for example:
fpc = -35.0*MPa
epsc0 = -0.002
fpcu = 0.2*fpc
epsU = -0.01
unload = 0.1
ft = -0.14*fpc
Ets = ft/abs(epsc0)
And use your function.
makeConcrete02(1,fpc,epsc0,fpcu,epsU,unload,ft,Ets)
For DamageTC3D you can do the same. As you may have noticed different attributes have different types. To check the type of a specific attribute you can go into this folder on your computer:
C:\Program Files\STKO\external_solvers\opensees
And search for the python file related to the XObject of interest. For example, as you see in the image below, the young modulus is a quantityScalar, while the Compressive law shape parameters are QuantityScalar.
With this you can access the properties, the parametrization is a further step, I am sure Dr. Petracca can help you with that.
Let us know how it goes and enjoy your programming!
Francesca
-
dudchenkoav
- Posts: 47
- Joined: Mon Feb 17, 2020 3:27 pm
Re: Access to material properties
Thank you for your answers!
I'll start working with that and I hope I will not disturb you too much.
Best Regards,
Aleksandr
I'll start working with that and I hope I will not disturb you too much.
Best Regards,
Aleksandr
-
KaushalPatel
- Posts: 23
- Joined: Thu Dec 21, 2023 3:17 pm
Re: Access to material properties
Hi,
I am trying to use python script to define matrial properties for concrete 02. I am using the script provided in "week 5" of webinar "Get Started in OpenSees with STKO". The script is not able to update epso, epsU and lambda. All other parameteres are updating well as defined in the python script. Can you just look into that and inform me if I am doing anything wrong?
Thanks in advance.
I am trying to use python script to define matrial properties for concrete 02. I am using the script provided in "week 5" of webinar "Get Started in OpenSees with STKO". The script is not able to update epso, epsU and lambda. All other parameteres are updating well as defined in the python script. Can you just look into that and inform me if I am doing anything wrong?
Thanks in advance.
-
kesavapraba
- Posts: 468
- Joined: Sat Mar 28, 2020 2:25 pm
Re: Access to material properties
Hi, Kaushal. There was an incorrect usage of the attribute's type - Real instread quantityScale.value should be used for the attributes that you mentioned. Please always check the Type of the attribute before calling it.
- Attachments
-
- Screenshot 2023-12-27 120005.png (29.89 KiB) Viewed 5431 times
:: With best wishes ::
Prabakaran Kesavan
Prabakaran Kesavan
-
KaushalPatel
- Posts: 23
- Joined: Thu Dec 21, 2023 3:17 pm
Re: Access to material properties
Your solution is working well, but the screenshot you attached is different from what appears in python code from week 5 of the webinar. May be, you need to update that python file as well.
Thank you.
Thank you.
-
kesavapraba
- Posts: 468
- Joined: Sat Mar 28, 2020 2:25 pm
Re: Access to material properties
Yes, the attached screenshot is meant for the demonstration purposes. Sure, we will update the script on the website. Thank you.
:: With best wishes ::
Prabakaran Kesavan
Prabakaran Kesavan