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

Added function to handle None inputs in bcs #165

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

jcgraciosa
Copy link
Contributor

Added a method to SolverBaseClass to convert BCs inputted by the user as None into sympy.oo for subsequent use by the solver. Also added some type checks and handlers and it should not break the current example scripts (based on some tests).

@lmoresi
Copy link
Member

lmoresi commented Mar 5, 2024

Is this a fix for #149 ?

@jcgraciosa
Copy link
Contributor Author

Yes, it's a fix for #149. When declaring boundary conditions, the user should put in None if that corresponding component is unconstrained.

Also, the fix does not break the current examples (using sympy.oo for no constraints), but might be good idea if I'm allowed to change them soon.


import numpy as np

if hasattr(fn, "__len__"): # BC input is iterable (has __len__ attribute)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of python "duck" typing, let's just assume fn is list/tuple of length u.dim for now?

@lmoresi
Copy link
Member

lmoresi commented Apr 23, 2024

Checking - are you happy with this, @julesghub ? We should not leave the branch hanging forever.

@julesghub
Copy link
Member

Good point @lmoresi.
I'll test this against the new dev and see if it's compatible. Should be.

All conditions are now turned into a list before conversion.
Modifying test to test the conversion code.
@julesghub
Copy link
Member

@jcgraciosa, please review my changes and we can discuss further if needed.

Copy link
Contributor Author

@jcgraciosa jcgraciosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the changes.
Thanks for improving on the original version.

@julesghub julesghub merged commit 9dbd44a into underworldcode:development Apr 24, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants