CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Obtain the node number in UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By ansys_matt
  • 1 Post By eagle_001

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 29, 2019, 12:11
Default Obtain the node number in UDF
  #1
Member
 
Join Date: Feb 2013
Posts: 60
Rep Power: 13
ansys_matt is on a distinguished road
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
Ety likes this.
ansys_matt is offline   Reply With Quote

Old   April 29, 2019, 12:56
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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.
LuckyTran is offline   Reply With Quote

Old   April 29, 2019, 13:05
Default
  #3
Member
 
Join Date: Feb 2013
Posts: 60
Rep Power: 13
ansys_matt is on a distinguished road
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.
ansys_matt is offline   Reply With Quote

Old   April 29, 2019, 18:41
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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.
LuckyTran is offline   Reply With Quote

Old   May 2, 2019, 17:58
Default
  #5
Member
 
Join Date: Feb 2013
Posts: 60
Rep Power: 13
ansys_matt is on a distinguished road
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...
ansys_matt is offline   Reply With Quote

Old   May 21, 2019, 09:13
Default
  #6
New Member
 
Ouyang
Join Date: Jun 2018
Posts: 6
Rep Power: 7
eagle_001 is on a distinguished road
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!
Ety likes this.

Last edited by eagle_001; May 21, 2019 at 21:48.
eagle_001 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


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


All times are GMT -4. The time now is 13:19.