modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
471 stars 168 forks source link

Missing term in entropy of table-based incompressible medium #1659

Open modelica-trac-importer opened 7 years ago

modelica-trac-importer commented 7 years ago

Reported by jorrit on 10 Feb 2015 19:22 UTC Is there any particular reason for ignoring the pressure term in Modelica.Media.Incompressible.TableBased.s_T?

The calculation of enthalpy contains the pressure term Image, while it is not found in the entropy formula Image.

Could it be possible to add a second entropy function like this

function s_pT "Compute specific entropy from pressure and temperature"
  extends Modelica.Icons.Function;
  input AbsolutePressure p "Pressure";
  input Temperature T "Temperature";
  output SpecificEntropy s "Specific entropy";
algorithm 
  s := s0 + (if TinK then 
    Poly.integralValue(poly_Cp[1:npol],T, T0) else 
    Poly.integralValue(poly_Cp[1:npol],Cv.to_degC(T),Cv.to_degC(T0)))
    + Modelica.Math.log(T/T0)*
    Poly.evaluate(poly_Cp,if TinK then 0 else Modelica.Constants.T_zero) 
    + (if densityOfT then 
      ((p - reference_p)/Poly.evaluate(poly_rho, if TinK then T else Cv.to_degC(T))^2
  *Poly.derivativeValue(poly_rho,if TinK then T else Cv.to_degC(T))) 
    else 0.0);
 annotation(Inline=true,smoothOrder=2);
end s_T;

Migrated-From: https://trac.modelica.org/Modelica/ticket/1659

modelica-trac-importer commented 7 years ago

Comment by hubertus on 10 Feb 2015 23:06 UTC The short answer: I agree, this should be added. The longer answer: it is not so good that we mix different possible assumptions in a single medium (a) really incompressible and thus not pressure dependent and (b) pressure dependent. It would be nicer to have these two assumptions in different packages. For the short term, I agree, that the addition makes sense.

modelica-trac-importer commented 7 years ago

Comment by jorrit on 11 Feb 2015 21:55 UTC Yes, that is true, but I thought that was what the "singleState" switch was used for. However, feel free to include it or forget about it, if you plan to restructure the Media package anyway. I just wanted to let you know, that it is not too difficult to include this extra term.