Pressure Changer#

The IDAES Pressure Changer model represents a unit operation with a single stream of material which undergoes a change in pressure due to the application of a work. The Pressure Changer model contains support for a number of different thermodynamic assumptions regarding the working fluid.

Degrees of Freedom#

Pressure Changer units generally have one or more degrees of freedom, depending on the thermodynamic assumption used.

Typical fixed variables are:

  • outlet pressure, \(P_{ratio}\) or \(\Delta P\),

  • unit efficiency (isentropic or pump assumption).

Model Structure#

The core Pressure Changer unit model consists of a single ControlVolume0D (named control_volume) with one Inlet Port (named inlet) and one Outlet Port (named outlet). Additionally, if an isentropic pressure changer is used, the unit model contains an additional StateBlock named properties_isentropic at the unit model level.

Variables#

Pressure Changers contain the following Variables (not including those contained within the control volume Block):

Variable

Name

Notes

\(P_{ratio}\)

ratioP

\(V_t\)

volume

Only if has_rate_reactions = True, reference to control_volume.rate_reaction_extent

\(W_{mechanical,t}\)

work_mechanical

Reference to control_volume.work *

\(W_{fluid,t}\)

work_fluid

Pump assumption only

\(\eta_{pump,t}\)

efficiency_pump

Pump assumption only

\(W_{isentropic,t}\)

work_isentropic

Isentropic assumption only

\(\eta_{isentropic,t}\)

efficiency_isentropic

Isentropic assumption only

* By default, control_volume.work is built only when the EnergyBalanceType of control_volume is not None and has_work_transfer. However, when modeling a Pump there are cases where the mechanical work is calculated without demanding a full energy balance constraint. In these cases (when thermodynamic_assumption=ThermodynamicAssumption.pump and energy_balance_type=none), a variable control_volume.work is constructed without being coupled to the usual energy balance constraint. work_mechanical is then referenced to control_volume.work and used to build constraints under the add_pump() method to simulate essential pump properties.

Isentropic Pressure Changers also have an additional Property Block named properties_isentropic (attached to the Unit Model).

Constraints#

In addition to the Constraints written by the Control Volume block, Pressure Changer writes additional Constraints which depend on the thermodynamic assumption chosen. All Pressure Changers add the following Constraint to calculate the pressure ratio:

\[P_{ratio,t} \times P_{in,t} = P_{out,t}\]

Isothermal Assumption#

The isothermal assumption writes one additional Constraint:

\[T_{out} = T_{in}\]

Adiabatic Assumption#

The isothermal assumption writes one additional Constraint:

\[H_{out} = H_{in}\]

Isentropic Assumption#

The isentropic assumption creates an additional set of Property Blocks (indexed by time) for the isentropic fluid calculations (named properties_isentropic). This requires a set of balance equations relating the inlet state to the isentropic conditions, which are shown below:

\[F_{in,t,p,j} = F_{isentropic,t,p,j}\]
\[s_{in,t} = s_{isentropic,t}\]
\[P_{in,t} \times P_{ratio,t} = P_{isentropic,t}\]

where \(F_{t,p,j}\) is the flow of component \(j\) in phase \(p\) at time \(t\) and \(s\) is the specific entropy of the fluid at time \(t\).

Next, the isentropic work is calculated as follows:

\[W_{isentropic,t} = \sum_p{H_{isentropic,t,p}} - \sum_p{H_{in,t,p}}\]

where \(H_{t,p}\) is the total energy flow of phase \(p\) at time \(t\). Finally, a constraint which relates the fluid work to the actual mechanical work via an efficiency term \(\eta\).

If compressor is True, \(W_{isentropic,t} = W_{mechanical,t} \times \eta_t\)

If compressor is False, \(W_{isentropic,t} \times \eta_t = W_{mechanical,t}\)

Pump (Incompressible Fluid) Assumption#

The incompressible fluid assumption writes two additional constraints. Firstly, a Constraint is written which relates fluid work to the pressure change of the fluid.

\[W_{fluid,t} = (P_{out,t}-P_{in,t})\times F_{vol,t}\]

where \(F_{vol,t}\) is the total volumetric flowrate of material at time \(t\) (from the outlet Property Block). Secondly, a constraint which relates the fluid work to the actual mechanical work via an efficiency term \(\eta\).

If compressor is True, \(W_{fluid,t} = W_{mechanical,t} \times \eta_t\)

If compressor is False, \(W_{fluid,t} \times \eta_t = W_{mechanical,t}\)

Initialization#

For simpler pressure changer models (isothermal, adiabatic and pump assumptions), the default SingleControlVolumeInitializer is applicable.

For isentropic pressure changers, an alternate IsentropicPressureChangerInitializer is available.

class idaes.models.unit_models.pressure_changer.IsentropicPressureChangerInitializer(**kwargs)[source]#

Initializer for isentropic pressure changer models (and derived types).

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.

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.

initialization_routine(model)[source]#

Initialization routine for isentropic pressure changers.

This routine starts by initializing the inlet and outlet states as usual, using the user provided operating conditions to estimate the outlet state. The isentropic state is then initialized at the same conditions as the outlet. Next, the pressure changer is solved with an isothermal assumption and fixed efficiency, followed by a second solve with the isentropic constraints. Finally, if user-provided performance constraints are present, these are activated and the model solved again.

Parameters:

model (Block) – model to be initialized

Returns:

Pyomo solver status object

Performance Curves#

Isentropic pressure changers support optional performance curve constraints. The exact form of these constraints is left to the user, but generally the constraints take the form of one or two equations which provide a correlation between head, efficiency, or pressure ratio and mass or volumetric flow. Additional variables such as compressor or turbine speed can be added if needed.

Performance curves should be added to the performance_curve sub-block rather than adding them elsewhere because it allows them to be integrated into the unit model initialization. It also provides standardization for users and provides a convenient way to turn the performance equations on and off by activating and deactivating the block.

Usually there are one or two performance curve constraints. Either directly or indirectly, these curves specify an efficiency and pressure drop, so in adding performance curves the efficiency and/or pressure drop should be freed as appropriate.

Performance equations generally are in a simple form (e.g. efficiency = f(flow)), where no special initialization is needed. Performance curves also are specific to a particular property package selection and pressure changer, which allows the performance curve equations to be written in a well-scaled way since units of measure and magnitudes are known.

To add performance curves to an isentropic pressure changer, simply supply the "support_isentropic_performance_curves": True options in the pressure changer config dict. This will create a performance_curve sub-block of the pressure changer model. By default this block will have the expressions head and heat_isentropic for convenience, as these quantities often appear in performance curves.

Two examples are provided below that demonstrate two ways to add performance curves. The first does not use a callback the second does.

from pyomo.environ import ConcreteModel, SolverFactory, units, value
from idaes.core import FlowsheetBlock
from idaes.models.unit_models.pressure_changer import Turbine
from idaes.models.properties import iapws95
import pytest

solver = SolverFactory('ipopt')
m = ConcreteModel()
m.fs = FlowsheetBlock(dynamic=False)
m.fs.properties = iapws95.Iapws95ParameterBlock()
m.fs.unit = Turbine(
    property_package=m.fs.properties,
    support_isentropic_performance_curves=True
)

# Add performance curves
@m.fs.unit.performance_curve.Constraint(m.fs.config.time)
def pc_isen_eff_eqn(b, t):
    # main pressure changer block parent of performance_curve
    prnt = b.parent_block()
    return prnt.efficiency_isentropic[t] == 0.9
@m.fs.unit.performance_curve.Constraint(m.fs.config.time)
def pc_isen_head_eqn(b, t):
    # divide both sides by 1000 for scaling
    return b.head_isentropic[t]/1000 == -75530.8/1000*units.J/units.kg

# set inputs
m.fs.unit.inlet.flow_mol[0].fix(1000)  # mol/s
Tin = 500  # K
Pin = 1000000  # Pa
Pout = 700000  # Pa
hin = iapws95.htpx(Tin*units.K, Pin*units.Pa)
m.fs.unit.inlet.enth_mol[0].fix(hin)
m.fs.unit.inlet.pressure[0].fix(Pin)

m.fs.unit.initialize()
solver.solve(m, tee=False)

assert value(m.fs.unit.efficiency_isentropic[0]) == pytest.approx(0.9, rel=1e-3)
assert value(m.fs.unit.deltaP[0]) == pytest.approx(-3e5, rel=1e-3)

The next example shows how to use a callback to add performance curves.

from pyomo.environ import ConcreteModel, SolverFactory, units, value
from idaes.core import FlowsheetBlock
from idaes.models.unit_models.pressure_changer import Turbine, IsentropicPressureChangerInitializer
from idaes.models.properties import iapws95
import pytest

solver = SolverFactory('ipopt')
m = ConcreteModel()
m.fs = FlowsheetBlock(dynamic=False)
m.fs.properties = iapws95.Iapws95ParameterBlock()

def perf_callback(blk):
    # This callback adds constraints to the performance_cruve block. blk is the
    # performance_curve block, but we also want to use quantities from the main
    # pressure changer model, which is the parent block.
    prnt = blk.parent_block()
    # this is the pressure changer model block
    @blk.Constraint(m.fs.config.time)
    def pc_isen_eff_eqn(b, t):
        return prnt.efficiency_isentropic[t] == 0.9
    @blk.Constraint(m.fs.config.time)
    def pc_isen_head_eqn(b, t):
        return b.head_isentropic[t]/1000 == -75530.8/1000*units.J/units.kg

m.fs.unit = Turbine(
    property_package=m.fs.properties,
    support_isentropic_performance_curves=True,
    isentropic_performance_curves={"build_callback": perf_callback}
)

# set inputs
m.fs.unit.inlet.flow_mol[0].fix(1000)  # mol/s
Tin = 500  # K
Pin = 1000000  # Pa
Pout = 700000  # Pa
hin = iapws95.htpx(Tin*units.K, Pin*units.Pa)
m.fs.unit.inlet.enth_mol[0].fix(hin)
m.fs.unit.inlet.pressure[0].fix(Pin)

initializer = IsentropicPressureChangerInitializer()
initializer.initialize(m.fs.unit)
solver.solve(m, tee=False)

assert value(m.fs.unit.efficiency_isentropic[0]) == pytest.approx(0.9, rel=1e-3)
assert value(m.fs.unit.deltaP[0]) == pytest.approx(-3e5, rel=1e-3)

PressureChanger Class#

class idaes.models.unit_models.pressure_changer.PressureChanger(*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}

    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_phase_equilibrium

    Indicates whether terms for phase equilibrium should be constructed, default = False. Valid values: { True - include phase equilibrium terms False - exclude phase equilibrium terms.}

    compressor

    Indicates whether this unit should be considered a compressor (True (default), pressure increase) or an expander (False, pressure decrease).

    thermodynamic_assumption

    Flag to set the thermodynamic assumption to use for the unit. - ThermodynamicAssumption.isothermal (default) - ThermodynamicAssumption.isentropic - ThermodynamicAssumption.pump - ThermodynamicAssumption.adiabatic

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

    support_isentropic_performance_curves

    Include a block for performance curves, configure via isentropic_performance_curves.

    isentropic_performance_curves

    Configuration dictionary for the performance curve block.

    isentropic_performance_curves
    build_callback

    Optional callback to add performance curve constraints

    build_head_expressions

    If true add expressions for ‘head’ and ‘head_isentropic’. These expressions can be used in performance curve constraints.

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

(PressureChanger) New instance

PressureChangerData Class#

class idaes.models.unit_models.pressure_changer.PressureChangerData(component)[source]#

Standard Compressor/Expander Unit Model Class

add_adiabatic()[source]#

Add constraints for adiabatic assumption.

Parameters:

None

Returns:

None

add_isentropic()[source]#

Add constraints for isentropic assumption.

Parameters:

None

Returns:

None

add_isothermal()[source]#

Add constraints for isothermal assumption.

Parameters:

None

Returns:

None

add_pump()[source]#

Add constraints for the incompressible fluid assumption

Parameters:

None

Returns:

None

build()[source]#
Parameters:

None

Returns:

None

init_adiabatic(state_args, outlvl, solver, optarg)[source]#

Initialization routine for adiabatic pressure changers.

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 initialization routine

  • optarg – solver options dictionary object (default={})

  • solver – str indicating which solver to use during initialization (default = None)

Returns:

None

init_isentropic(state_args, outlvl, solver, optarg)[source]#

Initialization routine for isentropic pressure changers.

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 initialization routine

  • optarg – solver options dictionary object (default={})

  • solver – str indicating which solver to use during initialization (default = None)

Returns:

None

initialize_build(state_args=None, routine=None, outlvl=0, solver=None, optarg=None)[source]#

General wrapper for pressure changer initialization routines

Keyword Arguments:
  • routine – str stating which initialization routine to execute * None - use routine matching thermodynamic_assumption * ‘isentropic’ - use isentropic initialization routine * ‘isothermal’ - use isothermal initialization routine

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

Returns:

None

model_check()[source]#

Check that pressure change matches with compressor argument (i.e. if compressor = True, pressure should increase or work should be positive)

Parameters:

None

Returns:

None