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

Problems with smoke3d to_global() #75

Open
Sokdenumeros opened this issue Mar 27, 2024 · 1 comment
Open

Problems with smoke3d to_global() #75

Sokdenumeros opened this issue Mar 27, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Sokdenumeros
Copy link

Hi, I've been getting some error messages when loading smoke3d data.

Here's what I got and what I think may be the issue from looking at the to_global() code in smoke3d.py:

1 ----
LINE: (214) subsmoke_data = np.concatenate((subsmoke_data, temp_data[dim][tuple(temp_data_slices)]), axis=axis + 1)
ERROR MESSAGE: ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 3, the array at index 0 has size 40 and the array at index 1 has size 21.
POTENTIAL PROBEM: here it is trying to concatenate temp_data, which was calculated at line 188 and subsmoke_data which was modified at line 204. Moving the block of code between lines 195 and 206 before line 179 seems to fix that issue for me.

2 ----
LINE: (200): n_repeat = max(int(round(
POTENTIAL PROBLEM: I think the two lines before that one were removed by mistake in the last commit "for axis in (0, 1, 2):" and "dim = ('x', 'y', 'z')[axis]" without those, this block of code is inside the "if masked" condition above which I don't think it's intended.

Finally, that's a non issue but I think the variables global_max and coord_max are the same, so one is probably redundant.

@JanVogelsang JanVogelsang added the bug Something isn't working label Mar 27, 2024
@Sokdenumeros
Copy link
Author

Sokdenumeros commented Mar 27, 2024

For the second problem, I just noticed that if I add back the loops as follows:
for axis in range(3):
dim = ('x', 'y', 'z')[axis]
# Add border points back again if needed
if np.isclose(subsmoke.mesh.coordinates[dim][-1], global_max[dim]):
temp_data_slices = [slice(s) for s in subsmoke_data.shape]
temp_data_slices[axis + 1] = slice(None)
subsmoke_data = np.concatenate((subsmoke_data, temp_data[dim][tuple(temp_data_slices)]), axis=axis + 1)

It can happen that if more than one dimension is close to the global_max, for the next axis it tries to concatenate arrays it will break. Because the shape of subsmoke_data will have been modified after the first concatenation.

@JanVogelsang JanVogelsang added the help wanted Extra attention is needed label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants