|
[Sponsors] |
April 29, 2019, 12:11 |
Obtain the node number in UDF
|
#1 |
Member
Join Date: Feb 2013
Posts: 60
Rep Power: 13 |
Hello,
The documentation says: The index number can be used with the FNODE macro to obtain the global face node number (e.g.,node = FNODE(f,t,n)). But this is not correct. I put this snippet in my udf: begin_f_loop(f, tf) { f_node_loop(f, tf, n) { v = F_NODE(f, tf, n); printf("The global node number is %i.\n",v); And I only get nonsense printed out. My entire domain has 4232 nodes, so I expect to see numbers on [1,4232] printed to the console. I have tried using *v instead of v, but I still get numbers that are in the range of billions, not between 1 and 4232. How can I get the actual node number from within a UDF? Thanks |
|
April 29, 2019, 12:56 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,689
Rep Power: 66 |
v is not a number but a reference to a Node dataclass. That's why it prints non-sense. You are seeing memory locations.
The local node number is actually n. I don't know how to get the global node number. |
|
April 29, 2019, 13:05 |
|
#3 |
Member
Join Date: Feb 2013
Posts: 60
Rep Power: 13 |
I see. So when the manual says this is how to get the global node number, as I quoted, the manual is mistaken. That is awful.
Thanks for the reply. Maybe someone else will know how to do it. |
|
April 29, 2019, 18:41 |
|
#4 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,689
Rep Power: 66 |
I'm not saying all hope is lost. The local node number is n. My macro's are rusty. As first step, what happens if you do?
printf("The local node number is %i.\n",n); In serial cases that would be equivalent to the global node number anyway. In parallel cases, I don't recall how the threads are partitioned and how to collect them, or whether it is even necessary to collect them. |
|
May 2, 2019, 17:58 |
|
#5 |
Member
Join Date: Feb 2013
Posts: 60
Rep Power: 13 |
Yeah, I do need the global node number, not just the local node. As I am using linear elements and looping over an edge, your code simply prints 1,2,1,2,1,2,1,2...
|
|
May 21, 2019, 09:13 |
|
#6 |
New Member
Ouyang
Join Date: Jun 2018
Posts: 6
Rep Power: 8 |
Hi, ansys_matt! Hope you have solved this problem.
I also tried to obtain the global index number of node by udf just as you did, but failed. Thank you very much, ansys_matt! Last edited by eagle_001; May 21, 2019 at 21:48. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar -allRegions | stru | OpenFOAM Pre-Processing | 2 | August 25, 2015 03:58 |
Compressor Simulation using rhoPimpleDyMFoam | Jetfire | OpenFOAM Running, Solving & CFD | 107 | December 9, 2014 13:38 |
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 | UDS_rambler | FLUENT | 2 | November 22, 2011 09:46 |
UDF Global Node Number ? | C. H. | FLUENT | 1 | November 24, 2006 10:02 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 04:15 |