|
[Sponsors] |
How to get cell labels for all the points within specific distance from a given point |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 9, 2014, 00:11 |
How to get cell labels for all the points within specific distance from a given point
|
#1 |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 13 |
Hi, everyone!
I need cell labels for all the points within specific distance from a given point. For example, the coordinate for the given point is (x,y,z), and I need velocity values of all the points within 3cm from this point to interpolate the velocity at this point. Could anyone help me with it? Billions of thanks! Xiangyu |
|
October 10, 2014, 14:17 |
|
#2 |
New Member
Join Date: Jul 2011
Posts: 9
Rep Power: 15 |
I am not sure if this functionnality is available directly in OpenFOAM .
However, this is how I would do : - First, get the cell centers coordinates of your mesh by using writeCellCentres. It writes the coordinates in the files ccx, ccy and ccz for the specified times. - Then, write a code in a scripting language (for example python) that reads the files for the cell centers and the velocity file U, and extract the lines corresponding to cells that are within 3cm of your point. There is certainly a way to do this directly in OpenFOAM but if you are not familiar with the OpenFOAM source code or C++, this is probably the simplest option |
|
October 10, 2014, 14:28 |
|
#3 | |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 13 |
Quote:
|
||
October 10, 2014, 15:18 |
|
#4 |
New Member
Join Date: Jul 2011
Posts: 9
Rep Power: 15 |
My bad, I didn't understand the question properly :P
I guess you could loop over all the cells and access the coordinates with: mesh.C[celli].component(0) (for the x-coordinate), and if the cell is within 3cm of your point, then just put its label in a list. Then you just have to iterate over the labels in the list and interpolate the velocities. Hope this helps.. |
|
October 10, 2014, 21:05 |
|
#5 |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 13 |
Sorry for bothering you again. Now I am facing a new problem. I am running my case in parallel. This is how I get the label and velocity for a given point:
vector probepoint(x[0],x[1],x[2]); label m=iMesh.findCell(probepoint); U_in[0]=U[m].x(); U_in[1]=U[m].y(); U_in[2]=U[m].z(); It works well in serial, but in parallel, I have the problem below: I decompose the domain into 16 parts, and the given point can only be in one part (let's say part 3). The label search works well in part 3, but in other parts, the solver gives me m=-1, which will make U_in[0]=U[m].x() impossible and kill the simulation. Do you know how to let the label search happen in only part 3? Thank you, Xiangyu |
|
October 10, 2014, 23:18 |
|
#6 |
New Member
Join Date: Jul 2011
Posts: 9
Rep Power: 15 |
To find a label in parallel, check out this thread : http://www.cfd-online.com/Forums/ope...-parallel.html
Last edited by wyldckat; October 11, 2014 at 14:29. Reason: rectified link, since the linked thread was moved to the programming sub-forum |
|
October 11, 2014, 13:43 |
|
#7 |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 13 |
Thank you very much, the information you provided is really helpful! Now the problem has been solved!
|
|
October 11, 2014, 16:17 |
|
#8 |
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 13 |
Sorry for my endless questions. I need to use findcell for 60 points per time step, which means I have to loop the domain for 60 times. It will take a lot of time. Is there a way to find the labels for all 60 points in only one loop? I tried to feed a vector list to find cell to findcell in order to get a label list, of course, it did not work. Could you please give me any hints?
Thank you very much, Xiangyu |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
Error message: 8 face(s) not in face lists of adjacent cells | jyoung79 | FLUENT | 0 | November 10, 2012 17:09 |
Two-Phase Buoyant Flow Issue | Miguel Baritto | CFX | 4 | August 31, 2006 13:02 |
distance from the wall to the first grid point | Wenqing Zhang | CFX | 0 | August 9, 2004 11:08 |
CFX4.3 -build analysis form | Chie Min | CFX | 5 | July 13, 2001 00:19 |