.. _python_API_dynamic:

.. currentmodule:: flow360

**************************
Dynamic Derivatives
**************************

This example demonstrates the computation of dynamic stability derivatives for an airfoil undergoing pitching oscillations.
It employs a sliding mesh approach, where the airfoil is enclosed within a rotating cylindrical interface.
The simulation strategy involves two stages: first, a steady-state simulation is performed to establish a baseline flow field,
followed by an unsteady simulation where the sliding interface oscillates according to a specified sinusoidal motion to capture the dynamic effects.
The script showcases the setup for both the steady initialization and the subsequent unsteady, oscillating simulation using the Flow360 Python API.

.. literalinclude:: ../../../../../../Flow360/examples/advanced_simulations/aerodynamics/dynamic_derivatives/dynamic_derivatives.py
  :language: python
  :linenos:

Notes
=====

- **Two-Stage Simulation:** A steady-state case initializes the flow field before the unsteady simulation begins, utilizing ``fork_from`` to inherit the flow field solution.
- **Sliding Interface Oscillation:** The pitching motion is modeled using a ``RotationCylinder`` sliding interface. Its angular position over time is defined via ``AngleExpression``, incorporating nondimensional time (``t``) and frequency.
