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

3 Part Question about cell access and averaging

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2020, 01:38
Default 3 Part Question about cell access and averaging
  #1
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Hi Guys,

I have been working to write some routines within the DNS solver I made. I want to achieve the following two things, hope I can get some help to write a fast and sensible piece of code.

1. I want to get planform average of the velocity. Consider a channel flow with streamwise (x), span wise (y) and vertical (z) coordinates. I would like to average the velocity field along the streamwise and spanwise coordinate (both are periodic ) and get U as a function of vertical coordinate only. What is the best way to compute such a planform average in runtime within the solver.

2. Consider the same channel flow case for only the bottom boundary (lets call it bottom). I would like to access the first two cells immediately above the bottom boundary (for the entire boundary) and carry out certain operation using these values. A quick schematic would look something like this


- - - - -
| o | Cell at z = n - 1
- - - - -
| o | Cell at z = n (last grid cell)
_______
BOTTOM


I want to extrapolate the value at a ghost cell z = n + 1 using a linear extrapolation over the entire bottom boundary something like

C[n+1] = C[n-1] + ((z[n+1] - z[n-1])/(z[n] - z[n-1] ))*(C[n] - C[n-1]), where C is some flow parameter.

Can someone suggest a good way to first access these cells and then compute the external value?


3. I want to access and get values of the cell centres along the vertical direction. I don't want all the z coordinates but only the unique z coordinates. I know that writeCellCenters gives all the z coordinates, however I only want the unique z coordinates i.e. cell centre z values.


Looking forward to your responses. Thanks!
Akshay_11235 is offline   Reply With Quote

Old   May 16, 2020, 17:21
Default
  #2
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Any thoughts on the above problem will be highly vappreciated!
Akshay_11235 is offline   Reply With Quote

Old   May 17, 2020, 21:23
Default
  #3
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Hi Guys,

Still hopeful that someone might shed some light into this. I managed to fix the algorithm for question 2 by creating topoSet cells to read the bottom two rows of cells and then operate on them. Since my mesh does not change in this application this is a valid approach. However, for the other things I would really love to hear your opinions.

Since I am dealing with DNS using (RK4 projection method and/or Adams-Bashforth 3rd order time integration projection method) I really need to compute the planform averages on the fly and not later given my grid is something like 44 million grid cells.
Akshay_11235 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 22:39.