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

TypeNameDefaultDescription
RealnParallel1Number of parallel components
IntegernV (from PartialDistributedVolume)1Number of discrete volumes
IntegernFMif useLumpedPressure then nFMLumped else nFMDistributednumber of flow models in flowModel
IntegernFMDistributedif 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
IntegernFMLumpedif not exposeState_a and not exposeState_b then 2 else 1
IntegeriLumpedinteger(nV/2) + 1Index of control volume with representative state if useLumpedPressure
SI.PressureDifferencedp_startp_a_start - p_b_start
SI.PressureDifferencedps_startif 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.MassFlowRatem_flowsFM_startif 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.TemperatureTs_wallFM_startif 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
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
BooleanuseInnerPortPropertiesfalse=true to take port properties for flow models from internal control volumes
BooleanuseLumpedPressurefalse=true to lump pressure states together
LumpedLocationlumpPressureAtLumpedLocation.port_aLocation of pressure for flow calculations
Advanced › Dynamics
DynamicsenergyDynamics (from PartialDistributedVolume)Dynamics.DynamicFreeInitialFormulation of energy balances
DynamicsmassDynamics (from PartialDistributedVolume)energyDynamicsFormulation of mass balances
DynamicssubstanceDynamics (from PartialDistributedVolume)massDynamicsFormulation of substance balances
DynamicstraceDynamics (from PartialDistributedVolume)massDynamicsFormulation of trace substance balances
Modelica.Fluid.Types.DynamicsmomentumDynamicsDynamics.SteadyStateFormulation of momentum balances
Initialization › Start Value: Absolute Pressure
SI.AbsolutePressureps_start (from PartialDistributedVolume)fill(Medium.p_default, nV)Pressure
SI.AbsolutePressurep_a_startMedium.p_defaultPressure at port a
SI.AbsolutePressurep_b_startp_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
Booleanuse_Ts_start (from PartialDistributedVolume)trueUse T_start if true, otherwise h_start
SI.Temperature[nV]Ts_start (from PartialDistributedVolume)fill(Medium.T_default, nV)Temperature
SI.TemperatureT_a_startMedium.T_defaultTemperature at port a
SI.TemperatureT_b_startT_a_startTemperature at port b
Initialization › Start Value: Specific Enthalpy
SI.SpecificEnthalpyhs_start (from PartialDistributedVolume){Medium.specificEnthalpy_pTX(ps_start[i], Ts_start[i], Xs_start[i, :]) for i in 1:nV}Specific enthalpy
SI.SpecificEnthalpyh_a_startMedium.specificEnthalpy_pTX(p_a_start, T_a_start, X_a_start)Specific enthalpy at port a
SI.SpecificEnthalpyh_b_startMedium.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_startMedium.X_defaultMass fraction at port a
SI.MassFraction[Medium.nX]X_b_startX_a_startMass 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_startfill(0, Medium.nC)Mass-Specific value at port a
SIadd.ExtraProperty[Medium.nC]C_b_startC_a_startMass-Specific value at port b
Initialization › Start Value: Mass Flow Rate
SI.MassFlowRatem_flow_a_start0Mass flow rate at port_a
SI.MassFlowRatem_flow_b_start-m_flow_a_startMass flow rate at port_b
SI.MassFlowRatem_flows_startlinspace(m_flow_a_start, -m_flow_b_start, nV + 1)Mass flow rates
Heat Transfer
Booleanuse_HeatTransferfalse= true to use the HeatTransfer model
Trace Mass Transfer
Booleanuse_TraceMassTransferfalse= true to use the TraceMassTransfer model
Advanced › Model Structure
BooleanexposeState_atrue=true, p is calculated at port_a else m_flow
BooleanexposeState_bfalse=true, p is calculated at port_b else m_flow
Visualization
BooleanshowNametrue
BooleanshowDesignFlowDirectiontrue
Visualization › Color Coding
BooleanshowColors (from IconColorMap)falseToggle dynamic color display
Integern_colors (from IconColorMap)64Number of colors in the colorMap, multiples of 4 is best

Connectors

TypeNameDefaultDescription
Interfaces.FluidPort_Flowport_a
Interfaces.FluidPort_Flowport_b
HeatAndMassTransfer.Interfaces.HeatPort_Flow[nV]heatPorts
HeatAndMassTransfer.Interfaces.MolePort_Flow[nV]massPorts

Components

TypeNameDefaultDescription
TRANSFORM.Fluid.SystemTFsystemTF
BaseClasses.Summarysummary
SI.Volume[nV]Vs (from PartialDistributedVolume)Discretized volumes
Medium.BasePropertiesmediums (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.ExtraPropertyExtrinsicmCs_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)
Geometrygeometry
FlowModelflowModelConduction Model
HeatTransferheatTransfer
InternalHeatGeninternalHeatGen
TraceMassTransfertraceMassTransfer
InternalTraceGeninternalTraceGen
SI.Accelerationg_nModelica.Constants.g_nGravitational acceleration
Medium.ThermodynamicStatestate_astate defined by volume outside port_a
Medium.ThermodynamicStatestate_bstate defined by volume outside port_b
SI.MassFlowRate[nV + 1]m_flowsMass flow rates across segment boundaries
SI.HeatFlowRate[nV + 1]H_flowsEnthalpy flow rates across segment boundaries
SI.MassFlowRatemXi_flowsSpecies mass flow rates across segment boundaries
SIadd.ExtraPropertyFlowRate[nV + 1,Medium.nC]mC_flowsTrace substance flow rates across segment boundaries
SI.Velocityvs{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.TemperatureTs_walluse_HeatTransfer = true then wall temperature else bulk medium temperature
SI.PowerWb_flowsMechanical power, p*der(V) etc.
Realval (from IconColorMap)Color map input variable
Realval_min (from IconColorMap)val <= val_min is mapped to colorMap[1,:]
Realval_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

NameDescription
Geometry
FlowModel
HeatTransfer
InternalHeatGen
TraceMassTransfer
InternalTraceGen

Revisions

  • 5 Dec 2008 by Michael Wetter:
    Modified mass balance for trace substances. With the new formulation, the trace substances masses mC are stored in the same way as the species mXi.
  • 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