Page 1 of 3
Model construction with Python API
Posted: Sun Nov 06, 2022 10:04 pm
by Fabiola
Dear STKO team,
I'm trying to model a soil domain which is formed by a soil deposit (of 2 layer) on top of a bedrock layer, I attach the draw below.
1. I built the geometry of the 2D model with Python API but i have some problems creating the second layer in my soil deposit. Below i've attached the Python script.
2. I also need to generate some codes (using Python API) to implement the physical properties by specifying various geotechincal parameters to be assigned, how can i do?
For example I have to assign a velocity trend that varies with depth within each layer, is it possible?
Thank you very much!!
Fabiola
Re: Model construction with Python API
Posted: Wed Nov 09, 2022 3:39 pm
by STKO Team
Before going ahead with the property assignment, have a look at this modified version of your script:
It's a bit cleaner. It builds the grid lines and then uses them to create the planar faces. In your previous script there was some mistake and some faces were invalid.
Check it and let us know if it works as intended.
Also there is a note at line 75. Please have a look
Re: Model construction with Python API
Posted: Fri Nov 18, 2022 9:26 pm
by Fabiola
Thank you so much for your help!
I checked the script and it runs very well. Now i'm trying to automate the process of implementing the properties and building the mesh in python. The focus of my work is to develop an automated python code to create the model. I tried to assign the properties directly on stko and then i tried to extract the input files, but i think it's not the right way, Can I have your help for this step?
Thank you again
Re: Model construction with Python API
Posted: Mon Nov 21, 2022 9:33 am
by STKO Team
Could you please assign some properties to the model generated by the script, and share it here?
I will show you how to do it in Python.
Re: Model construction with Python API
Posted: Mon Nov 21, 2022 9:33 pm
by Fabiola
Yes sure, Thank you so much!!!
Re: Model construction with Python API
Posted: Tue Nov 22, 2022 3:13 pm
by STKO Team
Ok, let's do it one step at a time.
In this script you will see how to:
- Create a physical property (Soil Material)
- Assign it to some faces of the geometry
Then you can try to do the same for other properties. For any doubt, ask here.
Re: Model construction with Python API
Posted: Fri Dec 09, 2022 6:10 pm
by Fabiola
Hi team,
Following your directions I've tried to assign the bedrock the same physical properties but I'm having some difficulty. I attach the model below.
I also have other questions:
1. How can I generate a second layer with variable y (for example also y=0) inside the basin using Python API?
2. How can I create a mesh using Python API?
Thanks for your help.
Re: Model construction with Python API
Posted: Wed Dec 14, 2022 4:55 pm
by STKO Team
There were some mistakes in the logic for assignment of the bedrock material
Re: Model construction with Python API
Posted: Mon Jan 30, 2023 9:21 pm
by Fabiola
Hello team,
thanks for your advice!!! I'm here again to ask for your help!
The starting file, this time, is the one updated by my teacher, I attach it below. The next step is to create a routine to define and assign element properties. I hope for your help!
Thank you so much
Re: Model construction with Python API
Posted: Tue Jan 31, 2023 11:54 am
by STKO Team
Here it is:
It follows the same steps as the physical properties.
You just have to figure out what attribute you want to change, and what Type it is (i.e. Real, Integer, QuantityScalar, etc...).
You can do it by looking at the associated python file (in your case the
quadUP.py in
C:\Program Files\STKO\external_solvers\opensees\element_properties\up_elements)