packagePartialLinearFluid

Generic pure liquid model with constant cp, compressibility and thermal expansion coefficients

Extends from Interfaces.PartialPureSubstance (Base class for pure substances of one chemical substance).

Information

Linear Compressibility Fluid Model

This linear compressibility fluid model is based on the assumptions that:

  • The specific heat capacity at constant pressure (cp) is constant
  • The isobaric expansion coefficient (beta) is constant
  • The isothermal compressibility (kappa) is constant
  • Pressure and temperature are used as states
  • The influence of density on specific enthalpy (h), entropy (s), inner energy (u) and heat capacity (cv) at constant volume is neglected.

That means that the density is a linear function in temperature and in pressure. In order to define the complete model, a number of constant reference values are needed which are computed at the reference values of the states pressure p and temperature T. The model can be interpreted as a linearization of a full non-linear fluid model (but it is not linear in all thermodynamic coordinates). Reference values are needed for

  1. the density (reference_d),
  2. the specific enthalpy (reference_h),
  3. the specific entropy (reference_s).

Apart from that, a user needs to define the molar mass, MM_const. Note that it is possible to define a fluid by computing the reference values from a full non-linear fluid model by computing the package constants using the standard functions defined in a fluid package (see example in liquids package).

In order to avoid numerical inversion of the temperature in the T_ph and T_ps functions, the density is always taken to be the reference density in the computation of h, s, u and cv. For liquids (and this model is intended only for liquids) the relative error of doing so is 1e-3 to 1e-4 at most. The model would be more "correct" based on the other assumptions, if occurrences of reference_d in the computations of h,s,u and cv would be replaced by a call to density(state). That would require a numerical solution for T_ps, while T_ph can be solved symbolically from a quadratic function. Errors from this approximation are small because liquid density varies little.

Efficiency considerations

One of the main reasons to use a simple, linear fluid model is to achieve high performance in simulations. There are a number of possible compromises and possibilities to improve performance. Some of them can be influenced by a flag. The following rules where used in this model:

  • All forward evaluations (using the ThermodynamicState record as input) are exactly following the assumptions above.
  • If the flag constantJacobian is set to true in the package, all functions that typically appear in thermodynamic Jacobians (specificHeatCapacityCv, density_derp_h, density_derh_p, density_derp_T, density_derT_p) are evaluated at reference conditions (that means using the reference density) instead of the density of the current pressure and temperature. This makes it possible to evaluate the thermodynamic Jacobian at compile time.
  • For inverse functions using other inputs than the states (e.g pressure p and specific enthalpy h), the inversion is using the reference state whenever that is necessary to achieve a symbolic inversion.
  • If constantJacobian is set to false, the above list of functions is computed exactly according to the above list of assumptions
Authors:
Francesco Casella
Dipartimento di Elettronica e Informazione
Politecnico di Milano
Via Ponzio 34/5
I-20133 Milano, Italy
email: casella@elet.polimi.it
and
Hubertus Tummescheit, previously at
Modelon AB
Ideon Science Park
SE-22730 Lund, Sweden

Parameters

TypeNameDefaultDescription
Modelica.Media.Interfaces.Choices.IndependentVariablesThermoStates (from PartialMedium)Enumeration type for independent variables
StringmediumName (from PartialMedium)"unusablePartialMedium"Name of the medium
String[:]substanceNames (from PartialMedium){mediumName}Names of the mixture substances. Set substanceNames={mediumName} if only one substance.
String[:]extraPropertiesNames (from PartialMedium)fill("", 0)Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused
BooleansingleState (from PartialMedium)= true, if u and d are not a function of pressure
BooleanreducedX (from PartialMedium)true= true, if medium contains the equation sum(X) = 1.0; set reducedX=true, if only one substance (see docu for details)
BooleanfixedX (from PartialMedium)false= true, if medium contains the equation X = reference_X
AbsolutePressurereference_p (from PartialMedium)101325Reference pressure of Medium: default 1 atmosphere
Temperaturereference_T (from PartialMedium)298.15Reference temperature of Medium: default 25 deg Celsius
MassFraction[nX]reference_X (from PartialMedium)fill(1/nX, nX)Default mass fractions of medium
AbsolutePressurep_default (from PartialMedium)101325Default value for pressure of medium (for initialization)
TemperatureT_default (from PartialMedium)Modelica.Units.Conversions.from_degC(20)Default value for temperature of medium (for initialization)
SpecificEnthalpyh_default (from PartialMedium)specificEnthalpy_pTX(p_default, T_default, X_default)Default value for specific enthalpy of medium (for initialization)
MassFraction[nX]X_default (from PartialMedium)reference_XDefault value for mass fractions of medium (for initialization)
ExtraProperty[nC]C_default (from PartialMedium)fill(0, nC)Default value for trace substances of medium (for initialization)
IntegernS (from PartialMedium)size(substanceNames, 1)Number of substances
IntegernX (from PartialMedium)nSNumber of mass fractions
IntegernXi (from PartialMedium)if fixedX then 0 else if reducedX then nS - 1 else nSNumber of structurally independent mass fractions (see docu for details)
IntegernC (from PartialMedium)size(extraPropertiesNames, 1)Number of extra (outside of standard mass-balance) transported properties
Real[nC]C_nominal (from PartialMedium)1.0e-6*ones(nC)Default for the nominal values for the extra properties
SpecificHeatCapacitycp_constSpecific heat capacity at constant pressure
IsobaricExpansionCoefficientbeta_constThermal expansion coefficient at constant pressure
SI.IsothermalCompressibilitykappa_constIsothermal compressibility
MolarMassMM_constMolar mass
Densityreference_dDensity in reference conditions
SpecificEnthalpyreference_hSpecific enthalpy in reference conditions
SpecificEntropyreference_sSpecific entropy in reference conditions
BooleanconstantJacobianIf true, entries in thermodynamic Jacobian are constant, taken at reference conditions

Contents

NameDescription
ThermodynamicStateA selection of variables that uniquely defines the thermodynamic state
BasePropertiesBase properties of medium
setState_pTXSet the thermodynamic state record from p and T (X not needed)
setState_phXSet the thermodynamic state record from p and h (X not needed)
setState_psXSet the thermodynamic state record from p and s (X not needed)
setState_dTXSet the thermodynamic state record from d and T (X not needed)
setSmoothStateReturn thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b
pressureReturn the pressure from the thermodynamic state
temperatureReturn the temperature from the thermodynamic state
densityReturn the density from the thermodynamic state
specificEnthalpyReturn the specific enthalpy from the thermodynamic state
specificEntropyReturn the specific entropy from the thermodynamic state
specificInternalEnergyReturn the specific internal energy from the thermodynamic state
specificGibbsEnergyReturn specific Gibbs energy from the thermodynamic state
specificHelmholtzEnergyReturn specific Helmholtz energy from the thermodynamic state
velocityOfSoundReturn velocity of sound from the thermodynamic state
isentropicExponentReturn isentropic exponent from the thermodynamic state
isentropicEnthalpyReturn isentropic enthalpy
specificHeatCapacityCpReturn specific heat capacity at constant volume
specificHeatCapacityCvReturn specific heat capacity at constant volume from the thermodynamic state
isothermalCompressibilityReturn the isothermal compressibility kappa
isobaricExpansionCoefficientReturn the isobaric expansion coefficient
density_derp_hReturn density derivative w.r.t. pressure at constant specific enthalpy
density_derh_pReturn density derivative w.r.t. specific enthalpy at constant pressure
density_derp_TReturn density derivative w.r.t. pressure at constant temperature
density_derT_pReturn density derivative w.r.t. temperature at constant pressure
density_derXReturns the partial derivative of density with respect to mass fractions at constant pressure and temperature
molarMassReturn molar mass
T_phReturn temperature from pressure and specific enthalpy
T_psReturn temperature from pressure and specific entropy