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

dalpha0_dxi is wrong #1199

Closed
ibell opened this issue Aug 23, 2016 · 0 comments
Closed

dalpha0_dxi is wrong #1199

ibell opened this issue Aug 23, 2016 · 0 comments
Milestone

Comments

@ibell
Copy link
Contributor

ibell commented Aug 23, 2016

Used the incorrect critical temps/densities:

CoolPropDbl MixtureDerivatives::dalpha0_dxi(HelmholtzEOSMixtureBackend &HEOS, std::size_t i, x_N_dependency_flag xN_flag)
{
    // Reducing values are constant for all components under consideration
    double Tr = HEOS.T_reducing();
    double rhor = HEOS.rhomolar_reducing();

    // Values for the i-th component
    double Tci = HEOS.get_fluid_constant(i, iT_critical);
    double rhoci = HEOS.get_fluid_constant(i, irhomolar_critical);
    double tau_oi = HEOS.tau()*Tci/Tr;
    double delta_oi = HEOS.delta()*rhor/rhoci;
    double Rratioi = 1;//HEOS.gas_constant()/HEOS.components[i].EOS().R_u;

    double term = Rratioi*HEOS.components[i].EOS().alpha0.base(tau_oi, delta_oi) + log(HEOS.mole_fractions[i]);

    std::size_t kmax = HEOS.mole_fractions.size();
    if (xN_flag == XN_DEPENDENT){ kmax--; }
    for (std::size_t k = 0; k < kmax; ++k){
        double xk = HEOS.mole_fractions[k];
        double Tck = HEOS.get_fluid_constant(k, iT_critical);
        double rhock = HEOS.get_fluid_constant(k, irhomolar_critical);
        double tau_ok = HEOS.tau()*Tck / Tr;
        double delta_ok = HEOS.delta()*rhor / rhock;
        double dtauok_dxi = -tau_ok / Tr*HEOS.Reducing->dTrdxi__constxj(HEOS.mole_fractions, i, xN_flag); // (Gernert, supp, B.19)
        double ddeltaok_dxi = delta_ok / rhor*HEOS.Reducing->drhormolardxi__constxj(HEOS.mole_fractions, i, xN_flag); // (Gernert, supp. B.20)

        double Rratiok = 1;//HEOS.gas_constant()/HEOS.components[k].EOS().R_u;
        double dalpha0_ok_dxi = HEOS.components[k].EOS().alpha0.dTau(tau_ok, delta_ok)*dtauok_dxi + HEOS.components[k].EOS().alpha0.dDelta(tau_ok, delta_ok)*ddeltaok_dxi;
        term += xk*(Rratiok*dalpha0_ok_dxi + 1/xk*Kronecker_delta(k,i));
    }
    return term;
}
@ibell ibell modified the milestone: v6.1 Aug 24, 2016
@ibell ibell closed this as completed in 5a92002 Aug 24, 2016
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

No branches or pull requests

1 participant