t.teschner |
January 14, 2015 19:03 |
coefficient calculation (a_P, a_nb) in unstructured meshes vs. structured meshes(FVM)
I am currently trying to understand unstructured meshes and am implementing the diffusion equation on a simple 2D rectangular domain with an unstructured mesh. I did this a while back for structured meshes and I was calculating the neighbor coefficient as
where and are the cross sectional area (per unit lenght) and the distance of two neighbor cells (cell center to cell center). The cross sectional area is simple in the x direction and in the y direction.
is defined .
The index 0 refers to the current cell and 1 to one of its neighbor.
for each cell in turn is then calculated as the sum
Hence, if is positive, all and must be positive for each cell as each component is positively defined (i defined and positive for each cell).
For unstructured meshes, the neighbor coefficients are calculated as
where
and .
If I expand I get
Since both and can take negative values, it is expected that both and can take negative values.
Now I am not sure if that is to be expected (as for the structured code I get solely positive values) but I am having the feeling that this i causing some problems for my code.
So the question is probably more, is there any definition for face/unit vector of for the direction they are pointing? Not sure if that is the only problem that I am having in the code, but at least its the only one I can identify to be not working at the moment. The gradient calculation seems to give physical results and I have tried to solve with and without the secondary gradient (cross diffusion term) to check if the error is coming from this term but it does not seem so.
I am using a face based approach where I solve over each face in the interior (followed by the boundary faces) where I add contribution to cell 0 (current cell I am in) and substract them from cell C1 (neighbor cell).
If anyone with experience with unstructured meshes and has a hunch what I am doing wrong I would appreciate the help.
|