HeatExchanger (0D)

The HeatExchanger model can be imported from idaes.unit_models, while additional rules and utility functions can be imported from idaes.unit_models.heat_exchanger.

Example

The example below demonstrates how to initialize the HeatExchanger model, and override the default temperature difference calculation.

import pyomo.environ as pe # Pyomo environment
from idaes.core import FlowsheetBlock, StateBlock
from idaes.unit_models import HeatExchanger
from idaes.unit_models.heat_exchanger import delta_temperature_amtd_rule
from idaes.property_models import iapws95

# Create an empty flowsheet and steam property parameter block.
model = pe.ConcreteModel()
model.fs = FlowsheetBlock(default={"dynamic": False})
model.fs.properties = iapws95.Iapws95ParameterBlock()

# Add a Heater model to the flowsheet.
model.fs.heat_exchanger = HeatExchanger(default={
        "delta_temperature_rule":delta_temperature_amtd_rule,
        "side_1":{"property_package": model.fs.properties},
        "side_2":{"property_package": model.fs.properties}})

model.fs.heat_exchanger.area.fix(1000)
model.fs.heat_exchanger.overall_heat_transfer_coefficient[0].fix(100)
model.fs.heat_exchanger.inlet_1.flow_mol.fix(100)
model.fs.heat_exchanger.inlet_1.pressure.fix(101325)
model.fs.heat_exchanger.inlet_1.enth_mol.fix(4000)
model.fs.heat_exchanger.inlet_2.flow_mol.fix(100)
model.fs.heat_exchanger.inlet_2.pressure.fix(101325)
model.fs.heat_exchanger.inlet_2.enth_mol.fix(3000)

# Initialize the model
model.fs.heat_exchanger.initialize()

Degrees of Freedom

Aside from the inlet conditions, a heat exchanger model usually has two degrees of freedom, which can be fixed for it to be fully specified:

  • heat transfer area
  • heat transfer coefficient.

The user may also provide constants to calculate the heat transfer coefficient.

Model Structure

The HeatExchanger model contains two ControlVolume0DBlock blocks (side_1 and side_2), which are configured the same as the ControlVolume0DBlock in the Heater model. The HeatExchanger model contains additional constraints that calculate the amount of heat transferred from side_1 to side_2.

The HeatExchanger has two inlet ports inlet_1 (inlet for side_1) and inlet_2 (outlet for side_2), and two outlet ports inlet ports inlet_1 (outlet for side_1) and outlet_2 (outlet for side_2).

If the \(\Delta T\) calculation method requires one side to be hotter than the other, side_1 is assumed to be the hot side.

Variables

Variable Symbol Index Sets Doc
heat_duty \(Q\) t Heat transferred from side_1 to side_2 a reference to side_2.heat
area \(A\) None Heat transfer area
heat_transfer_coefficient \(U\) t Heat transfer coefficient
delta_temperature \(\Delta T\) t Temperature difference for heat transfer calculations defaults to LMTD

Constraints

The default constants can be overridden by providing alternative rules for the heat transfer equation, temperature difference, and heat transfer coefficient. The section describes the default constraints.

Heat transfer from side_1 to side_2:

\[Q = UA\Delta T\]

Temperature difference is an expression:

\[\Delta T = \frac{\Delta T_1 - \Delta T_2}{\log_e \Delta T_1 - \log_e \Delta T_2}\]

The heat transfer coefficient is a variable with no associated constraints by default.

class idaes.unit_models.heat_exchanger.HeatExchanger(*args, **kwargs)

Simple 0D heat exchanger model.

Parameters:
  • rule (function) – A rule function or None. Default rule calls build().
  • concrete (bool) – If True, make this a toplevel model. Default - False.
  • ctype (str) – Pyomo ctype of the block. Default - “Block”
  • default (dict) –

    Default ProcessBlockData config

    Keys
    dynamic
    Indicates whether this model will be dynamic or not, default = useDefault. Valid values: { useDefault - get flag from parent (default = False), True - set as a dynamic model, False - set as a steady-state model.}
    has_holdup
    Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms}
    side_1
    A config block used to construct the side_1 control volume.
    material_balance_type
    Indicates what type of mass balance should be constructed, default - MaterialBalanceType.componentPhase. Valid values: { MaterialBalanceType.none - exclude material balances, MaterialBalanceType.componentPhase - use phase component balances, MaterialBalanceType.componentTotal - use total component balances, MaterialBalanceType.elementTotal - use total element balances, MaterialBalanceType.total - use total material balance.}
    energy_balance_type
    Indicates what type of energy balance should be constructed, default - EnergyBalanceType.enthalpyTotal. Valid values: { EnergyBalanceType.none - exclude energy balances, EnergyBalanceType.enthalpyTotal - single enthalpy balance for material, EnergyBalanceType.enthalpyPhase - enthalpy balances for each phase, EnergyBalanceType.energyTotal - single energy balance for material, EnergyBalanceType.energyPhase - energy balances for each phase.}
    momentum_balance_type
    Indicates what type of momentum balance should be constructed, default - MomentumBalanceType.pressureTotal. Valid values: { MomentumBalanceType.none - exclude momentum balances, MomentumBalanceType.pressureTotal - single pressure balance for material, MomentumBalanceType.pressurePhase - pressure balances for each phase, MomentumBalanceType.momentumTotal - single momentum balance for material, MomentumBalanceType.momentumPhase - momentum balances for each phase.}
    has_phase_equilibrium
    Indicates whether terms for phase equilibrium should be constructed, default = False. Valid values: { True - include phase equilibrium terms False - exclude phase equilibrium terms.}
    has_pressure_change
    Indicates whether terms for pressure change should be constructed, default - False. Valid values: { True - include pressure change terms, False - exclude pressure change terms.}
    property_package
    Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.}
    property_package_args
    A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}
    side_2
    A config block used to construct the side_2 control volume.
    material_balance_type
    Indicates what type of mass balance should be constructed, default - MaterialBalanceType.componentPhase. Valid values: { MaterialBalanceType.none - exclude material balances, MaterialBalanceType.componentPhase - use phase component balances, MaterialBalanceType.componentTotal - use total component balances, MaterialBalanceType.elementTotal - use total element balances, MaterialBalanceType.total - use total material balance.}
    energy_balance_type
    Indicates what type of energy balance should be constructed, default - EnergyBalanceType.enthalpyTotal. Valid values: { EnergyBalanceType.none - exclude energy balances, EnergyBalanceType.enthalpyTotal - single enthalpy balance for material, EnergyBalanceType.enthalpyPhase - enthalpy balances for each phase, EnergyBalanceType.energyTotal - single energy balance for material, EnergyBalanceType.energyPhase - energy balances for each phase.}
    momentum_balance_type
    Indicates what type of momentum balance should be constructed, default - MomentumBalanceType.pressureTotal. Valid values: { MomentumBalanceType.none - exclude momentum balances, MomentumBalanceType.pressureTotal - single pressure balance for material, MomentumBalanceType.pressurePhase - pressure balances for each phase, MomentumBalanceType.momentumTotal - single momentum balance for material, MomentumBalanceType.momentumPhase - momentum balances for each phase.}
    has_phase_equilibrium
    Indicates whether terms for phase equilibrium should be constructed, default = False. Valid values: { True - include phase equilibrium terms False - exclude phase equilibrium terms.}
    has_pressure_change
    Indicates whether terms for pressure change should be constructed, default - False. Valid values: { True - include pressure change terms, False - exclude pressure change terms.}
    property_package
    Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.}
    property_package_args
    A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}
    delta_temperature_rule
    Rule for equation for temperature difference
    flow_pattern
    Heat exchanger flow pattern, default - HeatExchangerFlowPattern.countercurrent. Valid values: { HeatExchangerFlowPattern.countercurrent - countercurrent flow, HeatExchangerFlowPattern.cocurrent - cocurrent flow, HeatExchangerFlowPattern.crossflow - cross flow, factor times countercurrent temperature difference.}
  • initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
  • idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
Returns:

(HeatExchanger) New instance

class idaes.unit_models.heat_exchanger.HeatExchangerData(component)[source]

Simple 0D heat exchange unit. Unit model to transfer heat from one material to another.

build()[source]

Building model

Parameters:None
Returns:None
initialize(state_args_1=None, state_args_2=None, outlvl=0, solver='ipopt', optarg={'tol': 1e-06}, duty=1000)[source]

Heat exchanger initialization method.

Parameters:
  • state_args_1 – a dict of arguments to be passed to the property initialization for side_1 (see documentation of the specific property package) (default = {}).
  • state_args_2 – a dict of arguments to be passed to the property initialization for side_2 (see documentation of the specific property package) (default = {}).
  • outlvl – sets output level of initialisation routine * 0 = no output (default) * 1 = return solver state for each step in routine * 2 = return solver state for each step in subroutines * 3 = include solver output infomation (tee=True)
  • optarg – solver options dictionary object (default={‘tol’: 1e-6})
  • solver – str indicating which solver to use during initialization (default = ‘ipopt’)
  • duty – an initial guess for the amount of heat transfered (default = 10000)
Returns:

None

set_scaling_factor_energy(f)[source]

This function sets scaling_factor_energy for both side_1 and side_2. This factor multiplies the energy balance and heat transfer equations in the heat exchnager. The value of this factor should be about 1/(expected heat duty).

Parameters:f – Energy balance scaling factor

Rules

A selection of functions for Pyomo rules are provided in the idaes.unit_models.heat_exchanger module, which provide options for different calculation methods. Users can also provide their own rule functions. See the source code for the rules below for examples.

Rules for the delta_temperature_rule Option

These rules provide expressions for the temperature difference used in the heat transfer equations.

idaes.unit_models.heat_exchanger.delta_temperature_lmtd_rule(b, t)[source]

This is a rule for a temperaure difference expression to calculate \(\Delta T\) in the heat exchanger model using log-mean temperature difference (LMTD). It can be supplied to “delta_temperature_rule” HeatExchanger configuration option.

idaes.unit_models.heat_exchanger.delta_temperature_amtd_rule(b, t)[source]

This is a rule for a temperaure difference expression to calculate \(\Delta T\) in the heat exchanger model using arithmetic-mean temperature difference (AMTD). It can be supplied to “delta_temperature_rule” HeatExchanger configuration option.

Rules for the heat_transfer_rule Option

These rules provide constraints for the heat transfer rate.

idaes.unit_models.heat_exchanger._heat_transfer_rule(b, t)[source]

This is the default rule used by the HeatExchanger model to calculate heat transfer (\(Q = UA\Delta T\)).

Rules for the heat_transfer_coefficient_rule Option

There are currently no rules provided for heat transfer coefficient calculation. When the rule is set to None, heat_transfer_coefficient is a fixed Var. User provided heat transfer coefficient rules should return a constraint.