Envelopes Module

Envelopes.

This module contains the classes that wrap the data structures used to represent different kinds of phase envelopes.

class PTEnvelope(global_composition, main_phases_compositions, reference_phase_compositions, reference_phase_kinds, main_phases_kinds, main_phases_molar_fractions, pressures, temperatures, iterations, specified_variable, critical_pressures, critical_temperatures)[source]

Bases: object

PTEnvelope. This class represents a pressure-temperature envelope. .. attribute:: global_composition

The global composition of the system. Shape is (n_components,).

type:

np.ndarray

main_phases_compositions

The compositions of the main phases along the envelope. Shape is (n_points, n_phases, n_components).

Type:

np.ndarray

reference_phase_compositions

The compositions of the reference phase along the envelope. Shape is (n_points, n_components).

Type:

np.ndarray

main_phases_molar_fractions

The molar fractions of the main phases along the envelope. Shape is (n_points, n_phases).

Type:

np.ndarray

pressures

The pressures along the envelope. [bar]

Type:

np.ndarray

temperatures

The temperatures along the envelope. [K]

Type:

np.ndarray

iterations

The number of iterations taken to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

specified_variable

The specified variable used to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

reference_phase_kinds

The kinds of the reference phase at each point. Shape is (n_points,).

Type:

np.ndarray

main_phases_kinds

The kinds of the main phases at each point. Shape is (n_points, n_phases).

Type:

np.ndarray

cp

A list of lists containing the indices of the critical points for each phase. Each sublist corresponds to a phase and contains the indices of the critical points in the temperatures and pressures arrays.

Type:

list

df

A DataFrame containing the data of the envelope. The columns are: - ‘T’: Temperatures along the envelope. - ‘P’: Pressures along the envelope. - ‘x_i^j’: Compositions of the main phases, where i is the component index and j is the phase index. - ‘w_i’: Compositions of the reference phase, where i is the component index. - ‘beta^j’: Molar fractions of the main phases, where j is the phase index.

Type:

pd.DataFrame

plot(**plot_kwargs)[source]
class PXEnvelope(temperature, global_composition_0, global_composition_i, main_phases_compositions, reference_phase_compositions, main_phases_molar_fractions, pressures, alphas, iterations, specified_variable, critical_pressures, critical_alphas, main_phases_kinds, reference_phase_kinds)[source]

Bases: object

PXEnvelope.

This class represents a pressure-composition envelope.

temperature

The temperature at which the envelope is defined. [K]

Type:

float

global_composition_0

The global composition at the point where \(lpha = 0\).

Type:

np.ndarray

global_composition_i

The global composition at the point where \(lpha = 1\).

Type:

np.ndarray

main_phases_compositions

The compositions of the main phases along the envelope. Shape is (n_points, n_phases, n_components).

Type:

np.ndarray

reference_phase_compositions

The compositions of the reference phase along the envelope. Shape is (n_points, n_components).

Type:

np.ndarray

main_phases_molar_fractions

The molar fractions of the main phases along the envelope. Shape is (n_points, n_phases).

Type:

np.ndarray

pressures

The pressures along the envelope. [bar]

Type:

np.ndarray

alphas

The molar fraction of the global_composition_i, \(lpha\). Shape is (n_points,).

Type:

np.ndarray

critical_pressures

The critical pressures of the envelope. Shape is (n_critical_points,).

Type:

np.ndarray

critical_alphas

The molar fractions of the global_composition_i at the critical points, \(lpha\). Shape is (n_critical_points,).

Type:

np.ndarray

iterations

The number of iterations taken to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

specified_variable

The specified variable used to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

df

A DataFrame containing the data of the envelope. The columns are: - ‘alpha’: Molar fraction of the global_composition_i. - ‘P’: Pressures along the envelope. - ‘x_i^j’: Compositions of the main phases, where i is the component index and j is the phase index. - ‘w_i’: Compositions of the reference phase, where i is the component index. - ‘beta^j’: Molar fractions of the main phases, where j is the phase index.

Type:

pd.DataFrame

plot(**plot_kwargs)[source]

Plot the envelope.

Plot the envelope in a matplotlib axis. Using the natural variables of the envelope (\(alpha\) and pressure) If the ax keyword argument is provided, it will be used as the axis to plot on. Otherwise, the current axis will be used.

Parameters:

plot_kwargs (dict) – Keyword arguments to pass to the plot method of the axis. This can include line style, color, etc.

class TXEnvelope(pressure, global_composition_0, global_composition_i, main_phases_compositions, reference_phase_compositions, main_phases_molar_fractions, temperatures, alphas, iterations, specified_variable, critical_temperatures, critical_alphas, main_phases_kinds, reference_phase_kinds)[source]

Bases: object

TXEnvelope.

This class represents a temperature-composition envelope.

pressure

The pressure at which the envelope is defined. [bar]

Type:

float

global_composition_0

The global composition at the point where \(lpha = 0\).

Type:

np.ndarray

global_composition_i

The global composition at the point where \(lpha = 1\).

Type:

np.ndarray

main_phases_compositions

The compositions of the main phases along the envelope. Shape is (n_points, n_phases, n_components).

Type:

np.ndarray

reference_phase_compositions

The compositions of the reference phase along the envelope. Shape is (n_points, n_components).

Type:

np.ndarray

main_phases_molar_fractions

The molar fractions of the main phases along the envelope. Shape is (n_points, n_phases).

Type:

np.ndarray

temperatures

The temperatures along the envelope. [K]

Type:

np.ndarray

alphas

The molar fraction of the global_composition_i, \(lpha\). Shape is (n_points,).

Type:

np.ndarray

iterations

The number of iterations taken to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

specified_variable

The specified variable used to compute the envelope at each point. Shape is (n_points,).

Type:

np.ndarray

temperature

The temperatures along envelope. [K]

Type:

float

critical_temperatures

The critical temperatures of the envelope. Shape is (n_critical_points,).

Type:

np.ndarray

critical_alphas

The molar fractions of the global_composition_i at the critical points, \(lpha\). Shape is (n_critical_points,).

Type:

np.ndarray

df

A DataFrame containing the data of the envelope. The columns are: - ‘alpha’: Molar fraction of the global_composition_i. - ‘T’: Temperatures along the envelope. - ‘x_i^j’: Compositions of the main phases, where i is the component index and j is the phase index. - ‘w_i’: Compositions of the reference phase, where i is the component index. - ‘beta^j’: Molar fractions of the main phases, where j is the phase index.

Type:

pd.DataFrame

plot(**plot_kwargs)[source]

Plot the envelope.

Plot the envelope in a matplotlib axis. Using the natural variables of the envelope (\(alpha\) and temperature) If the ax keyword argument is provided, it will be used as the axis to plot on. Otherwise, the current axis will be used.

Parameters:

plot_kwargs (dict) – Keyword arguments to pass to the plot method of the axis. This can include line style, color, etc.