Closed florianreinle closed 1 week ago
Dear @florianreinle,
Try following the code snippet below:
import ansys.rocky.core as pyrocky
rocky = pyrocky.launch_rocky()
project = rocky.api.OpenProject("Path/to/rocky_project.rocky")
geometry = project.GetStudy().GetGeometryCollection().GetGeometry("wall_name")
gf_names = geometry.GetGridFunctionNames()
I tested it here with PyRocky 0.2.0 (the latest release) and Rocky 24.2. PyRocky is able to access both static and transient grid functions on walls. To access any array at any given output, say the 20th:
gf = geometry.GetGridFunction("grid_function_name").GetArray(time_step=20)
The code structure should follow the same as in https://developer.ansys.com/docs/prepost-scripting-2024-r2/RAStudy.md
Dear @viniciusdaroz
Thank you so much! Now it works. In my case GetGeometryCollection() was not necessary. There was a mistake in the module setup so no result data available even if simulation was run. (I'm working a lot with automated simulations ATM). There was a chain of old mistakes/assumptions and communication errors with project partners involved. Your advice helped making me look for the right things:-) And what matters, it works now!
Thanks for the help and Greetings Florian
π Before submitting the issue
π Description of the bug
Postprocessing like this works fine (like in the examples):
particles = Study.GetParticles() velocity_gf = particles.GetGridFunction("Velocity : Translational : Absolute")
BUT with:
geometry_workpiece = Study.GetGeometry(geometry_name) GF = np.array(geometry_workpiece.GetGridFunction(GF_name).GetArray())
Sadly only those Grid Functions are available:
Available: Coordinate : Nodal : Z Area : Cell Coordinate : Nodal : X Area : Nodal Coordinate : Nodal : Y
So no time depended values available, which are necessary for post processing like "Duration : Mean", "Stress : Normal" and many, many more.
If I try:
wall = Study.GetWallFromFilename(geometry_name) wall = wall[0] # since we get a list wall_duration = wall.GetGridFunction("Duration : Mean")
to get the object with another way same issue occurs. HasResults and RefreshResult was also used for double check.
π Steps to reproduce
π» Which operating system are you using?
Linux
π Which ANSYS version are you using?
Ansys Rocky 22R2
π Which Python version are you using?
3.12
π¦ Installed packages