Module “equilibrium”¶
-
class
tc_python.process_metallurgy.equilibrium.
AbstractEquilibriumAddition
¶ Bases:
tc_python.process_metallurgy.base.AbstractAddition
The base class for representing an addition to an equilibrium calculation.
-
set_amount
(amount: float)¶ Change the amount of the addition.
- Parameters
amount – The new amount [in the amount unit of this addition]
- Returns
This
AbstractEquilibriumAddition
object
-
set_component_composition
(component: str, content: float)¶ Change the composition of a component of the addition.
- Parameters
component – The component to be changed
content – The new content of the component [in the composition unit defined for this addition]
- Returns
This
AbstractEquilibriumAddition
object
-
-
class
tc_python.process_metallurgy.equilibrium.
AdiabaticEquilibriumCalculation
(calculator)¶ Bases:
tc_python.process_metallurgy.equilibrium.EquilibriumCalculation
An adiabatic Process Metallurgy equilibrium calculation. Such calculations can for example be used to determine the global equilibrium state of a process.
-
add_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Adds an addition to the calculation.
- Parameters
addition – A
EquilibriumAddition
orEquilibriumGasAddition
- Returns
This
AdiabaticEquilibriumCalculation
object
-
add_poly_command
(command: str)¶ Adds a Thermo-Calc Console syntax POLY module command which will be executed when performing the calculation using the
calculate()
method.If multiple commands are added, they will be executed in the order of addition. Each command will only be executed one.
Note
It should not be necessary for most users to use this method, try to use the corresponding method implemented in the API instead.
Warning
As this method runs raw Thermo-Calc commands directly in the engine, it may hang the program in case of spelling mistakes (e.g. forgotten equals sign).
- Parameters
command – The POLY module command in Thermo-Calc console syntax
- Returns
This
AdiabaticEquilibriumCalculation
object
-
calculate
(timeout_in_minutes: float = 0.0) → tc_python.process_metallurgy.equilibrium.EquilibriumResult¶ Runs the Process Metallurgy equilibrium calculation.
- Parameters
timeout_in_minutes – The calculation will be aborted after that time, default: no timeout
- Returns
A new
EquilibriumResult
object
-
remove_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Removes an addition from the calculation.
- Parameters
addition – The addition to be removed
- Returns
This
AdiabaticEquilibriumCalculation
object
-
remove_all_additions
()¶ Removes all additions from the calculation.
- Returns
This
AdiabaticEquilibriumCalculation
object
-
set_pressure
(pressure: float = 100000.0)¶ Sets the pressure.
- Parameters
pressure – The pressure [Pa]
- Returns
This
AdiabaticEquilibriumCalculation
object
-
with_options
(options: tc_python.process_metallurgy.base.ProcessMetallurgyOptions)¶ Sets the options for the calculation.
- Parameters
options – The options
- Returns
This
AdiabaticEquilibriumCalculation
object
-
-
class
tc_python.process_metallurgy.equilibrium.
EquilibriumAddition
(composition: Dict[str, float], amount: float, temperature: float = 293.15, composition_unit: tc_python.utils.CompositionUnit = <CompositionUnit.MASS_PERCENT: 0>, do_scale: bool = False)¶ Bases:
tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition
An addition to an equilibrium calculation.
Tip
By setting do_scale=True, the composition will be scaled to 100% / fraction of 1. This is useful if the composition provided is not summing to 100% / 1. An example could be a slag addition which is provided like this: 90 wt-% CaO - 5 wt-% Al2O3 - 4 wt-% SiO2.
- Parameters
composition – The composition
amount – The amount [kg]
temperature – The initial addition temperature (default: 20 °C) [K]
composition_unit – The composition unit
do_scale – If the composition is scaled to 100% / fraction of 1
-
get_amount
() → float¶ Returns the amount of this addition.
- Returns
The amount [kg]
-
get_composition_unit
() → tc_python.utils.CompositionUnit¶ Returns the composition unit used in this addition.
- Returns
The composition unit
-
class
tc_python.process_metallurgy.equilibrium.
EquilibriumCalculation
(metallurgical_reaction)¶ Bases:
object
A Process Metallurgy equilibrium calculation. Such calculations can for example be used to determine the global equilibrium state of a process.
-
abstract
add_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Adds an addition to the calculation.
- Parameters
addition – The addition
- Returns
This
EquilibriumCalculation
object
-
abstract
add_poly_command
(command: str)¶ Adds a Thermo-Calc Console syntax POLY module command which will be executed when performing the calculation using the
calculate()
method.If multiple commands are added, they will be executed in the order of addition. Each command will only be executed one.
Note
It should not be necessary for most users to use this method, try to use the corresponding method implemented in the API instead.
Warning
As this method runs raw Thermo-Calc commands directly in the engine, it may hang the program in case of spelling mistakes (e.g. forgotten equals sign).
- Parameters
command – The POLY module command in Thermo-Calc console syntax
- Returns
This
EquilibriumCalculation
object
-
abstract
calculate
(timeout_in_minutes: float = 0.0) → tc_python.process_metallurgy.equilibrium.EquilibriumResult¶ Runs the Process Metallurgy equilibrium calculation.
- Parameters
timeout_in_minutes – The calculation will be aborted after that time, default: no timeout
- Returns
A new
EquilibriumResult
object
-
abstract
remove_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Removes an addition from the calculation.
- Parameters
addition – The addition to be removed
- Returns
This
EquilibriumCalculation
object
-
abstract
remove_all_additions
()¶ Removes all additions from the calculation.
- Returns
This
EquilibriumCalculation
object
-
abstract
set_pressure
(pressure: float = 100000.0)¶ Sets the pressure.
- Parameters
pressure – The pressure [Pa]
- Returns
This
EquilibriumCalculation
object
-
update_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Replaces an already added addition with an updated one. This is usually used to change the composition or amount of an addition while iterating over them. Typically, this is done for stepping or mapping calculations.
Note
The calculation must already contain the addition object to be updated.
- Parameters
addition – The new addition containing updated values
- Returns
This
IsoThermalMetallurgyCalculation
object
-
abstract
with_options
(options: tc_python.process_metallurgy.base.ProcessMetallurgyOptions)¶ Sets the options for the calculation.
- Parameters
options – The options
- Returns
This
EquilibriumCalculation
object
-
abstract
-
class
tc_python.process_metallurgy.equilibrium.
EquilibriumGasAddition
(composition: Dict[str, float], amount: float, temperature: float = 293.15, amount_unit: tc_python.utils.GasAmountUnit = <GasAmountUnit.NORM_CUBIC_METER: 0>, composition_unit: tc_python.utils.GasCompositionUnit = <GasCompositionUnit.VOLUME_PERCENT: 4>, do_scale: bool = False)¶ Bases:
tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition
A gas addition to an equilibrium calculation.
Tip
By setting do_scale=True, the composition will be scaled to 100% / fraction of 1. This is useful if the composition provided is not summing to 100% / 1. An example could be a gas addition which is provided like this: 90 vol–% Ar - 10 vol-% O2.
-
get_amount
() → float¶ Returns the amount of this addition.
Note
The amount unit can be obtained using
get_amount_unit()
.- Returns
The amount [in the amount unit]
-
get_amount_unit
() → tc_python.utils.GasAmountUnit¶ Returns the amount unit used in this addition.
- Returns
The amount unit
-
get_composition_unit
() → tc_python.utils.GasCompositionUnit¶ Returns the composition unit used in this addition.
- Returns
The composition unit
-
-
class
tc_python.process_metallurgy.equilibrium.
EquilibriumResult
(result)¶ Bases:
tc_python.abstract_base.AbstractResult
The result of a Process Metallurgy equilibrium calculation.
-
get_activity_of_slag
(component: str, reference: tc_python.process_metallurgy.base.ActivityReference = <ActivityReference.LIQUID: 1>) → float¶ Returns the activity of a component in the slag.
- Parameters
component – The component
reference – The reference for the activity, can be liquid or solid slag, default: liquid slag
- Returns
The activity of the component [-]
-
get_amount
() → float¶ Returns the total amount.
- Returns
The total amount [kg]
-
get_amount_of_elements
() → Dict[str, float]¶ Returns the amount of each element.
- Returns
The amount of the elements [kg]
-
get_amount_of_phase_groups
() → Dict[tc_python.process_metallurgy.base.PhaseGroup, float]¶ Returns the amount of each phase group (e.g., for example all liquid slag).
- Returns
The amount of the phase groups [kg]
-
get_amount_of_phases
() → Dict[str, float]¶ Returns the amount of each phase.
- Returns
The amount of the phases [kg]
-
get_components
() → Set[str]¶ Returns all components defined for the elements present in this result.
- Returns
The components present in this result
-
get_composition
(composition_unit: tc_python.utils.CompositionUnit = <CompositionUnit.MASS_PERCENT: 0>) → Dict[str, float]¶ Returns the composition of the result.
- Parameters
composition_unit – The composition unit, default: mass percent
- Returns
The composition
-
get_composition_of_phase
(phase: str, composition_unit: tc_python.utils.CompositionUnit = <CompositionUnit.MASS_PERCENT: 0>, composition_type: tc_python.utils.CompositionType = <CompositionType.COMPONENT: 1>) → Dict[str, float]¶ Returns the composition of a phase in the result.
- Parameters
phase – The phase name
composition_unit – The composition unit, default: mass percent
composition_type – Defines if the composition is given by element (e.g., 75 wt-% Fe - 25 wt-% Cr) or by component (e.g. 65 wt-% Al2O3 - 35 wt-% CaO). In case of a metallic phase, the composition is given by element even if component is selected. Default: by component.
- Returns
The composition
-
get_composition_of_phase_group
(phase_group: tc_python.process_metallurgy.base.PhaseGroup, composition_unit: tc_python.utils.CompositionUnit = <CompositionUnit.MASS_PERCENT: 0>, composition_type: tc_python.utils.CompositionType = <CompositionType.COMPONENT: 1>) → Dict[str, float]¶ Returns the composition of a phase group (e.g., all liquid slag) in the result.
- Parameters
phase_group – The phase group
composition_unit – The composition unit, default: mass percent
composition_type – Defines if the composition is given by element (e.g., 75 wt-% Fe - 25 wt-% Cr) or by component (e.g. 65 wt-% Al2O3 - 35 wt-% CaO). In case of a metallic phase, the composition is given by element even if component is selected. Default: by component.
- Returns
The composition
-
get_elements
() → Set[str]¶ Returns all elements defined for the result.
- Returns
All elements present in this result
-
get_formula_for_activity_of_slag
(component: str, reference: tc_python.process_metallurgy.base.ActivityReference = <ActivityReference.LIQUID: 1>) → str¶ Returns the Thermo-Calc Console syntax formula used for calculating the activity of a component in the slag (e.g. AC(AL2O3, IONIC_LIQ). The actual activity can be obtained using
get_activity_of_slag()
.- Parameters
component – The component
reference – The reference for the activity, can be liquid or solid slag, default: liquid slag
- Returns
The formula for calculating the activity
-
get_formula_for_slag_property
(slag_property: tc_python.process_metallurgy.base.SlagProperty, slag_type: tc_python.process_metallurgy.base.SlagType = <SlagType.ALL: 2>) → str¶ Returns the Thermo-Calc Console syntax formula used for calculating a property of the slag (e.g. B(CAO)/B(SIO2). The actual slag property can be obtained using
get_slag_property()
.- Parameters
slag_property – The slag property
slag_type – The part of the slag for which the property will be calculated. Can be all slag, the liquid or the solid slag. Default: all slag
- Returns
The formula for calculating the slag property
-
get_fraction_of_phase_groups
(unit: tc_python.utils.PhaseUnit = <PhaseUnit.MASS_FRACTION: 1>) → Dict[tc_python.process_metallurgy.base.PhaseGroup, float]¶ Returns the fraction of the phase groups (e.g., all liquid slag) in the result.
- Parameters
unit – The unit of the fraction, default: volume fraction
- Returns
The phase fractions
-
get_fraction_of_phases
(unit: tc_python.utils.PhaseUnit = <PhaseUnit.MASS_FRACTION: 1>) → Dict[str, float]¶ Returns the fraction of the stable phases in the result.
- Parameters
unit – The unit of the fraction, default: volume fraction
- Returns
The phase fractions
-
get_gas_components
() → Set[str]¶ Returns all components of the gas phase defined for the elements present in this result.
- Returns
The components of the gas phase present in this result
-
get_oxygen_partial_pressure
() → float¶ Returns the partial pressure of oxygen in the result.
- Returns
The partial pressure [Pa]
-
get_pressure
() → float¶ Returns the pressure in the result.
- Returns
The pressure [Pa]
-
get_slag_property
(slag_property: tc_python.process_metallurgy.base.SlagProperty, slag_type: tc_python.process_metallurgy.base.SlagType = <SlagType.ALL: 2>) → float¶ Returns a property of the slag. These properties are mostly used to describe the property of a slag to pick up sulfur.
- Parameters
slag_property – The slag property
slag_type – The part of the slag for which the property will be calculated. Can be all slag, the liquid or the solid slag. Default: all slag
- Returns
The slag property [unit depending on the property]
-
get_stable_phases
() → Set[str]¶ Returns the stable phases in the result.
- Returns
The stable phases
-
get_stable_phases_in_phase_group
(phase_group: tc_python.process_metallurgy.base.PhaseGroup) → Set[str]¶ Returns the stable phases of a phase group (e.g., all liquid slag) in the result.
- Parameters
phase_group – The phase group
- Returns
The stable phases
-
get_temperature
() → float¶ Returns the temperature in the result.
- Returns
The temperature [K]
-
get_value_of
(classic_expression: str) → float¶ Returns a value for a thermodynamic quantity.
Warning
It should normally not be required to use this method, use the appropriate method available in the API instead.
- Parameters
classic_expression – The thermodynamic quantity to get the value of in Thermo-Calc Console Mode syntax (for example “NPM(FCC_A1)”)
- Returns
The requested value
-
get_viscosity_dynamic_of_phase
(phase: str) → float¶ Returns the dynamic viscosity of a phase in the result.
- Parameters
phase – The phase name
- Returns
The dynamic viscosity [Pa*s]
-
get_viscosity_kinematic_of_phase
(phase: str) → float¶ Returns the kinematic viscosity of a phase in the result.
- Parameters
phase – The phase name
- Returns
The kinematic viscosity [m**2/s]
-
-
class
tc_python.process_metallurgy.equilibrium.
IsoThermalEquilibriumCalculation
(calculation)¶ Bases:
tc_python.process_metallurgy.equilibrium.EquilibriumCalculation
An isothermal Process Metallurgy equilibrium calculation. Such calculations can for example be used to determine the global equilibrium state of a process.
-
add_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Adds an addition to the calculation.
- Parameters
addition – A
EquilibriumAddition
orEquilibriumGasAddition
- Returns
This
IsoThermalEquilibriumCalculation
object
-
add_poly_command
(command: str)¶ Adds a Thermo-Calc Console syntax POLY module command which will be executed when performing the calculation using the
calculate()
method.If multiple commands are added, they will be executed in the order of addition. Each command will only be executed one.
Note
It should not be necessary for most users to use this method, try to use the corresponding method implemented in the API instead.
Warning
As this method runs raw Thermo-Calc commands directly in the engine, it may hang the program in case of spelling mistakes (e.g. forgotten equals sign).
- Parameters
command – The POLY module command in Thermo-Calc console syntax
- Returns
This
IsoThermalEquilibriumCalculation
object
-
calculate
(timeout_in_minutes: float = 0.0) → tc_python.process_metallurgy.equilibrium.EquilibriumResult¶ Runs the Process Metallurgy equilibrium calculation.
- Parameters
timeout_in_minutes – The calculation will be aborted after that time, default: no timeout
- Returns
A new
EquilibriumResult
object
-
remove_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Removes an addition from the calculation.
- Parameters
addition – The addition to be removed
- Returns
This
IsoThermalEquilibriumCalculation
object
-
remove_all_additions
()¶ Removes all additions from the calculation.
- Returns
This
IsoThermalEquilibriumCalculation
object
-
set_pressure
(pressure: float = 100000.0)¶ Sets the pressure.
- Parameters
pressure – The pressure [Pa]
- Returns
This
IsoThermalEquilibriumCalculation
object
-
set_temperature
(temperature: float)¶ Sets the temperature.
- Parameters
temperature – The temperature [K]
- Returns
This
IsoThermalEquilibriumCalculation
object
-
update_addition
(addition: tc_python.process_metallurgy.equilibrium.AbstractEquilibriumAddition)¶ Replaces an already added addition with an updated one.
Tip
This is usually used to change the composition or amount of an addition while iterating over multiple values. Typically, this is done for stepping or mapping calculations.
Note
The calculation must already contain the addition object to be updated.
- Parameters
addition – A previously added addition object with the updated values
- Returns
This
IsoThermalEquilibriumCalculation
object
-
with_options
(options: tc_python.process_metallurgy.base.ProcessMetallurgyOptions)¶ Sets the options for the calculation.
- Parameters
options – The options
- Returns
This
IsoThermalEquilibriumCalculation
object
-