• GautierR
In summary: This individual is researching a numerical simulation code for solving 2D steatdy-state heat conduction problems (diffusion equation). He has read and followed two book references, which have led him to a penta-diagonal matrix to solve. The band corresponds to the coefficient at the west, east, north and south direction of the nodes.To solve the problem, he has implemented a number of different iterative algorithms, all of which converged with the same tolerance norm. The line-by-line TDMA algorithm was the fastest, while the direct (Matlab A \ B) algorithm was the slowest. However, if he sets up his sparse matrix correctly, the "A \ B" algorithm will solve
GautierR
TL;DR Summary
Trying to find an optimal way of solving a pentadiagonal matrix solver using a self-written solver or using the LAPACK library.
Hello,

I'm currently writing a numerical simulation code for solving 2D steatdy-state heat conduction problems (diffusion equation). After reading and following these two book references (Numerical Heat Transfer and Fluid Flow from Patankar and And Introduction to Computational Fluid Dynamics from Versteerd and Malalasekera), I ended up with a penta-diagonal matrix to solve (I'm not sure this is the right name for it). The band corresponds to the coefficient at the west, east, north and south direction of the nodes.

The discretized equation looks like :
ap * Tp = aw * Tw + ae * Te + an * Tn + as * Ts + Su
ap = aw + ae + as + an - Sp

The final version of this code will be written in Golang as it will be linked to an existing numerical code. I planning to write myself the solver or use the LAPACK library. But to do some trial and tests, I've first written it using Matlab.

Both books are proposing to solve the problem using a line-by-line method. Simply using the TDMA (Thomas algorithm) looping on each column then on each line until we reach convergence.

I've also implemented some other iterative algorithms (Gauss-seidel and Jacobi).

For the same tolerance norm(A*x-b) <= 1e-4, I obtain the following performances :

Number of elements - >16006400160000
Line-by-line TDMA1.05s13.25sx
Gauss-seidel87.57sxx
Jacobi226.9sxx
Direct (Matlab A \ B)0.004480s0.0209s0.65s

I am pretty sure I am obtaining bad results for the Gauss-seidel and Jacobi method because these algorithms can solve any problems with non-singular and non-zero diagonal A matrices, while I have a simple sparse matrix and I don't take advantages of this.

The line-by-line TDMA is much faster than the two other ones. However, if I set up correctly the sparse matrix in Matlab, the "A \ B" solve it much faster than any other solution. My question is then: How can I obtain similar performances using self-written solver or LAPACK library solver/tools ?

I'm looking for insight are advices not of proof of concept of the best solution =)

Thank you

## 1. What is a fast pentadiagonal matrix solver?

A fast pentadiagonal matrix solver is a computer algorithm that efficiently solves linear equations involving a pentadiagonal matrix, which is a special type of matrix with nonzero entries only on the main diagonal and the two diagonals above and below it.

## 2. How does a fast pentadiagonal matrix solver work?

A fast pentadiagonal matrix solver uses specialized techniques, such as the Thomas algorithm, to reduce the matrix into a simpler form and then solve for the unknown variables. This approach is more efficient than traditional methods for solving linear equations involving pentadiagonal matrices.

## 3. What are the advantages of using a fast pentadiagonal matrix solver?

The main advantage of a fast pentadiagonal matrix solver is its speed. Compared to traditional methods, it can solve equations involving pentadiagonal matrices much faster, making it useful for large-scale scientific and engineering calculations. It also requires less memory and is more stable than other methods.

## 4. Are there any limitations to using a fast pentadiagonal matrix solver?

One limitation of a fast pentadiagonal matrix solver is that it can only be used for equations involving pentadiagonal matrices. It is not suitable for other types of matrices, such as full or sparse matrices. It also may not work well for matrices with certain special properties, such as being symmetric or banded.

## 5. How is a fast pentadiagonal matrix solver used in scientific research?

A fast pentadiagonal matrix solver is used in a variety of scientific fields, including engineering, physics, and chemistry. It is commonly used to solve differential equations, which arise in many scientific problems, as well as in numerical simulations and optimization algorithms. Its speed and efficiency make it a valuable tool for solving complex equations in these fields.

• Quantum Physics
Replies
2
Views
1K
• Calculus and Beyond Homework Help
Replies
10
Views
4K
• Special and General Relativity
Replies
1
Views
1K
• Linear and Abstract Algebra
Replies
1
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
• General Math
Replies
12
Views
12K
• Engineering and Comp Sci Homework Help
Replies
1
Views
9K
• Calculus and Beyond Homework Help
Replies
1
Views
2K