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

Created a sample ThermoPhase.pyx #823

Closed
wants to merge 1 commit into from
Closed

Conversation

Arsh0508
Copy link

@Arsh0508 Arsh0508 commented Mar 21, 2020

Checklist

  • There is a clear use-case for this code change
  • The commit message has a short title & references relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • The pull request is ready for review

If applicable, fill in the issue number this pull request is fixing

Fixes #

Changes proposed in this pull request

@Arsh0508
Copy link
Author

@bryanwweber sir, I have wrote a demo wrapper for method/function "setState_PX" in class "ThermoPhase" in namespace "Cantera" supporting Pa and atm.
Please kindly review it once and if this is fine, I will extend it to other methods, units and classes.

Regards,
Arsh

@codecov
Copy link

codecov bot commented Mar 21, 2020

Codecov Report

Merging #823 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #823   +/-   ##
=======================================
  Coverage   71.39%   71.39%           
=======================================
  Files         372      372           
  Lines       43482    43482           
=======================================
  Hits        31045    31045           
  Misses      12437    12437           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c16c4b0...0a884a9. Read the comment docs.

@bryanwweber
Copy link
Member

@Arsh0508 I'm not sure this is a good approach. The problem is, what if a user wants to input pounds per square inch? Or pounds per square foot? Or kPa? Or... Hopefully you can see how treating each of these individually will be unsustainable. Moreover, this would have to be done for every method that requires units, which would be a lot of work.

Instead, I think a better approach will be to use something like Pint (as mentioned on Cantera/enhancements#3) and its ureg.wraps() method. In addition, I think it would be best to automatically generate the appropriate Python code that wraps each method in the .pyx files.

Hope it helps!

@Arsh0508
Copy link
Author

@bryanwweber sir, though I haven't really worked with Pint in the past, but I sure will check that out right away and then write a demo cython code using the ureg.wraps() method, if you prefer it that way and get back to you.

Thanks for taking time off your schedule to review it!

@bryanwweber
Copy link
Member

Superseded by #825

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.

2 participants