HeatExchanger (0D)¶

The HeatExchanger model can be imported from idaes.generic_models.unit_models, while additional rules and utility functions can be imported from idaes.generic_models.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.generic_models.unit_models import HeatExchanger
from idaes.generic_models.unit_models.heat_exchanger import delta_temperature_amtd_callback
from idaes.generic_models.properties 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_callback":delta_temperature_amtd_callback,
"shell":{"property_package": model.fs.properties},
"tube":{"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.shell_inlet.flow_mol.fix(100)
model.fs.heat_exchanger.shell_inlet.pressure.fix(101325)
model.fs.heat_exchanger.shell_inlet.enth_mol.fix(4000)
model.fs.heat_exchanger.tube_inlet.flow_mol.fix(100)
model.fs.heat_exchanger.tube_inlet.pressure.fix(101325)
model.fs.heat_exchanger.tube_inlet.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. Things that are frequently fixed are two of:

• heat transfer area,

• heat transfer coefficient, or

• temperature approach.

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

Model Structure¶

The HeatExchanger model contains two ControlVolume0DBlock blocks. By default the hot side is named shell and the cold side is named tube. These names are configurable. The sign convention is that duty is positive for heat flowing from the hot side to the cold side. Aside from the sign convention there is no requirement that the hot side be hotter than the cold side.

The control volumes 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 the hot side to the cold side.

The HeatExchanger has two inlet ports and two outlet ports. By default these are shell_inlet, tube_inlet, shell_outlet, and tube_outlet. If the user supplies different hot and cold side names the inlet and outlets are named accordingly.

Variables¶

Variable

Symbol

Index Sets

Doc

heat_duty

$$Q$$

t

Heat transferred from hot side to the cold side

area

$$A$$

None

Heat transfer area

heat_transfer_coefficient

$$U$$

t

Heat transfer coefficient

delta_temperature

$$\Delta T$$

t

Temperature difference, defaults to LMTD

Note: delta_temperature may be either a variable or expression depending on the callback used. If the specified cold side is hotter than the specified hot side this value will be negative.

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 shell to tube:

$Q = UA\Delta T$

Temperature difference is an expression:

$\Delta T = \frac{\Delta T_1 - \Delta T_2}{\log_e\left(\frac{\Delta T_1}{\Delta T_2}\right)}$

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

Class Documentation¶

Note

The hot_side_config and cold_side_config can also be supplied using the name of the hot and cold sides (shell and tube by default) as in the example.

class idaes.generic_models.unit_models.heat_exchanger.HeatExchanger(*args, **kwds)

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 (class) – Pyomo ctype of the block. Default - pyomo.environ.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: { useDefault - get flag from parent (default = False), True - construct holdup terms, False - do not construct holdup terms}

hot_side_name

Hot side name, sets control volume and inlet and outlet names

cold_side_name

Cold side name, sets control volume and inlet and outlet names

hot_side_config

A config block used to construct the hot side control volume. This config can be given by the hot side name instead of hot_side_config.

material_balance_type

Indicates what type of mass balance should be constructed, default - MaterialBalanceType.useDefault. Valid values: { MaterialBalanceType.useDefault - refer to property package for default balance type **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.useDefault. Valid values: { EnergyBalanceType.useDefault - refer to property package for default balance type **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.}

cold_side_config

A config block used to construct the cold side control volume. This config can be given by the cold side name instead of cold_side_config.

material_balance_type

Indicates what type of mass balance should be constructed, default - MaterialBalanceType.useDefault. Valid values: { MaterialBalanceType.useDefault - refer to property package for default balance type **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.useDefault. Valid values: { EnergyBalanceType.useDefault - refer to property package for default balance type **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_callback

Callback for for temperature difference calculations

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.}

side_1_is_hot

If True, side_1 is an alias for hot_side. Otherwise, side_1 is an alias for cold_side

• 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.generic_models.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=None, optarg=None, duty=None)[source]

Heat exchanger initialization method.

Parameters
• state_args_1 – a dict of arguments to be passed to the property initialization for the hot side (see documentation of the specific property package) (default = {}).

• state_args_2 – a dict of arguments to be passed to the property initialization for the cold side (see documentation of the specific property package) (default = {}).

• outlvl – sets output level of initialization routine

• optarg – solver options dictionary object (default=None, use default solver options)

• solver – str indicating which solver to use during initialization (default = None, use default solver)

• duty – an initial guess for the amount of heat transfered. This should be a tuple in the form (value, units), (default = (1000 J/s))

Returns

None

Callbacks¶

A selection of functions for constructing the delta_temperature variable or expression are provided in the idaes.generic_models.unit_models.heat_exchanger module. The user may also provide their own function. These callbacks should all take one argument (the HeatExchanger block). With the block argument, the function can add any additional variables, constraints, and expressions needed. The only requirement is that either a variable or expression called delta_temperature must be added to the block.

Defined Callbacks for the delta_temperature_callback Option¶

These callbacks provide expressions for the temperature difference used in the heat transfer equations. There is a choice of three forms for the LMTD calculation. Depending on the expected approach temperatures, one form may be more favorable. The first two forms do not require one side or the other to be the hot side, while the third form requires the hot side to be the hot side to avoid an evaluation error in the log function.

idaes.generic_models.unit_models.heat_exchanger.delta_temperature_lmtd_callback(b)[source]

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

$\Delta T = \frac{\Delta T_1 - \Delta T_2}{ \log_e\left(\frac{\Delta T_1}{\Delta T_2}\right)}$

where $$\Delta T_1$$ is the temperature difference at the hot inlet end and $$\Delta T_2$$ is the temperature difference at the hot outlet end.

idaes.generic_models.unit_models.heat_exchanger.delta_temperature_lmtd2_callback(b)[source]

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

$\Delta T = \frac{\Delta T_2 - \Delta T_1}{ \log_e\left(\frac{\Delta T_2}{\Delta T_1}\right)}$

where $$\Delta T_1$$ is the temperature difference at the hot inlet end and $$\Delta T_2$$ is the temperature difference at the hot outlet end.

idaes.generic_models.unit_models.heat_exchanger.delta_temperature_lmtd3_callback(b)[source]

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

$\Delta T = \frac{\Delta T_1 - \Delta T_2}{ \log_e\left(\Delta T_2\right) - \log_e\left(\Delta T_1\right)}$

where $$\Delta T_1$$ is the temperature difference at the hot inlet end and $$\Delta T_2$$ is the temperature difference at the hot outlet end.

idaes.generic_models.unit_models.heat_exchanger.delta_temperature_amtd_callback(b)[source]

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

$\Delta T = \frac{\Delta T_1 + \Delta T_2}{2}$

where $$\Delta T_1$$ is the temperature difference at the hot inlet end and $$\Delta T_2$$ is the temperature difference at the hot outlet end.

idaes.generic_models.unit_models.heat_exchanger.delta_temperature_underwood_callback(b)[source]

This is a callback for a temperature difference expression to calculate $$\Delta T$$ in the heat exchanger model using log-mean temperature difference (LMTD) approximation given by Underwood (1970). It can be supplied to “delta_temperature_callback” HeatExchanger configuration option. This uses a cube root function that works with negative numbers returning the real negative root. This should always evaluate successfully. This form is

$\Delta T = \left(\frac{ \Delta T_1^\frac{1}{3} + \Delta T_2^\frac{1}{3}}{2}\right)^3$

where $$\Delta T_1$$ is the temperature difference at the hot inlet end and $$\Delta T_2$$ is the temperature difference at the hot outlet end.