################################
Rotor 37 iso-speed line Tutorial
################################

.. py:currentmodule::  mola.workflow.rotating_component.turbomachinery

This tutorial follows the :ref:`Rotor 37 Tutorial`.

Like this one, it uses the example case :ref:`example-rotor37`. 
It performs stead RANS simulations on a whole iso-speed line.

Inputs are:

#. a mesh generated by Autogrid 5: `/stck/mola/data/open/mesh/rotor37/rotor37.cgns`. 
   For considerations about the input mesh, refer to :ref:`Rotor 37 Tutorial`

#. the script :download:`run_sator_isospeed_line.py <snippets/run_sator_isospeed_line.py>`



================================
Configure and launch computation
================================

The script :download:`run_sator_isospeed_line.py <snippets/run_sator_isospeed_line.py>`
is very similar to the one in the :ref:`Rotor 37 Tutorial`.
The instantiation of the Workflow (the block `w = turbomachinery.Workflow(...)`) is exactly 
the same. 
The only change is that the methods `prepare()`, `write_cfd_files()` and `submit()`
are now replaced by these lines:

.. literalinclude:: snippets/run_sator_isospeed_line.py
    :language: python
    :start-at: turbomachinery.WorkflowManager
    :end-at: submit()

You can observe that we first define a `turbomachinery.WorkflowManager`. 
It needs a base workflow (the one defined above in the script and called `w`),
and a root directory from where all simulation cases will be stored.

Then, the line:

.. literalinclude:: snippets/run_sator_isospeed_line.py
    :language: python
    :start-at: add_isospeed_line
    :end-at: add_isospeed_line

indicates that the outflow boundary condition of the base workflow will be 
modified to create several simulation cases along the iso-speed line of the rotor. 
The argument is a list (or a numpy array) of the values to use in the outflow boundary condition.
It corresponds to the expected value to change, depending on the type of the boundary condition.
In the present case, these values correspond to the parameter **ValveCoefficient**.

.. ======================
.. Monitor the simulation
.. ======================


.. =====================
.. End of the simulation
.. =====================


=====================
Visualize the results
=====================

To plot the performance on the whole iso-speed line, you can use these lines:

.. code:: python

    from mola.workflow.rotating_component import turbomachinery

    manager = turbomachinery.WorkflowManager('workflow_manager.cgns')
    perfo = manager.gather_performance('R37')
    manager.plot_isospeed_lines(perfo)
