Module “additive_manufacturing”

class tc_python.am.AdditiveManufacturingCalculation(calculation)

Bases: object

Abstract base class for an Additive Manufacturing calculation.

disable_fluid_flow_marangoni()

Disables the fluid flow modelling of the Marangoni effect.

Default: Enabled

Returns:

This AdditiveManufacturingCalculation object

disable_separate_materials()

Disables separate material properties for powder and solid material.

Default: Disabled

Returns:

This AdditiveManufacturingCalculation object

enable_fluid_flow_marangoni()

Enables the fluid flow modelling of the Marangoni effect.

Default: Enabled

Note

This option is not possible to use in conjunction with the option separate material, which is therefore automatically disabled.

Returns:

This AdditiveManufacturingCalculation object

enable_separate_materials()

Enables separate material properties for powder and solid material.

Default: Disabled

Note

This option is not possible to use in conjunction with the option Marangoni fluid flow, which is therefore automatically disabled.

Returns:

This AdditiveManufacturingCalculation object

get_configuration_as_string() str

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

Warning

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

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 afterward.

set_ambient_temperature(temperature: float = 296.15)

Sets the ambient temperature.

Default: 23 degree Celsius

Parameters:

temperature – The ambient temperature [K]

Returns:

This AdditiveManufacturingCalculation object

set_base_plate_temperature(temperature: float = 303.15)

Sets the baseplate temperature.

Default: 30 degree Celsius

Parameters:

temperature – The baseplate temperature [K]

Returns:

This AdditiveManufacturingCalculation object

set_gas_pressure(pressure: float = 100000.0)

Sets the gas pressure.

Default: 1.0e5 Pa

Parameters:

pressure – The pressure [Pa]

Returns:

This AdditiveManufacturingCalculation object

set_height(height: float = 0.002)

Sets the height of the simulation domain.

Default: 2.0e-3 m

Parameters:

height – The height [m]

Returns:

This AdditiveManufacturingCalculation object

set_layer_thickness(layer_thickness: float = 4e-05)

Sets the layer thickness.

Default: 40.0e-6 m

Parameters:

layer_thickness – The layer thickness [m]

Returns:

This AdditiveManufacturingCalculation object

set_powder_density(powder_density: float = 80.0)

Sets the powder density.

Default: 80.0%

Parameters:

powder_density – The powder density [%]

Returns:

This AdditiveManufacturingCalculation object

with_heat_source(heat_source: HeatSource)

Sets the heat source.

Parameters:

heat_source – The heat source

Returns:

This AdditiveManufacturingCalculation object

with_material_properties(material_properties: MaterialProperties)

Sets the material properties.

Tip

Material properties can be defined like this: MaterialProperties.from_library("IN718") or MaterialProperties.from_scheil_result(scheil_result).

Parameters:

material_properties – The material properties

Returns:

This AdditiveManufacturingCalculation object

with_mesh(mesh: Mesh)

Sets the mesh.

Parameters:

mesh – The mesh

Returns:

This AdditiveManufacturingCalculation object

with_numerical_options(numerical_options: NumericalOptions)

Sets the numerical options.

Parameters:

numerical_options – The numerical options

Returns:

This AdditiveManufacturingCalculation object

with_top_boundary_conditions(boundary_conditions: TopBoundaryConditions)

Sets the boundary conditions.

Parameters:

boundary_conditions – The boundary conditions

Returns:

This AdditiveManufacturingCalculation object

class tc_python.am.AdditiveManufacturingResult(result)

Bases: AbstractResult

Base class for additive manufacturing results.

get_pyvista_mesh(scalar: Scalar = Scalar.TEMPERATURE, material_type: MaterialType = MaterialType.SHOW_ALL)

Returns a pyvista mesh object that can be added to a pyvista plotter.

More details about pyvista meshes can be found in their documentation: https://docs.pyvista.org/version/stable/api/plotting/_autosummary/pyvista.Plotter.add_mesh.html

Tip

This method is typically used to obtain additional meshes with other settings if the plot object has already been retrieved with get_pyvista_plotter().

Parameters:
  • scalar – The quantity to be visualized in the plot

  • material_type – The material type to be visualized in the plot

Returns:

A pyvista.DataSet object

get_pyvista_plotter(scalar: Scalar = Scalar.TEMPERATURE, material_type: MaterialType = MaterialType.SHOW_ALL, camera: Optional[Dict[str, List[float]]] = None, anti_aliasing: str = 'msaa', multi_samples: int = 16, color_map: str = 'jet', enable_camera_orientation_widget: bool = False, render_lines_as_tubes: bool = True, background: str = 'LightSteelBlue', shape: Optional[bool] = None, view_buttons: bool = True, update_plot_callback: Optional[Callable] = None)

Returns a pyvista plotter and a mesh object containing the data from this result. They can be used to create 3D-plots visualizing the results of the AM calculation. More details about the pyvista settings can be found in their documentation: https://docs.pyvista.org/version/stable/api/plotting/_autosummary/pyvista.Plotter.html

The most simple usage of this method is:

plotter, mesh = result.get_pyvista_plotter()
plotter.add_mesh(mesh)
plotter.show()
Parameters:
  • scalar – The quantity to be visualized in the plot

  • material_type – The material type to be visualized in the plot, only available if AdditiveManufacturingCalculation.enable_separate_materials() has been used

  • camera – Defining the camera position, view-up vector and focus point, the default is DEFAULT_CAMERA, for example: {‘position’: [-2, -2, 1], ‘viewup’: [0, 0, 1], ‘focal_point’: [0.0, 0.0, 0.0]}. More details can be found here: https://docs.pyvista.org/version/stable/api/core/camera.html

  • anti_aliasing – The pyvista antialiasing setting, can be one of: “msaa” - Multi-Sample Anti-Aliasing, “fxaa” - Fast Approximate Anti-Aliasing or “ssaa” - Super-Sample Anti-Aliasing. More details can be found here: https://docs.pyvista.org/version/stable/examples/02-plot/anti-aliasing.html

  • multi_samples – The number of samples used for antialiasing

  • color_map – The pyvista colormap. Can be any colormap provided by Matplotlib and some other plotting libraries. More details can be found here: https://docs.pyvista.org/version/stable/examples/02-plot/cmap.html

  • enable_camera_orientation_widget – Enables the pyvista camera orientation widget in the plotter

  • render_lines_as_tubes – Controls if lines are rendered as tubes

  • background – The pyvista background color, either a string, rgb list or hex color string. https://docs.pyvista.org/version/stable/api/plotting/_autosummary/pyvista.Plotter.background_color.html

  • shape – The shape of the plot, i.e. how many subplots will be created - a tuple (y, x), for example (2, 2). They are accessed using pyvista.Plotter.subplot.

  • view_buttons – If buttons for quick navigation between camera and x-, y-, or z-direction view should be added to the plot

  • update_plot_callback – A plot update function that will be called every time the slider with simulation time is dragged in the plot windows, this can be used to dynamically apply changes to the plot, required syntax: def update_plot(plotter: pv.Plotter, mesh: pv.DataSet)

Returns:

Tuple containing the pyvista.Plotter and the pyvista.DataSet mesh object

get_result_file_path() str

Returns the path to the main result file (for example a ParaView *.pvd file) on disk containing the complete result data set. Its directory contains also further result data that can be useful.

Tip

The Python API of ParaView can be used to extract any kind of data from the result in a programmatic way. See here for more details: https://kitware.github.io/paraview-docs/latest/python/

Returns:

The path to the main result file

class tc_python.am.Automatic

Bases: FileSavingStrategy

An automatic saving strategy.

get_type() str

Returns the type of the file saving strategy.

Returns:

The type

set_max_number_of_files_stored(max_number: int = 1000000)

Sets the maximum number of files that are stored.

Default: unlimited

Parameters:

max_number – The maximum number of files that is stored

Returns:

This FileSavingStrategy object

set_saving_interval_strategy(saving_interval_strategy=AutomaticSavingIntervalStrategy.LINEAR)

Sets the saving interval strategy.

Default: A linear saving interval strategy.

Parameters:

saving_interval_strategy – The saving interval strategy

Returns:

This FileSavingStrategy object

store_unlimited_number_of_files()

Sets the maximum number of files that are stored to unlimited.

Returns:

This FileSavingStrategy object

class tc_python.am.AutomaticSavingIntervalStrategy(value)

Bases: Enum

The strategy for choosing the time interval for saving files in automatic mode.

EXPONENTIALLY_INCREASING = 2

An exponentially increasing time interval

LINEAR = 1

A linear time interval

class tc_python.am.BiDirectionalScanningStrategy

Bases: ScanningStrategy

A bidirectional scanning strategy (flipping scanning direction of the heat source between alternate tracks).

get_type() str

Returns the type of scanning strategy.

Returns:

The type

set_angle(angle: float = 0.0)

Sets the rotation of the scanning direction between two consecutive layers.

Note

The scanning direction of the first layer is always aligned parallel to the x-axis.

Default: 0 degree

Parameters:

angle – The angle [degree]

Returns:

This BiDirectionalScanningStrategy object

set_hatch_spacing(hatch_spacing: float = 0.0)

Sets the horizontal separation between two consecutive tracks.

Default: 0 m

Parameters:

hatch_spacing – The hatch spacing [m]

Returns:

This BiDirectionalScanningStrategy object

set_lift_time(lift_time: float = 0.0)

Sets the lift time, i.e. the time between two tracks where the heat source is inactive.

Default: 0 s

Parameters:

lift_time – The lift time [s]

Returns:

This BiDirectionalScanningStrategy object

set_margin(margin: float = 0.001)

Sets the margin.

This is the offset of the scanning path from the sides of the computational domain.

Default: 1.0e-3 [m]

Parameters:

margin – The margin [m]

Returns:

This BiDirectionalScanningStrategy object

set_number_of_layers(number_of_layers: int = 1)

Sets the number of layers.

Default: 1

Parameters:

number_of_layers – The number of layers

Returns:

This BiDirectionalScanningStrategy object

set_powder_fill_time(powder_fill_time: float = 0.0)

Sets the powder fill time.

Default: 0 s

Parameters:

powder_fill_time – The powder fill time [s]

Returns:

This BiDirectionalScanningStrategy object

class tc_python.am.CoarseMesh

Bases: Mesh

An initially coarse mesh.

Note

It is adaptive and will be automatically refined as required.

class tc_python.am.ConicalHeatSource

Bases: HeatSource

A conical heat source.

get_type() str

Returns the type of heat source.

Returns:

The type

set_absorptivity(absorptivity: float = 60.0)

Sets the absorptivity.

Default: 60%

Parameters:

absorptivity – The absorptivity [%]

Returns:

This ConicalHeatSource object

set_hi(hi_dim: float = 0.0001)

Sets the parameter Hi that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 100.0e-6 m

Parameters:

hi_dim – The Hi parameter [m]

Returns:

This ConicalHeatSource object

set_power(power: float = 120.0)

Sets the power of the heat source.

Default: 120 W

Parameters:

power – The power [W]

Returns:

This ConicalHeatSource object

set_re(re_dim: float = 0.0001)

Sets the parameter Re that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 100.0e-6 m

Parameters:

re_dim – The Re parameter [m]

Returns:

This ConicalHeatSource object

set_ri(ri_dim: float = 6e-05)

Sets the parameter Ri that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 60.0e-6 m

Parameters:

ri_dim – The Ri parameter [m]

Returns:

This ConicalHeatSource object

set_scanning_speed(beam_speed: float = 0.5)

Sets the moving velocity of the heat source.

Default: 500.0e-3 m/s

Parameters:

beam_speed – The beam speed [m/s]

Returns:

This ConicalHeatSource object

class tc_python.am.CustomMesh(minimum_element_size: float = 1e-05, maximum_element_size: float = 0.0001)

Bases: Mesh

An initial mesh with explicitly defined dimensions.

Note

It is adaptive and will be automatically refined as required.

Parameters:
  • minimum_element_size – The minimum element size [m]

  • maximum_element_size – The maximum element size [m]

tc_python.am.DEFAULT_CAMERA = {'focal_point': [0.0, 0.0, 0.0], 'position': [-2, -2, 1], 'viewup': [0, 0, 1]}

The default pyvista camera view.

class tc_python.am.DoubleEllipsoidalHeatSource

Bases: HeatSource

A double ellipsoidal heat source.

get_type() str

Returns the type of heat source.

Returns:

The type

set_absorptivity(absorptivity: float = 60.0)

Sets the absorptivity.

Default: 60%

Parameters:

absorptivity – The absorptivity [%]

Returns:

This DoubleEllipsoidalHeatSource object

set_af(af: float = 7e-05)

Sets the parameter Af that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 70.0e-6 m

Parameters:

af – The Af parameter [m]

Returns:

This DoubleEllipsoidalHeatSource object

set_ar(ar: float = 70.0)

Sets the parameter Ar that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 70.0e-6 m

Parameters:

ar – The Ar parameter [m]

Returns:

This DoubleEllipsoidalHeatSource object

set_b(b: float = 8.5e-05)

Sets the parameter B that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 85.0e-6 m

Parameters:

b – The B parameter [m]

Returns:

This DoubleEllipsoidalHeatSource object

set_c(c: float = 0.0002)

Sets the parameter C that defines the dimensions of the heat source.

Tip

See Thermo-Calc Online Help for details about this heat source model.

Default: 200.0e-6 m

Parameters:

c – The C parameter [m]

Returns:

This DoubleEllipsoidalHeatSource object

set_power(power: float = 120.0)

Sets the power of the heat source.

Default: 120 W

Parameters:

power – The power [W]

Returns:

This DoubleEllipsoidalHeatSource object

set_scanning_speed(beam_speed: float = 0.5)

Sets the moving velocity of the heat source.

Default: 500.0e-3 m/s

Parameters:

beam_speed – The beam speed [m/s]

Returns:

This DoubleEllipsoidalHeatSource object

class tc_python.am.EveryNthTimeStep

Bases: FileSavingStrategy

Saving at every n-th time step.

get_type() str

Returns the type of the file saving strategy.

Returns:

The type

set_n(n: int = 1)

Sets at which n-th time step files are saved.

Default: 1

Parameters:

n – The n-th time step where files are saved

Returns:

This FileSavingStrategy object

class tc_python.am.EveryTimeInterval

Bases: FileSavingStrategy

Saving after regular time intervals.

get_type() str

Returns the type of the file saving strategy.

Returns:

The type

set_time_interval(time_interval: float = 0.01)

Sets the time interval at which files are saved.

Default: 0.01 s

Parameters:

time_interval – The time interval [s]

Returns:

This FileSavingStrategy object

class tc_python.am.FileSavingStrategy

Bases: object

The strategy for how result files are saved on disk. Both the number and time point of saving can be controlled.

classmethod automatic()

An automatic saving strategy. This is the default.

classmethod every_n_th_time_step()

Saving at every n-th time step.

classmethod every_time_interval()

Saving after regular time intervals.

class tc_python.am.FineMesh

Bases: Mesh

An initially fine mesh.

Note

It is adaptive and will be automatically refined as required.

class tc_python.am.GaussianHeatSource

Bases: HeatSource

A Gaussian heat source.

disable_keyhole_model()

Disables using a keyhole model in the simulation.

Returns:

This GaussianHeatSource object

get_type() str

Returns the type of heat source.

Returns:

The type

set_absorptivity(absorptivity: float = 60.0)

Sets the absorptivity.

Default: 60%

Parameters:

absorptivity – The absorptivity [%]

Returns:

This GaussianHeatSource object

set_beam_radius(beam_radius: float = 0.00011)

Sets the beam radius.

Default: 110.0e-6 m

Parameters:

beam_radius – The beam radius [m]

Returns:

This GaussianHeatSource object

set_power(power: float = 120.0)

Sets the power of the heat source.

Default: 120 W

Parameters:

power – The power [W]

Returns:

This GaussianHeatSource object

set_scanning_speed(beam_speed: float = 0.5)

Sets the moving velocity of the heat source.

Default: 500.0e-3 m/s

Parameters:

beam_speed – The beam speed [m/s]

Returns:

This GaussianHeatSource object

with_keyhole_model(config: KeyholeModel)

Sets the keyhole model applied in the simulation.

Default: None

Parameters:

config – The keyhole model

Returns:

This GaussianHeatSource object

class tc_python.am.HeatSource

Bases: object

The heat source.

The heat source model has either a Gaussian, double ellipsoidal or conical distribution.

Default: A Gaussian heat source.

classmethod conical()

A conical heat source.

The default is a Gaussian heat source.

Returns:

A new ConicalHeatSource object

classmethod double_ellipsoidal()

A double ellipsoidal heat source.

The default is a Gaussian heat source.

Returns:

A new DoubleEllipsoidalHeatSource object

classmethod gaussian()

A Gaussian heat source.

This is the default.

Returns:

A new GaussianHeatSource object

classmethod get_calibrated_heatsource_names() List[str]

Returns a list of the names of the available calibrated heat sources.

The name can then be used with the function get_path_of_calibrated_heatsource().

Returns:

The list of names

classmethod get_path_of_calibrated_heatsource(optimized_heatsource_name: str) str

Returns the file path of the calibrated heat source.

Parameters:

optimized_heatsource_name – The name of the calibrated heat source

Returns:

The file path

class tc_python.am.KeyholeModel

Bases: object

A model for an “analytic” keyhole in the AM calculation.

set_rayleigh_length(rayleigh_length: float = 0.0025)

Sets the Rayleigh length.

Default: 2.5e-3 m

Parameters:

rayleigh_length – The Rayleigh length [m]

Returns:

This KeyholeModel object

class tc_python.am.LibraryMaterialProperties(library_name: str)

Bases: MaterialProperties

Material properties previously saved on disk using the specified library name.

class tc_python.am.MaterialProperties

Bases: object

The material properties used in the AM calculation, can be either from a Scheil calculation or from a previously stored library.

delete_library()

Deletes the material library from disk.

classmethod from_library(library_name: str)

Uses material properties previously saved on disk using a library name.

Parameters:

library_name – The library name

Returns:

A new LibraryMaterialProperties object

classmethod from_scheil_result(result: ScheilCalculationResult)

Creates material properties from the result of a Scheil calculation.

Parameters:

result – The Scheil result to create material properties from

Returns:

A new ScheilMaterialProperties object

classmethod get_all_library_names() List[str]

Returns a list with the names of all material libraries available on disk.

Returns:

A list with the names of all material libraries

get_average_material_property_in_range(material_property_enum: MaterialProperty, from_zone: Zone, to_zone: Zone) float

Returns average values for the specified material property in the specified zone interval.

Parameters:
  • material_property_enum – The material property

  • from_zone – The lower zone boundary

  • to_zone – The upper zone boundary

Returns:

The average value for the specified material property in the specified zone interval

get_evaporation_temperature() float

Returns the evaporation temperature for the material.

Returns:

The evaporation temperature [K]

get_liquidus_temperature() float

Returns the liquidus temperature for the material.

Returns:

The liquidus temperature [K]

get_name() str

Returns the name of the library.

Returns:

The name of the library

get_smoothed_values_for_material_property(material_property_enum: MaterialProperty) [List[float], List[float]]

Returns smoothed values for the specified material property.

Parameters:

material_property_enum – The material property

Returns:

The temperature [K] and the values of the specified material property

get_smoothing_for(material_property_enum: MaterialProperty) Smoothing

Returns the smoothing level for the specified material property.

Parameters:

material_property_enum – The material property to get smoothing level for

Returns:

The smoothing level for the specified material property

get_solidification_temperature() float

Returns the solidification temperature for the material.

Returns:

The solidification temperature [K]

rename_as_library(name: str)

Renames the material library.

Parameters:

name – The new name of the library

Returns:

This MaterialProperties object

save_as_library(name: str = '')

Saves the material library with the specified name to disk.

Default: Re-save the current object with the previously chosen name

Parameters:

name – The new name of the library

Returns:

This MaterialProperties object

save_library()

Saves the material library to disk.

Returns:

This MaterialProperties object

set_smoothing_for_all_properties(smoothing_enum: Smoothing)

Sets the smoothing level for all material properties.

Parameters:

smoothing_enum – The smoothing level

Returns:

This MaterialProperties object

set_smoothing_for_property(material_property_enum: MaterialProperty, smoothing_enum: Smoothing)

Sets the smoothing level for the specified material property.

Parameters:
  • material_property_enum – The specified material property

  • smoothing_enum – The smoothing level

Returns:

This MaterialProperties object

class tc_python.am.MaterialProperty(value)

Bases: Enum

A single material property used in the class MaterialProperties.

CP = 0

Apparent heat capacity [J/(kg K)]

DENSITY = 1

Density [kg/m3]

DRIVING_FORCE_EVAPORATION = 8

Driving force for evaporation [J/mol]

DYNAMIC_VISCOSITY = 4

Dynamic viscosity [Pa s]

ENTHALPY_PER_KG = 10

Enthalpy [J/kg]

ENTHALPY_PER_MOLE = 2

Enthalpy [J/mol]

EVAPORATION_ENTHALPY = 9

Evaporation enthalpy [J/mol]

MOLAR_MASS_OF_GAS = 7

Molar mass of Gas [kg/mol]

MOLAR_VOLUME = 6

Molar volume [m3/mol]

SURFACE_TENSION = 5

Surface tension [J/m2]

THERMAL_CONDUCTIVITY = 3

Thermal conductivity [W/(m K)]

class tc_python.am.MaterialType(value)

Bases: Enum

The material (solid, liquid, powder) to be plotted in a pyvista visualization plot.

LIQUID = 'Liquid'

Onl liquid material

POWDER = 'Powder'

Only powder

SHOW_ALL = 'All'

All material

SOLID = 'Solid'

Only solid material

SOLID_AND_LIQUID = 'Solid and liquid'

Only solid and liquid material

SOLID_AND_POWDER = 'Solid and powder'

Only solid material and powder

class tc_python.am.MediumMesh

Bases: Mesh

An initially medium mesh.

Note

It is adaptive and will be automatically refined as required.

class tc_python.am.Mesh

Bases: object

The initial mesh size in the simulation.

Can be coarse, medium, fine, or custom.

Note

It is adaptive and will be automatically refined as required.

classmethod coarse()

Selecting the mesh to be initially coarse.

Note

It is adaptive and will be automatically refined as required.

Returns:

A new CoarseMesh object

classmethod custom(minimum_element_size: float = 1e-05, maximum_element_size: float = 0.0001)

Selecting explicitly the initial mesh.

Default: Minimum element size: 10 um, maximum element size: 100 um

Note

It is adaptive and will be automatically refined as required.

Parameters:
  • minimum_element_size – The minimum element size [m]

  • maximum_element_size – The maximum element size [m]

Returns:

A new CustomMesh object

classmethod fine()

Selecting the mesh to be initially fine.

Note

It is adaptive and will be automatically refined as required.

Returns:

A new FineMesh object

classmethod medium()

Selecting the mesh to be initially medium.

Note

It is adaptive and will be automatically refined as required.

Returns:

A new MediumMesh object

class tc_python.am.NumericalOptions

Bases: object

The numerical options for an AM simulation.

disable_damping()

Disable numerical damping.

Default: disabled

Returns:

This NumericalOptions object

disable_petrov_galerkin()

Disables Streamline upwind Petrov-Galerkin (SUPG) for the numerical solver.

Default: enabled

Returns:

This NumericalOptions object

enable_petrov_galerkin()

Enables Streamline upwind Petrov-Galerkin (SUPG) for the numerical solver.

Default: enabled

Returns:

This NumericalOptions object

set_damping_factor(damping_factor: float = 0.0)

Sets the numerical damping factor.

Default: numerical damping is disabled

Parameters:

damping_factor – The numerical damping factor

Returns:

This NumericalOptions object

set_number_of_cores(num_cores: int)

Sets the number of used processor cores.

Default: Half of the available cores on the CPU, 2 cores on a 2-core CPU, and 1 core on a 1-core CPU.

Parameters:

num_cores – The number of used cores

Returns:

This NumericalOptions object

with_file_saving_strategy(file_saving_strategy: FileSavingStrategy)

Sets the strategy how result files are saved on disk. Both the number and time point of saving can be controlled.

Default: an automatic file saving strategy

Parameters:

file_saving_strategy – The file saving strategy

Returns:

This NumericalOptions object

class tc_python.am.ProbeCoordinate(x: float, y: float, z: float)

Bases: object

The coordinates of a probe. This is a point in the simulation domain whose properties can be obtained from the result object after the calculation using TransientResult.get_temperatures_at_probe().

class tc_python.am.Scalar(value)

Bases: Enum

A quantity to be plotted in a pyvista visualization plot.

MATERIAL_TYPE = 'subdomain_id'

Material type

MOLAR_VOLUME = 'molar_volume'

Molar volume

SURFACE_TENSION = 'gamma'

Surface tension

TEMPERATURE = 'temperature'

Temperature

THERMAL_CONDUCTIVITY = 'k'

Thermal conductivity

VOLUME_FRACTION_LIQUID = 'liquid_vfrac'

Volume fraction of liquid

class tc_python.am.ScanningStrategy

Bases: object

The scanning pattern of the heat source.

Single track, bidirectional (flipping scanning direction of the heat source between alternate tracks), or unidirectional (same scanning direction of the heat source for all tracks) are available.

classmethod bi_directional()

A bidirectional scanning strategy (flipping scanning direction of the heat source between alternate tracks).

Returns:

A new BiDirectionalScanningStrategy object

classmethod single_track()

A single track scanning strategy.

Returns:

A new SingleTrackScanningStrategy object

classmethod uni_directional()

A unidirectional scanning strategy (same scanning direction of the heat source for all tracks).

Returns:

A new UniDirectionalScanningStrategy object

class tc_python.am.ScheilMaterialProperties(scheil_result: ScheilCalculationResult)

Bases: MaterialProperties

Material properties created from the result of a Scheil calculation.

class tc_python.am.SingleTrackScanningStrategy

Bases: ScanningStrategy

A single track scanning strategy.

get_type() str

Returns the type of scanning strategy.

Returns:

The type

set_margin(margin: float = 0.001)

Sets the margin.

This is the offset of the scanning path from the sides of the computational domain. In case of single tracks, offset is placed from the sides transverse to the scanning direction.

Default: 1.0e-3 [m]

Parameters:

margin – The margin [m]

Returns:

This SingleTrackScanningStrategy object

set_number_of_layers(number_of_layers: int = 1)

Sets the number of layers.

Default: 1

Parameters:

number_of_layers – The number of layers

Returns:

This SingleTrackScanningStrategy object

set_powder_fill_time(powder_fill_time: float = 0.0)

Sets the powder fill time.

Default: 0 [s]

Parameters:

powder_fill_time – [s]

Returns:

This SingleTrackScanningStrategy object

class tc_python.am.Smoothing(value)

Bases: Enum

The smoothing level used in the class MaterialProperties.

CONSTANT = -200

Constant smoothing

LARGE = 600

Large smoothing

LINEAR = -100

Linear smoothing

LITTLE = 60

Little smoothing

MEDIUM = 150

Medium smoothing

NONE = 0

No smoothing

class tc_python.am.SteadyStateCalculation(calculation)

Bases: AdditiveManufacturingCalculation

A steady-state Additive Manufacturing calculation.

Note

This computes the temperature distribution in a steady-state environment, either on a bare metal substrate or with a powder layer on the top, with the possibility to add fluid flow inside the melt pool.

calculate(timeout_in_minutes: float = 0.0) SteadyStateResult

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

Returns:

A SteadyStateResult which later can be used to get specific values from the calculated result

class tc_python.am.SteadyStateResult(result)

Bases: AdditiveManufacturingResult

A result for a steady-state calculation.

get_heat_affected_zone_depth() float

Returns the depth of the heat affected zone.

Returns:

The depth of the heat affected zone [m]

get_heat_affected_zone_length() float

Returns the length of the heat affected zone.

Returns:

The heat affected zone length [m]

get_heat_affected_zone_width() float

Returns the width of the heat affected zone.

Returns:

The width of the heat affected zone [m]

get_keyhole_depth() float

The depth of the keyhole.

Returns:

The depth of the keyhole [m]

get_keyhole_length() float

The length of the keyhole.

Returns:

The length of the keyhole [m]

get_keyhole_width() float

The width of the keyhole.

Returns:

The width of the keyhole [m]

get_meltpool_depth() float

Returns the meltpool depth.

Returns:

The meltpool depth [m]

get_meltpool_length() float

Returns the meltpool length.

Returns:

The meltpool length [m]

get_meltpool_width() float

Returns the meltpool width.

Returns:

The meltpool width [m]

has_keyhole() bool

Returns if the result contains a keyhole.

Returns:

True if the result has a keyhole

class tc_python.am.TopBoundaryConditions

Bases: object

The top boundary conditions of the simulation.

disable_evaporation()

Disables the evaporation heat loss due to heating of the powder layer or the metallic surface when being close to the evaporation temperature.

Default: enabled

Returns:

This TopBoundaryConditions object

enable_evaporation()

Enables the evaporation heat loss due to heating of the powder layer or the metallic surface when being close to the evaporation temperature.

Default: enabled

Returns:

This TopBoundaryConditions object

set_convective_heat_coefficient(convective_heat_coefficient: float = 20.0)

Sets the convective heat transfer coefficient for the top surface to the surrounding gas.

Enter 0 to disable convective heat transfer.

Default: 20.0 W/m**2

Parameters:

convective_heat_coefficient – The convective heat transfer coefficient [W/m**2]

Returns:

This TopBoundaryConditions object

set_radiation_emissivity(radiation_emissivity: float = 0.8)

Sets the radiation from the top surface to the surrounding gas.

Enter 0 to disable radiation.

Default: 0.8

Parameters:

radiation_emissivity – The radiation emissivity, range: [0 - 1] [-]

Returns:

This TopBoundaryConditions object

class tc_python.am.TransientCalculation(calculation)

Bases: AdditiveManufacturingCalculation

A transient Additive Manufacturing calculation.

Note

This computes the temperature distribution in a transient case with the given scanning strategy including multiple paths and layers and the possibility to add fluid flow inside the melt pool.

add_probe(coordinate: ProbeCoordinate)

Adds a probe, this a point in the simulation domain whose properties can be obtained from the result after the calculation using TransientResult.get_temperatures_at_probe().

Parameters:

coordinate – The probe to be added

Returns:

This TransientCalculation object

calculate(timeout_in_minutes: float = 0.0) TransientResult

Runs the 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 TransientResult which later can be used to get specific values from the calculated result

remove_all_probes()

Removes all probes.

Returns:

This TransientCalculation object

remove_probe(coordinate: ProbeCoordinate)

Removes a probe.

Parameters:

coordinate – The coordinates of the probe to be removed

Returns:

This TransientCalculation object

set_length(length: float = 0.005)

Sets the length of the simulation domain.

Default: 5.0e-3 m :param length: The length [m] :return: This TransientCalculation object

set_width(width: float = 0.004)

Sets the width of the simulation domain.

Default: 4.0e-3 m

Parameters:

width – The width [m]

Returns:

This TransientCalculation object

with_scanning_strategy(scanning_strategy: ScanningStrategy)

Sets the scanning strategy of the heat source, i.e. beam.

Parameters:

scanning_strategy – The scanning strategy

Returns:

This TransientCalculation object

class tc_python.am.TransientResult(result)

Bases: AdditiveManufacturingResult

A result for transient calculations (also with steady-state heat source).

get_temperatures_at_probe(coordinate: ProbeCoordinate) Tuple[List[float], List[float]]

Obtains the temperature at a probe (i.e., a point in the simulation domain) that had previously been defined for the calculation using TransientCalculation.add_probe() or TransientWithSteadyStateCalculation.add_probe().

Parameters:

coordinate – The coordinates of the probe - must have been defined in the calculator previously

Returns:

A tuple (time points [s], temperatures [K])

class tc_python.am.TransientWithSteadyStateCalculation(transient_with_ss_calculation, ss_calculation)

Bases: AdditiveManufacturingCalculation

A transient Additive Manufacturing calculation using a heat source from steady-state.

Note

This computes the temperature distribution in a transient case with the given scanning strategy including multiple paths and layers.

  1. A steady-state simulation runs with the configured heat source and with the possibility to add fluid flow in the melt pool.

  2. A volume heat source (based on the solution of steady-state calculation) is used in the transient simulation.

Tip

This type of calculation is significantly faster than fully transient calculations using TransientCalculation.

add_probe(coordinate: ProbeCoordinate)

Adds a probe, this a point in the simulation domain whose properties can be obtained from the result after the calculation using TransientResult.get_temperatures_at_probe().

Parameters:

coordinate – The probe to be added

Returns:

This TransientWithSteadyStateCalculation object

calculate(timeout_in_minutes: float = 0.0) TransientResult

Runs the 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 TransientResult which later can be used to get specific values from the calculated result

disable_fluid_flow_marangoni()

Disables the fluid flow modelling of the Marangoni effect.

Default: Enabled

Returns:

This TransientWithSteadyStateCalculation object

disable_separate_materials()

Disables separate material properties for powder and solid material.

Default: Disabled

Returns:

This TransientWithSteadyStateCalculation object

enable_fluid_flow_marangoni()

Enables the fluid flow modelling of the Marangoni effect.

Default: Enabled

Note

This option is not possible to use in conjunction with the option separate material, which is therefore automatically disabled.

Returns:

This TransientWithSteadyStateCalculation object

enable_separate_materials()

Enables separate material properties for powder and solid material.

Default: Disabled

Note

This option is not possible to use in conjunction with the option Marangoni fluid flow, which is therefore automatically disabled.

Returns:

This TransientWithSteadyStateCalculation object

remove_all_probes()

Removes all probes.

Returns:

This TransientWithSteadyStateCalculation object

remove_probe(coordinate: ProbeCoordinate)

Removes a probe.

Parameters:

coordinate – The coordinates of the probe to be removed

Returns:

This TransientWithSteadyStateCalculation object

set_ambient_temperature(temperature: float = 296.15)

Sets the ambient temperature.

Default: 23 degree Celsius

Parameters:

temperature – The ambient temperature [K]

Returns:

This TransientWithSteadyStateCalculation object

set_base_plate_temperature(temperature: float = 303.15)

Sets the baseplate temperature.

Default: 30 degree Celsius

Parameters:

temperature – The baseplate temperature [K]

Returns:

This TransientWithSteadyStateCalculation object

set_gas_pressure(pressure: float = 100000.0)

Sets the gas pressure.

Default: 1.0e5 Pa

Parameters:

pressure – The pressure [Pa]

Returns:

This TransientWithSteadyStateCalculation object

set_height(height: float = 0.002)

Sets the height of the simulation domain.

Default: 2.0e-3 m

Parameters:

height – The height [m]

Returns:

This TransientWithSteadyStateCalculation object

set_layer_thickness(layer_thickness: float = 4e-05)

Sets the layer thickness.

Default: 40.0e-6 m

Parameters:

layer_thickness – The layer thickness [m]

Returns:

This TransientWithSteadyStateCalculation object

set_length(length: float = 0.005)

Sets the length of the simulation domain.

Default: 5.0e-3 m :param length: The length [m] :return: This TransientWithSteadyStateCalculation object

set_powder_density(powder_density: float = 80.0)

Sets the powder density.

Default: 80.0%

Parameters:

powder_density – The powder density [%]

Returns:

This TransientWithSteadyStateCalculation object

set_width(width: float = 0.004)

Sets the width of the simulation domain.

Default: 4.0e-3 m

Parameters:

width – The width [m]

Returns:

This TransientWithSteadyStateCalculation object

with_heat_source(heat_source: HeatSource)

Sets the heat source.

Parameters:

heat_source – The heat source

Returns:

This TransientWithSteadyStateCalculation object

with_material_properties(material_properties: MaterialProperties)

Sets the material properties.

Tip

Material properties can be defined like this: MaterialProperties.from_library("IN718") or MaterialProperties.from_scheil_result(scheil_result).

Parameters:

material_properties – The material properties

Returns:

This TransientWithSteadyStateCalculation object

with_mesh(mesh: Mesh)

Sets the mesh.

Parameters:

mesh – The mesh

Returns:

This TransientWithSteadyStateCalculation object

with_numerical_options(numerical_options: NumericalOptions)

Sets the numerical options.

Parameters:

numerical_options – The numerical options

Returns:

This TransientWithSteadyStateCalculation object

with_scanning_strategy(scanning_strategy: ScanningStrategy)

Sets the scanning strategy of the heat source, i.e. beam.

Parameters:

scanning_strategy – The scanning strategy

Returns:

This TransientWithSteadyStateCalculation object

with_top_boundary_conditions(boundary_conditions: TopBoundaryConditions)

Sets the boundary conditions.

Parameters:

boundary_conditions – The boundary conditions

Returns:

This TransientWithSteadyStateCalculation object

class tc_python.am.UniDirectionalScanningStrategy

Bases: ScanningStrategy

A unidirectional scanning strategy (same scanning direction of the heat source for all tracks).

get_type() str

Returns the type of scanning strategy.

Returns:

The type

set_angle(angle: float = 0.0)

Sets the rotation of the scanning direction between two consecutive layers.

Note

The scanning direction of the first layer is always aligned parallel to the x-axis.

Default: 0 degree

Parameters:

angle – The angle [degree]

Returns:

This UniDirectionalScanningStrategy object

set_hatch_spacing(hatch_spacing: float = 0.0)

Sets the horizontal separation between two consecutive tracks.

Default: 0 m

Parameters:

hatch_spacing – The hatch spacing [m]

Returns:

This UniDirectionalScanningStrategy object

set_lift_time(lift_time: float = 0.0)

Sets the lift time, i.e. the time between two tracks where the heat source is inactive.

Default: 0 s

Parameters:

lift_time – The lift time [s]

Returns:

This UniDirectionalScanningStrategy object

set_margin(margin: float = 0.001)

Sets the margin.

This is the offset of the scanning path from the sides of the computational domain.

Default: 1.0e-3 [m]

Parameters:

margin – The margin [m]

Returns:

This UniDirectionalScanningStrategy object

set_number_of_layers(number_of_layers: int = 1)

Sets the number of layers.

Default: 1

Parameters:

number_of_layers – The number of layers

Returns:

This UniDirectionalScanningStrategy object

set_powder_fill_time(powder_fill_time: float = 0.0)

Sets the powder fill time.

Default: 0 s

Parameters:

powder_fill_time – The powder fill time [s]

Returns:

This UniDirectionalScanningStrategy object

class tc_python.am.Zone(value)

Bases: Enum

Zones to be used in combination with keyhole model and material properties.

LIQUID = 2

Liquid zone

MUSHY = 1

Mushy zone

SOLID = 0

Solid zone

VAPOR = 3

Vapor zone