PySimAI documentation#

Release v0.2.4 (Changelog)

PySimAI is part of the PyAnsys ecosystem that allows you to use SimAI within a Python environment of your choice in conjunction with other PyAnsys libraries and external Python libraries. With PySimAI, you can manage and access your data on the platform from within Python apps and scripts.

Requirements#

PySimAI requires Python 3.9 or later.

Installation#

Install PySimAI with this command:

pip install ansys-simai-core --upgrade

Use this same command every time you want to update PySimAI.

Getting started#

The SimAIClient class is the core of PySimAI. All operations are made through it.

from ansys.simai.core import SimAIClient

simai = SimAIClient()

You are prompted for your credentials.

Note

You can also start a SimAIClient instance from a configuration file. For more information, see Client configuration.

Once the SimAIClient class is started, you use the upload() method to load a geometry:

geometry = simai.geometries.upload(
    "/path-to-my-stl-file.stl",
    name="A name for my geometry",
    metadata={
        "geom_property_1": "A",
        "geom_property_2": 1.2,
    },
)

To learn more about what geometries are and how they should be formatted, see Geometries.

You use the run_predictions() method to run a prediction on the geometry:

prediction = geometry.run_prediction(boundary_conditions=dict(Vx=10.0))

The PredictionPostProcessing class provides for postprocessing and analzing your prediction data.

You use the post attribute of the prediction to run the postprocessing and access its data:

# Run postprocessing
global_coefficients = prediction.post.global_coefficients()
# Access its data
print(global_coefficients.data)

Note

Depending on the postprocessing, the data attribute returns either a dictionary or a DownloadableResult object.

For more information, see Postprocessings.

You’re all set. You can now learn about more advanced concepts, such as starting the SimAI client from a configuration file, exploring your data, and best practices.

To explore the functions and methods available to you, see API reference.