User's Guide of Media Library

Package Contents


Medium usage


Medium definition


Release notes






This information is part of the Modelica Standard Library maintained by the Modelica Association.

Library Modelica.Media is a free Modelica package providing a standardized interface to fluid media models and specific media models based on this interface. A fluid medium model defines algebraic equations for the intensive thermodynamic variables used in the mass and energy balance of component models. Optionally, additional medium properties can be computed such as dynamic viscosity or thermal conductivity. Medium models are defined for single and multiple substance fluids with one and multiple phases.

A large part of the library provides specific medium models that can be directly utilized. This library can be used in all types of Modelica fluid libraries that may have different connectors and design philosophies. It is particularly utilized in the Modelica_Fluid library (the Modelica_Fluid library is currently under development to provide 1D therm-fluid flow components for single and multiple substance flow with one and multiple phases). The Modelica.Media library has the following main features:

  • Balance equations and media model equations are decoupled. This means that the used medium model does usually not have an influence on how the balance equations are formulated. For example, the same balance equations are used for media that use pressure and temperature, or pressure and specific enthalpy as independent variables, as well as for incompressible and compressible media models. A Modelica tool will have enough information to generate as efficient code as a traditional (coupled) definition. This feature is described in more detail in section Static State Selection.
  • Optional variables, such as dynamic viscosity, are only computed if needed in the corresponding component.
  • The independent variables of a medium model do not influence the definition of a fluid connector port. Especially, the media models are implemented in such a way that a connector may have the minimum number of independent medium variables in a connector and still get the same efficiency as if all medium variables are passed by the connector from one component to the next one (the latter approach has the restriction that a fluid port can only connect two components and not more). Note, the Modelica_Fluid library uses the first approach, i.e., having a set of independent medium variables in a connector.
  • The medium models are implemented with regards to efficient dynamic simulation. For example, two phase medium models trigger state events at phase boundaries (because the medium variables are not differentiable at this point).

This User's Guide has the following main parts:

  • Medium usage describes how to use a medium model from this library in a component model.
  • Medium definition describes how a new fluid medium model has to be implemented.
  • ReleaseNotes summarizes the changes of the library releases.
  • Future provides information about the upcoming version 3.1 of Modelica.Media and some changes to this version to enable forward compatibility.
  • Contact provides information about the authors of the library as well as acknowledgements.