Module “base”

class tc_python.process_metallurgy.base.AbstractAddition

Bases: object

The base class for representing an addition to an equilibrium calculation or process simulation.

get_composition() → Dict[str, float]

Returns the composition of the addition - without containing a dependent component.

Returns

The composition [in the unit provided by getCompositionUnit()]

abstract get_composition_unit()

Returns the composition unit used in this addition.

Returns

The composition unit

get_dependent_component() → str

Returns the dependent component.

Returns

The dependent component or an empty string if no dependent component is defined

get_elements() → Set[str]

Returns all elements of the addition.

Returns

The elements

get_id() → str

Returns the unique ID of the addition.

Returns

The unique ID of the addition

get_temperature() → float

Returns the temperature of the addition. This refers to the temperature before it is added to the process.

Returns

The temperature [K]

is_do_scale() → bool

Returns if the composition of the addition is being scaled to 100% / 1 or not.

Returns

If the composition is scaled

is_empty() → bool

Returns if the addition is “empty”, i.e., has zero amount.

Returns

If the addition is empty

class tc_python.process_metallurgy.base.ActivityReference(value)

Bases: enum.Enum

The reference for a slag activity calculation. The actual reference phase depends on the component for which the activity is request and can be obtained by using these methods on the result object: tc_python.process_metallurgy.process.ProcessSimulationResult.get_formula_for_activity_of_slag() or tc_python.process_metallurgy.equilibrium.EquilibriumResult.get_formula_for_activity_of_slag().

LIQUID = 1

The reference is liquid slag.

SOLID = 0

The reference is solid slag.

class tc_python.process_metallurgy.base.PhaseGroup(value)

Bases: enum.Enum

The phase group, such a group is collecting all phases that belong to a certain type.

ALL_METAL = 2

All metal phases.

ALL_SLAG = 5

All slag phases.

GAS = 6

All gas phases.

LIQUID_METAL = 0

All liquid metal phases.

LIQUID_SLAG = 4

All liquid slag phases.

SOLID_METAL = 1

All solid metal phases.

SOLID_SLAG = 3

All solid slag phases.

class tc_python.process_metallurgy.base.ProcessDatabase(value)

Bases: enum.Enum

The database used for a Process Metallurgy calculation.

LATEST = 0

The latest database available.

OXDEMO = 1

The database OXDEMO.

TCOX10 = 4

The database TCOX10.

TCOX11 = 5

The database TCOX11.

TCOX8 = 2

The database TCOX8.

TCOX9 = 3

The database TCOX9.

class tc_python.process_metallurgy.base.ProcessMetallurgyOptions

Bases: tc_python.single_equilibrium.SingleEquilibriumOptions

The options for a process metallurgy calculation.

disable_approximate_driving_force_for_metastable_phases()

Disables the approximation of the driving force for metastable phases.

Default: Enabled

Note

When enabled, the metastable phases are included in all iterations. However, these may not have reached their most favorable composition and thus their driving forces may be only approximate.

If it is important that these driving forces are correct, use disable_approximate_driving_force_for_metastable_phases() to force the calculation to converge for the metastable phases.

Returns

This ProcessMetallurgyOptions object

disable_control_step_size_during_minimization()

Disables step size control during minimization (non-global).

Default: Enabled

Returns

This ProcessMetallurgyOptions object

disable_force_positive_definite_phase_hessian()

Disables forcing of positive definite phase Hessian. This determines how the minimum of an equilibrium state in a normal minimization procedure (non-global) is reached. For details, search the Thermo-Calc documentation for “Hessian minimization”.

Default: Enabled

Returns

This ProcessMetallurgyOptions object

enable_approximate_driving_force_for_metastable_phases()

Enables the approximation of the driving force for metastable phases.

Default: Enabled

Note

When enabled, the metastable phases are included in all iterations. However, these may not have reached their most favorable composition and thus their driving forces may be only approximate.

If it is important that these driving forces are correct, use disable_approximate_driving_force_for_metastable_phases() to force the calculation to converge for the metastable phases.

Returns

This ProcessMetallurgyOptions object

enable_control_step_size_during_minimization()

Enables step size control during normal minimization (non-global).

Default: Enabled

Returns

This ProcessMetallurgyOptions object

enable_force_positive_definite_phase_hessian()

Enables forcing of positive definite phase Hessian. This determines how the minimum of an equilibrium state in a normal minimization procedure (non-global) is reached. For details, search the Thermo-Calc documentation for “Hessian minimization”.

Default: Enabled

Returns

This ProcessMetallurgyOptions object

set_global_minimization_max_grid_points(max_grid_points: int = 2000)

Sets the maximum number of grid points in global minimization. Only applicable if global minimization is actually used.

Default: 2000 points

Parameters

max_grid_points – The maximum number of grid points

Returns

This ProcessMetallurgyOptions object

set_max_no_of_iterations(max_no_of_iterations: int = 2000)

Sets the maximum number of iterations for the CALPHAD minimizer.

Default: max. 2000 iterations

Note

As some models give computation times of more than 1 CPU second/iteration, this number is also used to check the CPU time and the calculation stops if 500 CPU seconds/iterations are used.

Parameters

max_no_of_iterations – The max. number of iterations

Returns

This ProcessMetallurgyOptions object

set_process_minimization_policy(minimization_policy: tc_python.process_metallurgy.base.ProcessMinimizationPolicy)

Sets the minimization policy for the process metallurgy calculation. It is possible to choose policies that try different methods if one method fails.

Parameters

minimization_policy – The minimization policy to be used

Returns

This ProcessMetallurgyOptions object

set_required_accuracy(accuracy: float = 1e-06)

Sets the required relative accuracy.

Default: 1.0E-6

Note

This is a relative accuracy, and the program requires that the relative difference in each variable must be lower than this value before it has converged. A larger value normally means fewer iterations but less accurate solutions. The value should be at least one order of magnitude larger than the machine precision.

Parameters

accuracy – The required relative accuracy

Returns

This ProcessMetallurgyOptions object

set_smallest_fraction(smallest_fraction: float = 1e-16)

Sets the smallest fraction for constituents that are unstable.

It is normally only in the gas phase that you can find such low fractions.

The default value for the smallest site-fractions is 1E-16 for all phases except for IDEAL phase with one sublattice site (such as the GAS mixture phase in many databases) for which the default value is always as 1E-30.

Parameters

smallest_fraction – The smallest fraction for constituents that are unstable

Returns

This ProcessMetallurgyOptions object

class tc_python.process_metallurgy.base.ProcessMinimizationPolicy(value)

Bases: enum.Enum

The policy for the CALPHAD minimization routine used in a calculation.

Note

This affects the runtime and stability of a calculation. Global minimization is more stable but more time-consuming. Local minimization is much faster but can miss new phases coming up. Global test is a compromise between both approaches.

GLOBAL = 0

Always use global minimization.

GLOBAL_TEST = 1

Always use global test.

GLOBAL_TEST__GLOBAL = 5

First try global test, if that fails use global minimization.

LOCAL = 2

Always use local minimization.

LOCAL__GLOBAL_TEST = 3

First try local minimization, if that fails use global test.

LOCAL__GLOBAL_TEST__GLOBAL = 4

First try local minimization, if that fails try global test and if that fails use global minimization.

class tc_python.process_metallurgy.base.SlagProperty(value)

Bases: enum.Enum

The slag property, different definitions are available. The actual definition of a certain slag property for the current system can be obtained using these methods on the result object: tc_python.process_metallurgy.process.ProcessSimulationResult.getFormulaForSlagProperty() or tc_python.process_metallurgy.equilibrium.EquilibriumResult.getFormulaForSlagProperty().

Note

If not all components required by the definition of slag property are available in a given system, the slag property will return NaN.

B2 = 0

Basicity B2 (based on: CaO / SiO2).

B3 = 1

Basicity B3 (based on: CaO / MgO / SiO2).

B4 = 3

Basicity B4 (based on: CaO / MgO / SiO2 / Al2O3).

BAS2 = 2

Basicity Bas2 (based on: CaO / MgO / SiO2 / Al2O3 / TiO2).

BELLS_RATIO = 4

Basicity Bell’s ratio (based on: CaO / MgO / SiO2 / Al2O3).

LOG_10_SULPHUR_CAPACITY = 5

Logarithmic sulphur capacity of the slag.

LS = 6

Sulphur capacity Ls of the slag.

class tc_python.process_metallurgy.base.SlagType(value)

Bases: enum.Enum

The type of slag considered for a slag property calculation.

ALL = 2

The slag property is calculated for all slag, i.e. for both the liquid and solid slag.

LIQUID = 1

The slag property is calculated for all liquid slag.

SOLID = 0

The slag property is calculated for all solid slag.