Package “propertymodel”

class tc_toolbox.propertymodel.PropertyModelCalculation

Configuration for a Property Model calculation.

Note

Specify the settings, the calculation is performed with calculate().

Constructor Summary
PropertyModelCalculation(back)

Call base constructor: tc_toolbox.AbstractCalculation.

Method Summary
calculate(timeout_in_minutes)

Runs the Property Model calculation.

Parameters:

timeout_in_minutes – Used to prevent the calculation from running longer than what is wanted, or from hanging. If the calculation runs longer than timeout_in_minutes, a CalculationEngineException will be thrown.

Returns:

A PropertyModelResult which later can be used to get specific values from the simulation.

get_argument_default(argument_id)

Returns the default value for the specified argument. The argument id can be obtained with get_arguments().

Parameters:

argument_id – The argument id

Returns:

The default value (the type depends on the argument)

get_argument_description(argument_id)

Returns the detailed description of the argument. The id can be obtained with get_arguments().

Parameters:

argument_id – The argument id

Returns:

The detailed description

get_arguments()

Returns a list of the arguments of the Property Model.

Note

The arguments are the ‘UI-panel components’ defined in the Property Model interface method provide_ui_panel_components(). They have the same id as specified in the Property Model. The naming is different because there is no UI present.

Returns:

The ids of the available arguments

get_configuration_as_string()

Returns detailed information about the current state of the calculation object.

Warning

The structure of the calculator objects is an implementation detail and might change between releases without notice. Therefore do not rely on the internal object structure.

get_dynamic_arguments()

Returns a list of the dynamic arguments of the Property Model.

Note

Dynamic arguments are “extra” arguments created by pressing the “plus” button that can occur next to the UI-panel for some models, when running the Property Model from within Thermo-Calc. You can use them also from the API by invoke_dynamic_argument().

Returns:

The ids of the available dynamic arguments

get_model_description()

Returns the description text of the current model.

Returns:

the description

get_model_parameter_value(model_parameter_id)

Returns the current value of an optimizable model parameter. The id can be obtained with get_model_parameters().

Parameters:

model_parameter_id – The model parameter id

Returns:

The current value [unit according to the parameter meaning]

get_model_parameters()

Returns a list of the optimizable model parameters.

Note

The model parameters are an optional set of variables that can be used within the Property Model. Typically they are used to provide the possibility to inject parameter values during an optimization into the model. This allows the dynamic development of Property Models that need to be fitted to experimental data. The model parameters are controlled with the Property Model interface methods provide_model_parameters and set_model_parameter.

Returns:

The ids of the optimizable model parameters

get_system_data()

Returns the content of the database for the currently loaded system. This can be used to modify the parameters and functions and to change the current system by using with_system_modifications().

Note

Parameters can only be read from unencrypted (i.e. user) databases loaded as *.tdb-file.

Returns:

The system data

invalidate()

Invalidates the object and frees the disk space used by it. This is only required if the disk space occupied by the object needs to be released during the calculation. No data can be retrieved from the object afterwards.

invoke_dynamic_argument(argument_id)

Increases the number of instances of this dynamic argument by one, the argument will have an id such as argument_1, argument_2, … if the dynamic argument is called argument.

Note

You can obtain all available dynamic arguments by using get_dynamic_arguments().

Parameters:

argument_id – argument_id: The argument id

Returns:

This PropertyModelCalculation object

remove_all_conditions()

Removes all set classic POLY conditions.

Note

This does not affect the compositions set by set_composition().

Returns:

This PropertyModelCalculation object

remove_dependent_element()

Removes a manually set dependent element. This method does not affect the automatic choice of the dependent element if set_composition() is used.

Returns:

This PropertyModelCalculation object

set_argument(argument, value)

Sets the specified model argument to the specified value. The id can be obtained with get_arguments().

Parameters:
  • argument – The argument id

  • value – The value [unit according to the argument meaning]

Returns:

This PropertyModelCalculation object

set_composition(element_name, value)

Sets the composition of a element. The unit for the composition can be changed using set_composition_unit().

Default: Mole percent (CompositionUnit.MOLE_PERCENT)

Parameters:
  • element_name – The element

  • value – The composition value [composition unit defined for the calculation]

Returns:

This PropertyModelCalculation object

set_composition_unit(unit_enum)

Sets the composition unit.

Default: Mole percent (CompositionUnit.MOLE_PERCENT).

Parameters:

unit_enum – The new composition unit

Returns:

This PropertyModelCalculation object

set_condition(classic_condition, value)

Adds a classic POLY condition. If that method is used, all conditions need to be specified in such a way. If this method is used, it is necessary to set the dependent element manually using set_dependent_element().

Default if not specified: pressure P = 1e5 Pa, system size N = 1, Temperature T = 1000 K

Note

It should not be necessary for most users to use this method, try to use set_composition() instead.

Warning

It is not possible to mix POLY-commands and compositions using set_composition().

Warning

As this method runs raw POLY-commands directly in the engine, it may hang the program in case of spelling mistakes (e.g. forgotten parenthesis, …).

Parameters:
  • classic_condition – The classic POLY condition (for example: X(CR))

  • value – The value of the condition

Returns:

This PropertyModelCalculation object

set_dependent_element(dependent_element_name)

Sets the dependent element manually.

Note

It should not be necessary for most users to use this method. Setting the dependent element manually is only necessary and allowed if set_condition() is used.

Parameters:

dependent_element_name – The name of the dependent element

Returns:

This PropertyModelCalculation object

set_model_parameter(model_parameter_id, value)

Resets an optimizable model parameter. The id can be obtained with get_model_parameters().

Parameters:
  • model_parameter_id – The model parameter id

  • value – The new value of the parameter

Returns:

This PropertyModelCalculation object

set_temperature(temperature)

Sets the temperature.

Default: 1000 K

Parameters:

temperature – The temperature [K]

Returns:

This PropertyModelCalculation object

with_system_modifications(system_modifications)

Updates the system of this calculator with the supplied system modification (containing new phase parameters and system functions).

Note

This is only possible if the system has been read from unencrypted (i.e. user) databases loaded as a *.tdb-file.

Parameters:

system_modifications – The system modification to be performed

Returns:

This PropertyModelCalculation object

class tc_toolbox.propertymodel.PropertyModelResult

The result of a Property Model calculation.

Constructor Summary
PropertyModelResult(back)

Call base constructor: tc_toolbox.AbstractResult.

Method Summary
get_result_quantities()

Returns a list of the available result quantities defined in the Property Model.

Returns:

The ids of the defined result quantities

get_result_quantity_description(result_quantity_id)

Returns the detailed description of the result quantity. The id can be obtained by get_result_quantities().

Parameters:

result_quantity_id – The result quantity id

Returns:

The detailed description

get_single_equilibrium_result(result_quantity_id)

Returns a result quantity value. The available result quantities can be obtained by get_result_quantities().

Parameters:

result_quantity_id – The id of the result quantity.

Returns:

The requested value [unit depending on the quantity], if the result is a SingleEquilibriumResult, is returned.

get_value_of(result_quantity_id)

Returns a result quantity value. The available result quantities can be obtained by get_result_quantities().

Parameters:

result_quantity_id – The id of the result quantity

Returns:

The requested value [unit depending on the quantity]. If the result is parameterized, parameter-value pairs are returned.

invalidate()

Invalidates the object and frees the disk space used by it. This is only required if the disk space occupied by the object needs to be released during the calculation. No data can be retrieved from the object afterwards.

save_to_disk(path)

Saves the result to disk. The result can later be loaded using tc_toolbox.server.SetUp.load_result_from_disk().

Note

The result data is represented by a whole folder possibly containing multiple files.

Parameters:

path – The path to the result folder, can be relative or absolute.

Returns:

This PropertyModelResult object