4. Python API ๐Ÿ#

The Flow360 Python API provides a powerful, user-friendly interface to configure, run, and analyze Computational Fluid Dynamics (CFD) simulations. Built with modern Python practices, the API leverages Pydantic models for robust configuration and validation, making it both flexible and reliable.

๐Ÿ“š First Steps

New to Flow360? Start here to learn the basics and set up your environment.

Getting Started
๐Ÿ”ฌ Basic Simulations

Run your first CFD simulations with step-by-step guides.

Basic Simulations
๐Ÿงช Advanced Use Cases

Explore complex setups, multiphysics coupling, and optimization workflows.

Advanced Simulations
๐Ÿ“Š Post-Processing

Extract insights from your simulation results with powerful analysis tools.

Post Processing
๐Ÿ”„ Workflow Management

Efficiently organize and manage multiple simulation campaigns.

Workflow Management
๐Ÿ“– API Reference

Comprehensive documentation of classes, methods, and parameters.

API Reference ๐Ÿ’ป

4.1. Installation and Setup#

Getting Started#

Before using Flow360, you need to:

  1. Sign up for a user account at flow360.simulation.cloud

  2. Obtain your API key from your account profile

  3. Install the Python package and configure your API key

Package Installation#

Install the latest stable version:

pip install -U flow360

To install a specific version of Python API, for example 24.11:

pip install "flow360==24.11.*"

For pre-release versions:

pip install -U flow360 --pre

To install a specific Github branch of Python API, for example develop branch:

pip install git+https://github.com/flexcompute/Flow360.git@develop

API Key Configuration#

Most of the functionalities (like uploading mesh and submitting case) of Flow360 Python API requires setting up proper API key for authentication. The API key can be obtained from the Flow360 WebUI by clicking on your avatar on the top right of your workspace then clicking on your Account then Python Authentication. Please contact customer support for more information.

../_images/api_key_getting.png

Fig. 4.1.1 Accessing your API key.#

To setup the API key authentication, you can use one of the following methods: Method 1: Global Configuration (Recommended)

In the command line. Run the following command.

flow360 configure --apikey XXX

This will prompt you to enter your API key and store it in ~/.flow360

Method 2: Configure in Python

import flow360 as fl
fl.configure(apikey='XXX')

Method 3: Environment Variable in Shell

In the command line. Run the following command.

export FLOW360_APIKEY="XXX"

Method 4: Environment Variable in Python

import os
os.environ["FLOW360_APIKEY"] = "XXX"
import flow360

Note

The FLOW360_APIKEY environment variable takes precedence over the configuration file.

Testing Your Installation#

To verify your installation is working correctly:

import flow360
print(flow360.__version__)  # Check installed version