CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

CGNS unstructured in own solver

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   May 13, 2006, 13:34
Default CGNS unstructured in own solver
Posts: n/a

I am currently adding CGNS to a unstructured solver. CGNS seems to be cell based (vertices are defined for the cell) and not face based as other format (like fluent). This cause several problems, since the solver is obviously face based. Basicly i need the to be able to get indices of left and right cell to a face. Unfortunately in this cell based format, this would require to check for same faces: *go through all cells and store cell faces *go through all faces, and see if the face has been defined before so that it can be deleted.

This last operation is approximately a loop of nf*nf*0.5 (where nf is number of faces) this is obviously very time consuming for large grids.

I expect that i have something missing, since Fluent seems to be able to load the mesh quite quickly.

I have also seen that CGNS group is looking at face-based support for the future.


  Reply With Quote

Old   May 14, 2006, 08:19
Default Re: CGNS unstructured in own solver
Hrvoje Jasak
Posts: n/a
You can do much better than that - there is absolutely no need for a n-squared search.

First, create a point-cell connectivity, listing all cells around a point. Second, make a list of indices for each cell where you will record the faces that vave already been created. Third, loop through all cells and for each cell visit all faces. If the face has already been detected, skip it. Fourth, for each new face, grab point zero and get a list of cells around that point (call it cpf). Then, take the second point of the face, go through the small list (cpf) and ask each cell if it's got the second point. Repeat for the third point etc. This will give you the cell you need. Now, check the other cell to find the identical face, add the face to the face list with its owner and neighbour cell and record the new face in both cells.

If the mesh is full-regular, 3 points is enough to eliminate all but one cell, but you can easily keep going until there is only one. If you get more than one, this would indicate that 3 cells are sharing a face, which is an error in the mesh (the algorithm does not really care).


  Reply With Quote

Old   May 14, 2006, 13:25
Default Re: CGNS unstructured in own solver
Posts: n/a
Yep, much better, much faster and nice way to do it. Thanks a lot.
  Reply With Quote

Old   May 18, 2006, 16:31
Default Re: CGNS unstructured in own solver
Posts: n/a
Alternatively, just run through the cells and look up each face of the current cell using a face hash table, where the hash key is the (order independent) list of face vertices. If the face is not in the table, create the face. If it is already there, add this cell as the second cell for the face.

With a decent hash function (fast and well-distributed) this will be faster and use less memory than the vertex connectivity approach.

  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
write unstructured grid on cgns manaliac Main CFD Forum 0 June 1, 2010 03:52
Creating New Solver: For particle-laden compressible jets sankarv OpenFOAM 0 April 4, 2010 18:06
Help for constructing an Unstructured Incompressible solver moomba Main CFD Forum 0 February 25, 2010 16:38
Unstructured Euler Solver John Main CFD Forum 3 September 6, 2007 15:34
unstructured VOF flow solver yann Main CFD Forum 1 November 13, 2002 05:07

All times are GMT -4. The time now is 12:05.