Package Modelica.​Fluid
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.

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

Copyright © 2002-2019, Modelica Association and contributors

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

Package Contents

DissipationFunctions for convective heat transfer and pressure loss characteristics
ExamplesDemonstration of the usage of the library
FittingsAdaptors for connections of fluid components and the regulation of fluid flow
InterfacesInterfaces for steady state and unsteady, mixed-phase, multi-substance, incompressible and compressible flow
MachinesDevices for converting between energy held in a fluid and mechanical energy
PipesDevices for conveying fluid
SensorsIdeal sensor components to extract signals from a fluid connector
SourcesDefine fixed or prescribed boundary conditions
SystemSystem properties and default values (ambient, flow direction, initialization)
TypesCommon types for fluid models
UsersGuideUser's Guide
UtilitiesUtility models to construct fluid components (should not be used directly)
ValvesComponents for the regulation and control of fluid flow
VesselsDevices for storing fluid

Model 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 exceptions are:

The global system.m_flow_small and system.dp_small are classic parameters. They do not distinguish between laminar flow and regularization of zero flow. Absolute small values are error prone for models with local nominal values. Moreover dp_small can generally be obtained automatically. Consider using the new system.use_eps_Re = true (see Advanced tab).


AbsolutePressurep_ambient101325Default ambient pressure
TemperatureT_ambient293.15Default ambient temperature
AccelerationgModelica.​Constants.​g_nConstant gravity acceleration
BooleanallowFlowReversaltrue= false to restrict to design flow direction (port_a -> port_b)
DynamicsenergyDynamicsModelica.​Fluid.​Types.​Dynamics.​DynamicFreeInitialDefault formulation of energy balances
DynamicsmassDynamicsenergyDynamicsDefault formulation of mass balances
final DynamicssubstanceDynamicsmassDynamicsDefault formulation of substance balances
final DynamicstraceDynamicsmassDynamicsDefault formulation of trace substance balances
DynamicsmomentumDynamicsModelica.​Fluid.​Types.​Dynamics.​SteadyStateDefault formulation of momentum balances, if options available
MassFlowRatem_flow_start0Default start value for mass flow rates
AbsolutePressurep_startp_ambientDefault start value for pressures
TemperatureT_startT_ambientDefault start value for temperatures
Booleanuse_eps_Refalse= true to determine turbulent region automatically using Reynolds number
MassFlowRatem_flow_nominalif use_eps_Re then 1 else 100 * m_flow_smallDefault nominal mass flow rate
Realeps_m_flow1e-4Regularization of zero flow for |m_flow| < eps_m_flow*m_flow_nominal
AbsolutePressuredp_small1Default small pressure drop for regularization of laminar and zero flow
MassFlowRatem_flow_small0.01Default small mass flow rate for regularization of laminar and zero flow