.. _python_API_quick_start:

.. currentmodule:: flow360

**************************
Quick Start
**************************

This guide provides a fundamental illustration of the Flow360 Python API workflow, commencing with geometry definition and proceeding through simulation setup, execution, and basic results visualization. The example script demonstrates a streamlined process suitable for initiating straightforward CFD analyses.

The script executes the following sequential steps:

1.  **Project Initialization**: Creates a new Flow360 project from a predefined geometry file.
2.  **Geometry Inspection**: Displays available geometric groupings to aid in boundary condition assignment.
3.  **Face Grouping**: Organizes geometry faces based on tags, facilitating the definition of ``Surface`` objects.
4.  **Simulation Parameter Definition**: Configures the simulation settings within the SI unit system context, including meshing parameters, operating conditions, numerical schemes, physical models, and output specifications. It utilizes an ``AutomatedFarfield`` component for simplified boundary setup.
5.  **Simulation Execution**: Submits the defined simulation case for execution.
6.  **Results Retrieval and Visualization**: Waits for simulation completion, retrieves key aerodynamic coefficients (CL, CD), and generates a basic plot of their convergence history.

The complete script is presented below:

.. literalinclude:: ../../../../Flow360/examples/getting_started/quick_start.py
  :language: python
  :linenos:

Notes
====

-   Utilize the ``AutomatedFarfield`` component for streamlined setup of farfield boundary conditions.
-   Ensure physical quantities are defined within the ``with fl.SI_unit_system:`` or other context manager for correct unit handling. Specify units explicitly where needed using ``fl.u`` (e.g., ``alpha=5 * fl.u.deg``).
-   Access simulation outputs and results data through the ``case.results`` attribute (e.g., ``case.results.total_forces``) for post-processing and analysis.
