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

Include a units package to clarify values (possibly Python only) #3

Closed
GoogleCodeExporter opened this issue Mar 26, 2015 · 17 comments
Closed
Labels
feature-request New feature request gsoc-idea work-in-progress An enhancement that someone is currently working on

Comments

@GoogleCodeExporter
Copy link

After just spending way too much time looking for an error caused by my wrong 
use of units, I suggest including a units package. Thus, you could e.g. 
determine much more easy what gas.viscosity is;)

Possibly, this would make sense for the Python interface only. There are 
several packages available (numericalunits, pint, units). I personally became a 
big fan of pint (https://pint.readthedocs.org).

However, I don't know if the wrapping of the C++ code makes things more 
difficult. It surely is low-priority. But it would still be a cool feature.

Original issue reported on code.google.com by thetruet...@googlemail.com on 29 Jan 2014 at 9:58

@GoogleCodeExporter
Copy link
Author

I don't think that integration of a units package into cantera is necessary, as 
units are as far as I am aware consistent within cantera, and documentation of 
units (at least of r2710) is available through python's help function 
(generated from the original .pyx files in 
<cantera-src>/interfaces/cython/cantera).

Original comment by ischo...@gmail.com on 30 Jan 2014 at 4:03

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

You're right, it is pretty nice that cantera is unit-consistent (and SI). The 
documentation of the units is also pretty good, although a little cumbersome 
(like gas.viscosity? does not give you any useful help, but you have to find 
your way to cantera.transport.viscosity? - or am I doing something cumbersome 
myself here?)

The advantage of using a units-package would be that the user is forced to 
enter the right units, and can easily convert it to other units.

This is surely not an essential feature and also possibly annoying for some 
people. It's just an idea.

Original comment by thetruet...@googlemail.com on 30 Jan 2014 at 5:27

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

I wouldn't be opposed to providing a set of wrapped classes that worked with 
dimensioned values, but I think the main Cantera classes should remain as is. 
It would probably even be possible to generate the classes somewhat 
programatically.

As far accessing the documentation in IPython goes, this is unfortately what 
always happens when using properties. That is, you get the docstring for 
whatever "gas.viscosity" returns, in this case a float, rather than the 
docstring for the property. The other option besides using 
"Solution.viscosity?" is to do "gas.__class__.viscosity?" which is also 
somewhat cumbersome, but doesn't require you to know the type of the underlying 
object.

Original comment by yarmond on 31 Jan 2014 at 3:59

  • Added labels: Component-Python, Priority-Low
  • Removed labels: OpSys-Linux, Priority-Medium

@bryanwweber
Copy link
Member

This seems like it wouldn't be too difficult, if we wanted to use Pint and their idea of "Wrapped functions": https://pint.readthedocs.org/en/0.6/wrapping.html

@mm-git01
Copy link

mm-git01 commented Mar 7, 2018

@bryanwweber saw that this was listed as a idea for gsoc,would love to work on this

@CyberDrudge
Copy link

@bryanwweber I would like to work on implementing this in GSoC this year.

@bryanwweber
Copy link
Member

@CyberDrudge Great! I'll be happy to work with you on your application once the student applications open up. Please feel free to send an email to the email associated with my profile once you get started.

@CyberDrudge
Copy link

@bryanwweber I have my exams starting next week so i wont have much time for next 2 weeks. I am a bit familiar with pint, but would like to take a look at other packages too, before finalising which package to implement. I'll get back to you soon.

@speth speth transferred this issue from Cantera/cantera Dec 2, 2019
@speth speth added the feature-request New feature request label Dec 6, 2019
@bryanwweber
Copy link
Member

From the GSoC idea issue #36:

Idea

Nearly all calculations in Cantera are done in SI units (K, Pa, kg, kmol), and the units of quantities available to the user are also in SI units. Although this is the most useful general case, it would be helpful if users could input other units to Cantera functions and the conversion to SI is done internally before conducting calculations. This project would implement a wrapper around Cantera classes and/or functions to enable the use of alternative units transparently.

Difficulty

Medium-Easy

Required Knowledge

Python

Mentors

@bryanwweber

@shrey27tri01
Copy link

shrey27tri01 commented Feb 25, 2020

@bryanwweber I would like to contribute this year in GSoC; would like to implement this idea.

@bryanwweber
Copy link
Member

@shrey27tri01 @BugsBunny0 Hello, welcome to Cantera. Please see our wiki page about GSoC 2020 for more information about applying. Thanks for your interest.

@Arsh0508
Copy link

@bryanwweber sir, I would love to work on this project for GSoC 2020. I was hoping, if you could kindly guide me on how to proceed with this?

@bryanwweber
Copy link
Member

@Arsh0508 Please see my previous comment and the links there.

@Arsh0508
Copy link

Arsh0508 commented Mar 10, 2020

@bryanwweber Sir, I was hoping if you could help me get started with it as I'm unable to find the repo where I am supposed to implement the wrapper in, so can you kindly please provide me a link to that.

@bryanwweber
Copy link
Member

@Arsh0508 the main Cantera repository is at https://github.com/Cantera/cantera. Is that what you needed?

@Arsh0508
Copy link

@bryanwweber yes sir, thanks a lot!!

@bryanwweber bryanwweber added the work-in-progress An enhancement that someone is currently working on label Mar 8, 2021
@ischoegl
Copy link
Member

Superseded by #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request gsoc-idea work-in-progress An enhancement that someone is currently working on
Projects
None yet
Development

No branches or pull requests

8 participants