Physical Property Package Classes#
Physical property packages represent a collection of calculations necessary to determine the state properties of a given material. Property calculations form a critical part of any process model, and thus property packages form the core of the IDAES modeling framework.
Physical property packages consist of two parts:
PhysicalParameterBlocks, which contain a set of parameters associated with the specific material(s) being modeled, and
StateBlocks, which contain the actual calculations of the state variables and functions.
Physical Parameter Blocks#
Physical Parameter blocks serve as a central location for linking to a property package, and contain all the parameters and indexing sets used by a given property package.
PhysicalParameterBlock Class#
The role of the PhysicalParameterBlock class is to set up the references required by the rest of the IDAES framework for constructing instances of StateBlocks and attaching these to the PhysicalParameter block for ease of use. This allows other models to be pointed to the PhysicalParameter block in order to collect the necessary information and to construct the necessary StateBlocks without the need for the user to do this manually.
Physical property packages form the core of any process model in the IDAES modeling framework, and are used by all of the other modeling components to inform them of what needs to be constructed. In order to do this, the IDAES modeling framework looks for a number of attributes in the PhysicalParameter block which are used to inform the construction of other components.
state_block_class - a pointer to the associated class that should be called when constructing StateBlocks. This should only be set by the property package developer.
phase_list - a Pyomo Set object defining the valid phases of the mixture of interest.
component_list - a Pyomo Set defining the names of the chemical species present in the mixture.
element_list - (optional) a Pyomo Set defining the names of the chemical elements that make up the species within the mixture. This is used when doing elemental material balances.
element_comp - (optional) a dict-like object which defines the elemental composition of each species in component_list. Form: component: {element_1: value, element_2: value, …}.
supported properties metadata - a list of supported physical properties that the property package supports, along with instruction to the framework on how to construct the associated variables and constraints, and the units of measurement used for the property. This information is set using the add_properties attribute of the define_metadata class method.
Physical Parameter Configuration Arguments#
Physical Parameter blocks have one standard configuration argument:
default_arguments - this allows the user to provide a set of default values for construction arguments in associated StateBlocks, which will be passed to all StateBlocks when they are constructed.
- class idaes.core.base.property_base.PhysicalParameterBlock(component)[source]#
This is the base class for thermophysical parameter blocks. These are blocks that contain a set of parameters associated with a specific thermophysical property package, and are linked to by all instances of that property package.
- build()[source]#
General build method for PropertyParameterBlocks. Inheriting models should call super().build.
- Parameters:
None –
- Returns:
None
- build_state_block(*args, **kwargs)[source]#
Methods to construct a StateBlock associated with this PhysicalParameterBlock. This will automatically set the parameters construction argument for the StateBlock.
- Returns:
StateBlock
- get_component(comp)[source]#
Method to retrieve a Component object based on a name from the component_list.
- Parameters:
comp – name of Component object to retrieve
- Returns:
Component object
State Blocks#
State Blocks are used within all IDAES Unit models (generally within ControlVolume Blocks) in order to calculate physical properties given the state of the material. State Blocks are notably different to other types of Blocks within IDAES as they are always indexed by time (and possibly space as well). There are two base Classes associated with State Blocks:
StateBlockData forms the base class for all StateBlockData objects, which contain the instructions on how to construct each instance of a State Block.
StateBlock is used for building classes which contain methods to be applied to sets of Indexed State Blocks (or to a subset of these). See the documentation on declare_process_block_class and the IDAES tutorials and examples for more information.
State Block Construction Arguments#
State Blocks have the following construction arguments:
parameters - a reference to the associated Physical Parameter block which will be used to make references to all necessary parameters.
defined_state - this argument indicates whether the State Block should expect the material state to be fully defined by another part of the flowsheet (such as by an upstream unit operation). This argument is used to determine whether constraints such as sums of mole fractions should be enforced.
has_phase_equilibrium - indicates whether the associated Control Volume or Unit model expects phase equilibrium to be enforced (if applicable).
Constructing State Blocks#
State Blocks can be constructed directly from the associated Physical Parameter Block by calling the build_state_block() method on the Physical Parameter Block. The parameters construction argument will be automatically set, and any other arguments (including indexing sets) may be provided to the build_state_block method as usual.
StateBlockData Class#
StateBlockData contains the code necessary for implementing the as needed construction of variables and constraints.
- class idaes.core.base.property_base.StateBlockData(*args, **kwargs)[source]#
This is the base class for state block data objects. These are blocks that contain the Pyomo components associated with calculating a set of thermophysical and transport properties for a given material.
- calculate_bubble_point_pressure(*args, **kwargs)[source]#
Method which computes the bubble point pressure for a multi- component mixture given a temperature and mole fraction.
- calculate_bubble_point_temperature(*args, **kwargs)[source]#
Method which computes the bubble point temperature for a multi- component mixture given a pressure and mole fraction.
- calculate_dew_point_pressure(*args, **kwargs)[source]#
Method which computes the dew point pressure for a multi- component mixture given a temperature and mole fraction.
- calculate_dew_point_temperature(*args, **kwargs)[source]#
Method which computes the dew point temperature for a multi- component mixture given a pressure and mole fraction.
- property default_initializer#
Block Triangularization based Initializer object.
This Initializer should be suitable for most models, but may struggle to initialize tightly coupled systems of equations.
This Initializer uses the common workflow defined in InitializerBase and calls the Pyomo solve_strongly_connected_components function to initialize the model.
- constraint_tolerance
Tolerance for checking constraint convergence
- output_level
Set output level for logging messages
- block_solver
Solver to use for NxN blocks
- block_solver_options
Dict of options to use to set solver.options.
- block_solver_options
- tol
Convergence tolerance for block solver
- max_iter
Iteration limit for block solver
- block_solver_writer_config
Dict of writer_config arguments to pass to block solver
- block_solver_writer_config
- linear_presolve
Whether to use linear presolver with block solver
- scale_model
Whether to apply model scaling with block solver
- block_solver_call_options
Dict of arguments to be passed as part of the solver.solve call, such as tee=True.
- calculate_variable_options
Dict of options to pass to calc_var_kwds argument in solve_strongly_connected_components method.
- define_display_vars()[source]#
Method used to specify components to use to generate stream tables and other outputs. Defaults to define_state_vars, and developers should overload as required.
- define_port_members()[source]#
Method used to specify components to populate Ports with. Defaults to define_state_vars, and developers should overload as required.
- define_state_vars()[source]#
Method that returns a dictionary of state variables used in property package. Implement a placeholder method which returns an Exception to force users to overload this.
- get_energy_density_terms(*args, **kwargs)[source]#
Method which returns a valid expression for enthalpy density to use in the energy balances.
- get_energy_diffusion_terms(*args, **kwargs)[source]#
Method which returns a valid expression for energy diffusion to use in the energy balances.
- get_enthalpy_flow_terms(*args, **kwargs)[source]#
Method which returns a valid expression for enthalpy flow to use in the energy balances.
- get_material_density_terms(*args, **kwargs)[source]#
Method which returns a valid expression for material density to use in the material balances .
- get_material_diffusion_terms(*args, **kwargs)[source]#
Method which returns a valid expression for material diffusion to use in the material balances.
- get_material_flow_basis(*args, **kwargs)[source]#
Method which returns an Enum indicating the basis of the material flow term.
- get_material_flow_terms(*args, **kwargs)[source]#
Method which returns a valid expression for material flow to use in the material balances.
StateBlock Class#
- class idaes.core.base.property_base.StateBlock(*args, **kwds)[source]#
This is the base class for state block objects. These are used when constructing the SimpleBlock or IndexedBlock which will contain the PropertyData objects, and contains methods that can be applied to multiple StateBlockData objects simultaneously.
- build_port(doc=None, slice_index=None, index=None)[source]#
Constructs a Port based on this StateBlock attached to the target block.
- Parameters:
object (doc - doc string or Prot) –
index (slice_index - Slice) – used to index self when constructing port references. Default = None.
None. (index - time index to use when calling define_port_members. Default =) –
- Returns:
Port object and list of tuples with form (Reference, member name)
- default_initializer#
alias of
BlockTriangularizationInitializer
- get_port_reference_name(component_name, port_name)[source]#
Get the standard name of a “port reference”, the component accessed on the port by “port_name.component_name”.
- Parameters:
interest (component_name - name of port member of) –
object (port_name - name of Port) –
- Returns:
str with name for Reference used for Port member
- initialize(*args, **kwargs)[source]#
This is a default initialization routine for StateBlocks to ensure that a routine is present. All StateBlockData classes should overload this method with one suited to the particular property package
- Parameters:
None –
- Returns:
None
- report(index=0, true_state=False, dof=False, ostream=None, prefix='')[source]#
Default report method for StateBlocks. Returns a Block report populated with either the display or state variables defined in the StateBlockData class.
- Parameters:
index – tuple of Block indices indicating which point in time (and space if applicable) to report state at.
true_state – whether to report the display variables (False default) or the actual state variables (True)
dof – whether to show local degrees of freedom in the report (default=False)
ostream – output stream to write report to
prefix – string to append to the beginning of all output lines
- Returns:
Printed output to ostream