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

Handling p0 input in source #468

Open
djps opened this issue Sep 11, 2024 · 1 comment
Open

Handling p0 input in source #468

djps opened this issue Sep 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@djps
Copy link
Collaborator

djps commented Sep 11, 2024

Describe the bug
The logic of defining an initial pressure distribution is different from all other methods in that it can not be modified after being defined, throwing the error: TypeError: 'NoneType' object does not support item assignment for something like

source.p0 = np.zeros((Nx,Ny,Nz))
source.p0[Nx // 2 -1, Ny // 2 -1, Nz // 2 -1] = 1

This would be fine for ux etc. There are ways to handle it, i.e.

p0 = np.zeros((Nx,Ny,Nz))
p0[Nx // 2 -1, Ny // 2 -1, Nz // 2 -1] = 1
source.p0 = p0

but the logic is confusing.

@djps djps added the bug Something isn't working label Sep 11, 2024
@djps
Copy link
Collaborator Author

djps commented Sep 17, 2024

It appears that

if len(val) == 0 or np.sum(val != 0) == 0:

has np.sum(val !=0) which should be replaced by a statement with np.all() statement equivalent, as the setter overwrites things to None when it shouldn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant