CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   unstructured mesh solver (https://www.cfd-online.com/Forums/main/71587-unstructured-mesh-solver.html)

los January 8, 2010 11:07

unstructured mesh solver
 
Hello everybody,

Does any one know were can i find something about how to program an unstructured solver?

I had some ideas, but they are not really efficient... When you have a structured mesh/multiblock you can just use the index of each volume, but in a unstructured mesh how can you index it?

I already had a look at fluent's documentation and it just talks about topology of the volume and stuff like this, anyway if I build a connectivity matrix about which face belongs to which volume how can I program it to "scan" all the fluid volumes in the most efficient way and how to be sure it will not pass through a volume two times?

Thank you,

los

DoHander January 8, 2010 17:57

First you should create an edge/face data structure, this way you will pass only once through a face.

Any unstructured grid generator will give you the connectivity matrix but the list of edges/faces you must construct this from the given data. A good introduction is the book of Blazeck.

You can use Gambit to generate your mesh and save the connectivity array in a text file, or you could use an open source software like FreeFem.

Do

zmester January 9, 2010 13:45

hi

I also work on my unstructured solver, if i have time and humor for that. It uses .msh files generated with Gambit, Icem, etc. .msh file contains grid point coordinates, faces with corner grid points and left and right side cells+ contains informations about BC-s, and zones. So this way of grid storing concentrate on the faces. You can understand the structures of .msh files by viewing them in notepad in simple test cases.

Its also useful to store all the informations connected to each cells (cell center, cell volume, bounding faces, etc). My solver calculate all of this information from the .msh file. than loop all over the cells and builds up the coefficient matrix (1row -1 cell). It is recommended to store only the non zero elements in the matrix! The structure of the matrix of course depends on the cell numbering of the gambit, but you can renumber the cells if you want(and know how to), but this doesnt change the size of the matrix, maybe has effect on the speed of convergence.

If you dont have Gambit or other mesher you can download .msh files from all over the internet. Let's say on my page there's an .msh viewer that you can download. The zip file contains some simple .msh files.
www.herczz.extra.hu
( I dont know yet whats my goal with this page, but i plan to upload a solver, and it would be nice to have some visitor :) )

los January 9, 2010 19:12

Hey guys really thanks for the input, but maybe I asked it wrong.

Let me take an example that will probably help you to understand my doubt. When you first learn FVM you normally start with a 1D problem. At this problem you will write the matrix based on the ap ,ae ,aw coefficients of each volume. than you can solve this matrix, as you which, to have your solution.

The next step would be a 2d example where you have a plane formed by cubes, at this problem you can use, basically, the same idea as before. You can just choose a line os this plane and solve it, then go to the next line and go on… then if you want you can also change the direction which you are solving your problem to make things faster.

Then in the 3d problem the same basic principle can be used, you can just solve that one line as the first 1d example and just keep changing the way you solve that one line to make your solution converge.

What you replied to me is basically how can i known which face goes to which volume, but how do I mount the matrix I need to solve with this information?

In a unstructured mesh there are lots of ways to go from one boundary condition to another boundary condition at the other side of your domain and even if you do some algorithm to seek volumes in your domain how can you be sure it is the fasts way possible?

I had a look at fluent and gambit's documentation and I was thinking that maybe the matrix coefficients approach was not a good idea. Maybe just computing the flux of all the faces in my domain and then use the information of the connectivity to calculate the new values of each volume would be the way to go?

Thanks for the answers guys

zmester January 10, 2010 08:10

I dont really understand what you mean under solve the equations line by line, do you mean with a Line relaxation method? Of course such a method cant work here, because theres no line because of the unstructured grid, plus ap,aw,ae,as,an coeff. also meaningless, if you have triangular cells they are even more meaningless. So you wont get a coeff. matrix with 3, or 5 nice stripes in it, but a symmetric (or maybe antisymmetric (depends on the problem)) sparse matrix without regular stripes. You wont be able to capitalize the stripes with using lets say a tridiagonal solver. It seems to me that it is important to you to go from one bc to an other during the iteration, why? There's many iterative method that doesnt care it's structured or not. Simplest is Jacobi, but unfortunately i dont know how the influence the convergence rate the numbering of the cells. Obviously you get different matrix, if you use other numbering. Let's say in 1d, if one uses 1,6,5,4,2,3... cell numbering get other matrix than in case of the straight forward 1,2,3,4,5,6... cell numbering. Is there anyone who knows how that influences the convergence rate?

Personally i would like to implement an algebric multigrid method soon, because that only uses the coefficient matrix, dont necessary to know anything about the grid (sturctured or not, tri or quad), and its probably fast enough. Is there anyone who has experience with that?


All times are GMT -4. The time now is 00:30.