Skip to content
LIBRARY
Examples.HeatExchanger.WaterToWaterCounterFlow.md

Examples.HeatExchanger.WaterToWaterCounterFlow ​

Transient counterflow heat exchanger with hot liquid water transferring heat to cold liquid water.

All numerical operating conditions, geometry, initialization values, and the concrete medium selection are confined to this example. Both streams flow in their positive design directions; BasicHX reverses the stream-2 thermal segment connections to represent counterflow heat exchange.

Usage ​

FluidComponents.Examples.HeatExchanger.WaterToWaterCounterFlow(T_hot_in=360, T_cold_in=300, T_hot_start=330, T_cold_start=320, T_wall_start=325, m_flow_hot=0.2, m_flow_cold=0.2, p_outlet=100000, p_inlet_start=101000)

Parameters: ​

NameDescriptionUnitsDefault value
medium_data–MediaCompon...WaterData()
nNodes–4
T_hot_inK360
T_cold_inK300
T_hot_startK330
T_cold_startK320
T_wall_startK325
m_flow_hotkg/s0.2
m_flow_coldkg/s0.2
p_outletPa100000
p_inlet_startPa101000

Variables ​

NameDescriptionUnits
T_hot_outK
T_cold_outK
T_wall_meanK
Q_hotW
Q_coldW

Behavior ​

Source ​

dyad
"""
Transient counterflow heat exchanger with hot liquid water transferring heat to
cold liquid water.

All numerical operating conditions, geometry, initialization values, and the
concrete medium selection are confined to this example. Both streams flow in
their positive design directions; BasicHX reverses the stream-2 thermal segment
connections to represent counterflow heat exchange.
"""
component WaterToWaterCounterFlow
  "Distributed counterflow heat exchanger."
  heat_exchanger = FluidComponents.Examples.HeatExchanger.BaseClasses.BasicHX(medium_data_1 = medium_data, medium_data_2 = medium_data, nNodes = nNodes, modelStructure_1 = FluidComponents.Types.ModelStructure.av_b(), modelStructure_2 = FluidComponents.Types.ModelStructure.a_vb(), allowFlowReversal = true, energyDynamics = FluidComponents.Types.Dynamics.FixedInitial(), massDynamics = FluidComponents.Types.Dynamics.SteadyState(), momentumDynamics = FluidComponents.Types.Dynamics.SteadyState(), use_T_start = true, length = 5, crossArea_1 = 4.5e-4, crossArea_2 = 4.5e-4, perimeter_1 = 0.075, perimeter_2 = 0.075, area_h_1 = 0.375, area_h_2 = 0.375, nParallel_1 = 1, nParallel_2 = 1, height_ab_1 = 0, height_ab_2 = 0, roughness_1 = 2.5e-5, roughness_2 = 2.5e-5, dp_nominal_1 = 1000, dp_nominal_2 = 1000, m_flow_nominal_1 = m_flow_hot, m_flow_nominal_2 = m_flow_cold, alpha0_1 = 1000, alpha0_2 = 1000, k_ambient_1 = 0, k_ambient_2 = 0, T_ambient_1 = 300, T_ambient_2 = 300, s_wall = 0.002, k_wall = 15, c_wall = 500, rho_wall = 7800, Twall_start = T_wall_start, dT = 0, p_a_start_1 = p_inlet_start, p_b_start_1 = p_outlet, p_a_start_2 = p_inlet_start, p_b_start_2 = p_outlet, T_start_1 = T_hot_start, T_start_2 = T_cold_start, h_start_1 = 4184 * (T_hot_start - 273.15), h_start_2 = 4184 * (T_cold_start - 273.15), m_flow_start_1 = m_flow_hot, m_flow_start_2 = m_flow_cold) {
    "Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 139, "y2": 239}}}
  }
  "Prescribed hot-water inlet."
  hot_source = FluidComponents.Sources.MassFlowSource_T(medium_data = medium_data, nPorts = 1, use_m_flow_in = false, m_flow = m_flow_hot, T = T_hot_in) {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 260, "y2": 360}}}
  }
  "Fixed-pressure hot-water outlet."
  hot_sink = FluidComponents.Sources.Boundary_pT(medium_data = medium_data, nPorts = 1, p = p_outlet, T = T_hot_in) {
    "Dyad": {"placement": {"diagram": {"x1": 670, "x2": 570, "y1": 10, "y2": 110}}}
  }
  "Prescribed cold-water inlet."
  cold_source = FluidComponents.Sources.MassFlowSource_T(medium_data = medium_data, nPorts = 1, use_m_flow_in = false, m_flow = m_flow_cold, T = T_cold_in) {
    "Dyad": {"placement": {"diagram": {"x1": 650, "x2": 550, "y1": 340, "y2": 440}}}
  }
  "Fixed-pressure cold-water outlet."
  cold_sink = FluidComponents.Sources.Boundary_pT(medium_data = medium_data, nPorts = 1, p = p_outlet, T = T_cold_in) {"Dyad": {"placement": {"diagram": {"x1": -70, "x2": 30, "y1": 0, "y2": 100}}}}
  # Concrete medium selected when the example is constructed [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData = MediaComponents.Water.ConstantPropertyLiquidWaterData()
  # Number of axial fluid and wall segments [-]
  structural parameter nNodes::Integer(min = 1) = 4
  # Hot-stream inlet temperature [K]
  parameter T_hot_in::Temperature = 360
  # Cold-stream inlet temperature [K]
  parameter T_cold_in::Temperature = 300
  # Hot-stream initial temperature [K]
  parameter T_hot_start::Temperature = 330
  # Cold-stream initial temperature [K]
  parameter T_cold_start::Temperature = 320
  # Wall initial temperature [K]
  parameter T_wall_start::Temperature = 325
  # Mass flow rate through the hot stream [kg/s]
  parameter m_flow_hot::MediaComponents.Types.MassFlowRate = 0.2
  # Mass flow rate through the cold stream [kg/s]
  parameter m_flow_cold::MediaComponents.Types.MassFlowRate = 0.2
  # Outlet pressure of each stream [Pa]
  parameter p_outlet::MediaComponents.Types.AbsolutePressure = 100000
  # Nominal inlet pressure used for initialization [Pa]
  parameter p_inlet_start::MediaComponents.Types.AbsolutePressure = 101000
  # Hot-stream outlet temperature [K]
  variable T_hot_out::Temperature
  # Cold-stream outlet temperature [K]
  variable T_cold_out::Temperature
  # Mean wall temperature [K]
  variable T_wall_mean::Temperature
  # Total heat flow into the hot stream [W]
  variable Q_hot::HeatFlowRate
  # Total heat flow into the cold stream [W]
  variable Q_cold::HeatFlowRate
relations
  connect(hot_source.ports[1], heat_exchanger.port_a1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 20, "y": 310}, {"x": 20, "y": 190}], "E": 2}],
      "path": {}
    }
  }
  connect(heat_exchanger.port_b1, hot_sink.ports[1]) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 402.5, "y": 190}, {"x": 402.5, "y": 60}], "E": 2}],
      "path": {}
    }
  }
  connect(cold_source.ports[1], heat_exchanger.port_a2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 330, "y": 390}, {"x": 330, "y": 212}], "E": 2}],
      "path": {}
    }
  }
  connect(heat_exchanger.port_b2, cold_sink.ports[1]) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 166}, {"x": 140, "y": 50}], "E": 2}],
      "path": {}
    }
  }
  T_hot_out = heat_exchanger.pipe_1.mediums[nNodes].T
  T_cold_out = heat_exchanger.pipe_2.mediums[nNodes].T
  T_wall_mean = sum(heat_exchanger.wall.T) / nNodes
  Q_hot = heat_exchanger.Q_flow_1
  Q_cold = heat_exchanger.Q_flow_2
end
Flattened Source
dyad
"""
Transient counterflow heat exchanger with hot liquid water transferring heat to
cold liquid water.

All numerical operating conditions, geometry, initialization values, and the
concrete medium selection are confined to this example. Both streams flow in
their positive design directions; BasicHX reverses the stream-2 thermal segment
connections to represent counterflow heat exchange.
"""
component WaterToWaterCounterFlow
  "Distributed counterflow heat exchanger."
  heat_exchanger = FluidComponents.Examples.HeatExchanger.BaseClasses.BasicHX(medium_data_1 = medium_data, medium_data_2 = medium_data, nNodes = nNodes, modelStructure_1 = FluidComponents.Types.ModelStructure.av_b(), modelStructure_2 = FluidComponents.Types.ModelStructure.a_vb(), allowFlowReversal = true, energyDynamics = FluidComponents.Types.Dynamics.FixedInitial(), massDynamics = FluidComponents.Types.Dynamics.SteadyState(), momentumDynamics = FluidComponents.Types.Dynamics.SteadyState(), use_T_start = true, length = 5, crossArea_1 = 4.5e-4, crossArea_2 = 4.5e-4, perimeter_1 = 0.075, perimeter_2 = 0.075, area_h_1 = 0.375, area_h_2 = 0.375, nParallel_1 = 1, nParallel_2 = 1, height_ab_1 = 0, height_ab_2 = 0, roughness_1 = 2.5e-5, roughness_2 = 2.5e-5, dp_nominal_1 = 1000, dp_nominal_2 = 1000, m_flow_nominal_1 = m_flow_hot, m_flow_nominal_2 = m_flow_cold, alpha0_1 = 1000, alpha0_2 = 1000, k_ambient_1 = 0, k_ambient_2 = 0, T_ambient_1 = 300, T_ambient_2 = 300, s_wall = 0.002, k_wall = 15, c_wall = 500, rho_wall = 7800, Twall_start = T_wall_start, dT = 0, p_a_start_1 = p_inlet_start, p_b_start_1 = p_outlet, p_a_start_2 = p_inlet_start, p_b_start_2 = p_outlet, T_start_1 = T_hot_start, T_start_2 = T_cold_start, h_start_1 = 4184 * (T_hot_start - 273.15), h_start_2 = 4184 * (T_cold_start - 273.15), m_flow_start_1 = m_flow_hot, m_flow_start_2 = m_flow_cold) {
    "Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 139, "y2": 239}}}
  }
  "Prescribed hot-water inlet."
  hot_source = FluidComponents.Sources.MassFlowSource_T(medium_data = medium_data, nPorts = 1, use_m_flow_in = false, m_flow = m_flow_hot, T = T_hot_in) {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 260, "y2": 360}}}
  }
  "Fixed-pressure hot-water outlet."
  hot_sink = FluidComponents.Sources.Boundary_pT(medium_data = medium_data, nPorts = 1, p = p_outlet, T = T_hot_in) {
    "Dyad": {"placement": {"diagram": {"x1": 670, "x2": 570, "y1": 10, "y2": 110}}}
  }
  "Prescribed cold-water inlet."
  cold_source = FluidComponents.Sources.MassFlowSource_T(medium_data = medium_data, nPorts = 1, use_m_flow_in = false, m_flow = m_flow_cold, T = T_cold_in) {
    "Dyad": {"placement": {"diagram": {"x1": 650, "x2": 550, "y1": 340, "y2": 440}}}
  }
  "Fixed-pressure cold-water outlet."
  cold_sink = FluidComponents.Sources.Boundary_pT(medium_data = medium_data, nPorts = 1, p = p_outlet, T = T_cold_in) {"Dyad": {"placement": {"diagram": {"x1": -70, "x2": 30, "y1": 0, "y2": 100}}}}
  # Concrete medium selected when the example is constructed [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData = MediaComponents.Water.ConstantPropertyLiquidWaterData()
  # Number of axial fluid and wall segments [-]
  structural parameter nNodes::Integer(min = 1) = 4
  # Hot-stream inlet temperature [K]
  parameter T_hot_in::Temperature = 360
  # Cold-stream inlet temperature [K]
  parameter T_cold_in::Temperature = 300
  # Hot-stream initial temperature [K]
  parameter T_hot_start::Temperature = 330
  # Cold-stream initial temperature [K]
  parameter T_cold_start::Temperature = 320
  # Wall initial temperature [K]
  parameter T_wall_start::Temperature = 325
  # Mass flow rate through the hot stream [kg/s]
  parameter m_flow_hot::MediaComponents.Types.MassFlowRate = 0.2
  # Mass flow rate through the cold stream [kg/s]
  parameter m_flow_cold::MediaComponents.Types.MassFlowRate = 0.2
  # Outlet pressure of each stream [Pa]
  parameter p_outlet::MediaComponents.Types.AbsolutePressure = 100000
  # Nominal inlet pressure used for initialization [Pa]
  parameter p_inlet_start::MediaComponents.Types.AbsolutePressure = 101000
  # Hot-stream outlet temperature [K]
  variable T_hot_out::Temperature
  # Cold-stream outlet temperature [K]
  variable T_cold_out::Temperature
  # Mean wall temperature [K]
  variable T_wall_mean::Temperature
  # Total heat flow into the hot stream [W]
  variable Q_hot::HeatFlowRate
  # Total heat flow into the cold stream [W]
  variable Q_cold::HeatFlowRate
relations
  connect(hot_source.ports[1], heat_exchanger.port_a1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 20, "y": 310}, {"x": 20, "y": 190}], "E": 2}],
      "path": {}
    }
  }
  connect(heat_exchanger.port_b1, hot_sink.ports[1]) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 402.5, "y": 190}, {"x": 402.5, "y": 60}], "E": 2}],
      "path": {}
    }
  }
  connect(cold_source.ports[1], heat_exchanger.port_a2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 330, "y": 390}, {"x": 330, "y": 212}], "E": 2}],
      "path": {}
    }
  }
  connect(heat_exchanger.port_b2, cold_sink.ports[1]) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 166}, {"x": 140, "y": 50}], "E": 2}],
      "path": {}
    }
  }
  T_hot_out = heat_exchanger.pipe_1.mediums[nNodes].T
  T_cold_out = heat_exchanger.pipe_2.mediums[nNodes].T
  T_wall_mean = sum(heat_exchanger.wall.T) / nNodes
  Q_hot = heat_exchanger.Q_flow_1
  Q_cold = heat_exchanger.Q_flow_2
metadata {}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses