Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/dfCanteraMixture/CanteraMixture.H
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,24 @@ public:
const scalar& T
) const
{
// for ideal gas, psi = CanteraGas_->density()/p = 1/RT
return CanteraGas_->density()/p;
const Cantera::AnyMap& map = CanteraGas_->input();
if(map["thermo"].asString()=="Peng-Robinson" || map["thermo"].asString()=="Redlich-Kwong")
{
// for non-ideal EoS, psi = \partial rho/ \partial p at constant enthalpy
// Currently, Peng-Robinson and Redlich-Kwong are available in Cantera
// The partial derivative was approximated using backward difference with a step size dx
double h0 = CanteraGas_->enthalpy_mass();
double dx = 0.0001;
double rho1 = CanteraGas_->density();
CanteraGas_->setState_HP(h0,p*(1-dx));
double rho2 = CanteraGas_->density();
return (rho1-rho2)/(dx*p);
}
else
{
// for ideal gas, psi = W/RT
return CanteraGas_->meanMolecularWeight()/CanteraGas_->RT();
}
}

scalar rho
Expand Down