Library of 1-dim. thermo-fluid flow models using the Modelica.Media media description


Library Modelica.Fluid is a free Modelica package providing components for 1-dimensional thermo-fluid flow in networks of vessels, pipes, fluid machines, valves and fittings. A unique feature is that the component equations and the media models as well as pressure loss and heat transfer correlations are decoupled from each other. All components are implemented such that they can be used for media from the Modelica.Media library. This means especially that an incompressible or compressible medium, a single or a multiple substance medium with one or more phases might be used.

In the next figure, several features of the library are demonstrated with a simple heating system with a closed flow cycle. By just changing one configuration parameter in the system object the equations are changed between steady-state and dynamic simulation with fixed or steady-state initial conditions.

With respect to previous versions, the design of the connectors has been changed in a non-backward compatible way, using the recently developed concept of stream connectors that results in much more reliable simulations (see also Stream-Connectors-Overview-Rationale.pdf). This extension was included in Modelica 3.1. As of Jan. 2009, the stream concept is supported in Dymola 7.1. It is recommended to use Dymola 7.2 (available since Feb. 2009), or a later Dymola version, since this version supports a new annotation to connect very conveniently to vectors of connectors. Other tool vendors will support the stream concept as well.

The following parts are useful, when newly starting with this library:

Licensed by the Modelica Association under the Modelica License 2
Copyright © 2002-2010, ABB, DLR, Dassault Systèmes AB, Modelon, TU Braunschweig, TU Hamburg-Harburg, Politecnico di Milano.

This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Modelica.Fluid.UsersGuide UsersGuide User's Guide
Modelica.Fluid.Examples Examples Demonstration of the usage of the library
Modelica.Fluid.System System System properties and default values (ambient, flow direction, initialization)
Modelica.Fluid.Vessels Vessels Devices for storing fluid
Modelica.Fluid.Pipes Pipes Devices for conveying fluid
Modelica.Fluid.Machines Machines Devices for converting between energy held in a fluid and mechanical energy
Modelica.Fluid.Valves Valves Components for the regulation and control of fluid flow
Modelica.Fluid.Fittings Fittings Adaptors for connections of fluid components and the regulation of fluid flow
Modelica.Fluid.Sources Sources Define fixed or prescribed boundary conditions
Modelica.Fluid.Sensors Sensors Ideal sensor components to extract signals from a fluid connector
Modelica.Fluid.Interfaces Interfaces Interfaces for steady state and unsteady, mixed-phase, multi-substance, incompressible and compressible flow
Modelica.Fluid.Types Types Common types for fluid models
Modelica.Fluid.Dissipation Dissipation Functions for convective heat transfer and pressure loss characteristics
Modelica.Fluid.Utilities Utilities Utility models to construct fluid components (should not be used directly)
Modelica.Fluid.Icons Icons  

Modelica.Fluid.System Modelica.Fluid.System

System properties and default values (ambient, flow direction, initialization)


A system component is needed in each fluid model to provide system-wide settings, such as ambient conditions and overall modeling assumptions. The system settings are propagated to the fluid models using the inner/outer mechanism.

A model should never directly use system parameters. Instead a local parameter should be declared, which uses the global setting as default. The only exception currently made is the gravity system.g.


AbsolutePressurep_ambient101325Default ambient pressure [Pa]
TemperatureT_ambient293.15Default ambient temperature [K]
AccelerationgModelica.Constants.g_nConstant gravity acceleration [m/s2]
BooleanallowFlowReversaltrue= false to restrict to design flow direction (port_a -> port_b)
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Default formulation of energy balances
DynamicsmassDynamicsenergyDynamicsDefault formulation of mass balances
DynamicsmomentumDynamicsModelica.Fluid.Types.Dynamic...Default formulation of momentum balances, if options available
MassFlowRatem_flow_start0Default start value for mass flow rates [kg/s]
AbsolutePressurep_startp_ambientDefault start value for pressures [Pa]
TemperatureT_startT_ambientDefault start value for temperatures [K]
MassFlowRatem_flow_small0.01Default small laminar mass flow rate for regularization of zero flow [kg/s]
AbsolutePressuredp_small1Default small pressure drop for regularization of laminar and zero flow [Pa]

Modelica definition

model System 
  "System properties and default values (ambient, flow direction, initialization)"

  package Medium = Modelica.Media.Interfaces.PartialMedium 
    "Medium model for default start values";
  parameter Modelica.SIunits.AbsolutePressure p_ambient=101325 
    "Default ambient pressure";
  parameter Modelica.SIunits.Temperature T_ambient=293.15 
    "Default ambient temperature";
  parameter Modelica.SIunits.Acceleration g=Modelica.Constants.g_n 
    "Constant gravity acceleration";

  // Assumptions
  parameter Boolean allowFlowReversal = true 
    "= false to restrict to design flow direction (port_a -> port_b)";
  parameter Modelica.Fluid.Types.Dynamics energyDynamics=
    "Default formulation of energy balances";
  parameter Modelica.Fluid.Types.Dynamics massDynamics=
    energyDynamics "Default formulation of mass balances";
  final parameter Modelica.Fluid.Types.Dynamics substanceDynamics=
    massDynamics "Default formulation of substance balances";
  final parameter Modelica.Fluid.Types.Dynamics traceDynamics=
    massDynamics "Default formulation of trace substance balances";
  parameter Modelica.Fluid.Types.Dynamics momentumDynamics=
    "Default formulation of momentum balances, if options available";

  // Initialization
  parameter Modelica.SIunits.MassFlowRate m_flow_start = 0 
    "Default start value for mass flow rates";
  parameter Modelica.SIunits.AbsolutePressure p_start = p_ambient 
    "Default start value for pressures";
  parameter Modelica.SIunits.Temperature T_start = T_ambient 
    "Default start value for temperatures";

  // Advanced
  parameter Modelica.SIunits.MassFlowRate m_flow_small(min=0) = 0.01 
    "Default small laminar mass flow rate for regularization of zero flow";
  parameter Modelica.SIunits.AbsolutePressure dp_small(min=0) = 1 
    "Default small pressure drop for regularization of laminar and zero flow";

end System;

Automatically generated Fri Nov 12 16:30:52 2010.