fairyfly_therm.properties.model module

Model Therm Properties.

class fairyfly_therm.properties.model.ModelThermProperties(host)[source]

Bases: object

Therm Properties for Fairyfly Model.

Parameters:

host – A fairyfly_core Model object that hosts these properties.

Properties:
  • host

  • materials

  • conditions

  • gases

ToString()[source]
apply_properties_from_dict(data)[source]

Apply the therm properties of a dictionary to the host Model of this object.

Parameters:

data – A dictionary representation of an entire fairyfly-core Model. Note that this dictionary must have ModelThermProperties in order for this method to successfully apply the therm properties.

check_all(raise_exception=True, detailed=False)[source]

Check all of the aspects of the Model therm properties.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if any errors are found. If False, this method will simply return a text string with all errors that were found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A text string with all errors that were found or a list if detailed is True. This string (or list) will be empty if no errors were found.

check_all_duplicate_identifiers(raise_exception=True, detailed=False)[source]

Check that there are no duplicate identifiers for any therm objects.

This includes Materials, Gases, and Conditions.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if any duplicate identifiers are found. If False, this method will simply return a text string with all errors that were found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A text string with all errors that were found or a list if detailed is True. This string (or list) will be empty if no errors were found.

check_duplicate_condition_identifiers(raise_exception=True, detailed=False)[source]

Check that there are no duplicate Condition identifiers in the model.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if duplicate identifiers are found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A string with the message or a list with a dictionary if detailed is True.

check_duplicate_gas_identifiers(raise_exception=True, detailed=False)[source]

Check that there are no duplicate Gas identifiers in the model.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if duplicate identifiers are found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A string with the message or a list with a dictionary if detailed is True.

check_duplicate_material_identifiers(raise_exception=True, detailed=False)[source]

Check that there are no duplicate Material identifiers in the model.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if duplicate identifiers are found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A string with the message or a list with a dictionary if detailed is True.

check_for_extension(raise_exception=True, detailed=False)[source]

Check that the Model is valid for Therm simulation.

This process includes all relevant fairyfly-core checks as well as checks that apply only for Therm.

Parameters:
  • raise_exception – Boolean to note whether a ValueError should be raised if any errors are found. If False, this method will simply return a text string with all errors that were found. (Default: True).

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A text string with all errors that were found or a list if detailed is True. This string (or list) will be empty if no errors were found.

duplicate(new_host=None)[source]

Get a copy of this object.

Parameters:

new_host – A new Model object that hosts these properties. If None, the properties will be duplicated with the same host.

static load_properties_from_dict(data, skip_invalid=False)[source]

Load model therm properties of a dictionary to Python objects.

Loaded objects include Materials, Boundaries, Gases, and PureGases.

The function is called when re-serializing a Model object from a dictionary to load fairyfly_therm objects into their Python object form before applying them to the Model geometry.

Parameters:
  • data – A dictionary representation of an entire fairyfly-core Model. Note that this dictionary must have ModelThermProperties in order for this method to successfully load the therm properties.

  • skip_invalid – A boolean to note whether objects that cannot be loaded should be ignored (True) or whether an exception should be raised about the invalid object (False). (Default: False).

Returns:

A tuple with eight elements

  • materials – A dictionary with identifiers of materials as keys and Python material objects as values.

  • conditions – A dictionary with identifiers of conditions as keys and Python boundary objects as values.

  • gases – A dictionary with identifiers of gases as keys and Python gas objects as values.

  • pure_gases – A dictionary with identifiers of pure gases and Python PureGas objects as values.

to_dict()[source]

Return Model therm properties as a dictionary.

ERROR_MAP = {'210001': 'check_duplicate_material_identifiers', '210002': 'check_duplicate_condition_identifiers', '210003': 'check_duplicate_gas_identifiers'}
property conditions

Get a list of all unique conditions contained within the model.

property gases

Get a list of all unique gases contained within the model.

property host

Get the Model object hosting these properties.

property materials

Get a list of all unique materials assigned to Shapes.