Wednesday, March 27, 2013



Numerical Accuracy in CFD

Numerical accuracy is of prime importance when one is playing with numbers especially in CFD. In CFD the naive understanding of numerical accuracy has to be shed off. It pertains to the scheme, grid, the problem involved, and many other factors. However, I will try to portray some of the predominant  ones. The sources of numerical accuracy are;

1. Numerical scheme
  • Discretisation - order of accuracy of the convective terms, minimal amount of artificial viscosity
  • Tunable parameters - like co-effcients in JST scheme and in turbulence models
  • Boundary conditions - especially pressure based
  • Temporal accuracy

2. Grid - Mesh dependency

3. Convergence

  • Linear Solvers used - for implicit or multi-grid or multi-stepping schemes
  • Stopping criterion for iterative solvers - tolerance, pre-conditioning, etc
4. Validation / Verification - proper choice of analytical, benchmark & experimental test cases with the above requirements for specific class of problems that you are dealing with


CFD developers and application engineers likewise should be able to demonstrate the above before going ahead with simulating the class of problems. When using an industrial CFD solver ( which in most cases guarantees the above criteria), it is good practice to understand or play around to get the above criterion. 


Thursday, March 21, 2013




Free On-line Books


Ok side tracking somewhat from CFD this time.

I stumbled upon these few websites for good information, which is open-source and free of course !
I know only a few but would like to increase the list. Much to learn, much to know about.

Would like to know more links from you all.

Indian Regional Language Books 
http://www.dli.ernet.in/


Arxiv  [ arxiv.org
Open access to e-prints in Physics, Mathematics, Computer Science, Quantitative Biology, Quantitative Finance and Statistics

Archive 
http://www.archive.org/

Project Gutenburg & Associates
Check this wiki link for more online resources where you can find good books

LibriVox
Open source books in audio format

Open Content Alliance
http://www.opencontentalliance.org/

Wiki Source
wikisource.org

Directory of Open Access Books

Finally a wiki list of the websites

Friday, March 15, 2013




Sparse Matrices (Basics)


This post is my personal experience with sparse matrices and is not extensive as is my knowledge about them. I would like to go through these as follows steps / directions.

1. What is a sparse matrix ?
A matrix having many zero elements or block elements (a matrix consisting of smaller matrices of size m-by-m, can be zero as well) .

Example of sparse matrix (Wikipedia)
    1   2  3  4  5  6  7  
1  [ 11 22  0  0  0  0  0 ]
2  [  0 33 44  0  0  0  0 ]
3  [  0  0 55 66 77  0  0 ]
4  [  0  0  0  0  0 88  0 ]
5  [  0  0  0  0  0  0 99 ]




2. Why do we need a "sparse " matrix ?
As shown in the example above when handling the sparse matrices there is no need to store the zero-elements. Say, using an addition / multiplication on these full matrices does not have an effect with the zero element. Hence, the matrix can be compressed i.e. storing only the non-zero elements. This would save a lot of memory and floating point operation count. The bold numbers show the row and column indices respectively.

3. What is a sparse matrix format ?
The format mentioned is a "way" of storing the non-zero elements. Foe example, we can store the above example as (using 1-indexing, row-major)

Example of sparse matrix format

Values =  [ 11 22  33 44  55 66 77  88 99 ]
Rows =    [ 1   1   2  2  3  3  3   4  5  ]
Cols =    [ 1   2   2  3  3  4  5   6  7  ]

The above format is known as COO (short for Co-ordinate format). There are many such formats available [ http://web.eecs.utk.edu/~dongarra/etemplates/node372.html ]

4. Sparse matrices applied in CFD, where do they come in ?
Sparse matrices come into picture in incompressible solvers (poisson solvers), compressible (implicit solvers), Multi-grid acceleration techniques etc in FDM, FVM, FEM based solvers. The sparsity pattern comes from the stencil and the grid itself. 

5. Some useful ways to work them out
It is always good to start with a very small matrix (i.e. grid) when starting and noting the matrix structure. It is also good practice to test out from a hand-generated mapping (grid) the sparse matrix and then working on it to understand your format of choice for doing matrix operations.

6. Some useful utility codes
It is always good to use the available sparse matrix format converters and libraries that work on sparse matrices to avoid unnecessary bugs in your code. There are many such available converters, (the libraries are presented in different posts);



Thursday, March 7, 2013




CFD on a golf ball





A Vortex Tied in Knots


Another landmark in the field of turbulence. 



Subscribe to RSS Feed Follow me on Twitter!