# Rotating mesh CFD analysis

In many engineering applications it is important to simulate the flow around a rotating component. Typical applications are the simulation of flow around propellers, wind turbines or mixing vessels.

This tutorial shows the application of the rotating mesh CFD analysis to the simulation of a mixing vessel and the impact the impeller rotation has on the mixing of an external substance within a vessel.  The mesh rotation physically moves the rotating component and it is the most accurate (and most computationally expensive) way of simulating these kind of problems. The analysis has to be transient and during each time step the CFD simulation will converge to a solution.

We will simulate a mixing vessel with an inlet at the top, an outlet at the bottom and a rotating internal impeller. To visualise the mixing effect, a passive scalar will be injected from the inlet and the its concentration will be checked in the different configurations.

To properly capture the effect of the impeller rotation, a rotating mesh configuration will be used. This requires a transient simulation to simulate the physical motion of the impeller. Each step will be solved by SimWorks with several iterations and the solution is going to be used for the subsequent step.

The most important element of a transient simulation is to define the time step (see our guide about the Courant number to have the full background of this). If the step is too small the simulation will require too long to run, if it is too big, the simulation could lead to unphysical results and probably diverge quickly. As a guide for a rotating mesh CFD analysis we need to make sure that any point on the rotating mesh portion does not travel more than the local mesh size during a time step. See also the OpenFoam guide about rotating meshes.

\begin{gather} V_{tan} = \omega * R \end{gather}
\begin{gather} T_{step} = \frac{L_{mesh}}{V_{tan}} \end{gather}

We can calculate the V_tan which is tangential velocity by multiplying the rotational speed by the rotating mesh radius and then the minimum time step depends on the mesh size and the rotational speed of the mesh.

In our example since we have a rotational speed of 10 rad/s and a rotating mesh radius of 4.5m:

\begin{gather} V_{tan} = 10 * \frac{rad}{s} * 0.45m = 4.5 \frac{m}{s} \end{gather}
\begin{gather} T_{step} = \frac{0.05m}{4.5\frac{m}{s}} = 0.0125 s \end{gather}

The maximum time step would be 0.0125 sec, we will use 0.01 sec in our example

This is an advanced SimWorks tutorial, so if you are not yet fully confident with internal flow simulations with Simworks we would advice to complete the Pipe flow tutorial first.

## Setup the transient simulation with fixed impeller

Since the mesh rotation simulation requires a transient simulation, we will first carry out a transient simulation with a stationary impeller, that will give us a reference point to check the effect of the impeller rotation in the time evolution of the substance spreading in the tank.

Please download the geometry and activate the Transient simulation option with start time 0 and end time 2 sec, also define a time step 0 of 0.01 sec (see the above calculation for reference) and an output interval of 5 (every 5 time steps, so every 0.05 sec the solution will be written). Activate the Passive scalar option and finally increase the number of processes to 4 (or how many physical cores your machine has): As done in the pipe tutorial, you need to deactivate the Outer Domain. For the boundary conditions, set the Inlet with a Velocity Normal boundary condition of -5 m/s (the negative value comes from the fact that the normal to the inlet surface is negative, again refer to the Pipe flow tutorial for reference) and set a Pressure outlet of 0 Pa on the outlet.  For the Walls and Impeller, leave the default boundary conditions of no-slip wall. The base mesh size will be 0.1 m and the maximum surface and level refinments 2 to keep the mesh relatively coarse: Finally define 10 sections in X and Y and 20 sections in Z in the Output tab and 4 passive_scalar isosurfaces with values 0.05, 0.1, 0.25 and 0.5: Once the simulation has run you can see the evolution of the passive scalar isosurfaces with progressing time steps (display all the isosurfaces of passive scalar and select as displayed variable the passive scalar itself at time steps 0.2, 0.5, 1.0 and the last one 2.0):    ## Setup the rotating mesh

To create the simulation with the rotating mesh, you can simply right-click on the simulation just completed and select duplicate. Rename the simulation Mixing Vessel impeller rotating

Add a Coordinate system with unit vector 0 0 1 and 0 -1 0, this will be used to define the rotation axis of the mesh. Add a Volume as well, this function can be used to define rotating meshes, MRF zones and porous media.

Then define it as a Rotating mesh cylinder called ImpellerVolume, with rotation 0 0 90, mesh refinement max 2, size 0.45 0.95, position 0 0 -0.475, rotational speed and as Reference frame select the Coord System 1 defined at the beginning. Bear in mind that the rotational axis will be the Axis 1 (X axis) of the Coordinate System selected in the Reference frame, so make sure that the coordinate system X axis coincides with the required axis of rotation or the simulation will be incorrect and might crash. You can then run the simulation. This will take a while since every time step will require the simulation to converge.

Once completed, you can load the results in Fields and compare the same time steps (0.2, 0.5, 1.0 and 2.0) as the previous simulation.  The impeller now rotates as we progress with the simulation time and as a consequence the passive scalar is spreading much quicker in the vessel than in the case with a static impeller:    Try the free version of SimWorks or contact us to find out more