Unit operations
Documentation for the class objects creation are presented in this section [Highlighted in blue]. Documentation for methods called internally and not requiring user definition are ignored.
Reactors
- class PharmaPy.Reactors.BatchReactor(mask_params=None, base_units='concentration', temp_ref=298.15, isothermal=True, reset_states=False, controls=None, h_conv=1000, ht_mode='jacket', return_sens=True, state_events=None)
Bases:
_BaseReactorInherited constructor for the Batch reactor class.
- Parameters:
partic_species (list of str) – Names of the species participating in the reaction. Names correspond to species names in the physical properties .json file.
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computations.
base_units (str (optional, default = 'concentration')) – Basis used for material units in the reactor.
temp_ref (float (optional, default = 298.15)) – Reference temperature for enthalpy calculations.
isothermal (bool (optional, default = True)) – Boolean value indicating whether the energy balance is considered. (i.e. dT/dt = 0 when isothermal is True)
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation.
controls (dict of functions (optional, default = None)) – Dictionary with keys representing the state which is controlled and the value indicating the function to use while computing the variable. Functions are of the form f(time) = state_value
h_conv (float (optional, default = 1000)) – Convective heat transfer coefficient for the liquid phase in the reactor (W m-2 K-1).
ht_mode (str (optional, default = 'jacket')) – What method is used for heat transfer. Options: [‘jacket’, ‘coil’, ‘bath’]
return_sens (bool (optional, default = True)) – whether or not the paramest_wrapper method should return the sensitivity system along with the concentratio profiles. Use False if you want the parameter estimation platform to estimate the sensitivity system using finite differences
- energy_balances(time, mole_conc, vol, temp, temp_ht, inputs, heat_prof=False)
- material_balances(time, mole_conc, vol, temp, temp_ht, inputs)
- nomenclature()
- retrieve_results(time, states)
- solve_unit(runtime=None, time_grid=None, eval_sens=False, params_control=None, verbose=True, sundials_opts=None)
Batch reactor method for solving the individual unit directly. runtime : float (default = None)
Value for total unit runtime.
- time_gridlist of float (optional, default = None)
Optional list of time values for the integrator to use during simulation.
- eval_sensbool (optional, default = False)
Boolean value indicating whether the parametric sensitivity system will be included during simulation. Must be true to access sensitivity information.
- verbosebool (optional, default = True)
Boolean value indicating whether the simulator will output run statistics after simulation is complete. Use true if you want to see the number of function evaluations and wall-clock runtime for the unit.
- timesim_limitfloat (optional, default = 0)
Float value of the maximum wall-clock time for the simulator to use before aborting the simulation.
- returndefault 2 arrays (3 if eval_sens is True)
Returns 2 or 3 indexed data structures. First, the integrator time points. Second, the state values corresponding to those integrator time points. And if eval_sens is True, third is the parametric sensitivity information of the simulation.
- class PharmaPy.Reactors.CSTR(mask_params=None, base_units='concentration', temp_ref=298.15, isothermal=True, reset_states=False, controls=None, h_conv=1000, ht_mode='jacket', return_sens=True, state_events=None)
Bases:
_BaseReactorInherited constructor for the continuous stirred-tank reactor (CSTR) class.
- Parameters:
partic_species (list of str) – Names of the species participating in the reaction. Names correspond to species names in the physical properties .json file.
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computations.
base_units (str (optional, default = 'concentration')) – Basis used for material units in the reactor.
temp_ref (float (optional, default = 298.15)) – Reference temperature for enthalpy calculations.
isothermal (bool (optional, default = True)) – Boolean value indicating whether the energy balance is considered. (i.e. dT/dt = 0 when isothermal is True)
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation.
controls (dict of functions (optional, default = None)) – Dictionary with keys representing the state which is controlled and the value indicating the function to use while computing the variable. Functions are of the form f(time) = state_value
h_conv (float (optional, default = 1000)) – Convective heat transfer coefficient for the liquid phase in the reactor (W m-2 K-1).
ht_mode (str (optional, default = 'jacket')) – What method is used for heat transfer. Options: [‘jacket’, ‘coil’, ‘bath’]
return_sens (bool (optional, default = True)) – whether or not the paramest_wrapper method should return the sensitivity system along with the concentratio profiles. Use False if you want the parameter estimation platform to estimate the sensitivity system using finite differences
- property Inlet
- energy_balances(time, mole_conc, vol, temp, temp_ht, inputs, heat_prof=False)
- material_balances(time, mole_conc, vol, temp, temp_ht, inputs)
- nomenclature()
- retrieve_results(time, states)
- solve_unit(runtime=None, time_grid=None, eval_sens=False, params_control=None, verbose=True, sundials_opts=None)
- class PharmaPy.Reactors.PlugFlowReactor(diam_in, num_discr, mask_params=None, base_units='concentration', temp_ref=298.15, isothermal=False, adiabatic=False, reset_states=False, controls=None, h_conv=1000, ht_mode='bath', return_sens=True, state_events=None)
Bases:
_BaseReactorInherited constructor for the plug-flow (PFR) reactor class.
- Parameters:
diam_in (float) – Diameter of the tubular reactor in meters.
num_discr (int) – number of finite volumes to use to discretize the volume coordinate
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computations.
base_units (str (optional, default = 'concentration')) – Basis used for material units in the reactor.
temp_ref (float (optional, default = 298.15)) – Reference temperature for enthalpy calculations.
isothermal (bool (optional, default = True)) – Boolean value indicating whether the energy balance is considered. (i.e. dT/dt = 0 when isothermal is True)
adiabatic (bool (optional, default = False)) – Boolean value indication whether the reactor is considered to be adiabatic. Temperature change will not be zero but heat transfer will be zero in this case.
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation.
controls (dict of functions (optional, default = None)) – Dictionary with keys representing the state which is controlled and the value indicating the function to use while computing the variable. Functions are of the form f(time) = state_value
h_conv (float (optional, default = 1000)) – Convective heat transfer coefficient for the liquid phase in the reactor (W m-2 K-1).
ht_mode (str (optional, default = 'bath')) – What method is used for heat transfer. Options: [‘jacket’, ‘coil’, ‘bath’]
return_sens (bool (optional, default = True)) – whether or not the paramest_wrapper method should return the sensitivity system along with the concentratio profiles. Use False if you want the parameter estimation platform to estimate the sensitivity system using finite differences
- property Inlet
- animate_reactor(filename=None, step_data=2, fps=5, pick_idx=None, title=None)
- energy_balances(time, mole_conc, vol_diff, temp, flow_in, rate_i, heat_profile=False)
- energy_steady(conc, temp)
- get_inputs(time)
- material_balances(time, mole_conc, vol_diff, temp, flow_in, rate_j)
- material_steady(conc, temp)
- nomenclature()
- plot_profiles(times=None, vol=None, pick_comp=None, **fig_kw)
Plot representative profiles for tank reactors. For a more flexible plotting interface, see plot_function in th PharmaPy.Plotting module
- Parameters:
pick_comp (list of str/int, optional) – list of components to be plotted. Each element of the list can be either the name of a species (str) or the index of the species (int). The default is None.
**fig_kwargs (keyword arguments to plt.subplots()) – named arguments passed to the plotting functions. A yypical field is ‘figsize’, passed as a (width, height) tuple.
- Returns:
fig (TYPE) – fig object.
ax (numpy array or array) – ax object or array of objects.
- plot_steady(fig_size=None, title=None)
- retrieve_results(time, states)
- solve_steady(vol_rxn, adiabatic=False)
- solve_unit(runtime=None, time_grid=None, verbose=True, any_event=True, sundials_opts=None)
- unit_model(time, states, sw=None, params=None, enrgy_bce=False)
- unit_steady(time, states, params=None)
- class PharmaPy.Reactors.SemibatchReactor(vol_tank, mask_params=None, base_units='concentration', temp_ref=298.15, isothermal=True, reset_states=False, controls=None, h_conv=1000, ht_mode='jacket', return_sens=True, state_events=None)
Bases:
CSTRInherited constructor for the semibatch stirred-tank reactor class. This method inherits from the CSTR constructor.
- Parameters:
partic_species (list of str) – Names of the species participating in the reaction. Names correspond to species names in the physical properties .json file.
vol_tank (float) – Volume of the vessel in m**3. Required to ensure that the vessel does not overflow
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computations.
base_units (str (optional, default = 'concentration')) – Basis used for material units in the reactor.
temp_ref (float (optional, default = 298.15)) – Reference temperature for enthalpy calculations.
isothermal (bool (optional, default = True)) – Boolean value indicating whether the energy balance is considered. (i.e. dT/dt = 0 when isothermal is True)
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation.
controls (dict of functions (optional, default = None)) – Dictionary with keys representing the state which is controlled and the value indicating the function to use while computing the variable. Functions are of the form f(time) = state_value
h_conv (float (optional, default = 1000)) – Convective heat transfer coefficient for the liquid phase in the reactor (W m-2 K-1).
ht_mode (str (optional, default = 'jacket')) – What method is used for heat transfer. Options: [‘jacket’, ‘coil’, ‘bath’]
return_sens (bool (optional, default = True)) – whether or not the paramest_wrapper method should return the sensitivity system along with the concentratio profiles. Use False if you want the parameter estimation platform to estimate the sensitivity system using finite differences
- material_balances(time, inputs, **kwargs)
- nomenclature()
- solve_unit(runtime=None, time_grid=None, eval_sens=False, params_control=None, verbose=True, sundials_opts=None)
- PharmaPy.Reactors.check_stoichiometry(stoich, mws)
- PharmaPy.Reactors.get_sundials_callable(events, eval_sens, param_vals, unit_model, get_jac)
- PharmaPy.Reactors.order_state_names(names)
Crystallizers
- class PharmaPy.Crystallizers.BatchCryst(target_comp, mask_params=None, method='1D-FVM', scale=1, vol_tank=None, controls=None, adiabatic=False, rad_zero=0, reset_states=False, h_conv=1000, vol_ht=None, basis='mass_conc', jac_type=None, state_events=None, param_wrapper=None)
Bases:
_BaseCrystConstruct a Batch Crystallizer object
- Parameters:
target_comp (str, list of strings) – Name of the crystallizing compound(s) from .json file.
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computation
method (str) – Choice of the numerical method. Options are: ‘moments’, ‘1D-FVM’
scale (float) – Scaling factor by which crystal size distribution will be multiplied.
controls (dict of dicts (funcs) (optional, default = None)) – Dictionary with keys representing the state (e.g.’Temp’) which is controlled and the value indicating the function to use while computing the varible. Functions are of the form f(time) = state_value
cfun_solub (callable) – User defined function for the solubility function : func(conc)
adiabatic (bool (optional, default =True)) – Boolean value indicating whether the heat transfer of the crystallization is considered.
rad_zero (float (optional)) – size of the first bin of the CSD discretization [m]
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation
basis (str (optional, default = 'mass_conc')) – Options : ‘massfrac’, ‘massconc’
state_events (lsit of dict(s)) – list of dictionaries, each one containing the specification of a state event
- energy_balances(time, params, cryst_rate, u_inputs, rhos, mu_n, distrib, mass_conc, temp, temp_ht, vol, h_in=None, heat_prof=False)
- get_heat_duty(time, states)
- jac_params(time, states, params)
- jac_states(time, states, params, return_only=True)
- material_balances(time, params, u_inputs, rhos, mu_n, distrib, mass_conc, temp, temp_ht, vol, phi_in=None)
- retrieve_results(time, states)
- class PharmaPy.Crystallizers.MSMPR(target_comp, mask_params=None, method='1D-FVM', scale=1, vol_tank=None, controls=None, adiabatic=False, rad_zero=0, reset_states=False, h_conv=1000, vol_ht=None, basis='mass_conc', jac_type=None, num_interp_points=3, state_events=None, param_wrapper=None)
Bases:
_BaseCrystConstruct a MSMPR object.
- Parameters:
target_comp (str, list of strings) – Name of the crystallizing compound(s) from .json file.
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computation
method (str) – Choice of the numerical method. Options are: ‘moments’, ‘1D-FVM’
scale (float) – Scaling factor by which crystal size distribution will be multiplied.
controls (dict of dicts (funcs) (optional, default = None)) – Dictionary with keys representing the state (e.g.’Temp’) which is controlled and the value indicating the function to use while computing the varible. Functions are of the form f(time) = state_value
cfun_solub (callable) – User defined function for the solubility function : func(conc)
adiabatic (bool (optional, default =True)) – Boolean value indicating whether the heat transfer of the crystallization is considered.
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation
basis (str (optional, default = 'mass_conc')) – Options : ‘massfrac’, ‘massconc’
state_events (lsit of dict(s)) – list of dictionaries, each one containing the specification of a state event
- property Inlet
- energy_balances(time, params, cryst_rate, u_inputs, rhos, mu_n, distrib, mass_conc, temp, temp_ht, vol, h_in, heat_prof=False)
- get_heat_duty(time, states)
- material_balances(time, params, u_inputs, rhos, mu_n, distrib, mass_conc, temp, temp_ht, vol, phi_in)
- retrieve_results(time, states)
- solve_steady_state(frac_seed, temp)
- class PharmaPy.Crystallizers.SemibatchCryst(target_comp, vol_tank=None, mask_params=None, method='1D-FVM', scale=1, controls=None, adiabatic=False, rad_zero=0, reset_states=False, h_conv=1000, vol_ht=None, basis='mass_conc', jac_type=None, num_interp_points=3, state_events=None, param_wrapper=None)
Bases:
MSMPRConstruct a Semi-batch Crystallizer object
- Parameters:
target_comp (str, list of strings) – Name of the crystallizing compound(s) from .json file.
mask_params (list of bool (optional, default = None)) – Binary list of which parameters to exclude from the kinetics computation
method (str) – Choice of the numerical method. Options are: ‘moments’, ‘1D-FVM’
scale (float) – Scaling factor by which crystal size distribution will be multiplied.
controls (dict of dicts (funcs) (optional, default = None)) – Dictionary with keys representing the state (e.g.’Temp’) which is controlled and the value indicating the function to use while computing the varible. Functions are of the form f(time) = state_value
adiabatic (bool (optional, default =True)) – Boolean value indicating whether the heat transfer of the crystallization is considered.
reset_states (bool (optional, default = False)) – Boolean value indicating whether the states should be reset before simulation
basis (str (optional, default = 'mass_conc')) – Options : ‘massfrac’, ‘massconc’
state_events (lsit of dict(s)) – list of dictionaries, each one containing the specification of a state event
- energy_balances(time, params, cryst_rate, u_inputs, rhos, distrib, mass_conc, temp, temp_ht, vol, mu_n, h_in)
- material_balances(time, params, u_inputs, rhos, mu_n, distrib, mass_conc, temp, temp_ht, vol, phi_in)
Evaporators
- class PharmaPy.Evaporators.AdiabaticFlash(pres_drum, div_energybce=1000.0, gamma_method='ideal', mult_midfun=1, seed_basedon_input=False)
Bases:
objectCreate an adiabatic flash object.
- Parameters:
pres_drum (float) – tank pressure [Pa].
div_energybce (float, optional) – Constant by which the energy balance equation is divided. It helps improving the conditioning of the numerical solver. The default is 1e3.
gamma_method (str, optional) – one of ‘ideal’, ‘UNIFAC’ or ‘UNIQUAC’. If ‘UNIFAC’ or ‘UNIQUAC’ is passed, the pure-component .json property file must have required parameters for the activity coefficient model.
mult_midfun (TYPE, optional) – DESCRIPTION. The default is 1.
seed_basedon_input (TYPE, optional) – DESCRIPTION. The default is False.
- Return type:
None.
- property Inlet
- energy_balance(liq, vap, x_i, y_i, z_i, temp)
- material_balances(liq, vap, x_i, y_i, z_i, temp)
- solve_unit(v_seed=0.5)
Solve AdiabaticFlash unit
- Parameters:
v_seed (float, optional) – A seed for output fraction of vapor with respect to feed material to the flash. It must be in the range 0-1. The default is 0.5.
- Returns:
solution – solution of the root finding algorithm.
- Return type:
SciPy OptimizerResult object
- unit_model(states)
- class PharmaPy.Evaporators.ContinuousEvaporator(vol_drum, adiabatic=False, pressure=101325, diam_out=0.0254, frac_liq=0.5, k_liq=100, k_vap=1, cv_gas=0.8, h_conv=1000, activity_model='ideal', num_interp_points=3, mult_flash=1, state_events=None, reflux_ratio=0)
Bases:
objectCreate a continuous evaporator object
- Parameters:
vol_drum (float) – total drum volume [m**3].
adiabatic (bool, optional) – if True, heat transfer will be disregarded from the energy balance. The default is False.
pressure (TYPE, optional) – pressure setpoint [Pa] (actual pressure is computed by the evaporator model). The default is 101325.
diam_out (float, optional) – diameter of the vapor outlet pipe [m]. The default is 2.54e-2.
frac_liq (float, optional) – setpoint for the fraction of the total tank volume occupied by the liquid phase. The default is 0.5.
k_liq (float, optional) – proportional control constant for liquid level control, which dictates output liquid mole flow (F_L), with F_L = k_liq * (v_drum * frac_liq - V_L(t)), being V_L(t) the liquid volume computed by the DAE system. The default is 100.
k_vap (float, optional) – proportional control constant for pressure, which actual pressure (P) by changing output vapor molar flow (F_V), with F_V = k_vap * f(pressure - P). The default is 1.
h_conv (float, optional) – convective heat transfer coefficient for the liquid phase [W/m**2/K]. The default is 1000.
activity_model (str, optional) – model to be used for calculation activity coefficient in vapor-liquid equilibria. Choose one of ‘ideal’, ‘UNIFAC’ and ‘UNIQUAC’ The default is ‘ideal’.
num_interp_points (int, optional) – Number of interpolation points to be used by the Interpolation module of PharmaPy to calculate inputs if the evaporator receives material from a dynamic upstream unit operation. The default is 3.
state_events (list of dicts, optional) – list of dictionaries containing the specification of a state event. To learn about the structure of a state event, see the PharmaPy.Commons.eval_state_events documentation. The default is None.
reflux_ratio (float, optional) – reflux ratio ranging from (0 - 1), which dictates the fraction of the vapor flow which is sent back to the unit, assuming total condensation. The default is 0.
- Return type:
A continuous vaporizer object.
- property Inlet
- property Phases
- property Utility
- energy_balances(time, flow_liq, flow_vap, vol_liq, u_int, temp, x_liq, y_vap, mol_i, mol_liq, mol_vap, pres, u_inputs, heat_prof=False)
- flatten_states()
- get_heat_duty(time, states)
- get_inputs(time)
- get_mole_flows(temp, pres, x_i, y_i, mol_liq, mol_vap, input_flow)
- get_volumes(temp, pres, x_i, mol_liq, mol_vap)
- init_unit()
- material_balances(time, mol_i, x_liq, y_vap, mol_liq, mol_vap, pres, u_int, temp, u_inputs, flows_out=False)
- nomenclature()
- plot_profiles(pick_comp=None, vol_plot=False, **fig_kwargs)
Convenience function to plot model solution. Dynamic profiles displayed by this funcion are x_liq vs t, y_vap vs t, T/P vs t and either mol_liq-mol_vap vs t or vol_liq-vol_vap vs t.
- Parameters:
pick_comp (list of int, optional) – indexes of states to be plot. If None, all the states are plotted. The default is None.
vol_plot (bool, optional) – If True, vol_liq-vol_vap vs t is plotted. Otherwise, mol_liq-mol_vap vs t is plotted.
**fig_kwargs (keyword arguments) – keyword arguments to be passed to the construction of fig and axes objects of matplotlib (plt.subplots(**kwargs)). Do not use nrows or ncols arguments, since the plot grid is already defined by PharmaPy
- Returns:
fig (TYPE) – figure object.
ax (numpy array) – grid of axis objects.
- retrieve_results(time, states)
- solve_unit(runtime, steady_state=False, verbose=True, sundials_opts=None, any_event=True)
Solve ContinuousEvaporator model
- Parameters:
runtime (float) – final time of the simulation routine.
steady_state (bool, optional) – If True, a steady-state version of the model is solved. Otherwise, a dynamic model is solved. The default is False.
verbose (bool, optional) – if True, integrator statistics will be displayed after the model is solved. The default is True.
sundials_opts (dict, optional) – options to be passed to SUNDIALS. For a list of available options, visit https://jmodelica.org/assimulo/ODE_CVode.html. The default is None.
any_event (TYPE, optional) – DESCRIPTION. The default is True.
- Returns:
If steady_state, then a SciPy OptimizationResult object is returned.
Else, a tuple containing a list of times returned by the numerical
integrator and an array of solved states is returned.
- unit_jacobian(c, time, states, sdot, params=None)
- unit_model(time, states, states_dot, sw, params=None, enrgy_bce=False)
- class PharmaPy.Evaporators.Evaporator(vol_drum, pressure=101325, diam_out=0.0254, k_vap=1, cv_gas=0.8, h_conv=1000, activity_model='ideal', state_events=None, stop_at_maxvol=True, flash_kwargs=None, include_nitrogen=False)
Bases:
objectCreate a batch/semibatch evaporator object
- Parameters:
vol_drum (float) – total drum volume [m**3].
pressure (float, optional) – pressure setpoint [Pa] (actual pressure is computed by the evaporator model). The default is 101325.
diam_out (float, optional) – diameter of the vapor outlet pipe [m]. The default is 2.54e-2.
k_vap (float, optional) – constant for vapor flow proportional control. Vapor flow is calculated as F_v = k_vap * (P_model - P) + F_in. The default is 1.
h_conv (float, optional) – convective heat transfer coefficient for the liquid phase [W/m**2/K]. The default is 1000.
activity_model (str, optional) – model to be used for calculation activity coefficient in vapor-liquid equilibria. Choose one of ‘ideal’, ‘UNIFAC’ and ‘UNIQUAC’ The default is ‘ideal’.
state_events (list of dicts, optional) – list of dictionaries containing the specification of a state event. To learn about the structure of a state event, see the PharmaPy.Commons.eval_state_events documentation. The default is None.
stop_at_maxvol (bool, optional) – whether or not to automatically stop integration when liquid volume reaches tank volume. This can be important for semi-batch vaporization. is important for The default is True.
flash_kwargs (dict, optional) – dictionary to be passed to the solve_unit method of the PharmaPy.AdiabaticFlash instance run to initialize the vaporizer. The default is None.
- Returns:
A vaporizer object (VO). If a PharmaPy.Stream object is aggregated to the
resulting instance (instance.Inlet = PharmaPy.Stream(…)),
the VO will be interpreted as a Semi-batch evaporator object.
Otherwise, a Batch evaporator will be run.
- property Inlet
- property Phases
- property Utility
- energy_balances(time, vol_liq, flow_vap, u_int, temp, x_liq, y_vap, mol_liq, mol_vap, pres, mol_i, u_inputs, du_dt=None)
- flatten_states()
- get_heat_duty(time, states)
- get_inputs(time)
- init_unit()
- material_balances(time, mol_i, x_liq, y_vap, mol_liq, mol_vap, pres, u_int, temp, u_inputs, dmoli_dt=None)
- nomenclature()
- plot_profiles(pick_comp=None, **fig_kwargs)
Convenience function to plot model solution. Dynamic profiles displayed by this funcion are x_liq vs t, y_vap vs t, T/P vs t and mol_liq/mol_vap vs t.
- Parameters:
pick_comp (list of int, optional) – indexes of states to be plot. If None, all the states are plotted. The default is None.
**fig_kwargs (keyword arguments) – keyword arguments to be passed to the construction of fig and axes object of matplotlib (plt.subplots(**kwargs)). Do not use nrows or ncols arguments, since the plot grid is already defined by PharmaPy
- Returns:
fig (TYPE) – figure object.
ax (numpy array) – grid of axis objects.
- retrieve_results(time, states)
- solve_unit(runtime, verbose=True, sundials_opts=None)
Solve Evaporator model
- Parameters:
runtime (float) – final time of the simulation routine.
verbose (bool, optional) – if True, integrator statistics will be displayed after the model is solved. The default is True.
sundials_opts (dict, optional) – options to be passed to SUNDIALS. For a list of available options, visit https://jmodelica.org/assimulo/DAE_IDA.html The default is None.
- Returns:
time (list) – list of time steps taken by the numerical integrator.
states (numpy array) – array containing the solution of the model.
- unit_jacobian(c, time, states, sdot, params=None)
- unit_model(time, states, states_dot, sw, params=None)
- class PharmaPy.Evaporators.IsothermalFlash(temp_drum=None, pres_drum=None, gamma_method='ideal')
Bases:
objectCreate an isothermal flash object. The model run by the instances of this class is steady state isothermal flash given T and P. This model is often used to determine the thermodynamic state of a given stream or phase (only liquid, vapor-liquid, only vapor)
- Parameters:
temp_drum (float, optional) – equipment temperature [K]. If None, temperature will be taken from the Inlet object aggregated to the flash (from PharmaPy.Phases or PharmaPy.Streams modules). The default is None.
pres_drum (float, optional) – equipment pressure [Pa]. If None, pressure will be taken from the Inlet object aggregated to the flash (from PharmaPy.Phases or PharmaPy.Streams modules). The default is None.
gamma_method (str, optional) – one of ‘ideal’, ‘UNIFAC’ or ‘UNIQUAC’. If ‘UNIFAC’ or ‘UNIQUAC’ is passed, the pure-component .json file must have the interaction parameters of the model. The default is ‘ideal’.
- Return type:
None.
- property Inlet
- energy_balance(liq, vap, x_i, y_i, z_i)
- material_balance(liq, vap, x_i, y_i, z_i)
- solve_unit()
- unit_model(states, material=True)
- PharmaPy.Evaporators.merge_supercritical(flags, x_liq, y_vap, z_super)