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

LS-DYNA Binout Elout with Erosion #62

Open
ricepatti opened this issue Jul 19, 2024 · 2 comments
Open

LS-DYNA Binout Elout with Erosion #62

ricepatti opened this issue Jul 19, 2024 · 2 comments

Comments

@ricepatti
Copy link

🐛 Describe the bug
When reading binout data using binout.py, a bug is encountered when the user is requesting ELOUT data with eroding elements. Typically, data is stored in a rectangular list, which is then converted using np.array to be returned to the user. However, when the ELOUT data contains eroded elements, the data is stored in a list of tuples that are not all the same length. This results in a "inhomogeneous shape" error when calling np.array(data) in binout.py.

🔢 To Reproduce
Steps to reproduce the behavior:

  1. I ran DYNA version R15 with Elout *DATABASE_HISTORY_BEAM_SET requested for both eroding and non eroding elements. The eroding elements are deleted during the analysis.
  2. Request binout.read(xxx,elout,beam,axial)
  3. Error occurs.

💘 Expected behavior
Elout data is returned as an array.

🖥️ Setup

  • lasso-python latest version as of 7/18/24
  • numpy version 2, latest release as of 7/18/24

ℹ️ Additional context
I feel like this was not a problem in the past, so maybe it's the numpy version or DYNA R15 changed how it stores the binout data. I was able to implement a workaround in binout.py by making a function which checks if the variable "data" is rectangular before calling np.array(data), and if it is not, padding it with zeros. I am not great with python so there is probably a better way to do this.

I am also sorry for the lack of details, this bug occurs on a computer with LS-DYNA that I cannot upload to Github from. If needed I can probably replicate the functions.

@pytunia
Copy link

pytunia commented Sep 29, 2024

I ran into the same problem and added a small piece of code to handle it.
In the file binout.py insert the following code between line 338 and 340. Make sure to keep the indent aligned (8 spaces):

        # handle eroded elements
        try:
            new_data = np.zeros((len(data), len(data[0])))
            for j in range(len(data)):
                if type(data[j]) == int:
                    new_data[j][0] = data[j]
                else:
                    new_data[j][0:len(data[j])] = data[j]
            new_data.astype(type(data[0][0])) # make sure type does not change
            data = new_data
        except:
            pass

To find the location of your binout.py you can use:

import lasso
print(lasso.__file__)

@codie3611
Copy link
Contributor

Hmmm sounds like we need a patch for that 👀

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