Skip to content

Commit 3ad2a45

Browse files
modelica#4738 Implement missing media properties in TableBased
1 parent 2c0d22b commit 3ad2a45

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Modelica/Media/Incompressible.mo

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,46 @@ which is only exactly true for a fluid with constant density d=d0.
364364
annotation(smoothOrder=2);
365365
end thermalConductivity;
366366

367+
redeclare function extends density_derp_h
368+
"Return density derivative w.r.t. pressure at constant specific enthalpy"
369+
algorithm
370+
ddph := 0; // Correct if enthalpyOfT is true.
371+
end density_derp_h;
372+
373+
redeclare function extends density_derh_p
374+
"Return density derivative w.r.t. specific enthalpy at constant pressure"
375+
algorithm
376+
ddhp := density_derT_p(state) / specificHeatCapacityCp(state);
377+
end density_derh_p;
378+
379+
380+
redeclare function extends density_derp_T
381+
"Return density derivative w.r.t. pressure at constant temperature"
382+
algorithm
383+
ddpT := 0; // Incompressible
384+
end density_derp_T;
385+
386+
redeclare function extends density_derT_p
387+
"Return density derivative w.r.t. temperature at constant pressure"
388+
algorithm
389+
ddTp := Polynomials.derivativeValue(poly_rho, if TinK then state.T else Cv.to_degC(state.T));
390+
end density_derT_p;
391+
392+
redeclare function extends isobaricExpansionCoefficient
393+
"Return isobaric expansion coefficient (beta) as a function of the thermodynamic state record"
394+
algorithm
395+
beta := -density_derT_p(state) / density(state);
396+
annotation(
397+
Documentation(info = "<html><head></head><body><p>The isobaric expansion coefficient <code>beta</code> is defined as</p>
398+
<blockquote><pre>1/v * der(v,T)
399+
</pre></blockquote>
400+
<p>with <code>v</code> = <code>1/d</code>, at constant pressure <code>p</code>.
401+
Using the chain rule:</p>
402+
<blockquote><pre>1/v * der(v,T) = d * (-der(d, T) / d^2)
403+
= -der(d, T) / d</pre><pre><br></pre></blockquote>
404+
</body></html>"));
405+
end isobaricExpansionCoefficient;
406+
367407
function s_T "Compute specific entropy"
368408
extends Modelica.Icons.Function;
369409
input Temperature T "Temperature";

0 commit comments

Comments
 (0)