Skip to content

Commit

Permalink
Skip volume translation for cubics; closes #1018
Browse files Browse the repository at this point in the history
  • Loading branch information
ibell committed Apr 8, 2016
1 parent cd996fb commit 64bd34f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/Backends/Cubics/CubicBackend.h
Expand Up @@ -206,6 +206,7 @@ class SRKBackend : public AbstractCubicBackend {
AbstractCubicBackend *get_copy(bool generate_SatL_and_SatV = true){
return new SRKBackend(cubic->get_Tc(),cubic->get_pc(),cubic->get_acentric(),cubic->get_R_u(),generate_SatL_and_SatV);
}
std::string backend_name(void){return "SRKBackend";}
};

class PengRobinsonBackend : public AbstractCubicBackend {
Expand Down Expand Up @@ -243,6 +244,7 @@ class PengRobinsonBackend : public AbstractCubicBackend {
AbstractCubicBackend * get_copy(bool generate_SatL_and_SatV = true){
return new PengRobinsonBackend(cubic->get_Tc(),cubic->get_pc(),cubic->get_acentric(),cubic->get_R_u(),generate_SatL_and_SatV);
}
std::string backend_name(void){return "PengRobinsonBackend";}
};

/**
Expand Down
24 changes: 13 additions & 11 deletions src/Backends/Helmholtz/VLERoutines.cpp
Expand Up @@ -1755,18 +1755,20 @@ void StabilityRoutines::StabilityEvaluationClass::successive_substitution(int nu
rhomolar_liq = HEOS.SatL->solver_rho_Tp_SRK(HEOS.T(), HEOS.p(), iphase_liquid); // [mol/m^3]
rhomolar_vap = HEOS.SatV->solver_rho_Tp_SRK(HEOS.T(), HEOS.p(), iphase_gas); // [mol/m^3]

// Use Peneloux volume translation to shift liquid volume
// As in Horstmann :: doi:10.1016/j.fluid.2004.11.002
double summer_c = 0, v_SRK = 1/rhomolar_liq;
for (std::size_t i = 0; i < z.size(); ++i){
// Get the parameters for the cubic EOS
CoolPropDbl Tc = HEOS.get_fluid_constant(i, iT_critical),
pc = HEOS.get_fluid_constant(i, iP_critical),
rhomolarc = HEOS.get_fluid_constant(i, irhomolar_critical);
CoolPropDbl R = 8.3144598;
summer_c += z[i]*(0.40768*R*Tc/pc*(0.29441 - pc/(rhomolarc*R*Tc)));
if (HEOS.backend_name().find("Helmholtz") == 0){
// Use Peneloux volume translation to shift liquid volume
// As in Horstmann :: doi:10.1016/j.fluid.2004.11.002
double summer_c = 0, v_SRK = 1/rhomolar_liq;
for (std::size_t i = 0; i < z.size(); ++i){
// Get the parameters for the cubic EOS
CoolPropDbl Tc = HEOS.get_fluid_constant(i, iT_critical),
pc = HEOS.get_fluid_constant(i, iP_critical),
rhomolarc = HEOS.get_fluid_constant(i, irhomolar_critical);
CoolPropDbl R = 8.3144598;
summer_c += z[i]*(0.40768*R*Tc/pc*(0.29441 - pc/(rhomolarc*R*Tc)));
}
rhomolar_liq = 1/(v_SRK - summer_c);
}
rhomolar_liq = 1/(v_SRK - summer_c);

for (int step_count = 0; step_count < num_steps; ++step_count){
// Set the composition
Expand Down

0 comments on commit 64bd34f

Please sign in to comment.