CrossFlowHeatExchanger1D#

This model is for a cross flow heat exchanger between two gases. The gas in the shell has a straight path, while the gas in the tubes snakes back and forth across the shell’s path. Note that the finite_elements option in the shell and tube control volume configs should be set to an integer factor of number_passes in order for the discretization equations to make sense as a cross-flow heat exchanger.

Example#

import pyomo.environ as pyo

from idaes.core import FlowsheetBlock
import idaes.core.util.scaling as iscale
from idaes.models.unit_models import HeatExchangerFlowPattern
from idaes.models.properties.modular_properties import GenericParameterBlock
from idaes.models_extra.power_generation.properties.natural_gas_PR import (
    get_prop,
    EosType,
)
from idaes.models_extra.power_generation.unit_models import CrossFlowHeatExchanger1D
from idaes.core.util.model_statistics import degrees_of_freedom

optarg = {
    "constr_viol_tol": 1e-8,
    "nlp_scaling_method": "user-scaling",
    "linear_solver": "ma57",
    "OF_ma57_automatic_scaling": "yes",
    "max_iter": 350,
    "tol": 1e-8,
    "halt_on_ampl_error": "no",
}

m = pyo.ConcreteModel()
m.fs = pyo.FlowsheetBlock(dynamic=False)
m.fs.properties = GenericParameterBlock(
      **get_prop(["H2", "H2O", "Ar", "N2"], {"Vap"}, eos=EosType.IDEAL),
      doc="H2O + H2 gas property parameters",
  )
m.fs.heat_exchanger = CrossFlowHeatExchanger1D(
      has_holdup=True,
      dynamic=False,
      cold_side={
          "property_package": m.fs.h2_side_prop_params,
          "has_holdup": False,
          "dynamic": False,
          "has_pressure_change": pressure_drop,
          "transformation_method": "dae.finite_difference",
          "transformation_scheme": "FORWARD",
      },
      hot_side={
          "property_package": m.fs.h2_side_prop_params,
          "has_holdup": False,
          "dynamic": False,
          "has_pressure_change": pressure_drop,
          "transformation_method": "dae.finite_difference",
          "transformation_scheme": "BACKWARD",
      },
      shell_is_hot=True,
      flow_type=HeatExchangerFlowPattern.countercurrent,
      finite_elements=12,
      tube_arrangement="staggered",
  )

hx = m.fs.heat_exchanger

hx.hot_side_inlet.flow_mol.fix(2619.7)
hx.hot_side_inlet.temperature.fix(971.6)
hx.hot_side_inlet.pressure.fix(1.2e5)
hx.hot_side_inlet.mole_frac_comp[0, "H2"].fix(0.79715)
hx.hot_side_inlet.mole_frac_comp[0, "H2O"].fix(0.20177)
hx.hot_side_inlet.mole_frac_comp[0, "Ar"].fix(0.00086358)
hx.hot_side_inlet.mole_frac_comp[0, "N2"].fix(0.00021589)

hx.cold_side_inlet.flow_mol.fix(2619.7)
hx.cold_side_inlet.temperature.fix(446.21)
hx.cold_side_inlet.pressure.fix(1.2e5)
hx.cold_side_inlet.mole_frac_comp[0, "H2"].fix(0.36203)
hx.cold_side_inlet.mole_frac_comp[0, "H2O"].fix(0.63689)
hx.cold_side_inlet.mole_frac_comp[0, "Ar"].fix(0.00086358)
hx.cold_side_inlet.mole_frac_comp[0, "N2"].fix(0.00021589)

hx.di_tube.fix(0.0525018)
hx.thickness_tube.fix(0.0039116)
hx.length_tube_seg.fix(4.3)
hx.number_passes.fix(12)
hx.number_columns_per_pass.fix(50)
hx.number_rows_per_pass.fix(25)

hx.pitch_x.fix(0.1)
hx.pitch_y.fix(0.1)
hx.therm_cond_wall = 43.0
hx.rfouling_tube = 0.0001
hx.rfouling_shell = 0.0001
hx.fcorrection_htc_tube.fix(1)
hx.fcorrection_htc_shell.fix(1)

hx.cp_wall.value = 502.4

pp = m.fs.properties
pp.set_default_scaling("enth_mol_phase", 1e-3)
pp.set_default_scaling("pressure", 1e-5)
pp.set_default_scaling("temperature", 1e-2)
pp.set_default_scaling("flow_mol", 1e-3)

_mf_scale = {
    "H2": 1,
    "H2O": 1,
    "N2": 10,
    "Ar": 10,
}
for comp, s in _mf_scale.items():
    pp.set_default_scaling("mole_frac_comp", s, index=comp)
    pp.set_default_scaling("mole_frac_phase_comp", s, index=("Vap", comp))
    pp.set_default_scaling("flow_mol_phase_comp", s * 1e-3, index=("Vap", comp))

shell = hx.hot_side
tube = hx.cold_side
iscale.set_scaling_factor(shell.area, 1e-1)
iscale.set_scaling_factor(shell.heat, 1e-6)
iscale.set_scaling_factor(tube.area, 1)
iscale.set_scaling_factor(tube.heat, 1e-6)
iscale.set_scaling_factor(shell._enthalpy_flow, 1e-8)  # pylint: disable=W0212
iscale.set_scaling_factor(tube._enthalpy_flow, 1e-8)  # pylint: disable=W0212
iscale.set_scaling_factor(shell.enthalpy_flow_dx, 1e-7)
iscale.set_scaling_factor(tube.enthalpy_flow_dx, 1e-7)
iscale.set_scaling_factor(hx.heat_holdup, 1e-8)

iscale.calculate_scaling_factors(m)

initializer = m.fs.heat_exchanger.default_initializer(
      solver="ipopt",
      solver_options=optarg
)
initializer.initialize(m.fs.heat_exchanger)

Heat Exchanger Geometry#

Variable

Index Sets

Doc

number_columns_per_pass

None

Number of columns of tube per pass

number_rows_per_pass

None

Number of rows of tube per pass

number_passes

None

Number of tube banks of nrow_tube * ncol_inlet tubes

pitch_x

None

Distance between tubes parallel to shell flow, measured from center-of-tube to center-of-tube

pitch_y

None

Distance between tubes perpendicular to shell flow, measured from center-of-tube to center-of-tube

length_tube_seg

None

Length of tube segment perpendicular to flow in each pass

area_flow_shell

None

Reference to flow area on shell control volume

length_flow_shell

None

Reference to flow length on shell control volume

area_flow_shell_min

None

Minimum flow area on shell side

di_tube

None

Inner diameter of tubes

thickness_tube

None

Thickness of tube wall.

area_flow_tube

None

Reference to flow area on tube control volume

length_flow_tube

None

Reference to flow length on tube control volume

Expression

Index Sets

Doc

nrow_tube

None

Total number of rows of tube

do_tube

None

Outer diameter of tube (equal to di_tube+2*thickness_tube)

pitch_x_to_do

None

Ratio of pitch_x to do_tube

pitch_y_to_do

None

Ratio of pitch_y to do_tube

area_wall_seg

None

Total cross-sectional area of tube per pass

total_heat_transfer_area

None

Total heat transfer area, as measured on outer surface of tubes

Constraint

Index Sets

Doc

length_flow_shell_eqn

None

Constrains shell flow length from control volume to equal value implied by geometry

area_flow_shell_eqn

None

Constrains shell flow cross-sectional area from control volume to equal value implied by geometry

area_flow_shell_min_eqn

None

Constraints area_flow_shell_min to equal value determined by geometry

length_flow_tube_eqn

None

Constrains tube flow length from control volume to equal value implied by geometry

area_flow_tube_eqn

None

Constrains tube flow cross-sectional area from control volume to equal value implied by geometry

Performance Equations#

Variable

Index Sets

Doc

fcorrection_htc_shell

time, length

Correction factor for shell convective heat transfer

conv_heat_transfer_coeff_shell

time, length

Shell-side convective heat transfer coefficient

temp_wall_shell

time, length

Shell-side wall temperature of tube

temp_wall_center

time, length

Temperature at center of tube wall

v_shell

time, length

Flow velocity on shell side through minimum area

N_Re_shell

time, length

Reynolds number on shell side

N_Nu_shell

time, length

Nusselt number on shell side

heat_transfer_coeff_tube

time, length

Tube-side heat transfer coefficient

temp_wall_tube

time, length

Tube-side wall temperature of tube

v_tube

time, length

Flow velocity of gas in tube

N_Re_tube

time, length

Reynolds number in tube

N_Nu_tube

time, length

Nusselt number on tube side

Parameter

Index Sets

Doc

therm_cond_wall

None

Thermal conductivity of tube wall

density_wall

None

Mass density of tube wall metal

cp_wall

None

Tube wall heat capacity (mass basis)

rfouling_shell

None

Fouling resistance on shell side

f_arrangement

None

Adjustment factor depending on tube_arrangement in config

Constraint

Index Sets

Doc

v_shell_eqn

time, length

Calculates velocity of flow through shell using area_flow_shell_min

N_Re_shell_eqn

time, length

Calculates the shell-side Reynolds number

conv_heat_transfer_coeff_shell_eqn

time, length

Calculates the shell-side convective heat transfer coefficient

v_tube_eqn

time, length

Calculates gas velocity in tube

N_Re_tube_eqn

time, length

Calculates the tube-side Reynolds number

heat_transfer_coeff_tube_eqn

time, length

Calculates the tube-side heat transfer coefficient

N_Nu_shell_eqn

time, length

Calculate the shell-side Nusselt number

N_Nu_tube_eqn

time, length

Calculate the tube-side Nusselt number

heat_tube_eqn

time, length

Calculates heat transfer per unit length

heat_shell_eqn

time, length

Calculates heat transfer per unit length

temp_wall_tube_eqn

time, length

Calculate the wall temperature of the inner tube

temp_wall_shell_eqn

time, length

Calculate the wall temperature of the outer tube

temp_wall_center_eqn

time, length

Overall energy balance on tube metal

Expression

Index Sets

Doc

total_heat_transfer_coeff_shell

time

Returns conv_heat_transfer_coeff_shell. Could be extended to include radiation.

total_heat_duty

time

Created only if not dynamic. Gives total heat transferred over entire exchanger

log_mean_delta_temperature

time

Created only if not dynamic. Gives the log mean temperature difference (LMTD).

overall_heat_transfer_coefficient

time

Created only if not dynamic. Calculated from total heat transfer, area, and LMTD.

Pressure Change Equations#

Parameter

Index Sets

Doc

fcorrection_dp_shell

None

Correction factor for shell side pressure drop

kloss_uturn

None

Loss coefficient of a tube u-turn

fcorrection_dp_tube

None

Correction factor for tube side pressure drop

Variable

Index Sets

Doc

fcorrection_dp_shell

None

Correction factor for shell side pressure drop

friction_factor_shell

time, length

Friction factor on shell side

friction_factor_tube

time, length

Friction factor on tube side

deltaP_tube_friction

time, length

Change of pressure in tube due to friction

deltaP_tube_uturn

time, length

Change of pressure in tube due to U turns

Constraint

Index Sets

Doc

friction_factor_shell_eqn

time, length

Calculates the shell-side friction factor

deltaP_shell_eqn

time, length

Sets deltaP_shell based on the friction factor and shell properties

friction_factor_tube_eqn

time, length

Calculates the tube-side friction factor

deltaP_tube_friction_eqn

time, length

Sets deltaP_tube_friction based on friction factor

deltaP_tube_uturn_eqn

time, length

Sets deltaP_tube_uturn based on kloss_uturn

deltaP_tube_eqn

time, length

Sets deltaP_tube by summing deltaP_tube_friction and deltaP_tube_uturn

Holdup Equations#

Created when has_holdup=True in the config.

Variable

Index Sets

Doc

heat_holdup

time, length

Energy holdup per unit length of shell flow path

Constraint

Index Sets

Doc

heat_holdup_eqn

time, length

Defines heat holdup in terms of geometry and physical properties

Dynamic Equations#

Created when dynamic=True in the config.

Derivative Variable

Index Sets

Doc

heat_accumulation

time, length

Energy accumulation in tube wall per unit length of shell flow path per unit time

CrossFlowHeatExchanger1D Class#

class idaes.models_extra.power_generation.unit_models.cross_flow_heat_exchanger_1D.CrossFlowHeatExchanger1D(*args, **kwds)#
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

    Config args

    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

    hot side config arguments

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

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

    has_phase_equilibrium

    Argument to enable phase equilibrium. - True - include phase equilibrium term - False - do not include phase equilibrium term

    property_package

    Property parameter object used to define property calculations (default = ‘use_parent_value’) - ‘use_parent_value’ - get package from parent (default = None) - a ParameterBlock object

    property_package_args

    A dict of arguments to be passed to the PropertyBlockData and used when constructing these (default = ‘use_parent_value’) - ‘use_parent_value’ - get package from parent (default = None) - a dict (see property package for documentation)

    transformation_method

    Discretization method to use for DAE transformation. See Pyomo documentation for supported transformations.

    transformation_scheme

    Discretization scheme to use when transformating domain. See Pyomo documentation for supported schemes.

    cold_side

    cold side config arguments

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

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

    has_phase_equilibrium

    Argument to enable phase equilibrium. - True - include phase equilibrium term - False - do not include phase equilibrium term

    property_package

    Property parameter object used to define property calculations (default = ‘use_parent_value’) - ‘use_parent_value’ - get package from parent (default = None) - a ParameterBlock object

    property_package_args

    A dict of arguments to be passed to the PropertyBlockData and used when constructing these (default = ‘use_parent_value’) - ‘use_parent_value’ - get package from parent (default = None) - a dict (see property package for documentation)

    transformation_method

    Discretization method to use for DAE transformation. See Pyomo documentation for supported transformations.

    transformation_scheme

    Discretization scheme to use when transformating domain. See Pyomo documentation for supported schemes.

    finite_elements

    Number of finite elements to use when discretizing length domain (default=20)

    collocation_points

    Number of collocation points to use per finite element when discretizing length domain (default=3)

    flow_type

    Flow configuration of heat exchanger - HeatExchangerFlowPattern.cocurrent: hot and cold flows from 0 to 1 (default) - HeatExchangerFlowPattern.countercurrent: hot side flows from 0 to 1 cold side flows from 1 to 0

    hot_side_name

    Hot side name, sets control volume and inlet and outlet names. Default = None.

    cold_side_name

    Cold side name, sets control volume and inlet and outlet names. Default = None.

    shell_is_hot

    Boolean flag indicating whether shell side contains hot fluid (default=True). If True, shell side will be the hot_side, if False shell side will be cold_side.

    tube_arrangement

    tube arrangement could be in-line or staggered

  • initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries with config arguments as keys.

  • 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 override the default behavior of matching the BlockData index exactly to the index in initialize.

Returns:

(CrossFlowHeatExchanger1D) New instance

CrossFlowHeatExchanger1DData Class#

class idaes.models_extra.power_generation.unit_models.cross_flow_heat_exchanger_1D.CrossFlowHeatExchanger1DData(component)[source]#

Standard Cross Flow Heat Exchanger Unit Model Class.

build()[source]#

Begin building model (pre-DAE transformation).

Parameters:

None

Returns:

None

default_initializer#

alias of CrossFlowHeatExchanger1DInitializer

CrossFlowHeatExchanger1DInitializer Class#

class idaes.models_extra.power_generation.unit_models.cross_flow_heat_exchanger_1D.CrossFlowHeatExchanger1DInitializer(**kwargs)[source]#

Initializer for Cross Flow Heat Exchanger 1D units.

First, the shell and tube control volumes are initialized without heat transfer. Next the total possible heat transfer between streams is estimated based on heat capacity, flow rate, and inlet/outlet temperatures. The actual temperature change is set to be half the theoretical maximum, and the shell and tube are initialized with linear temperature profiles. Finally, temperatures besides the inlets are unfixed and the performance equations are activated before a full solve of the system model.

constraint_tolerance

Tolerance for checking constraint convergence

output_level

Set output level for logging messages

solver

Solver to use for initialization

solver_options

Dict of options to pass to solver

default_submodel_initializer

Default Initializer object to use for sub-models. Only used if no Initializer defined in submodel_initializers.

always_estimate_states

Whether initialization routine should estimate values for state variables that already have values. Note that if set to True, this will overwrite any initial guesses provided.

initialize_main_model(model, copy_inlet_state=False)[source]#

Initialization routine for the main Cross Flow Heat Exchanger 1D model (as opposed to submodels like costing, which presently do not exist).

Parameters:
  • model (Block) – Pyomo Block to be initialized.

  • copy_inlet_state (bool) – bool (default=False). Whether to copy inlet state to other states or not (0-D control volumes only). Copying will generally be faster, but inlet states may not contain all properties required elsewhere.

  • duty – initial guess for heat duty to assist with initialization. Can be a Pyomo expression with units.

Returns:

Pyomo solver results object.