Fix initialization of cached elements in Helmholtz terms

This commit is contained in:
Ian Bell
2015-08-23 21:27:42 -06:00
parent 0be1f39a4f
commit 6cb6b29b81
2 changed files with 13 additions and 11 deletions

View File

@@ -1099,21 +1099,23 @@ void HelmholtzEOSMixtureBackend::post_update()
CoolPropDbl HelmholtzEOSMixtureBackend::calc_Bvirial()
{
return 1/get_reducing_state().rhomolar*calc_alphar_deriv_nocache(0,1,mole_fractions,_tau,1e-12);
return 1/rhomolar_reducing()*calc_alphar_deriv_nocache(0,1,mole_fractions,_tau,1e-12);
}
CoolPropDbl HelmholtzEOSMixtureBackend::calc_dBvirial_dT()
{
CoolPropDbl dtau_dT =-get_reducing_state().T/pow(_T,2);
return 1/get_reducing_state().rhomolar*calc_alphar_deriv_nocache(1,1,mole_fractions,_tau,1e-12)*dtau_dT;
SimpleState red = get_reducing_state();
CoolPropDbl dtau_dT =-red.T/pow(_T,2);
return 1/red.rhomolar*calc_alphar_deriv_nocache(1,1,mole_fractions,_tau,1e-12)*dtau_dT;
}
CoolPropDbl HelmholtzEOSMixtureBackend::calc_Cvirial()
{
return 1/pow(get_reducing_state().rhomolar,2)*calc_alphar_deriv_nocache(0,2,mole_fractions,_tau,1e-12);
return 1/pow(rhomolar_reducing(),2)*calc_alphar_deriv_nocache(0,2,mole_fractions,_tau,1e-12);
}
CoolPropDbl HelmholtzEOSMixtureBackend::calc_dCvirial_dT()
{
CoolPropDbl dtau_dT =-get_reducing_state().T/pow(_T,2);
return 1/pow(get_reducing_state().rhomolar,2)*calc_alphar_deriv_nocache(1,2,mole_fractions,_tau,1e-12)*dtau_dT;
SimpleState red = get_reducing_state();
CoolPropDbl dtau_dT =-red.T/pow(_T,2);
return 1/pow(red.rhomolar,2)*calc_alphar_deriv_nocache(1,2,mole_fractions,_tau,1e-12)*dtau_dT;
}
void HelmholtzEOSMixtureBackend::p_phase_determination_pure_or_pseudopure(int other, CoolPropDbl value, bool &saturation_called)
{