modelPartialTwoPortFlow
Extends from Modelica.Fluid.Interfaces.PartialTwoPort (Partial component with two ports), Modelica.Fluid.Interfaces.PartialDistributedVolume (Base class for distributed volume models).
Information
Base class for distributed flow models. The total volume is split into nNodes segments along the flow path. The default value is nNodes=2.
Mass and Energy balances
The mass and energy balances are inherited from Interfaces.PartialDistributedVolume. One total mass and one energy balance is formed across each segment according to the finite volume approach. Substance mass balances are added if the medium contains more than one component.
An extending model needs to define the geometry and the difference in heights between the flow segments (static head). Moreover it needs to define two vectors of source terms for the distributed energy balance:
Qb_flows[nNodes], the heat flow source terms, e.g., conductive heat flows across segment boundaries, andWb_flows[nNodes], the work source terms.
Momentum balance
The momentum balance is determined by the FlowModel component, which can be replaced with any model extended from
BaseClasses.FlowModels.PartialStaggeredFlowModel.
The default setting is DetailedPipeFlow.
This considers
- pressure drop due to friction and other dissipative losses, and
- gravity effects for non-horizontal devices.
- variation of flow velocity along the flow path,
which occur due to changes in the cross sectional area or the fluid density, provided that
flowModel.use_Ib_flowsis true.
Model Structure
The momentum balances are formulated across the segment boundaries along the flow path according to the staggered grid approach.
The configurable modelStructure determines the formulation of the boundary conditions at port_a and port_b.
The options include (default: av_vb):
av_vb: Symmetric setting with nNodes-1 momentum balances between nNodes flow segments. The portsport_aandport_bexpose the first and the last thermodynamic state, respectively. Connecting two or more flow devices therefore may result in high-index DAEs for the pressures of connected flow segments.a_v_b: Alternative symmetric setting with nNodes+1 momentum balances across nNodes flow segments. Half momentum balances are placed betweenport_aand the first flow segment as well as between the last flow segment andport_b. Connecting two or more flow devices therefore results in algebraic pressures at the ports. The specification of good start values for the port pressures is essential for the solution of large nonlinear equation systems.av_b: Asymmetric setting with nNodes momentum balances, one between nth volume andport_b, potential pressure state atport_aa_vb: Asymmetric setting with nNodes momentum balance, one between first volume andport_a, potential pressure state atport_b
When connecting two components, e.g., two pipes, the momentum balance across the connection point reduces to
pipe1.port_b.p = pipe2.port_a.p
This is only true if the flow velocity remains the same on each side of the connection. Consider using a fitting for any significant change in diameter or fluid density, if the resulting effects, such as change in kinetic energy, cannot be neglected. This also allows for taking into account friction losses with respect to the actual geometry of the connection point.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n (from PartialDistributedVolume) | 2 | Number of discrete volumes |
| Medium.AbsolutePressure | ps_start (from PartialDistributedVolume) | if n > 1 then linspace(p_a_start, p_b_start, n) else {(p_a_start + p_b_start)/2} | Start value of pressure |
| Integer | nFM | if useLumpedPressure then nFMLumped else nFMDistributed | Number of flow models in flowModel |
| Integer | nFMDistributed | if modelStructure == Types.ModelStructure.a_v_b then n + 1 else if (modelStructure == Types.ModelStructure.a_vb or modelStructure == Types.ModelStructure.av_b) then n else n - 1 | Number of distributed flow models |
| Integer | nFMLumped | if modelStructure == Types.ModelStructure.a_v_b then 2 else 1 | Number of lumped flow models |
| Integer | iLumped | integer(n/2) + 1 | Index of control volume with representative state if useLumpedPressure |
| Assumptions | |||
| Boolean | allowFlowReversal (from PartialTwoPort) | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
| Assumptions › Dynamics | |||
| Types.Dynamics | energyDynamics (from PartialDistributedVolume) | system.energyDynamics | Formulation of energy balances |
| Types.Dynamics | massDynamics (from PartialDistributedVolume) | system.massDynamics | Formulation of mass balances |
| Types.Dynamics | substanceDynamics (from PartialDistributedVolume) | massDynamics | Formulation of substance balances |
| Types.Dynamics | traceDynamics (from PartialDistributedVolume) | massDynamics | Formulation of trace substance balances |
| Types.Dynamics | momentumDynamics | system.momentumDynamics | Formulation of momentum balances |
| Initialization | |||
| Medium.AbsolutePressure | p_a_start (from PartialDistributedVolume) | system.p_start | Start value of pressure at port a |
| Medium.AbsolutePressure | p_b_start (from PartialDistributedVolume) | p_a_start | Start value of pressure at port b |
| Boolean | use_T_start (from PartialDistributedVolume) | true | Use T_start if true, otherwise h_start |
| Medium.Temperature | T_start (from PartialDistributedVolume) | if use_T_start then system.T_start else Medium.temperature_phX((p_a_start + p_b_start)/2, h_start, X_start) | Start value of temperature |
| Medium.SpecificEnthalpy | h_start (from PartialDistributedVolume) | if use_T_start then Medium.specificEnthalpy_pTX((p_a_start + p_b_start)/2, T_start, X_start) else Medium.h_default | Start value of specific enthalpy |
| Medium.MassFraction[Medium.nX] | X_start (from PartialDistributedVolume) | Medium.X_default | Start value of mass fractions m_i/m |
| Medium.ExtraProperty[Medium.nC] | C_start (from PartialDistributedVolume) | Medium.C_default | Start value of trace substances |
| Medium.MassFlowRate | m_flow_start | system.m_flow_start | Start value for mass flow rate |
| Geometry | |||
| Real | nParallel | 1 | Number of identical parallel flow devices |
| SI.Length | lengths | Lengths of flow segments | |
| SI.Area | crossAreas | Cross flow areas of flow segments | |
| SI.Length | dimensions | Hydraulic diameters of flow segments | |
| Modelica.Fluid.Types.Roughness | roughnesses | Average heights of surface asperities | |
| Static head | |||
| SI.Length | dheights | zeros(n) | Differences in heights of flow segments |
| Advanced | |||
| Integer | nNodes | 2 | Number of discrete flow volumes |
| Types.ModelStructure | modelStructure | Types.ModelStructure.av_vb | Determines whether flow or volume models are present at the ports |
| Boolean | useLumpedPressure | false | = true to lump pressure states together |
| Boolean | useInnerPortProperties | false | = true to take port properties for flow models from internal control volumes |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.Interfaces.FluidPort_a | port_a (from PartialTwoPort) | Fluid connector a (positive design flow direction is from port_a to port_b) | |
| Modelica.Fluid.Interfaces.FluidPort_b | port_b (from PartialTwoPort) | Fluid connector b (positive design flow direction is from port_a to port_b) |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.System | system (from PartialTwoPort) | System wide properties | |
| SI.Volume | fluidVolumes (from PartialDistributedVolume) | Discretized volume, determine in inheriting class | |
| SI.Energy | Us (from PartialDistributedVolume) | Internal energy of fluid | |
| SI.Mass | ms (from PartialDistributedVolume) | Fluid mass | |
| SI.Mass | mXis (from PartialDistributedVolume) | Substance mass | |
| SI.Mass | mCs (from PartialDistributedVolume) | Trace substance mass | |
| SI.Mass | mCs_scaled (from PartialDistributedVolume) | Scaled trace substance mass | |
| Medium.ExtraProperty[n,Medium.nC] | Cs (from PartialDistributedVolume) | Trace substance mixture content | |
| Medium.BaseProperties | mediums (from PartialDistributedVolume) | ||
| Medium.MassFlowRate | mb_flows (from PartialDistributedVolume) | Mass flow rate, source or sink | |
| Medium.MassFlowRate | mbXi_flows (from PartialDistributedVolume) | Independent mass flow rates, source or sink | |
| Medium.ExtraPropertyFlowRate | mbC_flows (from PartialDistributedVolume) | Trace substance mass flow rates, source or sink | |
| SI.EnthalpyFlowRate | Hb_flows (from PartialDistributedVolume) | Enthalpy flow rate, source or sink | |
| SI.HeatFlowRate | Qb_flows (from PartialDistributedVolume) | Heat flow rate, source or sink | |
| SI.Power | Wb_flows (from PartialDistributedVolume) | Mechanical power, p*der(V) etc. | |
| Medium.ThermodynamicState | state_a | State defined by volume outside port_a | |
| Medium.ThermodynamicState | state_b | State defined by volume outside port_b | |
| Medium.ThermodynamicState | statesFM | State vector for flowModel model | |
| FlowModel | flowModel | Flow model | |
| Medium.MassFlowRate | m_flows | Mass flow rates of fluid across segment boundaries | |
| Medium.MassFlowRate | mXi_flows | Independent mass flow rates across segment boundaries | |
| Medium.MassFlowRate | mC_flows | Trace substance mass flow rates across segment boundaries | |
| Medium.EnthalpyFlowRate | H_flows | Enthalpy flow rates of fluid across segment boundaries | |
| SI.Velocity | vs | {0.5*(m_flows[i] + m_flows[i + 1])/mediums[i].d/crossAreas[i] for i in 1:n}/nParallel | Mean velocities in flow segments |
Contents
| Name | Description |
|---|---|
Revisions
- 5 Dec 2008
by Michael Wetter:
Modified mass balance for trace substances. With the new formulation, the trace substances massesmCare stored in the same way as the speciesmXi. - Dec 2008
by Rüdiger Franke:
Derived model from original DistributedPipe models- moved mass and energy balances to PartialDistributedVolume
- introduced replaceable pressure loss models
- combined all model structures and lumped pressure into one model
- new ModelStructure av_vb, replacing former avb
- 04 Mar 2006
by Katrin Prölß:
Model added to the Fluid library