.. _python_API_2d_cylinder:

.. currentmodule:: flow360

**************************
Unsteady 2D Cylinder
**************************

This example demonstrates the configuration and execution of an unsteady simulation for laminar flow over a 2D cylinder using the Flow360 Python API. The script utilizes the ``operating_condition_from_mach_reynolds`` helper function to define the flow conditions based on specified Mach and Reynolds numbers. It sets up appropriate boundary conditions, including no-slip walls, freestream boundaries, and slip walls for periodic boundaries, and configures unsteady time stepping parameters.

.. literalinclude:: ../../../../../Flow360/examples/basic_simulations/unsteady/unsteady_2D_cylinder.py
  :language: python
  :linenos:

Notes
====

- The ``operating_condition_from_mach_reynolds`` function simplifies setting flow conditions based on Reynolds and Mach numbers, automatically calculating necessary parameters like velocity and density based on the chosen length unit.
- Unsteady simulations are configured using the ``fl.Unsteady`` class within the ``time_stepping`` parameter, and specifying physical time step size (``step_size``), total number of physical steps (``steps``), and maximum inner iterations per physical step (``max_pseudo_steps``).
- Note the use of ``fl.NoneSolver()`` for the ``turbulence_model_solver``, indicating a laminar simulation appropriate for the low Reynolds number (Re=50) used here.
