CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Access to neighbor faces on a boundary

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By giack
  • 3 Post By marupio
  • 1 Post By tiam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2016, 10:36
Default Access to neighbor faces on a boundary
  #1
Member
 
Join Date: Mar 2013
Posts: 98
Rep Power: 13
giack is on a distinguished road
Dear all,

I have a problem in the implementation of a smoothing filter that smooth a value averaging the neighbor ones.

The variable to smooth (let's call it sensitivity) is a volScalarField defined only along a wall surface. Therefore, the sensitivity is zero everywhere and different from zero on the wall faces.

I have access to the face values on the wall with sensitivity.boundaryField() but I'm not able to take the values of the neighbor faces on the wall. The typical way how to have access to neighbors is to use mesh.cellCells() and mesh.neighbor() but they are related to neighbor cells and neighbor internal faces respectively.

Someone knows how to have access to the neighbor faces on a boundary (the wall in my case)?

Thanks for any help
Giacomo
atulkjoy likes this.
giack is offline   Reply With Quote

Old   February 19, 2016, 11:36
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
sensitivity.boundaryField()[patchI] will give a fvScalarPatchField with all the values on it. Call patch() to get fvPatch, then call patch() again to get polyPatch. That has connectivity:

Code:
forAll(sensitivity.boundaryField(), i)
{
    fvScalarPatch& patchI(sensitivity.boundaryField()[patchI]);
    polyPatch& pp(patchI.patch().patch());
}
pp is now a polyPatch and has all the connectivity data. pp[faceIndex] gives a list of edges associated with that face. pp.edgeFaces[edgeIndex] gives a list of all faces associated with a given edge index. You may have to check to make sure the face you found is not an internal face. Then map back to the value.

I'm sure there's an easier way. Try looking for examples. PrimitivePatch::calcPointNormals creates a normal for each point on the face that is the average of the surrounding face normals. May be useful. (Mind you, this one doesn't account for parallel processing.)

Sorry for the ramble. Hope this helps ever so slightly.

Need more coffee this morning.
__________________
~~~
Follow me on twitter @DavidGaden

Last edited by marupio; February 19, 2016 at 11:37. Reason: Missed [code] tags
marupio is offline   Reply With Quote

Old   April 29, 2016, 07:15
Default
  #3
Member
 
Join Date: Mar 2013
Posts: 98
Rep Power: 13
giack is on a distinguished road
Many thanks for the advice, I'll have a look on that.

For the moment I solved the problem in a more simple way. I perform a double interpolation:
- interpolation of the face values to obtain the values on the boundary points (faceToPointInterpolate).
- interpolation of the boundary values to obtain the values on the face centers (pointToFaceInterpolate).

The interpolation is a linear interpolation so essentially I average twice to get a smoother values on the face center. In this way the smoothing is more conservative than a simple average between the face center values.

However, I still want to try to develop the first idea so I will check more in detail your suggestions.
giack is offline   Reply With Quote

Old   January 29, 2019, 08:23
Default
  #4
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 119
Rep Power: 14
tiam is on a distinguished road
Quote:
Originally Posted by marupio View Post
sensitivity.boundaryField()[patchI] will give a fvScalarPatchField with all the values on it. Call patch() to get fvPatch, then call patch() again to get polyPatch. That has connectivity:

Code:
forAll(sensitivity.boundaryField(), i)
{
    fvScalarPatch& patchI(sensitivity.boundaryField()[patchI]);
    polyPatch& pp(patchI.patch().patch());
}
pp is now a polyPatch and has all the connectivity data. pp[faceIndex] gives a list of edges associated with that face. pp.edgeFaces[edgeIndex] gives a list of all faces associated with a given edge index. You may have to check to make sure the face you found is not an internal face. Then map back to the value.

I'm sure there's an easier way. Try looking for examples. PrimitivePatch::calcPointNormals creates a normal for each point on the face that is the average of the surrounding face normals. May be useful. (Mind you, this one doesn't account for parallel processing.)

Sorry for the ramble. Hope this helps ever so slightly.

Need more coffee this morning.

A short note after working with a similar thing. Instead of pp[faceIndex], use pp.faceEdges()[faceIndex] to use local addressing, compatible with pp.edgeFaces()[edgeIndex].
atulkjoy likes this.
tiam is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Access to the velocity at boundary cells mathslw OpenFOAM 14 January 10, 2018 00:31
Domain Imbalance HMR CFX 5 October 10, 2016 06:57
Low torque values on Screw Turbine Shaun Waters CFX 34 July 23, 2015 09:16
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32


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