Skip to content

Modelica.Media.Interfaces.PartialSimpleMedium.setState_psX #4750

@RaphaelGebhart

Description

@RaphaelGebhart

Modelica.Media.Interfaces.PartialSimpleMedium.setState_psX and Modelica.Media.Interfaces.PartialSimpleMedium.specificEntropy are not compatible with each other.

redeclare function extends specificEntropy "Return specific entropy"
  extends Modelica.Icons.Function;
algorithm 
  s := cv_const*Modelica.Math.log(state.T/T0);
end specificEntropy;


  redeclare replaceable function setState_psX
    "Return thermodynamic state from p, s, and X or Xi"
    extends Modelica.Icons.Function;
    input AbsolutePressure p "Pressure";
    input SpecificEntropy s "Specific entropy";
    input MassFraction X[:]=reference_X "Mass fractions";
    output ThermodynamicState state "Thermodynamic state record";
  algorithm
    state := ThermodynamicState(p=p, T=Modelica.Math.exp(s/cp_const +
      Modelica.Math.log(reference_T)))
      "Here the incompressible limit is used, with cp as heat capacity";
  end setState_psX;

Using only either reference_T or T0 solves the problem for me for Modelica.Media.Water.ConstantPropertyLiquidWater TestConstantPropertyLiquidWater.txt (Dymola 2026x). Hondestly, I dont fully understand the difference of T0 and reference_T because is it written constant Temperature T0=reference_T "Zero enthalpy temperature";

Some further comments:

  • Why does ConstantPropertyLiquidWater extend PartialSimpleMedium?
  • Is PartialSimpleMedium supposed to be a base class for an incompressible fluid? In this case, shouldn't cp and cv be change to c and shouldn't the enthalpy formulation be changed to dh = c*dT + v*dp?
  • Is PartialSimpleMedium supposed to be a base class for an ideal gas? In this case shouldn't the entropy formulation include R*ln(p/p0)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    L: MediaIssue addresses Modelica.Media

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions