Additive#

class ansys.additive.core.additive.Additive(channel: grpc.Channel | None = None, host: str | None = None, port: int = DEFAULT_ADDITIVE_SERVICE_PORT, nsims_per_server: int = 1, product_version: str = DEFAULT_PRODUCT_VERSION, log_level: str = '', log_file: str = '', enable_beta_features: bool = False, linux_install_path: os.PathLike | None = None)#

Provides the client interface to one or more Additive services.

Parameters:
channel: grpc.Channel, default: None

Server connection. If provided, it is assumed that the grpc.Channel object is connected to the server. Also, if provided, the host and port parameters are ignored.

host: str, default: None

Host name or IPv4 address of the server. This parameter is ignored if the server_channels or channel parameters is other than None.

port: int, default: 50052

Port number to use when connecting to the server.

nsims_per_server: int, default: 1

Number of simultaneous simulations to run on the server. Each simulation requires a license checkout. If a license is not available, the simulation fails.

product_version: str

Version of the Ansys product installation in the form "YYR", where YY is the two-digit year and R is the release number. For example, the release 2024 R1 would be specified as 241. This parameter is only applicable in PyPIM-enabled cloud environments and on localhost. Using an empty string or None uses the default product version.

log_level: str, default: “”

Minimum severity level of messages to log. Valid values are “DEBUG”, “INFO”, “WARNING”, “ERROR”, and “CRITICAL”. The default value equates to “WARNING”.

log_file: str, default: “”

File name to write log messages to.

enable_beta_features: bool, default: False

Flag indicating if beta features are enabled.

linux_install_path: os.PathLike, None, default: None

Path to the Ansys installation directory on Linux. This parameter is only required when Ansys has not been installed in the default location. Example: /usr/shared/ansys_inc. Note that the path should not include the product version.

Examples

Connect to a list of servers. Multiple connections to the same host are permitted.

>>> additive = Additive(server_connections=["localhost:50052", "localhost:50052", "myserver:50052"])

Connect to a single server using the host name and port number.

>>> additive = Additive(host="additive.ansys.com", port=12345)

Start and connect to a server on localhost or in a PyPIM-enabled cloud environment. Allow two simultaneous simulations on the server.

>>> additive = Additive(nsims_per_server=2)

Start a single server on localhost or in a PyPIM-enabled cloud environment. Use version 2024 R1 of the Ansys product installation.

>>> additive = Additive(product_version="241")

Overview#

about

Return information about the client and server.

apply_server_settings

Apply settings to each server.

list_server_settings

Get a dictionary of settings for the server.

simulate

Execute additive simulations.

simulate_async

Execute additive simulations asynchronously. This method does not block while the

materials_list

Get a list of material names used in additive simulations.

material

Get a material for use in an additive simulation.

add_material

Add a custom material to the library for use in additive simulations.

remove_material

Remove a material from the server.

tune_material

Tune a custom material for use with additive simulations.

tune_material_async

Tune a custom material for use with additive simulations asynchronously.

simulate_study

Run the simulations in a parametric study.

simulate_study_async

Run the simulations in a parametric study asynchronously.

download_server_logs

Download server logs to a specified directory.

enable_beta_features

Flag indicating if beta features are enabled.

connected

Return True if the client is connected to a server.

load_material

Load a custom material definition for the current session. The resulting

Import detail#

from ansys.additive.core.additive import Additive

Property detail#

property Additive.enable_beta_features: bool#

Flag indicating if beta features are enabled.

property Additive.connected: bool#

Return True if the client is connected to a server.

Attribute detail#

Additive.DEFAULT_ADDITIVE_SERVICE_PORT = 50052#

Method detail#

Additive.about() str#

Return information about the client and server.

Returns:
str

Information about the client and server.

Additive.apply_server_settings(settings: dict[str, str]) list[str]#

Apply settings to each server.

Current settings include: - NumConcurrentSims: number of concurrent simulations per server.

Parameters:
settings: dict[str, str]

Dictionary of settings to apply to the server.

Returns:
list[str]

List of messages from the server.

Additive.list_server_settings() dict[str, str]#

Get a dictionary of settings for the server.

Additive.simulate(inputs: ansys.additive.core.single_bead.SingleBeadInput | ansys.additive.core.porosity.PorosityInput | ansys.additive.core.microstructure.MicrostructureInput | ansys.additive.core.thermal_history.ThermalHistoryInput | ansys.additive.core.microstructure_3d.Microstructure3DInput | list, progress_handler: ansys.additive.core.progress_handler.IProgressHandler | None = None) ansys.additive.core.single_bead.SingleBeadSummary | ansys.additive.core.porosity.PorositySummary | ansys.additive.core.microstructure.MicrostructureSummary | ansys.additive.core.thermal_history.ThermalHistorySummary | ansys.additive.core.microstructure_3d.Microstructure3DSummary | ansys.additive.core.simulation.SimulationError | list#

Execute additive simulations.

Parameters:
inputs: SingleBeadInput, PorosityInput, MicrostructureInput, ThermalHistoryInput, Microstructure3DInput, list

Parameters to use for simulations. A list of inputs may be provided to run multiple simulations.

progress_handler: IProgressHandler, None, default: None

Handler for progress updates. If None, and inputs contains a single simulation input, a default progress handler will be assigned.

Returns:
SingleBeadSummary, PorositySummary, MicrostructureSummary, ThermalHistorySummary,
Microstructure3DSummary, SimulationError, list

One or more summaries of simulation results. If a list of inputs is provided, a list is returned.

Additive.simulate_async(inputs: ansys.additive.core.single_bead.SingleBeadInput | ansys.additive.core.porosity.PorosityInput | ansys.additive.core.microstructure.MicrostructureInput | ansys.additive.core.thermal_history.ThermalHistoryInput | ansys.additive.core.microstructure_3d.Microstructure3DInput | list, progress_handler: ansys.additive.core.progress_handler.IProgressHandler | None = None) ansys.additive.core.simulation_task_manager.SimulationTaskManager#

Execute additive simulations asynchronously. This method does not block while the simulations are running on the server. This class stores handles of type google.longrunning.Operation to the remote tasks that can be used to communicate with the server for status updates.

Parameters:
inputs: SingleBeadInput, PorosityInput, MicrostructureInput, ThermalHistoryInput, Microstructure3DInput, list

Parameters to use for simulations. A list of inputs may be provided to run multiple simulations.

progress_handler: IProgressHandler, None, default: None

Handler for progress updates. If None, and inputs contains a single simulation input, a default progress handler will be assigned.

Returns:
SimulationTaskManager

A SimulationTaskManager to handle all tasks sent to the server by this function call.

Additive.materials_list() list[str]#

Get a list of material names used in additive simulations.

Returns:
list[str]

Names of available additive materials.

Additive.material(name: str) ansys.additive.core.material.AdditiveMaterial#

Get a material for use in an additive simulation.

Parameters:
name: str

Name of material.

Returns:
AdditiveMaterial

Requested material definition.

static Additive.load_material(parameters_file: str, thermal_lookup_file: str, characteristic_width_lookup_file: str) ansys.additive.core.material.AdditiveMaterial#

Load a custom material definition for the current session. The resulting AdditiveMaterial object will not be saved to the library.

Parameters:
parameters_file: str

Name of the JSON file containing material parameters. For more information, see Create Material Configuration File (.json) in the Additive Manufacturing Beta Features documentation.

thermal_lookup_file: str

Name of the CSV file containing the lookup table for thermal dependent properties. For more information, see Create Material Lookup File (.csv) in the Additive Manufacturing Beta Features documentation.

characteristic_width_lookup_file: str

Name of the CSV file containing the lookup table for characteristic melt pool width. For more information, see Find Characteristic Width Values and Generate Characteristic Width File (.csv) in the Additive Manufacturing Beta Features documentation.

Returns:
AdditiveMaterial

A material definition for use in additive simulations.

Additive.add_material(parameters_file: str, thermal_lookup_file: str, characteristic_width_lookup_file: str) ansys.additive.core.material.AdditiveMaterial | None#

Add a custom material to the library for use in additive simulations.

Parameters:
parameters_file: str

Name of the JSON file containing material parameters. For more information, see Create Material Configuration File (.json) in the Additive Manufacturing Beta Features documentation.

thermal_lookup_file: str

Name of the CSV file containing the lookup table for temperature-dependent properties. For more information, see Create Material Lookup File (.csv) in the Additive Manufacturing Beta Features documentation.

characteristic_width_lookup_file: str

Name of the CSV file containing the lookup table for characteristic melt pool width. For more information, see Find Characteristic Width Values and Generate Characteristic Width File (.csv) in the Additive Manufacturing Beta Features documentation.

Returns:
AdditiveMaterial

A definition of the material that was added to the library.

Additive.remove_material(name: str)#

Remove a material from the server.

Parameters:
name: str

Name of the material to remove.

Additive.tune_material(input: ansys.additive.core.material_tuning.MaterialTuningInput, out_dir: str = USER_DATA_PATH, progress_handler: ansys.additive.core.progress_handler.IProgressHandler = None) ansys.additive.core.material_tuning.MaterialTuningSummary | None#

Tune a custom material for use with additive simulations.

This method performs the same function as the Material Tuning Tool described in Find Simulation Parameters to Match Simulation to Experiments. It is used for one step in the material tuning process. The other steps are described in Chapter 2: Material Tuning Tool (Beta) to Create User Defined Materials.

Parameters:
input: MaterialTuningInput

Input parameters for material tuning.

out_dir: str, default: USER_DATA_PATH

Folder path for output files.

progress_handler: IProgressHandler, None, default: None

Handler for progress updates. If None, no progress updates are provided.

Returns:
MaterialTuningSummary, None

Summary of material tuning or None if the tuning failed.

Additive.tune_material_async(input: ansys.additive.core.material_tuning.MaterialTuningInput, out_dir: str = USER_DATA_PATH) ansys.additive.core.simulation_task.SimulationTask#

Tune a custom material for use with additive simulations asynchronously.

This method performs the same function as the Material Tuning Tool described in Find Simulation Parameters to Match Simulation to Experiments. It is used for one step in the material tuning process. The other steps are described in Chapter 2: Material Tuning Tool (Beta) to Create User Defined Materials.

Parameters:
input: MaterialTuningInput

Input parameters for material tuning.

out_dir: str, default: USER_DATA_PATH

Folder path for output files.

Returns:
SimulationTask

An asynchronous simulation task.

Additive.simulate_study(study: ansys.additive.core.parametric_study.ParametricStudy, simulation_ids: list[str] | None = None, types: list[ansys.additive.core.simulation.SimulationType] | None = None, priority: int | None = None, iteration: int = None)#

Run the simulations in a parametric study.

Parameters:
studyParametricStudy

Parametric study to run.

simulation_idslist[str], default: None

List of simulation IDs to run. If this value is None, all simulations with a status of Pending are run.

typeslist[SimulationType], default: None

Type of simulations to run. If this value is None, all simulation types are run.

priorityint, default: None

Priority of simulations to run. If this value is None, all priorities are run.

iterationint, default: None

Iteration number of simulations to run. The default is None, all iterations are run.

progress_handlerIProgressHandler, None, default: None

Handler for progress updates. If None, a ParametricStudyProcessHandler will be used.

Additive.simulate_study_async(study: ansys.additive.core.parametric_study.ParametricStudy, simulation_ids: list[str] | None = None, types: list[ansys.additive.core.simulation.SimulationType] | None = None, priority: int | None = None, iteration: int = None, progress_handler: ansys.additive.core.progress_handler.IProgressHandler = None) ansys.additive.core.simulation_task_manager.SimulationTaskManager#

Run the simulations in a parametric study asynchronously.

Parameters:
studyParametricStudy

Parametric study to run.

simulation_idslist[str], default: None

List of simulation IDs to run. If this value is None, all simulations with a status of Pending are run.

typeslist[SimulationType], default: None

Type of simulations to run. If this value is None, all simulation types are run.

priorityint, default: None

Priority of simulations to run. If this value is None, all priorities are run.

iterationint, default: None

Iteration number of simulations to run. The default is None, all iterations are run.

progress_handlerIProgressHandler, None, default: None

Handler for progress updates.

Additive.download_server_logs(log_dir: str | os.PathLike) str#

Download server logs to a specified directory.

Parameters:
log_dirstr

Directory to save the logs to.

Returns:
str

Path to the downloaded logs.