|
[Sponsors] |
Determining the cell neighbours for a given node |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 4, 2018, 16:39 |
Determining the cell neighbours for a given node
|
#1 |
New Member
Join Date: Jun 2015
Posts: 7
Rep Power: 11 |
I was wondering, is there a fluent macro for looping over all the cells adjacent to a given node? Thanks in advance
|
|
December 4, 2018, 22:10 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
how do you know the node?
lets imagine, you know it, so you may make a loop over all cells and find, where your node is located. If nodes matches this is your node. From Ansys Fluent Customization manual Code:
/* Store the mesh node coordinates in user-defined node memory */ thread_loop_c (t,domain) { begin_c_loop (c,t) { c_node_loop (c,t,n) { v = C_NODE(c,t,n); N_UDMI(v,0) = NODE_X(v); N_UDMI(v,1) = NODE_Y(v); #if RP_3D N_UDMI(v,2) = NODE_Z(v); #endif } } end_c_loop (c,t) } |
|
December 4, 2018, 23:38 |
|
#3 |
New Member
Join Date: Jun 2015
Posts: 7
Rep Power: 11 |
I guess what I would like to do is the opposite of c_node_loop(c,t,n). For a given cell, c_node_loop will loop over all the common nodes with that cell. For a given node, is there an easy way to identify all the cells that are common to that node?
|
|
December 4, 2018, 23:53 |
|
#4 |
New Member
Join Date: Jun 2015
Posts: 7
Rep Power: 11 |
One idea I had was to define a structure that stored the adjacent cell IDs. I would have an array of these structs and I could use the cell and node loops to identify which cells were associated with each node. However, for a given node ID, I want to know the adjacent cell IDs and I can't see how I can do this with my approach.
typedef struct NODE_ADJACENT{ Node *v; cell_t c_adj[4]; int total_adj; } node_cellneighbour; node_cellneighbour n1[count]; #if RP_NODE int i = 0; thread_loop_c(t,d) { begin_c_loop_int(c,t) { c_node_loop(c,t,n) { n1[i].v = C_NODE(c,t,n); n1[i].c_adj[n1[i].total_adj] = c; n1[i].total_adj = n1[i].total_adj + 1; i++; } } end_c_loop_int(c,t) } #endif |
|
December 6, 2018, 23:45 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
This code is not working? that looks good.
What data is stored in your array? Try to debug on single core first, if you are using fluent version less than 19.0 also begin_c_loop_int macro is very specific, you should check is it suitable for your case or not. Use Ansys Fluent Customization manual for for information best regards |
|
October 19, 2020, 10:37 |
|
#6 |
New Member
Andrew
Join Date: Feb 2014
Location: Russia
Posts: 20
Rep Power: 12 |
The code above will just collect arrays of Node structure pointers for each cell's neighbor nodes. It will not identify nodes. I googled for the topic and found that there is no solution on the Internet. I can propose the simple "dirty" method of finding node IDs, don't know if they are local for current thread (mesh partition) or for the entire domain. If we look at Fluent's user header files we'll find that node_struct is declared in mem_grid.h and there are cxindex id and int idx fields in this struct. I didn't further into cxindex struct, but idx is not just "1, 2, 3" but looks node index or ID. Strange that there is no macro for this, so you can use it, but it's not guaranteed to work in all Fluent versions. We use old 14 and 16 versions, so may not work in newer versions. And don't forget to check what happens in parallel mode. (Node ID or index will be just v->idx with this method)
|
|
October 20, 2020, 05:09 |
|
#7 |
New Member
Andrew
Join Date: Feb 2014
Location: Russia
Posts: 20
Rep Power: 12 |
Checked for the idx if it's global or for current partition. It's for current partition, so it changes from 0 to some value around NumberOfCells/NumberOfPartitions. For Fluent release 16.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Node and cell in cell centred system | lucamirtanini | Main CFD Forum | 20 | November 24, 2018 07:36 |
Export velocity in node or in cell center | jpina | FLUENT | 2 | November 6, 2015 13:42 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
The fluent stopped and errors with "Emergency: received SIGHUP signal" | yuyuxuan | FLUENT | 0 | December 3, 2013 23:56 |
node values or cell values? | aPpA | FLUENT | 0 | November 10, 2006 09:56 |