interface Module

Module with the definition of the base class for both the thermo-physical and the thermo-chemical properties, i.e., PropertyInterface.

class PropertyInterface

Abstract class that defines the interface for both the thermo-physical and the thermo-chemical properties. Derived classes must override the following attributes:

Even the following attributes can be overridden, but not mandatorily:

  • initialization_helper(): override this method if the property correlation is particularly difficult to solve in terms of temperature (see lbh15.properties.lead_properties.p_s.initialization_helper()). If not overridden, it is ignored.

  • name: override this member to give the property a custom name, otherwise the class name is used.

  • correlation_name: override this member to give the correlation a name different from the default one.

  • is_injective: override this member only in case the correlation function is not injective by returning the False value, otherwise it is considered injective.

Derived classes are not allowed having either the name starting with __ or overriding the name attribute for providing a name starting with __.

compute_bounds() None

Computes the bounds of the property within the validity range, i.e., the minimum and the maximum values of the correlation function inside the validity range, together with the corresponding temperature values. If this method is not invoked, the default values are -nan for the minimum value of the property and for its corresponding temperature, and nan for the maximum value of the property and for its corresponding temperature. The bounding values are computed using the scipy.optimize.minimize_scalar() function by adopting the “Bounded” method (for more details, please refer to the scipy documentation).

Return type:

None

initialization_helper(property_value: float) float | None

Returns the temperature guess value according to the value of the property passed as argument. It is used by the root finder algorithm in case the return type is not None.

Parameters:

property_value (float) – value of the property

Return type:

None

info(T: float, p: float = scipy.constants.atm, print_info: bool = True, n_tab: int = 0) None | str

Prints the information about the property and about the correlation adopted to compute its value.

Parameters:
  • T (float) – Temperature in \([K]\)

  • p (float, optional) – Pressure in \([Pa]\), by default the atmospheric pressure value, i.e., \(101325.0 Pa\)

  • print_info (bool, optional) – True to print to the console, False for getting the string. By default, True

  • n_tab (int, optional) – Number of indentation tabs used to format the output, by default 0

Returns:

Returns None if print_info=True, otherwise returns the content of the information.

Return type:

None | str

abstract correlation(T: float, p: float = scipy.constants.atm, verbose: bool = False) float

Returns the value of the property by applying the corresponding correlation.

Parameters:
  • T (float) – Temperature in \([K]\)

  • p (float, optional) – Pressure in \([Pa]\), by default the atmospheric pressure, i.e., \(101325.0 Pa\)

  • verbose (bool, optional) – True to tell the decorator to print a warning message in case of range check failing, False otherwise. By default, False

Return type:

exception

property name: str

Name of the property

Type:

str

property correlation_name: str

Name of the correlation

Type:

str

property is_injective: bool

True if the correlation is injective, False otherwise

Type:

bool

property min: float

Minimum value of the property correlation function within the validity range

Type:

float

property max: float

Maximum value of the property correlation function within the validity range

Type:

float

property T_at_min: float

Temperature value corresponding to the minimum value of the property correlation function within the validity range

Type:

float

property T_at_max: float

Temperature value corresponding to the maximum value of the property correlation function within the validity range

Type:

float

abstract property range: List[float]

Validity range of the property correlation function identified by the minimum and the maximum values of the temperature

Type:

List[float]

abstract property units: str

Property unit

Type:

str

abstract property long_name: str

Property long name

Type:

str

abstract property description: str

Property description

Type:

str