Skip to content
LIBRARY
Interfaces.PartialDistributedFlow.md

Interfaces.PartialDistributedFlow ​

Base class for a distributed momentum balance.

The extending flow model supplies the segment path lengths, momentum transport across the segment boundaries, pressure forces, and friction and gravity forces. This class defines the stored momentum and selects steady-state or dynamic momentum balances according to momentumDynamics.

Usage ​

FluidComponents.Interfaces.PartialDistributedFlow(m_flow_start)

Parameters: ​

NameDescriptionUnitsDefault value
medium_data–
allowFlowReversal–
m–
momentumDynamics–
m_flow_startkg/s

Variables ​

NameDescriptionUnits
pathLengthsm
m_flowskg/s
Iskg.m/s
Ib_flowsN
Fs_pN
Fs_fgN

Source ​

dyad
"""
Base class for a distributed momentum balance.

The extending flow model supplies the segment path lengths, momentum transport
across the segment boundaries, pressure forces, and friction and gravity
forces. This class defines the stored momentum and selects steady-state or
dynamic momentum balances according to momentumDynamics.
"""
partial component PartialDistributedFlow
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Whether flow reversal is permitted [-]
  structural parameter allowFlowReversal::Boolean
  # Number of momentum-balance segments [-]
  structural parameter m::Integer(min = 1)
  # Formulation of the momentum balances [-]
  structural parameter momentumDynamics::FluidComponents.Types.Dynamics
  # Start value of the segment mass flow rates [kg/s]
  parameter m_flow_start::MediaComponents.Types.MassFlowRate
  # Lengths of the momentum-balance segments supplied by the composing model [m]
  variable pathLengths::Length[m]
  # Mass flow rates between thermodynamic states [kg/s]
  variable m_flows::MediaComponents.Types.MassFlowRate(min = allowFlowReversal ? -Inf : 0)[m]
  # Momentum stored in the flow segments [kg.m/s]
  variable Is::Momentum[m]
  # Momentum flow across segment boundaries [N]
  variable Ib_flows::Force[m]
  # Pressure forces acting on the flow segments [N]
  variable Fs_p::Force[m]
  # Friction and gravity forces acting on the flow segments [N]
  variable Fs_fg::Force[m]
relations
  guess m_flows = fill(m_flow_start, m)
  for i in 1:m
    Is[i] = m_flows[i] * pathLengths[i]
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.SteadyState)
    for i in 1:m
      0 = Ib_flows[i] - Fs_p[i] - Fs_fg[i]
    end
  else
    for i in 1:m
      der(Is[i]) = Ib_flows[i] - Fs_p[i] - Fs_fg[i]
    end
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.FixedInitial)
    initial m_flows = fill(m_flow_start, m)
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.SteadyStateInitial)
    initial der(m_flows) = fill(0, m)
  end
end
Flattened Source
dyad
"""
Base class for a distributed momentum balance.

The extending flow model supplies the segment path lengths, momentum transport
across the segment boundaries, pressure forces, and friction and gravity
forces. This class defines the stored momentum and selects steady-state or
dynamic momentum balances according to momentumDynamics.
"""
partial component PartialDistributedFlow
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Whether flow reversal is permitted [-]
  structural parameter allowFlowReversal::Boolean
  # Number of momentum-balance segments [-]
  structural parameter m::Integer(min = 1)
  # Formulation of the momentum balances [-]
  structural parameter momentumDynamics::FluidComponents.Types.Dynamics
  # Start value of the segment mass flow rates [kg/s]
  parameter m_flow_start::MediaComponents.Types.MassFlowRate
  # Lengths of the momentum-balance segments supplied by the composing model [m]
  variable pathLengths::Length[m]
  # Mass flow rates between thermodynamic states [kg/s]
  variable m_flows::MediaComponents.Types.MassFlowRate(min = allowFlowReversal ? -Inf : 0)[m]
  # Momentum stored in the flow segments [kg.m/s]
  variable Is::Momentum[m]
  # Momentum flow across segment boundaries [N]
  variable Ib_flows::Force[m]
  # Pressure forces acting on the flow segments [N]
  variable Fs_p::Force[m]
  # Friction and gravity forces acting on the flow segments [N]
  variable Fs_fg::Force[m]
relations
  guess m_flows = fill(m_flow_start, m)
  for i in 1:m
    Is[i] = m_flows[i] * pathLengths[i]
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.SteadyState)
    for i in 1:m
      0 = Ib_flows[i] - Fs_p[i] - Fs_fg[i]
    end
  else
    for i in 1:m
      der(Is[i]) = Ib_flows[i] - Fs_p[i] - Fs_fg[i]
    end
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.FixedInitial)
    initial m_flows = fill(m_flow_start, m)
  end
  if case(momentumDynamics, FluidComponents.Types.Dynamics.SteadyStateInitial)
    initial der(m_flows) = fill(0, m)
  end
metadata {}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses