-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
[Thermo] Add property to call species charges in phase #863
Conversation
@korffdm ... Feel free to recylce the test! Simply replace |
Codecov Report
@@ Coverage Diff @@
## master #863 +/- ##
==========================================
- Coverage 71.57% 71.56% -0.02%
==========================================
Files 372 372
Lines 44501 44513 +12
==========================================
+ Hits 31851 31854 +3
- Misses 12650 12659 +9
Continue to review full report at Codecov.
|
This commit adds the ability for the user to call the charge of all species within a phase. This required updates to the phase source code and the Python wrapper files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on your first Cantera PR, @korffdm! I just have a few suggestions to improve this which I realized are mostly related to warts in the implementation of getMolecularWeights
, which this parallels.
One question I have which others may want to weigh in on is whether the names used here should just be charges
for the Python property and getCharges
for the C++ method, rather than species_charges
. There isn't anything else associated with a ThermoPhase
that can have a charge, right?
Change requests were made for Phase.cpp, ct.cpp, and Phase.h. These were mostly simplification changes to streamline the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these updates. I'd like to reiterate my earlier suggestion of removing the adjective "species" from the method/property names, since I think it should be clear that it's the species charges that are being returned.
Updated the property name to be just "charges" as well as simplifying the function 'getCharges' in Phase.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change here to the .m
file, but otherwise looks good to me.
% Vector of species charges. Units: elem. charge | ||
% | ||
|
||
ch = phase_get(tp.tp_id, 23); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a newline at the end of this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an extra line below line 12? I added that and pushed, but I'm not seeing it on my github repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least in my view (I think I'm using the new interface) it shows as a red circle with a line in it when there's no new line in the Files Changed view on the PR. The problem seems to be fixed by 32ec0f5 so it's all good. See here for a brief reasoning on why files should end with a blank line: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
Change requests were made for Phase.cpp, ct.cpp, and Phase.h. These were mostly simplification changes to streamline the code.
Change requests were made for Phase.cpp, ct.cpp, and Phase.h. These were mostly simplification changes to streamline the code.
Change requests were made for Phase.cpp, ct.cpp, and Phase.h. These were mostly simplification changes to streamline the code.
This commit adds the ability for the user to call the charge
of all species within a phase. This required updates to the
phase source code and the Python wrapper files.
Checklist
scons build
&scons test
) and unit tests address code coverageIf applicable, fill in the issue number this pull request is fixing
Fixes Cantera/enhancements#50
Similar to #862
Changes proposed in this pull request
ThermoPhase.species_charges
as a Property in the Python wrappermolecular_weights
codeNotes
In #862 there is already a test set up, is it possible to incorporate that test into this code or would a separate test need to be written for the approach used here?