Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mismatching array sizes when reading element_solid_history_variables #63

Open
jakobstanford opened this issue Jul 24, 2024 · 3 comments

Comments

@jakobstanford
Copy link

jakobstanford commented Jul 24, 2024

🐛 Describe the bug
I am trying to read element_solid_history_variables from my *.ptf files, but when I'm calling D3plot() with state_array_filter or state_filter, I get get an error.

🔢 To Reproduce

  1. take any .ptf file (d3plot files seem to work)
  2. run the following script:
from lasso.dyna import D3plot, ArrayType, FilterType
res = D3plot('GM108.ptf', state_array_filter=[ArrayType.element_solid_history_variables])
  1. get this error message:
    ValueError: could not broadcast input array from shape (522,5913,1,11) into shape (522,5913,1,5)

💘 Expected behavior
Function call works without throwing an error message.

🖥️ Setup

  • lasso-python version: 2.0.2
  • OS: Win11 x64, but also occurs on Linux.

ℹ️ Additional context
My current workaround is to call D3plot() without arguments. I can then read out the array as expected, but the issue is that this doesn't work with the rest of my infrastructure, where I can only read a set of timesteps at a time.

@codie3611
Copy link
Contributor

What is a ptf file?

@jakobstanford
Copy link
Author

Its similar to d3plot files. I actually thought it is exactly the same with a different file extension. Except that simply renaming my GM108.ptf to d3plot doesnt make the problem go away. So there must be some difference.

https://help.oasys-software.com/articles/#!d3plot-21-0/the-complete-state-ptf-file-also-rlf-and-d3eigv-files

@honzatomek
Copy link
Contributor

I created a pull request for this issue (actually noticed this issue after creating the pull request as I came up with the same problem with my d3plot files). You can check the solution here:
https://github.com/honzatomek/lasso-python/tree/bugfix/element_solid_strain

The problem is in _read_states_solid function in d3plot.py file where the i_solid_vars already contains the element_solid_history_variables therefore it is wrong to increment it again. The solid true strain data (element_solid_plastic_strain_tensor, element_solid_thermal_strain_tensor and element_solid_strain) are contained in element_solid_history_variables, if present. When element_solid_strain is requested, it is at the end of solid element data, therefore also at the end of element_solid_history_variables. The element_solid_history_variables are composed of strain data in the following order: [element_solid_plastic_strain_tensor], [element_solid_thermal_strain_tensor], [element_solid_strain].

Excerpt from the docu:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants