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

introducing class Quantity #290

Merged
merged 6 commits into from
Aug 24, 2015
Merged

introducing class Quantity #290

merged 6 commits into from
Aug 24, 2015

Conversation

speth
Copy link
Member

@speth speth commented Aug 5, 2015

This is a class that I've wanted to exist for awhile, which makes it easy to compute the state when two solutions are combined, instead of repeating the tedious calculation of the weighted average properties in order to set the new state.

I'm pretty happy with this implementation, which generates wrappers for all the properties of class Solution automatically, but I wanted to see if there were any suggestions for improving the interface before I merge this into master.

@skyreflectedinmirrors
Copy link
Contributor

Ray,

This is a great addition!

The only comment I have is that it runs a bit counter to my intuition to allow the user to do something like this:

q1 = ct.Quantity(gas, mass=5)

q1.constant = ‘HP’

q1.equilibrate(‘UV’)

alternatively, the user might expect to be able to call:

q1 = ct.Quantity(gas, mass=5)

q1.constant = ‘HP’

q1.equilibrate() #this runs HP

I’m not sure what the proper solution for this is…

From: Ray Speth [mailto:notifications@github.com]
Sent: Wednesday, August 05, 2015 5:23 PM
To: Cantera/cantera
Subject: [cantera] introducing class Quantity (#290)

This is a class that I've wanted to exist for awhile, which makes it easy to compute the state when two solutions are combined, instead of repeating the tedious calculation of the weighted average properties in order to set the new state.

I'm pretty happy with this implementation, which generates wrappers for all the properties of class Solution automatically, but I wanted to see if there were any suggestions for improving the interface before I merge this into master.


You can view, comment on, or merge this pull request online at:

#290

Commit Summary

  • [Python] Basic implementation of class Quantity
  • [Python] Add docs for class Quantity
  • [Python] Quantity.equilibrate updates the Quantity's state
  • [Python] Add example demonstrating use of class Quantity

File Changes

Patch Links:


Reply to this email directly or view it on GitHub #290 . https://github.com/notifications/beacon/AGKhifM21tzPvoSa-UcO0haJDdEHmBDyks5oknY8gaJpZM4FmZsG.gif

@speth
Copy link
Member Author

speth commented Aug 5, 2015

Nick, Thanks for the feedback. I like the idea in your second example of using the constant property pair as the default for equilibrate, and have implemented it.

I don't think the first example is a problem -- if the user explicitly says they want to equilibrate using a different property pair, that's fine. I guess the question in this case is whether the value of constant should be updated automatically. I'm leaning toward no.

@skyreflectedinmirrors
Copy link
Contributor

Ray,

I agree that the value of constant shouldn’t be changed in the first case.

Nick

From: Ray Speth [mailto:notifications@github.com]
Sent: Wednesday, August 05, 2015 7:45 PM
To: Cantera/cantera
Cc: arghdos
Subject: Re: [cantera] introducing class Quantity (#290)

Nick, Thanks for the feedback. I like the idea in your second example of using the constant property pair as the default for equilibrate, and have implemented it.

I don't think the first example is a problem -- if the user explicitly says they want to equilibrate using a different property pair, that's fine. I guess the question in this case is whether the value of constant should be updated automatically. I'm leaning toward no.


Reply to this email directly or view it on GitHub #290 (comment) . https://github.com/notifications/beacon/AGKhiSoOF8PhGNgzdnOBL-4Z5FZbtUpoks5okpeMgaJpZM4FmZsG.gif

@speth speth merged commit a77b79b into Cantera:master Aug 24, 2015
@speth speth deleted the quantity branch September 3, 2015 19:23
@speth speth mentioned this pull request Nov 29, 2016
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