Module “scheil”

class tc_python.scheil.CalculateSecondaryDendriteArmSpacing

Bases: ScheilBackDiffusion

Configures a secondary dendrite arm spacing calculation used by Scheil with back diffusion. The used equation is c * cooling_rate^(-n) with c and n being provided either by the user or taken from the defaults.

disable_delta_ferrite_to_austenite_transition()

Turns off the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This CalculateSecondaryDendriteArmSpacing object

enable_delta_ferrite_to_austenite_transition()

Turns on the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This CalculateSecondaryDendriteArmSpacing object

set_c(c: float = 5e-05)

Sets the scaling factor c in the governing equation c * cooling_rate^(-n).

Default: 50 µm

Parameters:

c – The scaling factor [m]

Returns:

This CalculateSecondaryDendriteArmSpacing object

set_cooling_rate(cooling_rate: float = 1.0)

Sets the cooling rate.

Default: 1.0 K/s

An increased value moves the result from equilibrium toward a Scheil-Gulliver calculation.

Parameters:

cooling_rate – The cooling rate [K/s]

Returns:

This CalculateSecondaryDendriteArmSpacing object

set_fast_diffusing_elements(element_names: List[str])

Sets elements as fast diffusing. This allows redistribution of these elements in both the solid and liquid parts of the alloy.

Default: No fast-diffusing elements.

Parameters:

element_names – The elements

Returns:

This CalculateSecondaryDendriteArmSpacing object

set_n(n: float = 0.33)

Sets the exponent n in the governing equation c * cooling_rate^(-n).

Default: 0.33

Parameters:

n – The exponent [-]

Returns:

This CalculateSecondaryDendriteArmSpacing object

set_primary_phasename(primary_phase_name: str = 'AUTOMATIC')

Sets the name of the primary phase.

The primary phase is the phase where the back diffusion takes place. If AUTOMATIC is selected, the program tries to find the phase which will give the most back diffusion. That behavior can be overridden by selecting a specific primary phase.

Default: AUTOMATIC

Parameters:

primary_phase_name – The phase name (or AUTOMATIC)

Returns:

This CalculateSecondaryDendriteArmSpacing object

class tc_python.scheil.ConstantSecondaryDendriteArmSpacing(secondary_dendrite_arm_spacing: float = 5e-05)

Bases: ScheilBackDiffusion

Configures a constant secondary dendrite arm spacing used by Scheil with back diffusion. The secondary dendrite arm spacing can either be provided by the user or taken from the defaults.

disable_delta_ferrite_to_austenite_transition()

Turns off the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This ConstantSecondaryDendriteArmSpacing object

enable_delta_ferrite_to_austenite_transition()

Turns on the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This ConstantSecondaryDendriteArmSpacing object

set_cooling_rate(cooling_rate: float = 1.0)

Sets the cooling rate.

Default: 1.0 K/s

An increased value moves the result from equilibrium toward a Scheil-Gulliver calculation.

Parameters:

cooling_rate – The cooling rate [K/s]

Returns:

This ConstantSecondaryDendriteArmSpacing object

set_fast_diffusing_elements(element_names: List[str])

Sets elements as fast diffusing. This allows redistribution of these elements in both the solid and liquid parts of the alloy.

Default: No fast-diffusing elements.

Parameters:

element_names – The elements

Returns:

This ConstantSecondaryDendriteArmSpacing object

set_primary_phasename(primary_phase_name: str = 'AUTOMATIC')

Sets the name of the primary phase.

The primary phase is the phase where the back diffusion takes place. If AUTOMATIC is selected, the program tries to find the phase which will give the most back diffusion. That behavior can be overridden by selecting a specific primary phase.

Default: AUTOMATIC

Parameters:

primary_phase_name – The phase name (or AUTOMATIC)

Returns:

This ConstantSecondaryDendriteArmSpacing object

class tc_python.scheil.ScheilBackDiffusion

Bases: ScheilCalculationType

Configuration for back diffusion in the solid primary phase.

Warning

This feature has only effect on systems with diffusion data (typically a mobility database). If used for a system without diffusion data, a normal Scheil calculation is done.

classmethod calculate_secondary_dendrite_arm_spacing()

Calculate the secondary dendrite arm spacing based on the following equation: c * cooling_rate^(-n) with c and n being provided either by the user or taken from the defaults.

Use the methods provide by CalculateSecondaryDendriteArmSpacing to configure the parameters.

Returns:

A CalculateSecondaryDendriteArmSpacing

classmethod constant_secondary_dendrite_arm_spacing(secondary_dendrite_arm_spacing: float = 5e-05)

Assuming constant secondary dendrite arm spacing, provided either by the user or taken from the defaults.

Default: 50 µm

Parameters:

secondary_dendrite_arm_spacing – The dendrite arm spacing [m]

Returns:

A ConstantSecondaryDendriteArmSpacing

class tc_python.scheil.ScheilCalculation(calculator)

Bases: AbstractCalculation

Configuration for a Scheil solidification calculation.

Note

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

calculate(timeout_in_minutes: float = 0.0) ScheilCalculationResult

Runs the Scheil 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 UnrecoverableCalculationException will be thrown, the current TCPython-block will be unusable and a new TCPython block must be created for further calculations.

Returns:

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

disable_global_minimization()

Disables global minimization.

Default: Enabled

Note

When enabled, a global minimization test is performed when an equilibrium is reached. This costs more computer time but the calculations are more robust.

Returns:

This ScheilCalculation object

enable_global_minimization()

Enables global minimization.

Default: Enabled

Note

When enabled, a global minimization test is performed when an equilibrium is reached. This costs more computer time but the calculations are more robust.

Returns:

This ScheilCalculation object

get_system_data() SystemData

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

set_composition(component_name: str, value: float)

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

Default: Mole percent (CompositionUnit.MOLE_PERCENT)

Parameters:
  • component_name – The component

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

Returns:

This ScheilCalculation object

set_composition_unit(unit_enum: CompositionUnit = CompositionUnit.MOLE_PERCENT)

Sets the composition unit.

Default: Mole percent (CompositionUnit.MOLE_PERCENT).

Parameters:

unit_enum – The new composition unit

Returns:

This ScheilCalculation object

set_start_temperature(temperature_in_kelvin: float = 2500.0)

Sets the start temperature.

Warning

The start temperature needs to be higher than the liquidus temperature of the alloy.

Default: 2500.0 K

Parameters:

temperature_in_kelvin – The temperature [K]

Returns:

This ScheilCalculation object

with_calculation_type(scheil_calculation_type: ScheilCalculationType)

Chooses a specific Scheil calculation. ClassicScheil for only setting fast diffusers, ScheilBackDiffusion enables back diffusion in the solid primary phase and optionally fast diffusers in all solid phases, and ScheilSoluteTrapping enables solute trapping in the solid primary phase. :param scheil_type: Type of Scheil calculation, either ScheilClassic, ScheilBackDiffusion or ScheilSoluteTrapping :return: This ScheilCalculation object

with_options(options: ScheilOptions)

Sets the Scheil simulation options.

Parameters:

options – The Scheil simulation options

Returns:

This ScheilCalculation object

with_system_modifications(system_modifications: SystemModifications)

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 ScheilCalculation object

class tc_python.scheil.ScheilCalculationResult(result)

Bases: AbstractResult

Result of a Scheil calculation.

get_solid_phase_with_largest_mole_fraction() str

Returns the name of the solid phase with the largest amount in terms of mole fraction at the end of the Scheil simulation.

Returns:

Phase name

get_stable_phases() List[str]

Returns all phases that were stable during a Scheil simulation.

Returns:

The list of stable phases

get_values_grouped_by_quantity_of(x_quantity: Union[ScheilQuantity, str], y_quantity: Union[ScheilQuantity, str], sort_and_merge: bool = True) Dict[str, ResultValueGroup]

Returns x-y-line data grouped by the multiple datasets of the specified quantities (for example in dependency of phases or components). Use get_values_of() instead if you need no separation. The available quantities can be found in the documentation of the factory class ScheilQuantity.

Note

The different datasets might contain NaN-values between different subsections and might not be sorted even if the flag `sort_and_merge` has been set (because they might be unsortable due to their nature).

Parameters:
  • x_quantity – The first Scheil quantity (“x-axis”), Console Mode syntax strings can be used as an alternative (for example “T”)

  • y_quantity – The second Scheil quantity (“y-axis”), Console Mode syntax strings can be used as an alternative (for example “NV”)

  • sort_and_merge – If True, the data is sorted and merged into as few subsections as possible (divided by NaN)

Returns:

Containing the ResultValueGroup dataset objects with their quantity labels as keys

get_values_grouped_by_stable_phases_of(x_quantity: Union[ScheilQuantity, str], y_quantity: Union[ScheilQuantity, str], sort_and_merge: bool = True) Dict[str, ResultValueGroup]

Returns x-y-line data grouped by the sets of “stable phases” (for example “LIQUID” or “LIQUID + FCC_A1”). Use get_values_of() instead if you need no separation. The available quantities can be found in the documentation of the factory class ScheilQuantity.

Note

The different datasets might contain NaN-values between different subsections and might not be sorted even if the flag `sort_and_merge` has been set (because they might be unsortable due to their nature).

Parameters:
  • x_quantity – The first Scheil quantity (“x-axis”), Console Mode syntax strings can be used as an alternative (for example “T”)

  • y_quantity – The second Scheil quantity (“y-axis”), Console Mode syntax strings can be used as an alternative (for example “NV”)

  • sort_and_merge – If True, the data will be sorted and merged into as few subsections as possible (divided by NaN)

Returns:

Containing the ResultValueGroup dataset objects with their “stable phases” labels as keys

get_values_of(x_quantity: Union[ScheilQuantity, str], y_quantity: Union[ScheilQuantity, str]) [List[float], List[float]]

Returns sorted x-y-line data without any separation. Use get_values_grouped_by_quantity_of() or get_values_grouped_by_stable_phases_of() instead if you need such a separation. The available quantities can be found in the documentation of the factory class ScheilQuantity.

Note

This method will always return sorted data without any NaN-values. In case of ambiguous quantities (for example: CompositionOfPhaseAsWeightFraction(“FCC_A1”, “All”)) that can give data that is hard to interpret. In such a case you need to choose the quantity in another way or use one of the other methods.

Parameters:
  • x_quantity – The first Scheil quantity (“x-axis”), Console Mode syntax strings can be used as an alternative (for example “T”)

  • y_quantity – The second Scheil quantity (“y-axis”), Console Mode syntax strings can be used as an alternative (for example “NV”)

Returns:

A tuple containing the x- and y-data in lists

save_to_disk(path: str)

Saves the result to disc. Note that a result is a folder, containing potentially many files. The result can later be loaded with load_result_from_disk()

Parameters:

path – the path to the folder you want the result to be saved in.

Returns:

this ScheilCalculationResult object

class tc_python.scheil.ScheilCalculationType

Bases: object

Specific configuration for the different Scheil calculation types

classmethod scheil_back_diffusion()

Configuration for back diffusion in the solid primary phase.

Warning

This feature has only effect on systems with diffusion data (typically a mobility database). If used for a system without diffusion data, a normal Scheil calculation is done. :return: A ScheilBackDiffusion

classmethod scheil_classic()

Configuration for Classic Scheil with fast diffusers. :return: A ScheilClassic

classmethod scheil_solute_trapping()

Configures the Scheil solute trapping settings. The used solidification speed equation is Scanning speed * cos(angle) with Scanning speed and angle being provided either by the user or taken from the defaults. :return: A ScheilSoluteTrapping

class tc_python.scheil.ScheilClassic

Bases: ScheilCalculationType

Configuration for Classic Scheil with fast diffusers.

disable_delta_ferrite_to_austenite_transition()

Turns off the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This ScheilClassic object

enable_delta_ferrite_to_austenite_transition()

Turns on the delta ferrite BCC to austenite FCC transition.

Default: Delta ferrite to austenite transition is off. :return: This ScheilClassic object

set_fast_diffusing_elements(element_names: List[str])

Sets elements as fast diffusing. This allows redistribution of these elements in both the solid and liquid parts of the alloy.

Default: No fast-diffusing elements.

Parameters:

element_names – The elements

Returns:

This ScheilClassic object

class tc_python.scheil.ScheilOptions

Bases: object

Options for the Scheil simulation.

calculate_from_gas()

Calculates the evaporation temperature if a gas phase is selected in the system, and then calculates equilibria in the gas+liquid and liquid regions until liquidus temperature is reached.

Default: Calculation starts from liquidus temperature.

Returns:

This ScheilOptions object

calculate_from_liquidus()

Solidification calculation starting from the liquidus temperature. Liquid properties between start temperature and liquidus are not obtainable.

Default: Calculation starts from liquidus temperature.

Returns:

This ScheilOptions object

calculate_from_start_temperature()

Calculation of equilibria from start temperature at 50 K intervals until liquidus temperature is reached. This option makes it possible to obtain properties of the liquid phase before the solidification starts.

Default: Calculation starts from liquidus temperature.

Returns:

This ScheilOptions object

calculate_to_end_of_scheil()

Stops the calculation when the Scheil calculation is finished.

Default: Calculation stops when the Scheil calculation is finished.

Returns:

This ScheilOptions object

calculate_to_temperature_below_solidus(number_of_steps: int = 50, final_temperature: float = 298.15)

Calculates properties in the solid state, for the phase compositions and fractions at the end of the Scheil calculation.

Default: Calculation stops when the Scheil calculation is finished.

Parameters:
  • number_of_steps – Calculates properties for the given number of temperatures, down to the final temperature.

  • final_temperature – The final (lowest) temperature where the calculation is performed.

Returns:

This ScheilOptions object

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 ScheilOptions object

disable_control_step_size_during_minimization()

Disables stepsize control during minimization (non-global).

Default: Enabled

Returns:

This ScheilOptions object

disable_equilibrium_solidification_calculation()

Skips the property (one axis) diagram calculation of solidification under equilibrium conditions, before the Scheil solidification calculation starts.

In general it is not necessary to perform this calculation.

Default: Disabled. The equilibrium solidification calculation is skipped.

Returns:

This ScheilOptions object

disable_evaporation_property_calculation()

Disables calculation of evaporation properties above liquidus.

Default: Disabled. The evaporation properties are not calculated.

Returns:

This ScheilOptions 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 ScheilOptions 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 ScheilOptions object

enable_control_step_size_during_minimization()

Enables stepsize control during normal minimization (non-global).

Default: Enabled

Returns:

This ScheilOptions object

enable_equilibrium_solidification_calculation()

Performs a property (one axis) diagram calculation of solidification under equilibrium conditions, before the Scheil solidification calculation starts, in the same way as is typically done in graphical and console mode.

In general it is not necessary to perform this calculation.

Default: Disabled. The equilibrium solidification calculation is skipped.

Returns:

This ScheilOptions object

enable_evaporation_property_calculation()

Enables calculation of the properties molar mass of gas, driving force for evaporation and evaporation enthalpy above liquidus. The calculation requires the gas phase to be selected.

Default: Disabled. The evaporation properties are not calculated.

Returns:

This ScheilOptions 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 ScheilOptions object

set_gas_phase(phase_name: str = 'GAS')

Sets the phase used as the gas phase.

Default: The phase “GAS”.

Parameters:

phase_name – The phase name

Returns:

This ScheilOptions 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 ScheilOptions object

set_global_minimization_test_interval(global_test_interval: int = 10)

Sets the interval for the global test.

Default: 10

Parameters:

global_test_interval – The global test interval

Returns:

This ScheilOptions object

set_liquid_phase(phase_name: str = 'LIQUID')

Sets the phase used as the liquid phase.

Default: The phase “LIQUID”.

Parameters:

phase_name – The phase name

Returns:

This ScheilOptions object

set_max_no_of_iterations(max_no_of_iterations: int = 500)

Set the maximum number of iterations.

Default: max. 500 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 ScheilOptions 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 ScheilOptions object

set_smallest_fraction(smallest_fraction: float = 1e-12)

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-12 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 ScheilOptions object

set_temperature_step(temperature_step_in_kelvin: float = 1.0)

Sets the temperature step. Decreasing the temperature step increases the accuracy, but the default value is usually adequate.

Default step: 1.0 K

Parameters:

temperature_step_in_kelvin – The temperature step [K]

Returns:

This ScheilOptions object

terminate_on_fraction_of_liquid_phase(fraction_to_terminate_at: float = 0.01)

Sets the termination condition to a specified remaining fraction of liquid phase.

Default: Terminates at 0.01 fraction of liquid phase.

Note

Either the termination criterion is set to a temperature or fraction of liquid limit, both together are not possible.

Parameters:

fraction_to_terminate_at – the termination fraction of liquid phase (value between 0 and 1)

Returns:

This ScheilOptions object

terminate_on_temperature(temperature_in_kelvin: float)

Sets the termination condition to a specified temperature.

Default: Terminates at 0.01 fraction of liquid phase, i.e. not at a specified temperature.

Note

Either the termination criterion is set to a temperature or fraction of liquid limit, both together are not possible.

Parameters:

temperature_in_kelvin – the termination temperature [K]

Returns:

This ScheilOptions object

class tc_python.scheil.ScheilSoluteTrapping

Bases: ScheilCalculationType

Configures the Scheil solute trapping settings. The used solidification speed equation is Scanning speed * cos(angle) with Scanning speed and angle being provided either by the user or taken from the defaults.

set_angle(alpha: float = 45.0)

Sets the transformation angle alpha between the solid/liquid boundary and laser scanning direction.

Default: 45.0

Parameters:

alpha – The transformation angle [degree]

Returns:

This ScheilSoluteTrapping object

set_primary_phasename(primary_phase_name: str = 'AUTOMATIC')

Sets the name of the primary phase.

The primary phase is the phase where solute trapping takes place. A necessary condition for this phase is that the phase definition contains all of the elements that are chosen in the system. When AUTOMATIC is selected, the program tries to find a suitable primary phase that fills this condition.

Default: AUTOMATIC

Parameters:

primary_phase_name – The phase name (or AUTOMATIC)

Returns:

This ScheilSoluteTrapping object

set_scanning_speed(scanning_speed: float = 1.0)

Sets the scanning speed.

Default: 1 m/s

Parameters:

scanning_speed – The scaling factor [m/s]

Returns:

This ScheilSoluteTrapping object