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

Implementation of Peng-Robinson EoS (Revised) #1047

Merged
merged 66 commits into from
Jul 21, 2021

Conversation

gkogekar
Copy link
Member

This is a more cleaned up version of the Peng-Robinson EoS implementation.
(Original PR: #641).

@speth
Copy link
Member

speth commented Jun 6, 2021

I'd like to suggest not using the button to accept and commit suggested changes - it really generates a cluttered commit history.

@codecov
Copy link

codecov bot commented Jun 29, 2021

Codecov Report

Merging #1047 (c32fa84) into main (1420a4c) will increase coverage by 0.38%.
The diff coverage is 87.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1047      +/-   ##
==========================================
+ Coverage   73.07%   73.45%   +0.38%     
==========================================
  Files         358      362       +4     
  Lines       46956    47554     +598     
==========================================
+ Hits        34311    34929     +618     
+ Misses      12645    12625      -20     
Impacted Files Coverage Δ
include/cantera/thermo/MixtureFugacityTP.h 0.00% <ø> (ø)
include/cantera/thermo/RedlichKwongMFTP.h 100.00% <ø> (ø)
src/thermo/MixtureFugacityTP.cpp 41.86% <68.71%> (+13.55%) ⬆️
src/thermo/RedlichKwongMFTP.cpp 84.91% <84.00%> (+6.46%) ⬆️
src/thermo/PengRobinson.cpp 88.26% <88.26%> (ø)
include/cantera/thermo/PengRobinson.h 100.00% <100.00%> (ø)
src/thermo/ThermoFactory.cpp 82.16% <100.00%> (+0.05%) ⬆️
test/thermo/PengRobinson_Test.cpp 100.00% <100.00%> (ø)
test/thermo/cubicSolver_Test.cpp 100.00% <100.00%> (ø)
test/thermo/thermoFromYaml.cpp 100.00% <100.00%> (ø)
... and 5 more

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 1420a4c...c32fa84. Read the comment docs.

Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

Just a few formatting comments here, the biggest one is a source for the value of omega in the critProperties.xml file.

data/inputs/critProperties.xml Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
include/cantera/thermo/PengRobinson.h Outdated Show resolved Hide resolved
src/thermo/PengRobinson.cpp Outdated Show resolved Hide resolved
@bryanwweber
Copy link
Member

Please also add yourself to the AUTHORS file! 🎉

Gandhali Kogekar and others added 14 commits July 20, 2021 18:19
Co-authored-by: Steven DeCaluwe <[email protected]>
Co-authored-by: Ray Speth <[email protected]>
…tureFugacityTP

Co-authored-by: Ray Speth <[email protected]>
Co-authored-by: Gandhali Kogekar <[email protected]>
- Creates CO2-PR phase in test/data/thermo-models.yaml
- Creates `PengRobinson_CO2` test in test/thermo/thermoFromYAML.cpp
- Fixes minor capitalization typo in PengRobinson:calculateAlpha
Deletes CO2 interaction parameters from co2_PR_example.yaml, such that
phase construction in PengRobinson_Test.cpp covers the cirtical property
lookup capabilities in PengRobinson::getCoeff. Note that this required
changing some of the regression test expected values, as the critical
properties don't correspond perfectly with the interaction parameters
previously stored in co2_PR_exmple.yaml.
1. g = h- T*s
2. cp = dH/dT at constant pressure using Finite difference method
3. molar enthalpy = \sum x_k h_k
-Temperature input not needed in PengRobinson:calculateAB
-Unused variable RT in PengRobinson_Test/totalEnthalpy
-Replacing duplicative code with call to calcualteAB
gkogekar and others added 21 commits July 20, 2021 18:19
Test that mole-fraction weighted sum of partial molar properties
equals the total, and that the identites h_k = u_k - P * v_k and
g_k = h_k - T * s_k are satisfied.
Test using a mixture with multiple components, and at a pressure where
some non-ideal effects will be present.
The temperatures used to calculate RT were inconsistent with the input
temperature values.
molar entropies are now evaluated using the equation: hk - t*sk = gk.
Also fixed an error in d2aAlpha_DT2 calculation
Co-authored-by: Steven C. DeCaluwe <[email protected]>

Simplifying d(aAlpha)/dT function for a multicomponent mixture

Co-authored-by: Steven C. DeCaluwe <[email protected]>

Using mixing coefficients a_ij instead of sqrt(a_ii*a_jj)

Co-authored-by: Steven C. DeCaluwe <[email protected]>

Simplifying d2(aAlpha)/dT2 function

Co-authored-by: Steven C. DeCaluwe <[email protected]>
… the

derivative term for aAlpha was missing in the calculation.
Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

Great work here @gkogekar! Thanks @speth and @decaluwe for the detailed reviews as well.

@bryanwweber bryanwweber merged commit 79ea42d into Cantera:main Jul 21, 2021
@decaluwe
Copy link
Member

🎉

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.

4 participants