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

Check bc and source term validity at run time instead on assignment? #2468

Closed
jgostick opened this issue May 26, 2022 · 1 comment
Closed

Comments

@jgostick
Copy link
Member

Might it be more sensible to check for overlapping bcs and source terms at run time, rather than when the user sets them?

At the moment the set_rate_bc and set_value_bc methods, as well as the set_source method all make sure there are no collisions between BCs and sources. I wonder if it'd be more logical to just check these at run time using some _validate_bcs logic like we do with all the other validations.

The reason for doing this is that we probably SHOULD be checking at run time anyway, since it's technically possible to specify BCs by fiddling with the 'pore.bc_value' and 'pore.bc_rate' arrays directly anyway. So if we move the checks to runtime, then no problems will sneak past.

Downsides:

  • users don't get immediate feedback about errors

Upsides:

  • The code would be much simpler since all arrays would be 'final' and could be checked in one go.
@ma-sadeghi
Copy link
Member

I agree. Either we need to somehow prevent users from manually reaching into pore.bc_* arrays, which I don't think is a good idea, OR we need to defer the health check until runtime.

In other words, in its current form, OpenPNM could be silently misused.

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

2 participants