modelGenericPipe
Extends from TRANSFORM.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions), BaseClasses.PartialDistributedVolume (Base class for distributed 1-D volume models), TRANSFORM.Utilities.Visualizers.IconColorMap.
Information
!!! Obsolete, sort of. This model is same as GenericPipe_MultiTransferSurface with the exception that it has one surface for heat transfer. To remove duplciations, etc. this model will be removed in favor of the other
Base model for distributed flow models. The total volume is split into nV segments along the flow path. The default value is nV=2.
The following boundary flow and source terms are part of the mass, energy, species, and trace balances and must be specified in an extending class:
- Qb_flows[nV], heat flow term, e.g., conductive heat flows across segment boundaries
- Wb_flows[nV], work term
- Hb_flows[nV], enthalpy flow
- mb_flows[nV], mass flow
- mbXi_flows[nV], substance mass flow
- mbC_flows[nV], trace substance mass flow
Wall temperature is passed to the flow model as it is needed for some cases. When use_HeatTransfer = false, the wall temperature is assumed to be equal to the medium temperature.
It provides the complete balance equations for one-dimensional fluid flow as formulated in UsersGuide.ComponentDefinition.BalanceEquations.
This generic model offers a large number of combinations of possible parameter settings. In order to reduce model complexity, consider defining and/or using a tailored model for the application at hand, such as HeatExchanger.
In reality this model is not a partial model BUT it is listed as such so different applications of this model will be generated with proper applications of the parameters, icons, etc.
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).
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_flows is 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 nV-1 momentum balances between nV flow segments. The ports port_a and port_b expose 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 nV+1 momentum balances across nV flow segments. Half momentum balances are placed between port_a and the first flow segment as well as between the last flow segment and port_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 nV momentum balances, one between nth volume and port_b, potential pressure state at port_a
- a_vb: Asymmetric setting with nV momentum balance, one between first volume and port_a, potential pressure state at port_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.
The model treats the partial differential equations with the finite volume method and a staggered grid scheme for momentum balances. The default value is nV=2. This results in two lumped mass and energy balances and one lumped momentum balance across the model.
Note that this generally leads to high-index DAEs for pressure states if this model are directly connected to each other, or generally to models with storage exposing a thermodynamic state through the port. This may not be valid if the model is connected to a model with non-differentiable pressure, like a Sources.Boundary_pT with prescribed jumping pressure. The modelStructure can be configured as appropriate in such situations, in order to place a momentum balance between a pressure state of the pipe and a non-differentiable boundary condition.
The default modelStructure is av_vb (see Advanced tab). The simplest possible alternative symmetric configuration, avoiding potential high-index DAEs at the cost of the potential introduction of nonlinear equation systems, is obtained with the setting nV=1, modelStructure=a_v_b. Depending on the configured model structure, the first and the last segment, or the flow path length of the first and the last momentum balance, are of half size.
Heat Transfer Structure
The HeatTransfer component specifies the source term Qb_flows of the energy balance. The default component uses a constant coefficient for the heat transfer between the bulk flow and the segment boundaries exposed through the heatPorts. The HeatTransfer model is replaceable and can be exchanged with any model extended from TRANSFORM.Fluid.Pipes.BaseClasses.HeatTransfer.PartialFlowHeatTransfer.
The intended use is for complex networks of pipes and other flow devices, like valves. See, e.g.,
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | nParallel | 1 | Number of parallel components |
| Integer | nV (from PartialDistributedVolume) | 1 | Number of discrete volumes |
| Integer | nFM | if useLumpedPressure then nFMLumped else nFMDistributed | number of flow models in flowModel |
| Integer | nFMDistributed | if not exposeState_a and not exposeState_b then nV + 1 else if (not exposeState_a and exposeState_b) or (exposeState_a and not exposeState_b) then nV else nV - 1 | |
| Integer | nFMLumped | if not exposeState_a and not exposeState_b then 2 else 1 | |
| Integer | iLumped | integer(nV/2) + 1 | Index of control volume with representative state if useLumpedPressure |
| SI.PressureDifference | dp_start | p_a_start - p_b_start | |
| SI.PressureDifference | dps_start | if useLumpedPressure then if not exposeState_a and not exposeState_b then cat(1, {dp_start/2}, {dp_start/2}) else {dp_start} else if not exposeState_a and not exposeState_b then if nV == 1 then cat(1, {dp_start/2}, {dp_start/2}) else cat(1, {dp_start/(nV + 1)}, {ps_start[i] - ps_start[i + 1] for i in 1:nV - 1}, {dp_start/(nV + 1)}) elseif not exposeState_a and exposeState_b then if nV == 1 then {dp_start} else cat(1, {dp_start/nV}, {ps_start[i] - ps_start[i + 1] for i in 1:nV - 1}) elseif exposeState_a and not exposeState_b then if nV == 1 then {dp_start} else cat(1, {ps_start[i] - ps_start[i + 1] for i in 1:nV - 1}, {dp_start/nV}) else {ps_start[i] - ps_start[i + 1] for i in 1:nV - 1} | |
| SI.MassFlowRate | m_flowsFM_start | if useLumpedPressure then if lumpPressureAt == LumpedLocation.port_a then if not exposeState_a and not exposeState_b then cat(1, {m_flows_start[1]}, {m_flows_start[1]})/nParallel else {m_flows_start[1]}/nParallel else if not exposeState_a and not exposeState_b then cat(1, {m_flows_start[nV + 1]}, {m_flows_start[nV + 1]})/nParallel else {m_flows_start[nV + 1]}/nParallel else if not exposeState_a and not exposeState_b then m_flows_start/nParallel elseif not exposeState_a and exposeState_b then {m_flows_start[i] for i in 1:nV}/nParallel elseif exposeState_a and not exposeState_b then {m_flows_start[i] for i in 2:nV + 1}/nParallel else {m_flows_start[i] for i in 2:nV}/nParallel | |
| SI.Temperature | Ts_wallFM_start | if useLumpedPressure then if not exposeState_a and not exposeState_b then cat(1, {T_a_start}, {0.5*(T_a_start + T_b_start)}, {T_b_start}) else cat(1, {T_a_start}, {T_b_start}) else if not exposeState_a and not exposeState_b then if nV == 1 then cat(1, {T_a_start}, {0.5*(T_a_start + T_b_start)}, {T_b_start}) else cat(1, {T_a_start}, {Ts_start[i] for i in 1:nV}, {T_b_start}) elseif not exposeState_a and exposeState_b then if nV == 1 then cat(1, {T_a_start}, {T_b_start}) else cat(1, {T_a_start}, {Ts_start[i] for i in 1:nV}) elseif exposeState_a and not exposeState_b then if nV == 1 then cat(1, {T_a_start}, {T_b_start}) else cat(1, {Ts_start[i] for i in 1:nV}, {T_b_start}) else {Ts_start[i] for i in 1:nV} | |
| Advanced | |||
| Boolean | allowFlowReversal | true | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
| Boolean | useInnerPortProperties | false | =true to take port properties for flow models from internal control volumes |
| Boolean | useLumpedPressure | false | =true to lump pressure states together |
| LumpedLocation | lumpPressureAt | LumpedLocation.port_a | Location of pressure for flow calculations |
| Advanced › Dynamics | |||
| Dynamics | energyDynamics (from PartialDistributedVolume) | Dynamics.DynamicFreeInitial | Formulation of energy balances |
| Dynamics | massDynamics (from PartialDistributedVolume) | energyDynamics | Formulation of mass balances |
| Dynamics | substanceDynamics (from PartialDistributedVolume) | massDynamics | Formulation of substance balances |
| Dynamics | traceDynamics (from PartialDistributedVolume) | massDynamics | Formulation of trace substance balances |
| Modelica.Fluid.Types.Dynamics | momentumDynamics | Dynamics.SteadyState | Formulation of momentum balances |
| Initialization › Start Value: Absolute Pressure | |||
| SI.AbsolutePressure | ps_start (from PartialDistributedVolume) | fill(Medium.p_default, nV) | Pressure |
| SI.AbsolutePressure | p_a_start | Medium.p_default | Pressure at port a |
| SI.AbsolutePressure | p_b_start | p_a_start + (if m_flow_a_start > 0 then -1e3 elseif m_flow_a_start < 0 then -1e3 else 0) | Pressure at port b |
| Initialization › Start Value: Temperature | |||
| Boolean | use_Ts_start (from PartialDistributedVolume) | true | Use T_start if true, otherwise h_start |
| SI.Temperature[nV] | Ts_start (from PartialDistributedVolume) | fill(Medium.T_default, nV) | Temperature |
| SI.Temperature | T_a_start | Medium.T_default | Temperature at port a |
| SI.Temperature | T_b_start | T_a_start | Temperature at port b |
| Initialization › Start Value: Specific Enthalpy | |||
| SI.SpecificEnthalpy | hs_start (from PartialDistributedVolume) | {Medium.specificEnthalpy_pTX(ps_start[i], Ts_start[i], Xs_start[i, :]) for i in 1:nV} | Specific enthalpy |
| SI.SpecificEnthalpy | h_a_start | Medium.specificEnthalpy_pTX(p_a_start, T_a_start, X_a_start) | Specific enthalpy at port a |
| SI.SpecificEnthalpy | h_b_start | Medium.specificEnthalpy_pTX(p_b_start, T_b_start, X_b_start) | Specific enthalpy at port b |
| Initialization › Start Value: Species Mass Fraction | |||
| SI.MassFraction[nV,Medium.nX] | Xs_start (from PartialDistributedVolume) | fillArray_1D(Medium.X_default, nV) | Mass fraction |
| SI.MassFraction[Medium.nX] | X_a_start | Medium.X_default | Mass fraction at port a |
| SI.MassFraction[Medium.nX] | X_b_start | X_a_start | Mass fraction at port b |
| Initialization › Start Value: Trace Substances | |||
| SIadd.ExtraProperty[nV,Medium.nC] | Cs_start (from PartialDistributedVolume) | fill(0, nV, Medium.nC) | Mass-Specific value |
| SIadd.ExtraProperty[Medium.nC] | C_a_start | fill(0, Medium.nC) | Mass-Specific value at port a |
| SIadd.ExtraProperty[Medium.nC] | C_b_start | C_a_start | Mass-Specific value at port b |
| Initialization › Start Value: Mass Flow Rate | |||
| SI.MassFlowRate | m_flow_a_start | 0 | Mass flow rate at port_a |
| SI.MassFlowRate | m_flow_b_start | -m_flow_a_start | Mass flow rate at port_b |
| SI.MassFlowRate | m_flows_start | linspace(m_flow_a_start, -m_flow_b_start, nV + 1) | Mass flow rates |
| Heat Transfer | |||
| Boolean | use_HeatTransfer | false | = true to use the HeatTransfer model |
| Trace Mass Transfer | |||
| Boolean | use_TraceMassTransfer | false | = true to use the TraceMassTransfer model |
| Advanced › Model Structure | |||
| Boolean | exposeState_a | true | =true, p is calculated at port_a else m_flow |
| Boolean | exposeState_b | false | =true, p is calculated at port_b else m_flow |
| Visualization | |||
| Boolean | showName | true | |
| Boolean | showDesignFlowDirection | true | |
| Visualization › Color Coding | |||
| Boolean | showColors (from IconColorMap) | false | Toggle dynamic color display |
| Integer | n_colors (from IconColorMap) | 64 | Number of colors in the colorMap, multiples of 4 is best |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Interfaces.FluidPort_Flow | port_a | ||
| Interfaces.FluidPort_Flow | port_b | ||
| HeatAndMassTransfer.Interfaces.HeatPort_Flow[nV] | heatPorts | ||
| HeatAndMassTransfer.Interfaces.MolePort_Flow[nV] | massPorts |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| TRANSFORM.Fluid.SystemTF | systemTF | ||
| BaseClasses.Summary | summary | ||
| SI.Volume[nV] | Vs (from PartialDistributedVolume) | Discretized volumes | |
| Medium.BaseProperties | mediums (from PartialDistributedVolume) | ||
| SI.Mass[nV] | ms (from PartialDistributedVolume) | Mass | |
| SI.Energy[nV] | Us (from PartialDistributedVolume) | Internal energy | |
| SI.Mass[nV,Medium.nXi] | mXis (from PartialDistributedVolume) | Species mass | |
| SIadd.ExtraPropertyExtrinsic[nV,Medium.nC] | mCs (from PartialDistributedVolume) | Trace substance extrinsic value | |
| SIadd.ExtraPropertyExtrinsic | mCs_scaled (from PartialDistributedVolume) | Scaled trace substance mass for improved numerical stability | |
| SIadd.ExtraProperty[nV,Medium.nC] | Cs (from PartialDistributedVolume) | Trace substance mass-specific value | |
| SI.MassFlowRate[nV] | mbs (from PartialDistributedVolume) | Mass flow rate balances across volume interfaces (e.g., enthalpy flow, diffusion) and source/sinks within volumes | |
| SI.HeatFlowRate[nV] | Ubs (from PartialDistributedVolume) | Energy sources across volume interfaces (e.g., thermal diffusion) and source/sinks within volumes | |
| SI.MassFlowRate[nV,Medium.nXi] | mXibs (from PartialDistributedVolume) | Species mass flow rates across volume interfaces and source/sinks within volumes | |
| SIadd.ExtraPropertyFlowRate[nV,Medium.nC] | mCbs (from PartialDistributedVolume) | Trace flow rate across volume interfaces (e.g., diffusion) and source/sinks within volumes (e.g., chemical reactions, external convection) | |
| Geometry | geometry | ||
| FlowModel | flowModel | Conduction Model | |
| HeatTransfer | heatTransfer | ||
| InternalHeatGen | internalHeatGen | ||
| TraceMassTransfer | traceMassTransfer | ||
| InternalTraceGen | internalTraceGen | ||
| SI.Acceleration | g_n | Modelica.Constants.g_n | Gravitational acceleration |
| Medium.ThermodynamicState | state_a | state defined by volume outside port_a | |
| Medium.ThermodynamicState | state_b | state defined by volume outside port_b | |
| SI.MassFlowRate[nV + 1] | m_flows | Mass flow rates across segment boundaries | |
| SI.HeatFlowRate[nV + 1] | H_flows | Enthalpy flow rates across segment boundaries | |
| SI.MassFlowRate | mXi_flows | Species mass flow rates across segment boundaries | |
| SIadd.ExtraPropertyFlowRate[nV + 1,Medium.nC] | mC_flows | Trace substance flow rates across segment boundaries | |
| SI.Velocity | vs | {0.5*(m_flows[i] + m_flows[i + 1])/mediums[i].d/geometry.crossAreas[i] for i in 1:nV} | mean velocities in flow segments |
| SI.Temperature | Ts_wall | use_HeatTransfer = true then wall temperature else bulk medium temperature | |
| SI.Power | Wb_flows | Mechanical power, p*der(V) etc. | |
| Real | val (from IconColorMap) | Color map input variable | |
| Real | val_min (from IconColorMap) | val <= val_min is mapped to colorMap[1,:] | |
| Real | val_max (from IconColorMap) | val >= val_max is mapped to colorMap[end,:] | |
| Real[3] | dynColor (from IconColorMap) | Modelica.Mechanics.MultiBody.Visualizers.Colors.scalarToColor(val, val_min, val_max, colorMap(n_colors)) |
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