Page 1 of 1

Access to material properties

Posted: Fri Jul 16, 2021 9:35 am
by dudchenkoav
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

Re: Access to material properties

Posted: Fri Jul 16, 2021 10:56 am
by STKO Team
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

Posted: Fri Jul 16, 2021 11:12 am
by admin
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.
4.png
4.png (170.76 KiB) Viewed 7592 times
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! :geek:

Francesca

Re: Access to material properties

Posted: Fri Jul 16, 2021 12:46 pm
by dudchenkoav
Thank you for your answers!
I'll start working with that and I hope I will not disturb you too much.

Best Regards,
Aleksandr

Re: Access to material properties

Posted: Thu Dec 21, 2023 7:40 pm
by KaushalPatel
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.

Re: Access to material properties

Posted: Wed Dec 27, 2023 11:03 am
by kesavapraba
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.

Re: Access to material properties

Posted: Wed Dec 27, 2023 4:26 pm
by KaushalPatel
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.

Re: Access to material properties

Posted: Wed Dec 27, 2023 5:48 pm
by kesavapraba
Yes, the attached screenshot is meant for the demonstration purposes. Sure, we will update the script on the website. Thank you.