CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   question on technical strategy of loop on unstrcutred grid for flux computatoin (http://www.cfd-online.com/Forums/main/114247-question-technical-strategy-loop-unstrcutred-grid-flux-computatoin.html)

 dokeun March 7, 2013 12:11

question on technical strategy of loop on unstrcutred grid for flux computatoin

Dear all

Now I'm trying to implement original LU-SGS scheme for 2D Euler unstructured mesh.
Properties are stored at cell center and face data points their left/right cell # and normal unit vector with magnitude of face vector.

When I wrote a code for explicit operator, in other word, 'residual', the 'face' based loop was convenient because of its intuitiveness for flux calculation.

At first thought, meanwhile, the 'cell' based loop seemed to be better than 'face' for the implicit operator. Because forward and backward sweeps chage the update of conservative vector for given cell, ie, . But I had to check whether the current cell is on left of the face or not. And it makes the code complex.

Which approach is better for your experience? face or cell?

 FMDenaro March 7, 2013 12:57

Quote:
 Originally Posted by dokeun (Post 412335) Dear all Now I'm trying to implement original LU-SGS scheme for 2D Euler unstructured mesh. Properties are stored at cell center and face data points their left/right cell # and normal unit vector with magnitude of face vector. When I wrote a code for explicit operator, in other word, 'residual', the 'face' based loop was convenient because of its intuitiveness for flux calculation. At first thought, meanwhile, the 'cell' based loop seemed to be better than 'face' for the implicit operator. Because forward and backward sweeps chage the update of conservative vector for given cell, ie, . But I had to check whether the current cell is on left of the face or not. And it makes the code complex. Which approach is better for your experience? face or cell?

I used to work on faces ... I defined a local system on the face, two unit vectors normal and tangential to the face. Then I fix a convention, for example the right cell sees the normal outward oriented. Then check for each couple of cells the right orientation

 dokeun March 7, 2013 22:55

Quote:
 Originally Posted by FMDenaro (Post 412346) I used to work on faces ... I defined a local system on the face, two unit vectors normal and tangential to the face. Then I fix a convention, for example the right cell sees the normal outward oriented. Then check for each couple of cells the right orientation
Dear professor
Thank you for sharing your precious experience.
I have some questions ensued.

1st-------------------------------------------------------------------
When I loop over faces, then, do I have to treat Diagonal, Lower, Upper components, i.e., , as an array in order to sweep?
(I guess it's 1D in which each component has the sum of lower/upper update flux and linearized Jocobians-spectral radii around a cell)
Or, then, how can I sweep along face to update solution with scalar variables?

The reason why I tried to use cell loop was I expect that I can make sweeps with scalar value of D, L, U(L, U are to be sum of fluxs) for each cell with this approach only.
I have no idea of making sweeps with scalar variables(D, L, U) for face based.
From my understanding, LU-SGS scheme's feature is to update solution with scalar values D, L, U.
(Exactly speaking, they are vectors composed with conservative variables-size 4 for euler 2d.)

2nd-------------------------------------------------------------------
For a structured solver, it seems clear that where a ghost cell's properties effect treated, L or U.
Because there are explicit relation between a cell and its ghost cell. But, it looks an elusive matter in unstructured case.
May boundary condition is applied to the both sweeps by ghost cells?

 FMDenaro March 8, 2013 05:55

for the first question, I think there is more than one technique to develop the algorithm ...

second question, I did not use ghost cells... on the boundaries I implemented the Neumann/Dirichlet BC directly in the shape functions in an FV/FEM hybrid approach...

 dokeun March 8, 2013 06:07

Quote:
 Originally Posted by FMDenaro (Post 412489) for the first question, I think there is more than one technique to develop the algorithm ... second question, I did not use ghost cells... on the boundaries I implemented the Neumann/Dirichlet BC directly in the shape functions in an FV/FEM hybrid approach...
Thank you for the kind reply, sir.

I think it's getting more clear for this problem.

Then, when the direct bc is implemented?I mean forward, backward, or in both sweeps.

 FMDenaro March 8, 2013 08:37

in my opinion, any time bc.s are involved

 dokeun March 8, 2013 10:56

i found an interasting discussion about thinking on cfl number in implicit scheme. For implicit scheme, whole computation area is regarded as the domain of dependent. in that sence it seems applying bc for all sweeps is reasonable.
thank you again for your kind explains.

 dokeun March 10, 2013 23:57

Although it's not a lofty subject, I think I have to update my thought in order to make this post more useful for someone.

First of all, I have several data structures ex) node, cell, face, BCs. node has just coordinates data.
Cell and face point the nodes they need. Face has also left/right cell pointers and its face vector.
Conservative properties and other necessary data are stored in each cell. Boundary faces are defined in BCs.
The cell doesn't know which bc types it has when there is no neighbors for one of the neibhbor face.

Over the weekend, I had a difficulty on implementing lu-sgs by face loop.
Because, for the current cell update, I have to have updates of the neighbor cells(which are L for forward, U for backward sweep).
For the explicit operator(residual), face loop is enough to get each cell's residual.
For the face loop in implicit operator, however, I can't get any update before the completion of face loop over a cell.
So, returning to the cell loop, My pseudo program is like below until now.

Code:

 loop icell(cell)   loop jface(cell's faces)     if jcell(lower/upper)?       compute D, L(U) with flux computation     end if   end loop   update conservative vector end loop
Here, my cells don't know what type of bc they have if there is no neighbor.
I have to put a loop after jface for applying bc. But it doesn't seem to be an efficient way.
A loop for finding the face in BCs data contains many overlapped tasks.
So I think need put more imformation to faces or cells defining which bc as their neighbors.
Afterall my problem looks like a data constructing for reasonable calculation loop.

 dokeun March 11, 2013 11:25

Now I can implement a loop over a cell which informed which bc is applied. What I'm concerning is how this bc is contributing on the sweepings. From the googling I found a paper.

Dmitri Sharov and Kazuhiro Nakahashi. "Reordering of Hybrid Unstructured Grids for Lower-Upper Symmetric Gauss-Seidel Computations", AIAA Journal, Vol. 36, No. 3 (1998), pp. 484-486.
doi: 10.2514/2.392

I didn't get this paper yet, but I found following sentence.

Contributions from boundary faces must be considered only for the computation of the diagonal matrixD. The important issue for the unstructured grid LU-SGS ...

This paper maybe an answer for my question.

 All times are GMT -4. The time now is 21:45.