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

how to get Face Normal vector and Face Center ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2018, 02:42
Default how to get Face Normal vector and Face Center ?
  #1
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
Hi All,
My doubt is very simple please forgive me if I am making it complicated by my words. If anything is unclear then please ask. I need to solve this problem asap.

I am making a dual grid solver. In which I need to interpolate fields in between the two grids. I need to determine which cells of the finer grid are inside a given cell of the coarser grid.

what I want to do is check which cell centroid of the coarser cell and finer cell lies on the same side of a given face plane. So I want to do is "multiply face normal to the difference of the cell centroid and face center".

I have a cell loop like this :

forAll(fluidRegions[0].cells(), cellI)

I am getting the face list for the given cell by this:

const cell& faces = fluidRegions[0].cells()[cellI];

Inside the above cell loop I have another cell loop for the other mesh as:

forAll(solidRegions[0].cells(), cellI1)

inside this loop i have my face loop in which I am finding the normal and do my calculation,

forAll( faces, iface ) //face loop
vector faceINormal = fluidRegions[0].Sf()[faces[i]] / fluidRegions[0].magSf()[faces[i]] ; //way I am finding the normal

Any help or suggestion will be deeply appreciated.

Last edited by kk415; July 11, 2018 at 06:18.
kk415 is offline   Reply With Quote

Old   July 11, 2018, 06:21
Default
  #2
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
I am getting error in the values of normal. Also the value of normal changes each time I run the program.
kk415 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



All times are GMT -4. The time now is 20:59.