Module “abstract_base”¶
-
class
tc_python.abstract_base.
AbstractCalculation
(calculator)¶ Bases:
object
Abstract base class for calculations.
-
get_configuration_as_string
() → str¶ 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_system_data
() → tc_python.abstract_base.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
-
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.
-
with_system_modifications
(system_modifications: tc_python.abstract_base.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
-
-
class
tc_python.abstract_base.
AbstractResult
(result)¶ Bases:
object
Abstract base class for results. This can be used to query for specific values .
-
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.
-
-
class
tc_python.abstract_base.
PhaseParameter
(parameter_name: Union[str, object])¶ Bases:
object
Database phase parameter expression used by
SystemModifications.set()
.- Parameters
parameter_name – The phase parameter name
-
get_intervals
() → List[tc_python.abstract_base.TemperatureInterval]¶ Returns the list of all defined intervals.
- Returns
The defined temperature intervals
-
get_lower_temperature_limit
() → float¶ Returns the lower temperature limit.
- Returns
The lower temperature limit in K
-
get_name
() → str¶ Returns the name of the phase parameter.
- Returns
The name of the phase parameter.
-
remove_all_intervals
()¶ Removes all previously defined temperature intervals.
- Returns
This
PhaseParameter
object
-
remove_interval_with_upper_limit
(upper_temperature_limit: float)¶ Removes a previously defined temperature interval with matching upper temperature limit.
If no such interval exists, an exception is thrown.
- Returns
This
PhaseParameter
object
-
set_expression_with_upper_limit
(parameter_expression: str, upper_temperature_limit: float = 6000.0)¶ Adds/overwrites a parameter expression for a temperature interval.
Default value of the upper limit of the interval: 6000 K
Note
The lower temperature limit is either defined by the lower temperature limit given with
PhaseParameter.set_lower_temperature_limit()
or by the upper temperature limit of the adjacent interval.Note
If there is an existing interval with exactly the same upper_temperature_limit, that interval is overwritten, otherwise the interval is added.
- Parameters
parameter_expression – The parameter expression, example: +V34*T*LN(T)+V35*T**2+V36*T**(-1)+V37*T**3”)
upper_temperature_limit – The upper temperature limit for which the expression should be used
- Returns
This
PhaseParameter
object
-
set_interval
(interval: tc_python.abstract_base.TemperatureInterval)¶ Adds/overwrites a temperature interval.
Note
The lower temperature limit is either defined by the lower temperature limit given with
PhaseParameter.set_lower_temperature_limit()
or by the upper temperature limit of the adjacent interval.Note
If there is an existing interval with exactly the same upper_temperature_limit, that interval is overwritten, otherwise the interval is added.
- Returns
This
PhaseParameter
object
-
set_lower_temperature_limit
(lower_temperature_limit: float = 298.15)¶ Sets the lower temperature limit of the phase parameter.
Default: 298.15 K
- Parameters
lower_temperature_limit – The lower temperature limit in K
- Returns
This
PhaseParameter
object
-
class
tc_python.abstract_base.
SystemData
(system_data)¶ Bases:
object
Provides information about the parameters and functions of a user database. The obtained objects can be used to modify the database using
with_system_modifications()
of all calculators.Note
Parameters can only be read from unencrypted (i.e. user) databases loaded as *.tdb-file.
-
get_phase_parameter
(parameter: str) → tc_python.abstract_base.PhaseParameter¶ Returns a phase parameter.
Example:
system_data.get_phase_parameter(‘G(HCP_A3,FE:VA;0)’)
Note
Parameters can only be read from unencrypted (i.e. user) databases loaded as a
*.tdb
-file.Note
For details about the syntax search the Thermo-Calc help for GES (the name for the Gibbs Energy System module in Console Mode).
- Parameters
parameter – The name of the phase parameter (for example: “G(LIQUID,FE;0)”)
- Returns
The phase parameter
-
get_phase_parameter_names
() → List[str]¶ Returns all phase parameters present in the current system.
- Returns
The list of phase parameters
-
get_system_function
(f: str) → tc_python.abstract_base.SystemFunction¶ Returns a system function.
Note
The parameter ‘f’ was previously called ‘function’ but was renamed.
Example:
system_data.get_system_function(‘GHSERCR’)
Note
Functions can only be read from unencrypted (i.e. user) databases loaded as a
*.tdb
-file.Note
For details about the syntax search the Thermo-Calc help for GES (the name for the Gibbs Energy System module in Console Mode).
- Parameters
f – The name of the system function (for example: “GHSERCR”)
- Returns
The system function
-
get_system_function_names
() → List[str]¶ Returns all system functions present in the current system.
- Returns
The list of system functions
-
-
class
tc_python.abstract_base.
SystemFunction
(function_name: Union[str, object])¶ Bases:
object
Database function expression used by
SystemModifications.set()
.- Parameters
function_name – The function name
-
get_intervals
() → List[tc_python.abstract_base.TemperatureInterval]¶ Returns the list of all defined intervals.
- Returns
The defined temperature intervals
-
get_lower_temperature_limit
() → float¶ Returns the lower temperature limit.
- Returns
The lower temperature limit in K
-
get_name
() → str¶ Returns the name of the system function.
- Returns
The name of the system function
-
remove_all_intervals
()¶ Removes all previously defined temperature intervals.
- Returns
This
SystemFunction
object
-
remove_interval_with_upper_limit
(upper_temperature_limit: float)¶ Removes a previously defined temperature interval with matching upper temperature limit.
If no such interval exists, an exception is thrown.
- Returns
This
SystemFunction
object
-
set_expression_with_upper_limit
(function_expression: str, upper_temperature_limit: float = 6000.0)¶ Adds/overwrites a function expression for a temperature interval.
Default value of the upper limit of the interval: 6000 K
Note
The lower temperature limit is either defined by the lower temperature limit given with
SystemFunction.set_lower_temperature_limit()
or by the upper temperature limit of the adjacent interval.Note
If there is an existing interval with exactly the same upper_temperature_limit, that interval is overwritten, otherwise the interval is added.
- Parameters
function_expression – The function expression, example: +V34*T*LN(T)+V35*T**2+V36*T**(-1)+V37*T**3”)
upper_temperature_limit – The upper temperature limit for which the expression should be used
- Returns
This
SystemFunction
object
-
set_interval
(interval: tc_python.abstract_base.TemperatureInterval)¶ Adds/overwrites a temperature interval.
Note
The lower temperature limit is either defined by the lower temperature limit given with
SystemFunction.set_lower_temperature_limit()
or by the upper temperature limit of the adjacent interval.Note
If there is an existing interval with exactly the same upper_temperature_limit, that interval is overwritten, otherwise the interval is added.
- Returns
This
SystemFunction
object
-
set_lower_temperature_limit
(lower_temperature_limit: float = 298.15)¶ Sets the lower temperature limit of the system function.
Default: 298.15 K
- Parameters
lower_temperature_limit – The lower limit in K
- Returns
This
SystemFunction
object
-
class
tc_python.abstract_base.
SystemModifications
¶ Bases:
object
Functionality to modify a user database during a calculation by changing phase parameters and system functions.
The actual changes are only applied by using
tc_python.abstract_base.AbstractCalculation.with_system_modifications()
on a calculator object.-
run_ges_command
(ges_command: str)¶ Sends a GES-command. This is actually applied when running `with_system_modifications` on a calculator object.
Example: run_ges_command(“AM-PH-DE FCC_A1 C_S 2 Fe:C”) for adding a second composition set to the FCC_A1 phase with Fe as major constituent on first sublattice and C as major constituent on second sublattice.
Note
For details about the syntax search the Thermo-Calc help for GES (the name for the Gibbs Energy System module in Console Mode).
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 GES-commands directly in the engine, it may hang the program in case of spelling mistakes (e.g. forgotten parenthesis, …).
- Parameters
ges_command – The GES-command (for example: “AM-PH-DE FCC_A1 C_S 2 Fe:C”)
- Returns
This
SystemModifications
object
-
set
(parameter_or_function: Union[tc_python.abstract_base.PhaseParameter, tc_python.abstract_base.SystemFunction])¶ Overwrites or creates a phase parameter or system function.
Example: system_modifications.set(PhaseParameter(‘G(LIQUID,FE;0)’).set_expression_with_upper_limit(‘+1.2*GFELIQ’))
Example: system_modifications.set(SystemFunction(“DGDEF”).set_expression_with_upper_limit(‘+10.0-R*T’, 1000).set_expression_with_upper_limit(‘+20.0-R*T’, 3000))
Note
The old parameter/function is overwritten and any temperature intervals not defined are lost.
Note
Please consult the Thermo-Calc GES-system documentation for details about the syntax.
- Returns
This
SystemModifications
object
-
-
class
tc_python.abstract_base.
TemperatureInterval
(expression: Union[str, object], upper_temperature_limit: float)¶ Bases:
object
Temperature interval expression used by the classes
SystemFunction
andPhaseParameter
.- Parameters
expression – The temperature function expressed in Thermo-Calc database syntax.
upper_temperature_limit – The upper temperature limit in K
-
get_expression
() → str¶ Returns the function expression of this temperature interval.
- Returns
The temperature function expression
-
get_upper_temperature_limit
() → float¶ Returns the upper limit of this temperature interval.
- Returns
The upper temperature limit in K
-
set_expression
(expression: str)¶ Sets the function expression of this temperature interval.
- Parameters
expression – The temperature function expression
-
set_upper_temperature_limit
(upper_temperature_limit: float)¶ Sets the upper limit of this temperature interval.
- Parameters
upper_temperature_limit – The upper temperature limit in K