Skip to content

Commit

Permalink
dT/dp along saturation: protect against division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
thorade committed May 3, 2020
1 parent 89c6b9b commit 797d72d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HelmholtzMedia/Interfaces/PartialHelmholtzMedium/package.mo
Expand Up @@ -1664,8 +1664,9 @@ protected
output DerTemperatureByPressure dTp;

algorithm
assert(sat.vap.s<>sat.liq.s, "liq and vap entropy identical", level=AssertionLevel.warning);
// Clausius-Clapeyron equation
dTp := (1.0/sat.vap.d-1.0/sat.liq.d)/(sat.vap.s-sat.liq.s);
dTp := (1.0/sat.vap.d-1.0/sat.liq.d)/max(Modelica.Constants.eps, (sat.vap.s-sat.liq.s));
annotation(Inline = true);
end saturationTemperature_derp_sat;

Expand Down

0 comments on commit 797d72d

Please sign in to comment.