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

[Reactor] clarify FlowDevice interface #667

Merged
merged 1 commit into from
Aug 5, 2019

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jul 2, 2019

This PR seeks to clarify the FlowDevice interface; specifically, the implementation of Valve.set_pressure_coeff was non-intuitive (misleading function name and partially incorrect doc string)

Please fill in the issue number this pull request is fixing:

Fixes #666

(also: addresses comment in #587, and prepares fix needed for #665)

Changes proposed in this pull request:

  • differentiate Valve::setValveCoeff from PressureController::setPressureCoeff
  • introduce Valve::setValveLift for time-dependent valve opening/closing
  • introduce Valve.set_valve_function to eliminate Valve.valve_coeff(Func1) being erroneously applied to Valve::setFunction
  • introduce properties Valve.valve_coeff / PressureController.pressure_coeff in Cython interface and deprecate Valve.set_pressure_coeff / PressureController.set_pressure_coeff (which is consistent with coefficient handling used by other zeroD objects)
  • deprecate corresponding function calls in clib interface
  • deprecate FlowDevice.setParameters (which was only used by MATLAB interface)

@ischoegl ischoegl changed the title [Reactor] clarified FlowDevice interface [Reactor] clarify FlowDevice interface Jul 2, 2019
@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch 3 times, most recently from b9d66e4 to 0bf3bf0 Compare July 2, 2019 22:06
@codecov
Copy link

codecov bot commented Jul 2, 2019

Codecov Report

Merging #667 into master will decrease coverage by 0.03%.
The diff coverage is 51.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #667      +/-   ##
==========================================
- Coverage   70.66%   70.62%   -0.04%     
==========================================
  Files         372      372              
  Lines       43507    43564      +57     
==========================================
+ Hits        30744    30768      +24     
- Misses      12763    12796      +33
Impacted Files Coverage Δ
src/clib/ctreactor.cpp 6.48% <0%> (-0.52%) ⬇️
include/cantera/zeroD/flowControllers.h 87.09% <100%> (+15.66%) ⬆️
src/zeroD/FlowDevice.cpp 94.44% <100%> (+0.32%) ⬆️
include/cantera/zeroD/FlowDevice.h 33.33% <6.66%> (-14.5%) ⬇️
src/zeroD/flowControllers.cpp 94.11% <95%> (-1.72%) ⬇️
src/transport/GasTransport.cpp 90.58% <0%> (+0.2%) ⬆️

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 7523022...1748996. Read the comment docs.

@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch 3 times, most recently from 5724346 to bfab8a0 Compare July 2, 2019 22:16
@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch from bfab8a0 to 7a5bef8 Compare August 2, 2019 14:22
Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

I think having valve flow rate be a function of both time and the pressure difference will be a nice addition. The implementation looks good to me. I just had a few comments, mainly about the terminology used for the new functions.

include/cantera/clib/ctreactor.h Show resolved Hide resolved
include/cantera/zeroD/flowControllers.h Outdated Show resolved Hide resolved
include/cantera/zeroD/flowControllers.h Outdated Show resolved Hide resolved
include/cantera/zeroD/flowControllers.h Outdated Show resolved Hide resolved
interfaces/cython/cantera/reactor.pyx Outdated Show resolved Hide resolved
interfaces/cython/cantera/reactor.pyx Outdated Show resolved Hide resolved
@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch 2 times, most recently from 276a974 to ed4c564 Compare August 4, 2019 14:56
src/clib/ctreactor.cpp Outdated Show resolved Hide resolved
@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch 7 times, most recently from aba17ff to e6aa1a1 Compare August 5, 2019 16:14
@ischoegl
Copy link
Member Author

ischoegl commented Aug 5, 2019

@speth ... thanks for the review! Your comment and suggestion regarding the naming convention led me to clarify further, and I believe the interface is even clearer now: using a coefficient plus set_time_function and set_pressure_function there is no ambiguity left. Internally, all FlowDevice objects use the same approach (i.e. coefficient multiplied with function(s)). I also tested associated changes of clib from Matlab.

You are correct that those changes were necessary to properly address #665.

On a separate note: on my last merged PR (#660) for some reason my author tag was overwritten (no idea how a rebase/fixup may cause this: a squash is the likely culprit). The effect is that the commits aren't associated with @ischoegl: the associated sha's are d263566 and 77295b2. I can't fix this myself at this point, but I'm also not sure whether it matters and/or that it needs to be changed.

include/cantera/zeroD/FlowDevice.h Show resolved Hide resolved
include/cantera/zeroD/FlowDevice.h Show resolved Hide resolved
include/cantera/zeroD/flowControllers.h Outdated Show resolved Hide resolved
@speth
Copy link
Member

speth commented Aug 5, 2019

@ischoegl The issue with commit ownership applies to this PR as well -- the "commiter" will get reset to me (or whoever merges this PR), but the "author" field will be preserved. The problem is that your "author" information is using your GMail address, while the "committer" field is using your LSU address (which I guess is your primary address on GitHub). After updating your Git configuration, you can reset this for this commit by doing git commit --amend --reset-author.

@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch from e6aa1a1 to 7c8dc8e Compare August 5, 2019 19:02
@ischoegl
Copy link
Member Author

ischoegl commented Aug 5, 2019

Thanks for the clarification: I will fix that momentarily (both here and for #676). It's highly confusing as my commits still show up with my tag.

@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch from 7c8dc8e to ce8a13f Compare August 5, 2019 19:10
 * differentiated Valve::setValveCoeff from PressureController::setPressureCoeff
 and introduced MassFlowController::setMassFlowCoeff for consistency.
 * introduced FlowDevice::setTimeFunction and FlowDevice::setPressureFunction to
 differentiate time-dependent and pressure-dependent functions.
 * introduced arbitrary pressure dependence for PressureController
 * deprecated FlowDevice::setFunction which is replaced by time and pressure
 specific functions.
 * introduced properties Valve.valve_coeff / PressureController.pressure_coeff /
 MassFlowController.mass_flow_coeff in Cython interface and deprecated
 Valve.set_pressure_coeff / PressureController.set_pressure_coeff
 * deprecated corresponding function calls in clib interface
 * deprecate FlowDevice.setParameters (which was only used by MATLAB interface)
@ischoegl ischoegl force-pushed the consistent-FlowDevice-objects branch from ce8a13f to 1748996 Compare August 5, 2019 19:35
@ischoegl
Copy link
Member Author

ischoegl commented Aug 5, 2019

Alright. I changed my primary address to my work and made sure that the commit shows the same. (Until now, I had my primary address set to gmail, which I used to set my account up years ago.) Let's see what happens ... .
EDIT: mystery solved ... typo in e-mail address (!)

@ischoegl ischoegl closed this Aug 5, 2019
@ischoegl ischoegl reopened this Aug 5, 2019
@speth speth merged commit bc8b4be into Cantera:master Aug 5, 2019
@speth
Copy link
Member

speth commented Aug 5, 2019

The one remaining to-do for this change is to update the "science" documentation for the reactor model on cantera.org (https://cantera.org/science/reactors.html#reactor-networks-and-devices).

@ischoegl
Copy link
Member Author

ischoegl commented Aug 5, 2019

@speth ... I can tackle this, but need to know how the docs are generated? Is there a primer you can direct me to?

@bryanwweber
Copy link
Member

The restructuredText documents are stored in the Cantera/cantera-website repo. That file will be in the pages/science/reactors.rst I think (sorry no links, I'm on my phone).

@ischoegl
Copy link
Member Author

ischoegl commented Aug 7, 2019

@bryanwweber ... when is an appropriate time to change the cantera website for features only implemented in the development branch?

@bryanwweber
Copy link
Member

That's a great question. I think the best thing to do is mark the updates as "development version only", to the extent that you can do that without deleting existing content. Anything that will be removed should be marked as deprecated or changed somehow. Let's try that out and see how it goes.

@ischoegl
Copy link
Member Author

ischoegl commented Aug 8, 2019

@bryanwweber ... would it make sense to create a branch that holds information until 2.5 goes live? (there are obviously multiple ways of handling this)

@bryanwweber
Copy link
Member

I think (maybe?) it would make sense for the information to be deployed now, but clearly marked as for the development version only. But let's move this conversation over to the website repo.

@ischoegl ischoegl deleted the consistent-FlowDevice-objects branch October 5, 2019 00:11
ischoegl added a commit to ischoegl/cantera-website that referenced this pull request Sep 1, 2020
Descriptions of mass flow devices (`Valve`, `MassFlowController` and
`PressureController`) are updated due to changes in Cantera/cantera#667.
ischoegl added a commit to ischoegl/cantera-website that referenced this pull request Sep 1, 2020
Descriptions of mass flow devices (`Valve`, `MassFlowController` and
`PressureController`) are updated due to changes in Cantera/cantera#667.
ischoegl added a commit to ischoegl/cantera-website that referenced this pull request Sep 1, 2020
Descriptions of mass flow devices (`Valve`, `MassFlowController` and
`PressureController`) are updated due to changes in Cantera/cantera#667.
speth pushed a commit to Cantera/cantera-website that referenced this pull request Feb 12, 2021
Descriptions of mass flow devices (`Valve`, `MassFlowController` and
`PressureController`) are updated due to changes in Cantera/cantera#667.
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.

Create consistent approach for FlowDevice parameters/functions
3 participants