Mixer#

The IDAES Mixer unit model represents operations where multiple streams of material are combined into a single flow. The Mixer class can be used to create either a stand-alone mixer unit, or as part of a unit model where multiple streams need to be mixed.

Degrees of Freedom#

Mixer units have zero degrees of freedom.

Model Structure#

The IDAES Mixer unit model does not use ControlVolumes, and instead writes a set of material, energy and momentum balances to combine the inlet streams into a single mixed stream. Mixer models have a user-defined number of inlet Ports (by default named inlet_1, inlet_2, etc.) and one outlet Port (named outlet).

Mixed State Block

If a mixed state block is provided in the construction arguments, the Mixer model will use this as the StateBlock for the mixed stream in the resulting balance equations. This allows a Mixer unit to be used as part of a larger unit operation by linking multiple inlet streams to a single existing StateBlock.

Variables#

Mixer units have the following variables (\(i\) indicates index by inlet):

Variable Name

Symbol

Notes

phase_equilibrium_generation

\(X_{eq, t, r}\)

Only if has_phase_equilibrium = True, Generation term for phase equilibrium

minimum_pressure

\(P_{min, t, i}\)

Only if momentum_mixing_type = MomemntumMixingType.minimize

Parameters#

Mixer units have the following parameters:

Variable Name

Symbol

Notes

eps_pressure

\(\epsilon\)

Only if momentum_mixing_type = MomemntumMixingType.minimize, smooth minimum parameter

Constraints#

The constraints written by the Mixer model depend upon the construction arguments chosen.

If material_mixing_type is extensive:

  • If material_balance_type is componentPhase:

material_mixing_equations(t, p, j):

\[0 = \sum_i{F_{in, i, p, j}} - F_{out, p, j} + \sum_r {n_{r, p, j} \times X_{eq, t, r}}\]
  • If material_balance_type is componentTotal:

material_mixing_equations(t, j):

\[0 = \sum_p{(\sum_i{F_{in, i, p, j}} - F_{out, p, j} + \sum_r {n_{r, p, j} \times X_{eq, t, r}})}\]
  • If material_balance_type is total:

material_mixing_equations(t):

\[0 = \sum_p{\sum_j{(\sum_i{F_{in, i, p, j}} - F_{out, p, j} + \sum_r {n_{r, p, j} \times X_{eq, t, r}})}}\]

where \(n_{r, p, j}\) is the stoichiometric coefficient of component \(j\) in phase \(p\) in reaction \(r\).

If ‘energy_mixing_type` is extensive:

enthalpy_mixing_equations(t):

\[0 = \sum_i{\sum_p{H_{in, i, p}}} - \sum_p{H_{out, p}}\]

If ‘momentum_mixing_type` is minimize, a series of smooth minimum operations are performed:

minimum_pressure_constraint(t, i):

For the first inlet:

\[P_{min, t, i} = P_{t, i}\]

Otherwise:

\[P_{min, t, i} = smin(P_{min, t, i-1}, P_{t, i}, eps)\]

Here, \(P_{t, i}\) is the pressure in inlet \(i\) at time \(t\), \(P_{min, t, i}\) is the minimum pressure in all inlets up to inlet \(i\), and \(smin\) is the smooth minimum operator (see IDAES Utility Function documentation).

The minimum pressure in all inlets is then:

mixture_pressure(t):

\[P_{mix, t} = P_{min, t, i=last}\]

If momentum_mixing_type is equality, the pressure in all inlets and the outlet are equated.

Note

This may result in an over-specified problem if the user is not careful.

pressure_equality_constraints(t, i):

\[P_{mix, t} = P_{t, i}\]

Often the minimum inlet pressure constraint is useful for sequential modular type initialization, but the equal pressure constants are required for pressure-driven flow models. In these cases it may be convenient to use the minimum pressure constraint for some initialization steps, them deactivate it and use the equal pressure constraints. The momentum_mixing_type is minimum_and_equality this will create the constraints for both with the minimum pressure constraint being active.

The mixture_pressure(t) and pressure_equality_constraints(t, i) can be directly activated and deactivated, but only one set of constraints should be active at a time. The use_minimum_inlet_pressure_constraint() and use_equal_pressure_constraint() methods are also provided to switch between constant sets.

Initialization#

class idaes.models.unit_models.mixer.MixerInitializer(**kwargs)[source]#

Hierarchical Initializer for Mixer blocks.

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

writer_config

Dict of writer_config arguments to pass to solver

default_submodel_initializer

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

initialization_routine(model)[source]#

Initialization routine for Mixer Blocks.

This routine starts by initializing each of the inlet streams, then uses those results to estimate the outlet state before solving the full model.

Parameters:

model (Block) – model to be initialized

Returns:

Pyomo solver status object

Mixer Class#

class idaes.models.unit_models.mixer.Mixer(*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 = False. Mixer blocks are always steady-state.

    has_holdup

    Mixer blocks do not contain holdup, thus this must be False.

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

    inlet_list

    A list containing names of inlets, default - None. Valid values: { None - use num_inlets argument, list - a list of names to use for inlets.}

    num_inlets

    Argument indicating number (int) of inlets to construct, not used if inlet_list arg is provided, default - None. Valid values: { None - use inlet_list arg instead, or default to 2 if neither argument provided, int - number of inlets to create (will be named with sequential integers from 1 to num_inlets).}

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

    has_phase_equilibrium

    Argument indicating whether phase equilibrium should be calculated for the resulting mixed stream, default - False. Valid values: { True - calculate phase equilibrium in mixed stream, False - do not calculate equilibrium in mixed stream.}

    energy_mixing_type

    Argument indicating what method to use when mixing energy flows of incoming streams, default - MixingType.extensive. Valid values: { MixingType.none - do not include energy mixing equations, MixingType.extensive - mix total enthalpy flows of each phase.}

    momentum_mixing_type

    Argument indicating what method to use when mixing momentum/ pressure of incoming streams, default - MomentumMixingType.minimize. Valid values: { MomentumMixingType.none - do not include momentum mixing equations, MomentumMixingType.minimize - mixed stream has pressure equal to the minimimum pressure of the incoming streams (uses smoothMin operator), MomentumMixingType.equality - enforces equality of pressure in mixed and all incoming streams., MomentumMixingType.minimize_and_equality - add constraints for pressure equal to the minimum pressure of the inlets and constraints for equality of pressure in mixed and all incoming streams. When the model is initially built, the equality constraints are deactivated. This option is useful for switching between flow and pressure driven simulations.}

    mixed_state_block

    An existing state block to use as the outlet stream from the Mixer block, default - None. Valid values: { None - create a new StateBlock for the mixed stream, StateBlock - a StateBock to use as the destination for the mixed stream.}

    construct_ports

    Argument indicating whether model should construct Port objects linked to all inlet states and the mixed state, default - True. Valid values: { True - construct Ports for all states, False - do not construct Ports.

  • 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:

(Mixer) New instance

MixerData Class#

class idaes.models.unit_models.mixer.MixerData(component)[source]#

This is a general purpose model for a Mixer block with the IDAES modeling framework. This block can be used either as a stand-alone Mixer unit operation, or as a sub-model within another unit operation.

This model creates a number of StateBlocks to represent the incoming streams, then writes a set of phase-component material balances, an overall enthalpy balance and a momentum balance (2 options) linked to a mixed-state StateBlock. The mixed-state StateBlock can either be specified by the user (allowing use as a sub-model), or created by the Mixer.

When being used as a sub-model, Mixer should only be used when a set of new StateBlocks are required for the streams to be mixed. It should not be used to mix streams from multiple ControlVolumes in a single unit model - in these cases the unit model developer should write their own mixing equations.

add_energy_mixing_equations(inlet_blocks, mixed_block)[source]#

Add energy mixing equations (total enthalpy balance).

add_inlet_state_blocks(inlet_list)[source]#

Construct StateBlocks for all inlet streams.

Parameters:

names (list of strings to use as StateBlock)

Returns:

list of StateBlocks

add_material_mixing_equations(inlet_blocks, mixed_block, mb_type)[source]#

Add material mixing equations.

add_mixed_state_block()[source]#

Constructs StateBlock to represent mixed stream.

Returns:

New StateBlock object

add_port_objects(inlet_list, inlet_blocks, mixed_block)[source]#

Adds Port objects if required.

Parameters:
  • objects (a list of inlet StateBlock)

  • object (a mixed state StateBlock)

Returns:

None

add_pressure_equality_equations(inlet_blocks, mixed_block)[source]#

Add pressure equality equations. Note that this writes a number of constraints equal to the number of inlets, enforcing equality between all inlets and the mixed stream.

add_pressure_minimization_equations(inlet_blocks, mixed_block)[source]#

Add pressure minimization equations. This is done by sequential comparisons of each inlet to the minimum pressure so far, using the IDAES smooth minimum function.

build()[source]#

General build method for MixerData. This method calls a number of sub-methods which automate the construction of expected attributes of unit models.

Inheriting models should call super().build.

Parameters:

None

Returns:

None

create_inlet_list()[source]#

Create list of inlet stream names based on config arguments.

Returns:

list of strings

default_initializer#

alias of MixerInitializer

fix_initialization_states()[source]#

Iterate over inlet ports and fix all variables.

For Mixers with pressure equality, we will assume that pressure has been correctly specified and not fix pressures.

Returns:

None

get_mixed_state_block()[source]#

Validates StateBlock provided in user arguments for mixed stream.

Returns:

The user-provided StateBlock or an Exception

initialize_build(outlvl=0, optarg=None, solver=None, hold_state=False)[source]#

Initialization routine for mixer.

Keyword Arguments:
  • 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)

  • hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - False. Valid values: True - states variables are not unfixed, and a dict of returned containing flags for which states were fixed during initialization, False - state variables are unfixed after initialization by calling the release_state method.

Returns:

If hold_states is True, returns a dict containing flags for which states were fixed during initialization.

model_check()[source]#

This method executes the model_check methods on the associated state blocks (if they exist). This method is generally called by a unit model as part of the unit’s model_check method.

Parameters:

None

Returns:

None

release_state(flags, outlvl=0)[source]#

Method to release state variables fixed during initialization.

Keyword Arguments:
  • flags – dict containing information of which state variables were fixed during initialization, and should now be unfixed. This dict is returned by initialize if hold_state = True.

  • outlvl – sets output level of logging

Returns:

None

use_equal_pressure_constraint()[source]#

Deactivate the mixer pressure = minimum inlet pressure constraint and activate the mixer pressure and all inlet pressures are equal constraints. This should only be used when momentum_mixing_type == MomentumMixingType.minimize_and_equality.

use_minimum_inlet_pressure_constraint()[source]#

Activate the mixer pressure = minimum inlet pressure constraint and deactivate the mixer pressure and all inlet pressures are equal constraints. This should only be used when momentum_mixing_type == MomentumMixingType.minimize_and_equality.