1D Finite Volume diffusion equation with second order accurate scheme and TDMA solver
( Solver created in PYTHON)
1D Finite Volume diffusion equation with second order accurate scheme and TDMA solver
( Solver created in PYTHON)
The Finite Volume method is one of the most common discretization methods used in most of the commercial CFD solvers. In this work, a 1D heat diffusion equation solver is created using Finite Volume discretization method with TDMA algebraic equation solver. The solver was created in Python. The solver was validated with a 1D heat conduction problem.
Skills and knowledge: CFD, Finite Volume method, Numerical methods, Heat transfer
Software and program used: Python (NumPy package)
Project: 1D diffusion equation using Finite Volume method
Introduction :
The Finite Volume method calculates the transport field variables at the cell centroid of the grid elements generated to discretize the domain of study. The transport equations (transport of velocity, temperature etc) are PDE equations which are hard to solve directly. This necessitates the development of numerical methods like Finite Volume and Finite Difference methods etc. The advantage of Finite Volume method is that the conservation is inherently satisfied. It also assumes that the field variables vary linearly across each cell in the grid.
The Finite Volume method depends on the Gauss divergence theorem to convert the volume integrals to surface integrals. The synonymous nature of integration and addition is used for converting the surface integrals to summation of the variables across the cell faces. Finally, the complex PDEs describing the physics would be converted to a set of algebraic equations, which would be solved using suitable numerical algebraic solvers.
Objective :
1. To use Finite Volume method for solving the 1D diffusion equations.
2. To use the Tri-Diagonal Matrix Algorithm (TDMA) for solving the algebraic equations.
3. Validation of the solver using 1D heat conduction problem.
Governing equation and nature of PDE:
Steady 1D diffusion equation with source term
Nature of PDE: Elliptic PDE
Transport variable considered: Temperature.
Face interpolation scheme:
Central differencing (Linear face interpolation) scheme was used for the face interpolation of field variables.
Accuracy of the scheme: 2nd order accurate.
Numerical methods to solve algebraic equations:
In this study, two methods were compared
1. Gauss - Seidel method
2. TDMA method
The Gauss- Seidel method is an iterative method for solving algebraic equations.
The TDMA method is a direct method for solving algebraic equations. The TDMA solver is much faster than the iterative GS solver especially for system of equations which form sparse diagonally dominant tri-diagonal coefficient matrix.
The TDMA solver has two steps 1. Forward elimination 2. Back substitution, after which the solution will be available. But it is not a viable solver for 2D and 3D analysis. The TDMA method when used for the 1D equations has a time complexity of O(n) (linear complexity) which is very efficient compared to other methods.
Validation of 1D heat conduction problem:
A steady heat conduction through a metallic bar is considered.
Metal bar length: 5m, cross- section A= 0.1 m2, conductivity K: 100 W/m K, no .of cells considered (adjustable) : 5
Boundary conditions: Dirichlet boundary conditions were used.
Left end : 100 (deg Celsius) , Right end: 200 (deg Celsius) , Heat source within the bar: 1000 W/m3
Iterations: 100
Initial condition (Initial temperature): 0 (deg Celsius)
The temperature distribution in the bar was obtained.
Validation results:
The temperature distribution obtained from the solver was found to be in good agreement with the analytical solutions.
The run time for the TDMA method was found to be shorter than the GS method for solving algebraic equations as expected.
The coefficient values, tri-diagonal matrix, the code for Gauss- Seidel and TDMA with the temperature profile plot are shown below.