From afc3b83bd1e89411235c1da0480e2c1b00728a01 Mon Sep 17 00:00:00 2001 From: Axel Matstoms Date: Fri, 6 Feb 2026 11:25:58 +0100 Subject: [PATCH] Implement missing media properties in TableBased Add density_derT_p, density_derh_p, density_derp_T, density_derp_h and isobaricExpansionCoefficient. * density_derT_p is the derivative of the density polynomial. * density_derh_p is the derivative of the density polynomial divided by Cp. * density_derp_T is zero with the assumptions made in the model. * density_derp_h is zero when enthalpyOfT is true. * isobaricExpansionCoefficient beta = (1/V) * der(V, T) = rho * -der(rho, T) / rho^2 = -der(rho, T) / rho --- Modelica/Media/Incompressible.mo | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Modelica/Media/Incompressible.mo b/Modelica/Media/Incompressible.mo index a8bea31379..4f7341a669 100644 --- a/Modelica/Media/Incompressible.mo +++ b/Modelica/Media/Incompressible.mo @@ -364,6 +364,46 @@ which is only exactly true for a fluid with constant density d=d0. annotation(smoothOrder=2); end thermalConductivity; + redeclare function extends density_derp_h + "Return density derivative w.r.t. pressure at constant specific enthalpy" + algorithm + ddph := 0; // Correct if enthalpyOfT is true. + end density_derp_h; + + redeclare function extends density_derh_p + "Return density derivative w.r.t. specific enthalpy at constant pressure" + algorithm + ddhp := density_derT_p(state) / specificHeatCapacityCp(state); + end density_derh_p; + + + redeclare function extends density_derp_T + "Return density derivative w.r.t. pressure at constant temperature" + algorithm + ddpT := 0; // Incompressible + end density_derp_T; + + redeclare function extends density_derT_p + "Return density derivative w.r.t. temperature at constant pressure" + algorithm + ddTp := Polynomials.derivativeValue(poly_rho, if TinK then state.T else Cv.to_degC(state.T)); + end density_derT_p; + + redeclare function extends isobaricExpansionCoefficient + "Return isobaric expansion coefficient (beta) as a function of the thermodynamic state record" + algorithm + beta := -density_derT_p(state) / density(state); + annotation( + Documentation(info = "

The isobaric expansion coefficient beta is defined as

+
1/v * der(v,T)
+
+

with v = 1/d, at constant pressure p. +Using the chain rule:

+
1/v * der(v,T) = d * (-der(d, T) / d^2)
+= -der(d, T) / d

+")); + end isobaricExpansionCoefficient; + function s_T "Compute specific entropy" extends Modelica.Icons.Function; input Temperature T "Temperature";