-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Add speed of sound property for ThermoPhase #1491
Conversation
I have a preference for |
Thanks, @corykinney. I think that adding this property is useful, especially when accompanied with implementations for phases other than the ideal gas model, where it's a non-trivial calculation. I agree that "speed" is preferable to "velocity", but I think calling this the "equilibrium" sound speed would be a misnomer, since the speed is not being computed while holding the mixture at chemical equilibrium. We even have an example illustrating this difference (sound_speed.py). |
Yes, frozen was the term I was looking for, not equilibrium. I can rename them to |
63d4330
to
2209329
Compare
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.
@corykinney ... thanks for the PR. Before a more in-depth review, could you please look into the failing tests? Most likely, you need to (i) add sound_speed
to the list of _scalar
definitions within the SolutionArray
class in composite.py
(around line 585), and (ii) add sound_speed
to the scalar property _attr
list in onedim.py
(around line 770).
Codecov Report
@@ Coverage Diff @@
## main #1491 +/- ##
==========================================
+ Coverage 69.76% 70.30% +0.53%
==========================================
Files 377 376 -1
Lines 58017 58261 +244
Branches 20701 20804 +103
==========================================
+ Hits 40477 40960 +483
+ Misses 14585 14316 -269
- Partials 2955 2985 +30
... and 24 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Looks like that fixed the failing checks! |
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.
Hi @corykinney ... thanks for fixing CI - I'm happy that this did the trick! Changes look mostly good to me.
The only other thing I'd ask you to update is the Python example sound_speed.py so it uses the new built-in function for the check with afrozen2
. Also, please make sure to update the requires
in the header.
@ischoegl I updated the example as requested (assuming this change will make it into 3.0.0). Also, I saw that there was a sound_speed_units.py example as well, so I believe I implemented the units for |
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, @corykinney ... this looks good from my side. I'll leave it open for a couple of days in case anyone else has anything to add.
@corykinney ... it looks like there now is a merge conflict due to recent upstream changes (#1501 moved consistency tests to a separate test). Could you rebase? |
4e5de23
to
852d1f9
Compare
@ischoegl Just force pushed with the rebased commits |
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, @corykinney, and my apologies for introducing the merge conflict with this. I had just one small suggestion before this is merged.
852d1f9
to
3035131
Compare
Thanks for the quick update, @corykinney. However, I think your commits are now out of order, such that building from some of the intermediate ones will fail. I think it should be:
|
Add ThermoPhase::soundSpeed virtual function with documentation Add IdealGasPhase implementation Add to cython interface Add units declaration
Add definitions of soundSpeed RedlichKwongMFTP and PengRobinson classes
Add finite difference check for soundSpeed
Updated sound_speed.py and sound_speed_units.py to check against the new built-in function
3035131
to
ecdac2a
Compare
@speth The changes should be grouped and ordered properly now. Thanks for your patience! Let me know if there is anything else. |
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 taking care of these details, @corykinney!
Changes proposed in this pull request
ThermoPhase::soundVelocity
virtual function that returns the equilibrium speed of sound in m/s.c_eq_sqrt_dP_drho_const_s
IdealGasPhase
,RedlichKwongMFTP
, andPengRobinson
Marking this as a draft to see if this would be useful or not. I'm also not sure whether
soundVelocity
is the best name, I also consideredsoundSpeed
andequilibriumSoundSpeed
, or something else could be better. I'm also not certain ifThermoPhase
is the best place for it, and I'm not positive I added it to the cython interface properly.If applicable, provide an example illustrating new features this pull request is introducing
Checklist
scons build
&scons test
) and unit tests address code coverage