CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Average of patch face values in "corner cells" (https://www.cfd-online.com/Forums/openfoam-programming-development/99279-average-patch-face-values-corner-cells.html)

 Arnoldinho March 30, 2012 08:41

Average of patch face values in "corner cells"

Hi foamers,

I have to do some interpolation/average of boundary values at corner cells.
More specific: I'm regarding e.g. a cell (hex mesh element) that is located at the upper right, front corner of my domain. Therefore, three of its faces are lying on boundary patches (inlet, right, top).

Within my solver I'm modifying the boundary condition values on these patches every time step. So I first have to find the cells that have three faces connected to patches, and then I need to calculate the average of these three boundary values and assign it to the single faces.

Therefore my question: How can I announce the corresponding face labels on the two remaining patches for every patch face? I was thinking of some extensive loops of loops over patches, faces and cells including lists and comparisons, but I hope that there is a faster way which has not yet come to my mind...

Any ideas?

Arne

 Arnoldinho April 3, 2012 02:11

In case someone might do a similar thing: I found a way based on this rather old thread http://www.cfd-online.com/Forums/ope...iven-cell.html using the functions whichPatch and whichFace that I had not known before.

Arne

 laurensvd April 3, 2012 05:07

Cant you just define the coordinate of that corner and loop over the cells to see which cell center is closest to that point? You could even make it faster by retrieving the cells which neighbor one of those patches and see which one of those is closest to that point. Take the smallest patch and youll have minimum overhead.

 Arnoldinho April 3, 2012 13:48

Hi laurens,

thanks for your hint. I already implemented it similar to the way it was mentioned by the link I posted:
1. Start from the boundary patches,
2. find corresponding cells in corners (and intersections),
3. calculate average values based on the corresponding patch face cells and temporarily store them,
4. write them back to the patch faces.

Arne

 All times are GMT -4. The time now is 14:34.