Main ContribExamples/TaylorGreenVortex

From OpenFOAMWiki

1 Short description

This tutorial solves the Taylor Green Vortex Case.

The case is used to validate the temporal accuracy of the Euler and Crank-Nicolson schemes and spatial accuracy of the central difference scheme.

2 Introduction

This presents an accuracy study on the OpenFOAM framework by using the Taylor Green Vortex case which has an analytical solution. The numerical solution of the Navier-Stokes is subject to errors due to the time and spatial discretizations. The analytical equation for the velocity may be expressed as a function of the numerical solution

U = U(\Delta x, \Delta y, \Delta t) + O({\Delta t}^a) + O({\Delta x}^b) + O({\Delta y}^b)

were U is velocity, \Delta t is the time step, \Delta x is the grid size in the x direction and \Delta y is the grid size in the y direction, and a and b are the order of the discretization errors. The error of the numerical solution may be calculated by subtracting the numerical solution from the analytical solution.


E=U-U(\Delta x, \Delta y, \Delta t)= c{\Delta t}^a + d{\Delta x}^b + d{\Delta y}^b

Defining a constant value of f=\frac{{\Delta t}^a}{{\Delta x}^b} and making \Delta x = \Delta y the equation can be rearranged to


E= (c f + 2 d){\Delta x}^b.

Taking the logarithm on both sides of the equation and defining h=(c f + 2 d)


log(E)= h + log({\Delta x}) b.

The same can be done in order to obtain the error as a function of time-step


log(E)= h + log({\Delta t}) a.

3 Analytical Solution

The analytical solution gives velocity in the x and y components and the pressure.


u_1=-cos(x) sin(y) e^{-2t}


u_2=sin(x) cos(y) e^{-2t}


p= -\frac{1}{4}(cos(2x)+cos(2y))e^{-4t}

4 Parameters

The computational period was 2\pi in the x and y directions. The first case simulations were run by letting \Delta x = \Delta y and fixing \frac{\Delta t}{{\Delta x}^2} = \frac{0.64}{\pi^2}. The second case simulations were run by fixing \frac{{\Delta t}^2}{{\Delta x}^2} = \frac{0.008}{\pi^2} This allows the time and spatial discretization errors to be studied independently. Different time-steps were chosen with a final time of 0.34 seconds which is close to the half life of the decaying vortex. The error was calculated by extracting the numerical solution from the analytical solution.

5 Files

File:TaylorGreenVortexSolver.tar.gz File:TaylorGreenVortex.tar.gz