prommis.leaching.leach_train#

Leach Train#

Author: Andrew Lee

The Leach Train unit model represents a series of leaching tanks in which a solid and liquid stream are contacted and undergo heterogeneous chemical reactions.

Configuration Arguments#

When creating an instance of a Leach Train model, the user must specify the number of tanks in train using the number_of_tanks configuration argument. This value cannot be changed later.

A Leach Train model also requires a special “heterogeneous reaction package” to define the reactions which occur in the system and the constraints defining the rate of reaction or equilibrium condition associated with each. These custom reaction packages are similar to normal IDAES reaction packages with the following differences:

  • the reaction package is not coupled to any specific thermophysical property package (i.e., the liquid or solid phase properties). Instead, it is expected that the reaction package will link to both the solid and liquid phase properties using self.parent_block().liquid and self.parent_block().solid as required.

Degrees of Freedom#

A Leach Train module has a number of degrees of freedom equal to the number of tanks in the train. These are the volume of each tank, and is specified using the volume attribute on the unit model (indexed by tank number).

Model Structure#

The core Leach Train unit model consists of a single MSContactor model (named mscontactor) with hard coded stream names (liquid and solid respectively). The Leach Train model also has two inlets and two outlets named liquid_inlet, solid_inlet, liquid_outlet and solid_outlet respectively.

Additional Constraints#

Leach Train units add one additional constraint to define the extent of reaction for rate reactions in the system (indexed by number of tanks and list of rate reactions).

\[X_{t,e,r} = V_{t,e} \times r_{t,e,r}\]

where \(X_{t,e,r}\) is the extent of reaction for reaction \(r\) in tank \(e\) at time \(t\), \(V_{t,e}\) is the volume of the reacting material in tank \(e\) at time \(t\) (allows for varying reactor volume with time) and \(r_{t,e,r}\) is the volumetric rate of reaction for reaction \(r\) in tank \(e\) at time \(t\) (from the reaction package).

Variables#

Leach Train units add the following additional Variables beyond those created by the MSContactor Block.

Variable

Name

Notes

\(V_{t,e}\)

volume

class prommis.leaching.leach_train.LeachingTrain(*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}

    liquid_phase

    Liquid phase properties

    liquid_phase
    property_package

    Property parameter object used to define property calculations for given stream, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PhysicalParameterObject - a PhysicalParameterBlock object.}

    property_package_args

    A ConfigDict with arguments to be passed to property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}

    has_energy_balance

    Bool indicating whether to include energy balance for stream. Default=True.

    has_pressure_balance

    Bool indicating whether to include pressure balance for stream. Default=True.

    solid_phase

    Solid phase properties

    solid_phase
    property_package

    Property parameter object used to define property calculations for given stream, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PhysicalParameterObject - a PhysicalParameterBlock object.}

    property_package_args

    A ConfigDict with arguments to be passed to property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}

    has_energy_balance

    Bool indicating whether to include energy balance for stream. Default=True.

    has_pressure_balance

    Bool indicating whether to include pressure balance for stream. Default=True.

    reaction_package

    Heterogeneous reaction package for leaching.

    reaction_package_args

    Arguments for heterogeneous reaction package for leaching.

    number_of_tanks

    Number of tanks in leaching train

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

(LeachingTrain) New instance

class prommis.leaching.leach_train.LeachingTrainData(component)[source]#

Leaching Train Unit Model Class

build()[source]#

Build method for LeachingTrain unit model.

default_initializer#

alias of LeachingTrainInitializer

default_scaler#

alias of LeachingTrainScaler

class prommis.leaching.leach_train.LeachingTrainInitializer(**kwargs)[source]#

This is a general purpose Initializer for the Leaching Train unit model.

This routine calls the initializer for the internal MSContactor model.

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.

ssc_solver_options

Dict of arguments for solver calls by ssc_solver

calculate_variable_options

Dict of options to pass to calc_var_kwds argument in scc_solver method.

initialization_routine(model: Block)[source]#

Initialization routine for MSContactor Blocks.

Parameters:

model – model to be initialized

Returns:

None

class prommis.leaching.leach_train.LeachingTrainScaler(**kwargs)[source]#

Scaler for the LeachingTrain unit model.

zero_tolerance

Value at which a variable will be considered equal to zero for scaling.

max_variable_scaling_factor

Maximum value for variable scaling factors.

min_variable_scaling_factor

Minimum value for variable scaling factors.

max_constraint_scaling_factor

Maximum value for constraint scaling factors.

min_constraint_scaling_factor

Minimum value for constraint scaling factors.

max_expression_scaling_hint

Maximum value for expression scaling hints.

min_expression_scaling_hint

Minimum value for constraint scaling hints.

overwrite

Whether to overwrite existing scaling factors.

constraint_scaling_routine(model, overwrite: bool = False, submodel_scalers: dict = None)[source]#

Routine to apply scaling factors to constraints in model.

Parameters:
  • model – model to be scaled

  • overwrite – whether to overwrite existing scaling factors

  • submodel_scalers – dict of Scalers to use for sub-models, keyed by submodel local name

Returns:

None

variable_scaling_routine(model, overwrite: bool = False, submodel_scalers: dict = None)[source]#

Variable scaling routine for LeachingTrain.

Parameters:
  • model – instance of LeachingTrain to be scaled

  • overwrite – whether to overwrite existing scaling factors

  • submodel_scalers – dict of Scalers to use for sub-models, keyed by submodel local name

Returns:

None