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

Testing pcsaft #1883

Open
wants to merge 506 commits into
base: master
Choose a base branch
from
Open

Testing pcsaft #1883

wants to merge 506 commits into from

Conversation

zmeri
Copy link
Contributor

@zmeri zmeri commented Dec 19, 2019

Requirements

  • Fill out this template to the extent possible so that this PR can be reviewed in a timely manner.
  • Replace the bracketed text below with your own.
  • All new code requires tests to ensure against regressions.

Description of the Change

Renamed entropy, enthalpy, and Gibbs energy functions for PC-SAFT because they only calculate the residual properties.

Benefits

Clarity

Possible Drawbacks

[ What are the possible side-effects or negative impacts of the code change? ]

Verification Process

I ran the unit tests. The PC-SAFT unit tests passed (except for the entropy test, which has a separate issue that needs to be fixed), and the other test that failed did not seem related to the changes made.

Applicable Issues

[ Enter any applicable Issues here. Use Closes #???? if this PR closes an open issue. ]

jowr and others added 30 commits October 24, 2018 21:51
* Free input strings in Mathematica interface
@@ -548,6 +552,10 @@ double AbstractState::hmolar(void){
if (!_hmolar) _hmolar = calc_hmolar();
return _hmolar;
}
double AbstractState::hmolar_residual(void){
Copy link
Contributor

Choose a reason for hiding this comment

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

also nice

@ibell
Copy link
Contributor

ibell commented Jan 16, 2020

Nice work!!!!

Can you please make some changes to the smolar_residual handling as I indicated by the comments? I should have been more explicit, but all residual properties in CoolProp/REFPROP are always defined as X^r(T,rho) = X(T,rho) - X^{(ig)}(T,rho), so I don't think we should fiddle with the public residual methods in the AbstractState. I would fully endorse updating the docs to make clear that this is what is actually calculated for smolar_residual. It would be good though to do what you started and make smolar_residual a generic method that calls calc_smolar_residual, and then calc_smolar_residual can have a default implementation that can be overwritten by other backends (e.g. PC-SAFT). Any changes to the abstract base class needs to have some discussion before those changes are made, since it might have some surprising side-effects.

@ibell
Copy link
Contributor

ibell commented Jan 16, 2020

But adding the residual methods as you did is a good idea, can you also add the default implementations?

@@ -556,6 +564,10 @@ double AbstractState::smolar(void){
if (!_smolar) _smolar = calc_smolar();
return _smolar;
}
double AbstractState::smolar_residual_trho(void){
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove this function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I will fix that.

case iHmass:
return hmass();
case iSmolar:
return smolar();
case iSmolar_residual:
return gas_constant()*(tau()*dalphar_dTau() - alphar());
case iSmolar_residual_trho:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should go back to smolar_residual

@@ -421,6 +423,8 @@ double AbstractState::keyed_output(parameters key)
return umass();
case iGmolar:
return gibbsmolar();
case iGmolar_residual:
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! Good idea

CoolPropDbl calc_gibbsmolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);

CoolPropDbl calc_helmholtzmolar(void);
CoolPropDbl calc_cpmolar_idealgas(void);
CoolPropDbl calc_pressure_nocache(CoolPropDbl T, CoolPropDbl rhomolar);
CoolPropDbl calc_smolar(void);
CoolPropDbl calc_smolar_nocache(CoolPropDbl T, CoolPropDbl rhomolar);

CoolPropDbl calc_smolar_residual_trho(void) { return gas_constant()*(tau()*dalphar_dTau() - alphar()); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, this is the right approach for the default implementation

@@ -40,7 +40,9 @@ const parameter_info parameter_info_list[] = {
{iCvmass, "Cvmass", "O", "J/kg/K", "Mass specific constant volume specific heat", false},
{iCp0molar, "Cp0molar", "O", "J/mol/K", "Ideal gas molar specific constant pressure specific heat",false},
{iCp0mass, "Cp0mass", "O", "J/kg/K", "Ideal gas mass specific constant pressure specific heat",false},
{iSmolar_residual, "Smolar_residual", "O", "J/mol/K", "Residual molar entropy (sr/R = tau*dar_dtau-ar)",false},
Copy link
Contributor

Choose a reason for hiding this comment

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

Please put this back, but maybe write sr/R = s(T,rho)-s^0(T,rho) instead of what I did

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

@ibell
Copy link
Contributor

ibell commented Apr 9, 2020

I think this PR can be closed, right?

@zmeri
Copy link
Contributor Author

zmeri commented Apr 9, 2020 via email

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.

None yet