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, thehost
andport
parameters are ignored.- host: str, default: None
Host name or IPv4 address of the server. This parameter is ignored if the
server_channels
orchannel
parameters is other thanNone
.- 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"
, whereYY
is the two-digit year andR
is the release number. For example, the release 2024 R1 would be specified as241
. This parameter is only applicable in PyPIM-enabled cloud environments and on localhost. Using an empty string orNone
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#
Return information about the client and server. |
|
Apply settings to each server. |
|
Get a dictionary of settings for the server. |
|
Execute additive simulations. |
|
Execute additive simulations asynchronously. This method does not block while the |
|
Get a list of material names used in additive simulations. |
|
Get a material for use in an additive simulation. |
|
Add a custom material to the library for use in additive simulations. |
|
Remove a material from the server. |
|
Tune a custom material for use with additive simulations. |
|
Tune a custom material for use with additive simulations asynchronously. |
|
Run the simulations in a parametric study. |
|
Run the simulations in a parametric study asynchronously. |
|
Download server logs to a specified directory. |
Flag indicating if beta features are enabled. |
|
Return True if the client is connected to a server. |
Load a custom material definition for the current session. The resulting |
Import detail#
from ansys.additive.core.additive import Additive
Property detail#
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.
- 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
, andinputs
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
, andinputs
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.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:
- study
ParametricStudy
Parametric study to run.
- simulation_ids
list
[str
], default:None
List of simulation IDs to run. If this value is
None
, all simulations with a status ofPending
are run.- types
list
[SimulationType
], default:None
Type of simulations to run. If this value is
None
, all simulation types are run.- priority
int
, default:None
Priority of simulations to run. If this value is
None
, all priorities are run.- iteration
int
, default:None
Iteration number of simulations to run. The default is
None
, all iterations are run.- progress_handler
IProgressHandler
,None
, default:None
Handler for progress updates. If
None
, aParametricStudyProcessHandler
will be used.
- study
- 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:
- study
ParametricStudy
Parametric study to run.
- simulation_ids
list
[str
], default:None
List of simulation IDs to run. If this value is
None
, all simulations with a status ofPending
are run.- types
list
[SimulationType
], default:None
Type of simulations to run. If this value is
None
, all simulation types are run.- priority
int
, default:None
Priority of simulations to run. If this value is
None
, all priorities are run.- iteration
int
, default:None
Iteration number of simulations to run. The default is
None
, all iterations are run.- progress_handler
IProgressHandler
,None
, default:None
Handler for progress updates.
- study