Holdup1D

Introduction

The Holdup1D block is used to model systems with variations in one spatial dimension, such as plug flow reactors and idea pipes. Holdup1D blocks contain a set of Indexed Property Blocks (with an instance of a Property Block at each node in the spatial domain), and write a set of material, energy and momentum balance equations with differential flow terms.

Spatial Domain

Holdup1D blocks have a normalized domain, name ldomain, which represents the spatial dimension of the unit. The developer has the option of specifying a domain to inherit from a parent model, or to construct a new domain for each holdup. This domain is normally defined as a Pyomo ContinuousSet with bounds of 0 and 1, and must be transformed using Pyomo.dae before the model can be solved. This is done automatically during construction of Holdup1D, based on the following arguments provided by the developer.

  • inherited_length_domain - allows the developer to provide an existing length domain to use within the holdup. This will be used wherever ldomain is called for, and no new domain will be created. Note: the balance equations in Holdup1D are written in normalized form, and thus expect a normalized domain. Unexpected behavior may occur if a non-normalized domain is provided.

  • length_domain_set - allows the user to specify a set of points to use as part of the spatial domain (default = [0.0, 1.0]). These points will be used to populate the initial domain, with additional points added later during transformation as required. This allows the user to specify custom grid spacings as required. Note: the balance equations in Holdup1D are written in normalized form, and thus expect a normalized domain. Unexpected behavior may occur if a non-normalized domain is provided.

  • flow_direction - indicates the direction of flow within the length domain. Options are:

    • ‘forward’ - flow from 0 to 1 (default)
    • ‘backward’ - flow from 1 to 0
  • discretization_method - specifies the method to use when discretizing the spatial domain. Options are:

    • BFD - backwards finite difference method (default)
    • FFD - forwards finite difference method
    • OCLR - orthogonal collocation on finite elements (Lagrange-Radau roots)
    • OCLL - orthogonal collocation on finite elements (Lagrange-Legendre roots)
  • finite_elements - number of finite elements to use when discretizing domain (default = 20)

  • collocation_ponts - number of collocation points to use per finite element (default = 3, collocation methods only)

Holdup1D Equations

Holdup1D contains support for a number of different forms of the material, energy and momentum balances, as well as options for controlling which terms will appear in these equations. The different options available are outlined below along with the equations written with each choice. In all cases, the extensive flow terms are provided by the associated Property Blocks, and the inlet boundary condition is provided by the inlet stream (inlet may be at \(x = 0\) or \(x = 1\) depending on flow direction).

Material Balance Types

Holdup1D provides support for three different types of material balance.

  • component_phase - material balances are written for each component in each phase (e.g. separate balances for liquid water and steam). Property packages may include information to indicate that certain species do not appear in all phases, and material balances will not be written in these cases (if include_holdup is True holdup terms will still appear for these species, however these will be set to 0). The equations written by the Holdup block for phase-component balances have the form:
\[\begin{split}@ x \neq inlet, L \times \frac{\partial M_{t, x, p, j}}{\partial t} = fd \times \frac{\partial F_{t, x, p, j}}{\partial x} + L \times N_{kinetic, t, x, p, j} + L \times N_{equilibrium, t, x, p, j} \\ + L \times N_{pe, t, x, p, j} + L \times N_{transfer, t, x, p, j} + \frac {A}{L} \times J_{diffusion, t, x, p, j}\end{split}\]

where \(M_{t, x, p, j}\) is the holdup of component \(j\) in phase \(p\) at point :math:’x’ and time \(t\), \(L\) and \(A\) are the (total) length and area of the control volume respectively, \(F_{t, x, p, j}\) is the flow of species \(j\) in phase \(p\) at point \(x\) and time \(t\), \(N_{kinetic, t, x, p, j}\), \(N_{equilibrium, t, x, p, j}\) and \(N_{pe, t, x, p, j}\) are the generation of species \(j\) in phase \(p\) by kinetic, chemical equilibrium and phase equilibrium controlled reactions respectively, \(N_{transfer, t, x, p, j}\) is a term to allow for other forms of mass transfer within or across the system boundary and \(J_{diffusion, t, x, p, j}\) is the diffusive material flux of component \(j\) in phase \(p\) at point \(x\) and time \(t\).

  • component_total - material balances will be written for each component across all phases (e.g. one balance for both liquid water and steam). Phase equilibrium terms are not included in this form of the material balance. This form can be useful for steady-state systems with phase-equilibrium. However users should be careful using this form of the material balance, especially for dynamic systems, as there are often additional degrees of freedom that need to be specified. The equations written by the Holdup block for total component balances have the form:
\[\begin{split}@ x \neq inlet, L \times \sum_p{\frac{\partial M_{t, x, p, j}}{\partial t}} = fd \times \sum_p{\frac{\partial F_{t, x, p, j}}{\partial x}} + L \times \sum_p{N_{kinetic, t, p, j}} \\ + L \times \sum_p{N_{equilibrium, t, p, j}} + L \times \sum_p{N_{transfer, t, p, j}} + \frac {A}{L} \times J_{diffusion, t, x, p, j}\end{split}\]
  • element_total - material balances are written for each element in the system (e.g. one material balance for hydrogen and one for oxygen). Only flow and mass transfer terms are included in this form of the material balance. This form of the material balance can be useful for certain reactive systems, and is necessary for performing Gibbs energy minimization. The equations written by the Holdup block for total element balances have the form:
\[@ x \neq inlet, L \times \sum_p{\frac{\partial M_{t, x, p, e}}{\partial t}} = fd \times \sum_p{\frac{\partial F_{t, x, p, e}}{\partial x}} + L \times \sum_p{N_{transfer, t, x, p, e}} + \frac {A}{L} \times J_{diffusion, t, x, p, e}\]

where \(M_{t, x, p, e}\) is the holdup of element \(e\) in phase \(p\) at point \(x\) and time \(t\), \(F_{t, x, p, e}\) is the flow of element \(e\) in phase \(p\) at point \(x\) and time \(t\), \(N_{transfer, t, x, p, e}\) is a term to allow for other forms of mass transfer, and \(J_{diffusion, t, x, p, e}\) is the diffusive material flux of element \(e\) in phase \(p\) at point \(x\) and time \(t\).

  • none - no material balances are written.

Energy Balance Types

Holdup1D currently supports only one form of energy balance.

  • total - one energy balance is written for the entire holdup, summing contributions from all phases. The form of the total energy balance written by the holdup block is:
\[\begin{split}@ x \neq inlet, s \times L \times \sum_p{\frac{\partial E_{t, x, p}}{\partial t}} = s \times fd \times \sum_p{\frac{\partial H_{t, x, p}}{\partial x}} + s \times L \times Q_{t, x} + s \times L \times W_{t, x} \\ + s \times \frac {A}{L} \times J_{conduction, t, x, p}\end{split}\]

where \(E_p\) is the holdup of energy in phase \(p\) at point \(x\) and time \(t\), \(H_{t, x, p}\) is the flow of energy in phase \(p\) at point \(x\) and time \(t\), \(Q_{t, x}\) is the heat transferred into the system, \(W_{t, x}\) is the work transfer into the system, \(J_{conduction, t, x, p}\) is the conductive heat transfer term in phase \(p\) at point \(x\) and time \(t\), and \(s\) is a scaling factor.

  • none - no energy balances are written.

Momentum Balance Types

Holdup1D currently supports only one form of momentum balance.

  • total - one momentum balance is written for the entire holdup. Currently this is a simple pressure balance across the system with a potential pressure drop term. The form of the total momentum balance written by the holdup block is:
\[@ x \neq inlet, 0 = s \times fd \times \frac{\partial P_{t, x}}{\partial x} + s \times L \times \Delta P_{t, x}\]

where \(P_{t, x}\) is the pressure at point \(x\) and time \(t\), \(\Delta P_{t, x}\) is the pressure drop at point \(x\) and time \(t\), and \(s\) is a scaling factor.

  • none - no momentum balances are written.

Supporting Equations

Holdup1D also creates a number of supporting Variables and Constraints as required by the balance equations, which are summarized below.

Geometry Constraints

Holdup1D writes one Constraint relating the volume and length of the control volume.

\[V = L \times A\]

where \(V\) is the volume of the control volume, \(L\) is the (actual) length of the spatial domain and \(A\) is the cross-sectional area of the control volume. Holdup1D does not currently support control volumes of changing volume.

Phase Fraction

For systems with more than one phase present (determined automatically from the phase list provided by the property package), Holdup1D creates a phase fraction variable for each phase, and enforces the following constraint at all points in space \(x\) and time \(t\):

\[\sum_p{\phi_{t, x, p}} = 1\]

When only one phase is present, \(\phi\) is automatically substituted with 1 in all equations.

Holdup Calculations

Holdup1D also calculates the holdup terms for the material and energy balances (unless include_holdup is False), and automatically writes Constraints for these based on information provided by the property package. The form of the holdup constraint for component balances is:

\[M_{t, x, p, j} = A \times \phi_{t, x, p} \times \rho_{t, x, p, j}\]

where \(M_{t, x, p, j}\) is the holdup of species \(j\) in phase \(p\) at point \(x\) and time \(t\), \(a\) is the cross-sectional area of the control volume, \(\phi_{t, x, p}\) is the phase fraction of phase \(p\) at point \(x\) and time \(t\) and \(\rho_{t, x, p, j}\) is the material density of component \(j\) in phase \(p\) at point \(x\) and time \(t\) (provided by the Property Block). For phase-component pairs which do not exist (as indicated by the Property Block), the following Constraint is written instead (this is required to close the degrees of freedom):

\[M_{t, x, p, j} = 0\]

For holdup blocks using element balances, an elemental holdup is required instead, which is calculated as follows:

\[M_{t, x, p, e} = a \times \phi_{t, x, p} \times \rho_{t, x, p, j} \times e_{j, e}\]

where \(e_{j, e}\) is the number of moles of element \(e\) per mole of component \(j\).

For the holdup term in the energy balances, the following Constraints are written:

\[E_{t, x, p} = A \times \phi_{t, x, p} \times \rho e_{t, x, p}\]

where \(E_{t, x, p}\) is the energy holdup in phase \(p\) at point \(x\) and time \(t\) and \(\rho e_{t, x, p}\) is the volumetric energy density in phase \(p\) (provided by the Property Block).

Extensive Flow Terms

Due to the spatial domain, Holdup1D writes the extensive flow terms in the balances equations as partial derivatives with respect to the spatial domain. Due to the way Pyomo.dae works, this also requires the related flow terms to be indexed variables (indexed by the spatial domain). To handle this, Holdup1D creates equivalent variables for these, and equates these to equivalent terms in the Property Blocks.

Stoichiometric Constraints

Holdup1D also automatically generates stoichiometric Constraints to ensure conservation of mass (and elements) between products and reactants in all types of reactions (including phase equilibrium). For kinetic and chemical equilibrium reactions, an extent of reaction terms is generated for each reaction, and Constraint is written to relate these to the generation terms in the balance equations. The form of these equations is:

\[N_{t, x, p, j} = \sum_r{\nu_{r, p, j} \times X_{t, x, r}}\]

where \(N_{t, x, p, j}\) is the generation of species \(j\) in phase \(p\) at point \(x\) and time \(t\), \(\nu_{r, p, j}\) is the stoichiometric coefficient for the generation of species \(j\) in phase \(p\) by reaction \(r\) and \(X_{t, x, r}\) is the extent of reaction \(r\) at point \(x\) and time \(t\).

For phase equilibrium reactions, the stoichiometric constraints can be simplified as it is known that the equilibrium is 1:1 between the same species in two different phases. In this case, rather than write separate generation terms for each phase-component pair, a generation term is written for each phase equilibrium reaction that occurs, and the term substituted directly into the material balance (with a \(\pm 1\) factor to determine which phase is ‘product’ phase and which the ‘reactant’ phase).

Diffusion and Conduction Constraints

For systems with diffusive mass transfer or conductive heat transfer, Holdup1D automatically writes constraints relating the relevant flux terms to the associated properties from the Property Block. The diffusive mass transfer term is:

\[x \neq inlet, J_{diffusion, t, x, p, j} = - D_{t, x, p, j} \frac{\partial^2 C_{t, x, p, j}}{\partial x^2}\]

where \(D_{t, x, p, j}\) is the diffusion coefficient and \(C_{t, x, p, j}\) is the concentration of species \(j\) in phase \(p\) at point \(x\) and time \(t\) (both provided by the Property Block).

The conductive heat transfer term is:

\[x \neq inlet, J_{conduction, t, x, p} = - k_{t, x, p} \frac{\partial^2 T_{t, x}}{\partial x^2}\]

where \(k_{t, x, p}\) is the thermal conductivity of phase \(p\) at point \(x\) and time \(t\) and \(T_{t, x}\) is the temperature of the material at point \(x\) and time \(t\) (the IDAES framework currently does not support different temperatures in different phases of the same Property Block).

Element Flow Terms

Element balances require an additional set of equations for relating component based flows to their element equivalents. When element balances are chosen for a holdup block, the following additional Constraints are written:

\[F_{t, x, p, e} = F_{t, x, p, j} \times e_{j, e}\]

where \(e_{j, e}\) is the number of moles of element \(e\) per mole of component \(j\). If mass diffusion is also included, the following Constraint is also written to calculate the elemental diffusive flux term:

\[J_[elemental, t, x, e] == \sum_j{(J_{diffusion, t, x, p, j} \times e_{j, e}}\]

Construction Options

Options available in Holdup1D for specifying which terms should appear within the balance equations. Most terms in the balance equations have an associated construction argument, which are described below:

  • dynamic - controls whether accumulation terms will be included in the balance equations, and the necessary constraints for relating these to the holdup terms. If set to True, accumulation terms will be constructed and included in the model. The number of accumulation terms created depends on the number of time points, phases and components present in the model.
  • include_holdup - controls whether terms and constraints for the holdup of material and energy should be constructed (momentum holdup is not yet supported). If set to True, material and energy holdup terms are created, along with constraints linking these to the volume of the holdup and the material and energy densities. If dynamic = True, include_holdup must also be True (this is automatically checked by the framework, and a warning raised if set incorrectly). If dynamic = False, then include_holdup may be set to True or False as desired by the user, depending on whether the holdup terms are required in the flowsheet.
  • has_rate_reactions - controls whether generation terms should be constructed for rate controlled reactions. If this is True, generation terms are created for each phase and component pair and included in the material balance equations. Additionally, an extent of reaction term is created for each reaction identified in the associated property package, and linked to the generation term via stoichiometric constraints. The Unit model or user is then expected to provide a set of Constraints relating the extent of reaction terms to the performance of the given unit operation.
  • has_equilibrium_reactions - controls whether generation terms should be constructed for equilibrium controlled reactions (excluding phase equilibrium). If this is True, generation terms are created for each phase-component pair, and included in the material balance equations. Additionally, stoichiometric constraints are written relating the different generation term. The property package is expected to provide a set of equilibrium constraints which enforce the equilibrium conditions.
  • has_phase_equilibrium - controls whether generation terms should be constructed for phase equilibrium reactions. If this is True, generation terms are created for each phase-component pair, and included in the material balance equations. The property package is expected to provide a set of equilibrium constraints which enforce the equilibrium conditions.
  • has_mass_transfer - controls whether mass transfer terms should be constructed in the material balance equations. If True, the generic mass transfer terms will be included, and the UnitModel or user will need to provide constraints for these terms.
  • has_heat_transfer - controls whether the heat transfer term should be included in the energy balance equation. If True, the \(Q\) term is constructed and the UnitModel or user will need to provide a constraint for this term.
  • has_work_transfer - controls whether the work transfer term should be included in the energy balance equation. If True, the \(W\) term is constructed and the UnitModel or user will need to provide a constraint for this term.
  • has_pressure_change - controls whether the pressure change term should be included in the momentum balance equation. If True, the \(\Delta P\) term is constructed and the UnitModel or user will need to provide a constraint for this term.
  • has_mass_diffusion - controls whether the mass diffusion terms should be included in the material balance equations. If True, the diffusion terms and associated Constraints are constructed.
  • has_energy_diffusion - controls whether the energy conduction terms should be included in the energy balance equations. If True, the conduction terms and associated Constraints are constructed.

Holdup1D Variables

The following is a table of all variables that may be constructed by a Holdup1D block (depending on options chosen), along with the names used to identify these quantities within actual code (indices are shown in the same order they appear in the code).

Variable Name
\(V\) volume
\(L\) length
\(A\) area
\(F_{t, x, p, j}\) material_flow
\(\frac {\partial F_{t, x, p, j}}{\partial x}\) material_flow_dx
\(F_{t, x, p, e}\) element_flow
\(\frac {\partial F_{t, x, p, e}}{\partial x}\) element_flow_dx
\(H_{t, x, p}\) energy_flow
\(\frac {\partial h_{t, x, p}}{\partial x}\) energy_flow_dx
\(P_{t, x}\) pressure
\(\frac {\partial P_{t, x}}{\partial x}\) pressure_dx
\(M_{t, x, p, j}\) material_holdup
\(\frac{\partial M_{t, x, p, j}}{\partial t}\) material_accumulation
\(M_{t, x, p, e}\) element_holdup
\(\frac{\partial M_{t, x, p, e}}{\partial t}\) element_accumulation
\(E_{t, x, p}\) energy_holdup
\(\frac{\partial E_{t, x, p}}{\partial t}\) energy_accumulation
\(\phi_{t, x, p}\) phase_fraction
\(N_{kinetic, t, x, p ,j}\) rate_reaction_generation
\(N_{equilibrium, t, x, p ,j}\) equilibrium_reaction_generation
\(N_{pe, t, x, r}\) phase_equilibrium_generation
\(N_{transfer, t, x, p, j}\) mass_transfer_term
\(N_{transfer, t, x, p, e}\) elemental_mass_transfer
\(Q_{t, x}\) heat
\(W_{t, x}\) work
\(\Delta P_{t, x}\) deltaP
\(X_{kinetic, t, x, r}\) rate_reaction_extent
\(X_{equilibrium, t, x, r}\) equilibrium_reaction_extent
\(J_{diffusion, t, x, p, j}\) material_diffusive_flux
\(J_[t, x, e]\) elemental_diffusive_flux
\(J_{conduction, t, x, p}\) energy_conduction_term
\(\frac{\partial^2 C_{t, x, p, j}}{\partial x^2}\) material_concentration_dx2
\(\frac{\partial^2 T_{t, x}}{\partial x^2}\) temperature_dx2

Additionally, to scaling factors are generated for the energy and momentum balances, named scaling_factor_energy and scaling_factor_momentum respectively.

Initialization

Holdup1D has an initialization method which can be called as part of initializing an associated UnitModel. The initialization method takes a set of state arguments which is passed on to the associated property package, mixers and splitters. As initialization of UnitModels often require the inlet state of the unit to be held at a fixed state whilst initializing the unit, the holdup initialization routine can be instructed to hold the inlet state at a fixed state until instructed to unfix it (an associated release_state method exists for this purpose). The procedure followed by the initialization routine is as follows:

  1. If an inlet mixer is present, the initialization routine of the mixer is called.
  2. The Property Block is initialized (properties).
  3. If an outlet splitter is present, the initialization routine of the splitter is called.
  4. If not instructed to hold the inlet state fixed, the release_state method is called, otherwise a dictionary of information on what state variables were fixed is returned to be used when calling release_state.

The assoiciated release_state method takes the dictionary of flags returned above, and uses this to unfix any variables fixed during initialization.

Holdup1dData Class

class idaes.core.holdup.Holdup1dData(component)[source]

1-Dimensional Holdup Class

This class is designed to be the core of all 1D discretized IDAES models. It builds property blocks, inlet/outlet ports and adds mass, energy and momentum balances. The form of the terms used in these constraints is specified in the chosen property package.

Assumes constant reactor dimensions

build()[source]

Build method for Holdup1D blocks. This method calls submethods to setup the necessary property blocks, distributed variables, material, energy and momentum balances based on the arguments provided by the user.

Parameters:None
Returns:None
initialize(state_args=None, outlvl=0, hold_state=True, solver='ipopt', optarg=None)[source]

Initialisation routine for holdup (default solver ipopt)

Keyword Arguments:
 
  • state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
  • outlvl

    sets output level of initialisation routine

    • 0 = no output
    • 1 = return solver state for each step in routine
    • 2 = include solver output infomation (tee=True)
  • optarg – solver options dictionary object (default=None)
  • solver – str indicating whcih solver to use during initialization (default = ‘ipopt’)
  • hold_state
    flag indicating whether the initialization routine
    should unfix any state variables fixed during initialization (default=True). - True - states varaibles 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 relase_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 exectues the model_check methods on the associated property 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 relase state variables fixed during initialisation.

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 of logging
Returns:

None