# Difference between revisions of "Inline oscillating cylinder by Michael Alletto"

Go back to Collection by authors.

Go back to Meshing.

# Inline oscillating cylinder

## Introduction

In this tutorial we will examine the inline oscillatory motion of a cylinder in a uniform flow. Inline means that the cylinder is oscillating parallel to the incoming flow. This kind of configuration is often used to validate solvers aiming to simulate large body motions (see e.g. [1, 4, 5]). The reason is that that despite its simplicity this configuration is associated with a variety of complex physical phenomena.

One of this phenomena are frequency lock in: When the frequency of the oscillating cylinder is close to twice the shedding frequency of the stationary cylinder fst, the frequency of the vortices shed became equal to the one of the cylinder. The amplitude of the cylinder motion which is required to maintain the lock in regime is increasing with departure from twice the shedding frequency of a fixed cylinder .

Another interesting phenomena is the increase of the lift coefficient Cl when the cylinder is oscillating at 2fst . For frequencies which are either lower or higher than 2fst Cl is much lower .  made simulations with an in line oscillating cylinder at a Reynolds number of Re = 175. For this Re number the ow around a fixed cylinder is two dimensional. For an oscillation frequency fc of 2fst and an amplitude of 65% of the cylinder diameter the frequency spectrum of the lift force increases considerably. For lower amplitudes of the oscillation only a few peaks are present in the frequency spectrum. In order to simulate this kind of flow configurations, OpenFOAM offers two different approaches: the overset methodology and the morphing mesh method. The latter can be used if the cylinder motion is not too large to deteriorate the mesh quality. Regarding the overset method we have one or more meshes which displace relative to a background mesh. The coupling between the moving meshes and the background mesh is achieved via interpolation of the ow quantities. Regarding the morphing mesh, the connectivity between the cells remain unchanged.However the position of the points building a cell can move relative to each other.

Since both methods described above can be used to simulate the flow of an inline oscillating cylinder, both methods can be compared against each other besides the validation against experiments and other simulations. The comparison of this two methods and the validation against experiments is the purpose of this tutorial.

## Set up

The figure below shows the setup of the simulation: At the inflow a uniform velocity of Uinf = 1 m/s in x-direction is applied. The pressure is set to zero gradient at this boundary. At the top and bottom walls a slip boundary condition is applied. At the outlet the pressure is to be set equal to zero and for the velocity a zero gradient boundary condition is applied. The kinematic viscosity ν = 0.01 m^2/s is set in order that the Reynolds number Re = Uinf D / ν based on the cylinder diameter D = 1 m is equal to Re = 100. For this Reynolds number the flow over a stationary cylinder is two dimensional. For this reason the flow is assumed to be two dimensional. This is imposed by using only one cell in span wise direction and setting both boundary conditions in this direction to the type empty. At the cylinder wall a no slip boundary condition is applied for the velocity and zero gradient for the pressure. The cylinder oscillates in x-direction with a prescribed sinosoidal motion: xc = A sin(2π fc t) = A sin (ω t). Four different frequencies are computed: fc = 0, 0.16, 0.33, 0.66 s^(-1). The amplitude is set to A = 0.14m. The purpose of this tutorial was to check whether the increase of the lift at fc = 2fst can be captured and if both techniques to simulate moving bodies deliver comparable results.

## Mesh generation

The mesh used for the overset mesh simulation is shown in the figure below. We can see that it is formed by the mesh surrounding the cylinder and the background mesh. The mesh surrounding the cylinder is generated by simply stretching the circular form of the cylinder outward. The background mesh consist of a rectangular block mesh with different refinement zones. In the outer part of the rectangle where the gradients of the flow field are smaller, a coarser mesh is used. Closer to the region surrounding the cylinder the mesh is finer. Note that when generating an overset mesh, it has to be paid attention that the cells at the intersection of the moving and the background mesh should have roughly the same size to minimize the interpolation errors.

The figure below shows the morphing mesh. It is generated using the utility blockMesh. Note that the dictionary for the generation of the mesh was taken from here and slightly modified in order to adept it to the present test case. It is evident that the constitution of the mesh is much more complex compared to the overset mesh. The number of cells of both meshes are similar: roughly 10 000 for the overset mesh and roughly 12 000 for the morphing mesh.

## Simulation set up

Since the procedure how to set up a overset mesh is described in other tutorials, here we will concentrate on the difference on how to describe the body motion between the overset mesh and the morphing mesh.

Regarding the overset mesh the solid body motion has to be prescribed in the constant/dynamicMeshDict:

```motionSolverLibs ( "libfvMotionSolvers.so" );
solver          displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity     uniform 1;
}
dynamicFvMesh       dynamicOversetFvMesh;
dynamicOversetFvMeshCoeffs
{
//    layerRelax 0.3;
}
solver          multiSolidBodyMotionSolver;
multiSolidBodyMotionSolverCoeffs
{
movingzone
{
solidBodyMotionFunction oscillatingLinearMotion;
oscillatingLinearMotionCoeffs
{
amplitude ( -0.14 0 0);
omega 1.04;
}
}
}

```

The type of motion and the mesh zone which has to perform this prescribed motion has to be specified. In our case the mesh zone named movingzone has to describe an oscillatory motion in x-direction with an amplitude of A = 0.14 m and a frequency of ω = 1.04 rad/s.

Regarding the morphing mesh, the displacement is described via the boundary condition of the field pointDisplacement:

```
dimensions      [0 1 0 0 0 0 0];
internalField   uniform (0 0 0);
boundaryField
{
topAndBottom
{
type            uniformFixedValue;
uniformValue    (0 0 0);
}
inlet
{
type            uniformFixedValue;
uniformValue    (0 0 0);
}
outlet
{
type            uniformFixedValue;
uniformValue    (0 0 0);
}
cylinder
{
type            oscillatingDisplacement;
amplitude       ( -0.14 0 0 );
omega           1.04;
value           uniform (0 0 0);
}
frontAndBack
{
type            empty;
}
}

```

We see that the in this case the displacement of the cylinder is imposed by specifying the type of motion the boundary patch named cylinder has to perform. All other boundary patches do not move and hence the value of the field pointDisplacement is set to uniform (0 0 0).

The method used to relax the cylinder movement towards the fixed outer boundary is specified in the constant/dynamicMeshDict:

```
dynamicFvMesh   dynamicMotionSolverFvMesh;
motionSolverLibs ( "libfvMotionSolvers.so" );
solver          displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity  inverseDistance 1(cylinder);
}

```

## Results

The table below shows the comparison between the present simulations and reference simulation and experiments for a fixed cylinder. The variables which are compared are the Strouhal number, the mean drag coefficient Cd,mean and the maximum lift coefficient Cl,max. The Strouhal number is computed by analyzing the signal of the lift (force in z-direction). Since the purpose of this tutorial is to evaluate the capability of OpenFOAM to simulate an oscillating cylinder, the first necessary step is to check the quality of the simulations for a fixed cylinder. It is evident that the agreement is reasonable. The results of the overset mesh and the mesh generated with blockMesh are very close. This means that the overset interpolation does not deteriorate the quality of the results for this case. The results shown are computed with a python script which analyzes the forces computed around the cylinder. Of course the python script is also provided within the downloadable files.

The next table below shows the comparison of the mean drag coefficient Cd,mean and the maximum lift coefficient Cl,max with other simulation (sim) for different oscillation frequencies fc. For the present simulations also the Strouhal number computed with the frequency of the lift signal with the maximum power is shown. It can see seen that both mean drag coefficient Cd,mean and the maximum lift coefficient Cl,max have a maximum at a frequency twice the shedding frequency of a fixed cylinder fc = 2 fst. The difference between the morphing mesh and the overset mesh are marginal and the agreement with the reference simulations are reasonable. All simulation (the one of this tutorials and also the reference simulations) report an almost tripling of the lift coefficient with respect to the stationary cylinder (see table above). The Strouhal number computed with the frequency with the maximum power of the lift signal remains unchanged when the oscillation frequency fc is increased.

The figure below shows the comparison of the temporal evolution of drag coefficient in the last 20 s of the simulation. It is evident that for increasing frequency fc the amplitude of the drag coefficient increases since the velocity at which the cylinder is displacing through the fluid increases. The results of the morphing mesh and the overset mesh are very close.

The figure below shows the comparison of the temporal evolution of lift coefficient. It is obvious that for a frequency of fc = 2 fst the amplitude of the lift coefficient is highest. Again the results of the morphing mesh and the overset mesh are very similar.

The figure below shows the power spectrum of the lift for the four oscillation frequencies fc analyzed and both mesh types. The results of both mesh types are again very similar. The amount of peaks increase with increasing fc.

A final remark should be made regarding the computational time. For the fixed cylinder and the case with a oscillation frequency fc = 0.16, the simulations with the morphing mesh are much faster. For increasing frequency however, the maximum Courant number Comax had to be decreased from 0.75 for fc = 0.16 to Comax = 0.5 for fc = 0.3 and Comax = 0.25 for fc = 0.66 for the morphing mesh. The purpose was to avoid nonphysical pressure peaks which occurred for higher Comax. For this reason the simulation time for the cases with the highest frequency was comparable between both mesh types. For the overset mesh the maximum Courant number Comax = 0.75 was the same for all frequencies.