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

Type Error in IG Helmholz free energy due to certain properties specified #100

Open
jranalli opened this issue Dec 17, 2024 · 0 comments
Open
Labels

Comments

@jranalli
Copy link
Collaborator

Source: ig.py - L1742 and ig2.py - L1278

Basically, what's happening is that it's possible to reach that point without p having been defined when certain property sets are specified. Basically, when pairs not containing p are sent to _argparse, it can return None for p, which causes the division to fail.

The relevant pairs are:

  • Td, Tv, dh, vh, de, ve
    • These are all actually the same pair (T & d) because h and e are replaced by T early on.
    • One possible fix for this one is just calculating values for it, e.g. p = d * R * T on ig.py#L262 ig2.py#L247
  • ds, vs
    • Similar, you might insert p = d * R * T in ig.py#L235 and ig2.py#L220

As a more general issue, the fact that _argparse can return nulls could lead to future similar bugs. I would possibly suggest that the appropriate algebraic form of the ideal gas law should be inserted into each case of _argparse generally to ensure that T, p, and d are fully populated. In this case though, the issue is just that f specifically relies on a completed value of p. The other places where it looks like this would be an issue right now are:

  • s+p could leave d blank
  • T+p could leave d blank
@jranalli jranalli added the bug label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant