0D Control Volume Class¶
The ControlVolume0DBlock block is the most commonly used Control Volume class, and is used for systems where there is a well-mixed volume of fluid, or where variations in spatial domains are considered to be negligible. ControlVolume0DBlock blocks generally contain two StateBlocks - one for the incoming material and one for the material within and leaving the volume - and one StateBlocks.
- class idaes.core.control_volume0d.ControlVolume0DBlock(*args, **kwds)¶
ControlVolume0DBlock is a specialized Pyomo block for IDAES non-discretized control volume blocks, and contains instances of ControlVolume0DBlockData.
ControlVolume0DBlock should be used for any control volume with a defined volume and distinct inlets and outlets which does not require spatial discretization. This encompases most basic unit models used in process modeling.
- 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, default - useDefault. Valid values: { useDefault - get flag from parent, 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}
- 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.}
- reaction_package
Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.}
- reaction_package_args
A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.}
- auto_construct
If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.}
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
(ControlVolume0DBlock) New instance
- class idaes.core.control_volume0d.ControlVolume0DBlockData(component)[source]¶
0-Dimensional (Non-Discretised) ControlVolume Class
This class forms the core of all non-discretized IDAES models. It provides methods to build property and reaction blocks, and add mass, energy and momentum balances. The form of the terms used in these constraints is specified in the chosen property package.
- add_geometry()[source]¶
Method to create volume Var in ControlVolume.
- Parameters
None –
- Returns
None
- add_phase_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]¶
This method constructs a set of 0D material balances indexed by time, phase and component.
- Parameters
has_rate_reactions – whether default generation terms for rate reactions should be included in material balances
has_equilibrium_reactions – whether generation terms should for chemical equilibrium reactions should be included in material balances
has_phase_equilibrium – whether generation terms should for phase equilibrium behaviour should be included in material balances
has_mass_transfer – whether generic mass transfer terms should be included in material balances
custom_molar_term – a Pyomo Expression representing custom terms to be included in material balances on a molar basis. Expression must be indexed by time, phase list and component list
custom_mass_term – a Pyomo Expression representing custom terms to be included in material balances on a mass basis. Expression must be indexed by time, phase list and component list
- Returns
Constraint object representing material balances
- add_phase_energy_balances(*args, **kwargs)[source]¶
Method for adding energy balances (including kinetic energy) indexed by phase to the control volume.
See specific control volume documentation for details.
- add_phase_enthalpy_balances(*args, **kwargs)[source]¶
Method for adding enthalpy balances indexed by phase to the control volume.
See specific control volume documentation for details.
- add_phase_momentum_balances(*args, **kwargs)[source]¶
Method for adding momentum balances indexed by phase to the control volume.
See specific control volume documentation for details.
- add_phase_pressure_balances(*args, **kwargs)[source]¶
Method for adding pressure balances indexed by phase to the control volume.
See specific control volume documentation for details.
- add_reaction_blocks(has_equilibrium=None)[source]¶
This method constructs the reaction block for the control volume.
- Parameters
has_equilibrium – indicates whether equilibrium calculations will be required in reaction block
package_arguments – dict-like object of arguments to be passed to reaction block as construction arguments
- Returns
None
- add_state_blocks(information_flow=FlowDirection.forward, has_phase_equilibrium=None)[source]¶
This method constructs the inlet and outlet state blocks for the control volume.
- Parameters
information_flow – a FlowDirection Enum indicating whether information flows from inlet-to-outlet or outlet-to-inlet
has_phase_equilibrium – indicates whether equilibrium calculations will be required in state blocks
package_arguments – dict-like object of arguments to be passed to state blocks as construction arguments
- Returns
None
- add_total_component_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_molar_term=None, custom_mass_term=None)[source]¶
This method constructs a set of 0D material balances indexed by time and component.
- Parameters
rate (has_rate_reactions - whether default generation terms for) – reactions should be included in material balances
for (has_equilibrium_reactions - whether generation terms should) – chemical equilibrium reactions should be included in material balances
phase (has_phase_equilibrium - whether generation terms should for) – equilibrium behaviour should be included in material balances
be (has_mass_transfer - whether generic mass transfer terms should) – included in material balances
to (custom_mass_term - a Pyomo Expression representing custom terms) – be included in material balances on a molar basis. Expression must be indexed by time, phase list and component list
to – be included in material balances on a mass basis. Expression must be indexed by time, phase list and component list
- Returns
Constraint object representing material balances
- add_total_element_balances(has_rate_reactions=False, has_equilibrium_reactions=False, has_phase_equilibrium=False, has_mass_transfer=False, custom_elemental_term=None)[source]¶
This method constructs a set of 0D element balances indexed by time.
- Parameters
rate (has_rate_reactions - whether default generation terms for) – reactions should be included in material balances
for (has_equilibrium_reactions - whether generation terms should) – chemical equilibrium reactions should be included in material balances
phase (has_phase_equilibrium - whether generation terms should for) – equilibrium behaviour should be included in material balances
be (has_mass_transfer - whether generic mass transfer terms should) – included in material balances
custom (custom_elemental_term - a Pyomo Expression representing) – terms to be included in material balances on a molar elemental basis. Expression must be indexed by time and element list
- Returns
Constraint object representing material balances
- add_total_energy_balances(*args, **kwargs)[source]¶
Method for adding a total energy balance (including kinetic energy) to the control volume.
See specific control volume documentation for details.
- add_total_enthalpy_balances(has_heat_of_reaction=False, has_heat_transfer=False, has_work_transfer=False, has_enthalpy_transfer=False, custom_term=None)[source]¶
This method constructs a set of 0D enthalpy balances indexed by time and phase.
- Parameters
should (has_heat_of_reaction - whether terms for heat of reaction) – be included in enthalpy balance
be (has_work_transfer - whether terms for work transfer should) – included in enthalpy balances
be – included in enthalpy balances
to (custom_term - a Pyomo Expression representing custom terms) – mass transfer should be included in enthalpy balance. This should generally be the same as the has_mass_transfer argument in the material balance methods
to – be included in enthalpy balances. Expression must be indexed by time and phase list
- Returns
Constraint object representing enthalpy balances
- add_total_material_balances(*args, **kwargs)[source]¶
Method for adding a total material balance to the control volume.
See specific control volume documentation for details.
- add_total_momentum_balances(*args, **kwargs)[source]¶
Method for adding a total momentum balance to the control volume.
See specific control volume documentation for details.
- add_total_pressure_balances(has_pressure_change=False, custom_term=None)[source]¶
This method constructs a set of 0D pressure balances indexed by time.
- Parameters
be (has_pressure_change - whether terms for pressure change should) – included in enthalpy balances
to (custom_term - a Pyomo Expression representing custom terms) – be included in pressure balances. Expression must be indexed by time
- Returns
Constraint object representing pressure balances
- initialize(state_args=None, outlvl=0, optarg=None, solver=None, hold_state=True)[source]¶
Initialization routine for 0D control volume.
- 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 log 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)
hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - True. 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
ControlVolume0DBlock Equations¶
This section documents the variables and constraints created by each of the methods provided by the ControlVolume0DBlock class.
\(t\) indicates time index
\(p\) indicates phase index
\(j\) indicates component index
\(e\) indicates element index
\(r\) indicates reaction name index
add_geometry¶
The add_geometry method creates a single variable within the control volume named volume indexed by time (allowing for varying volume over time). A number of other methods depend on this variable being present, thus this method should generally be called first.
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
volume |
\(V_t\) |
t |
None |
Constraints
No additional constraints
add_phase_component_balances¶
Material balances are written for each component in each phase (e.g. separate balances for liquid water and steam). Physical 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 has_holdup is True holdup terms will still appear for these species, however these will be set to 0).
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
material_holdup |
\(M_{t,p,j}\) |
t, p, j |
has_holdup = True |
phase_fraction |
\(\phi_{t,p}\) |
t, p |
has_holdup = True |
material_accumulation |
\(\frac{\partial M_{t,p,j}}{\partial t}\) |
t, p, j |
dynamic = True |
rate_reaction_generation |
\(N_{kinetic,t,p,j}\) |
t, p ,j |
has_rate_reactions = True |
rate_reaction_extent |
\(X_{kinetic,t,r}\) |
t, r |
has_rate_reactions = True |
equilibrium_reaction_generation |
\(N_{equilibrium,t,p,j}\) |
t, p ,j |
has_equilibrium_reactions = True |
equilibrium_reaction_extent |
\(X_{equilibrium,t,r}\) |
t, r |
has_equilibrium_reactions = True |
phase_equilibrium_generation |
\(N_{pe,t,p,j}\) |
t, p ,j |
has_phase_equilibrium = True |
mass_transfer_term |
\(N_{transfer,t,p,j}\) |
t, p ,j |
has_mass_transfer = True |
Constraints
material_balances(t, p, j):
The \(N_{custom, t, p, j}\) term allows the user to provide custom terms (variables or expressions) in both mass and molar basis which will be added into the material balances, which will be converted as necessary to the same basis as the material balance (by multiplying or dividing by the component molecular weight). The basis of the material balance is determined by the physical property package, and if undefined (or not mass or mole basis), an Exception will be returned.
If has_holdup is True, material_holdup_calculation(t, p, j):
where \(\rho_{t, p ,j}\) is the density of component \(j\) in phase \(p\) at time \(t\)
If dynamic is True:
Numerical discretization of the derivative terms, \(\frac{\partial M_{t,p,j}}{\partial t}\), will be performed by Pyomo.DAE.
If has_rate_reactions is True, rate_reaction_stoichiometry_constraint(t, p, j):
where \(\alpha_{r, p. j}\) is the stoichiometric coefficient of component \(j\) in phase \(p\) for reaction \(r\) (as defined in the PhysicalParameterBlock).
If has_equilibrium_reactions argument is True, equilibrium_reaction_stoichiometry_constraint(t, p, j):
where \(\alpha_{r, p. j}\) is the stoichiometric coefficient of component \(j\) in phase \(p\) for reaction \(r\) (as defined in the PhysicalParameterBlock).
add_total_component_balances¶
Material balances are written for each component across all phases (e.g. one balance for both liquid water and steam). Most terms in the balance equations are still indexed by both phase and component however. Physical 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 has_holdup is True holdup terms will still appear for these species, however these will be set to 0).
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
material_holdup |
\(M_{t,p,j}\) |
t, p, j |
has_holdup = True |
phase_fraction |
\(\phi_{t,p}\) |
t, p |
has_holdup = True |
material_accumulation |
\(\frac{\partial M_{t,p,j}}{\partial t}\) |
t, p, j |
dynamic = True |
rate_reaction_generation |
\(N_{kinetic,t,p,j}\) |
t, p ,j |
has_rate_reactions = True |
rate_reaction_extent |
\(X_{kinetic,t,r}\) |
t, r |
has_rate_reactions = True |
equilibrium_reaction_generation |
\(N_{equilibrium,t,p,j}\) |
t, p ,j |
has_equilibrium_reactions = True |
equilibrium_reaction_extent |
\(X_{equilibrium,t,r}\) |
t, r |
has_equilibrium_reactions = True |
mass_transfer_term |
\(N_{transfer,t,p,j}\) |
t, p ,j |
has_mass_transfer = True |
Constraints
material_balances(t, j):
The \(N_{custom, t, j}\) term allows the user to provide custom terms (variables or expressions) in both mass and molar basis which will be added into the material balances, which will be converted as necessary to the same basis as the material balance (by multiplying or dividing by the component molecular weight). The basis of the material balance is determined by the physical property package, and if undefined (or not mass or mole basis), an Exception will be returned.
If has_holdup is True, material_holdup_calculation(t, p, j):
where \(\rho_{t, p ,j}\) is the density of component \(j\) in phase \(p\) at time \(t\)
If dynamic is True:
Numerical discretization of the derivative terms, \(\frac{\partial M_{t,p,j}}{\partial t}\), will be performed by Pyomo.DAE.
If has_rate_reactions is True,, rate_reaction_stoichiometry_constraint(t, p, j):
where \(\alpha_{r, p. j}\) is the stoichiometric coefficient of component \(j\) in phase \(p\) for reaction \(r\) (as defined in the PhysicalParameterBlock).
If has_equilibrium_reactions argument is True, equilibrium_reaction_stoichiometry_constraint(t, p, j):
where \(\alpha_{r, p. j}\) is the stoichiometric coefficient of component \(j\) in phase \(p\) for reaction \(r\) (as defined in the PhysicalParameterBlock).
add_total_element_balances¶
Material balances are written for each element in the mixture.
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
element_holdup |
\(M_{t,e}\) |
t, e |
has_holdup = True |
phase_fraction |
\(\phi_{t,p}\) |
t, p |
has_holdup = True |
element_accumulation |
\(\frac{\partial M_{t,e}}{\partial t}\) |
t, e |
dynamic = True |
elemental_mass_transfer_term |
\(N_{transfer,t,e}\) |
t, e |
has_mass_transfer = True |
Expressions
elemental_flow_in(t, p, e):
elemental_flow_out(t, p, e):
where \(n_{j, e}\) is the number of moles of element \(e\) in component \(j\).
Constraints
element_balances(t, e):
The \(N_{custom, t, e}\) term allows the user to provide custom terms (variables or expressions) which will be added into the material balances.
If has_holdup is True, elemental_holdup_calculation(t, e):
where \(\rho_{t, p ,j}\) is the density of component \(j\) in phase \(p\) at time \(t\)
If dynamic is True:
Numerical discretization of the derivative terms, \(\frac{\partial M_{t,e}}{\partial t}\), will be performed by Pyomo.DAE.
add_total_enthalpy_balances¶
A single enthalpy balance is written for the entire mixture.
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
energy_holdup |
\(E_{t,p}\) |
t, p |
has_holdup = True |
phase_fraction |
\(\phi_{t,p}\) |
t, p |
has_holdup = True |
energy_accumulation |
\(\frac{\partial E_{t,p}}{\partial t}\) |
t, p |
dynamic = True |
heat |
\(Q_{t}\) |
t |
has_heat_transfer = True |
work |
\(W_{t}\) |
t |
has_work_transfer = True |
enthalpy_transfer |
\(H_{transfer,t}\) |
t |
has_enthalpy_transfer = True |
Expressions
heat_of_reaction(t):
where \(Q_{rxn, t}\) is the total enthalpy released by both kinetic and equilibrium reactions, and \(\Delta H_{rxn, r}\) is the specific heat of reaction for reaction \(r\).
Parameters
Parameter Name |
Symbol |
Default Value |
---|---|---|
scaling_factor_energy |
\(s_{energy}\) |
1E-6 |
Constraints
enthalpy_balance(t):
The \(E_{custom, t}\) term allows the user to provide custom terms which will be added into the energy balance.
If has_holdup is True, enthalpy_holdup_calculation(t, p):
where \(u_{t, p}\) is the internal energy density (specific internal energy) of phase \(p\) at time \(t\)
If dynamic is True:
Numerical discretization of the derivative terms, \(\frac{\partial E_{t,p}}{\partial t}\), will be performed by Pyomo.DAE.
add_total_pressure_balances¶
A single pressure balance is written for the entire mixture.
Variables
Variable Name |
Symbol |
Indices |
Conditions |
---|---|---|---|
deltaP |
\(\Delta P_{t}\) |
t |
has_pressure_change = True |
Parameters
Parameter Name |
Symbol |
Default Value |
---|---|---|
scaling_factor_pressure |
\(s_{pressure}\) |
1E-4 |
Constraints
pressure_balance(t):
The \(\Delta P_{custom, t}\) term allows the user to provide custom terms which will be added into the pressure balance.