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

Node UDF

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

Like Tree1Likes
  • 1 Post By gearboy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 23, 2011, 11:40
Default Node UDF
  #1
New Member
 
Join Date: Feb 2011
Posts: 8
Rep Power: 15
EdiVaD is on a distinguished road
Hi to everybody,

i want to know if it possible to read nodes coordinate once a time.

this is part of my udf code:
----------------------------------------------------------------------------------------------------------------
fprintf(fout,"thread id %d\n", id);
begin_f_loop(f,t)
{
f_node_loop(f,t,n)
{
v = F_NODE(f,t,n);
pos_x = NODE_X(v);
pos_y = NODE_Y(v);
fprintf(fout, "f%d %g %g\n", v, pos_x, pos_y);
}
}
end_f_loop(f,t)
fprintf(fout, "\n");
----------------------------------------------------------------------------------------------------------------
in this way i have obtained the same nodes more than one time, due to the nodes on the same faces. Can somebody help me?

Thank's in advance
EdiVaD is offline   Reply With Quote

Old   February 23, 2011, 21:04
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by EdiVaD View Post
Hi to everybody,

i want to know if it possible to read nodes coordinate once a time.

this is part of my udf code:
----------------------------------------------------------------------------------------------------------------
fprintf(fout,"thread id %d\n", id);
begin_f_loop(f,t)
{
f_node_loop(f,t,n)
{
v = F_NODE(f,t,n);
pos_x = NODE_X(v);
pos_y = NODE_Y(v);
fprintf(fout, "f%d %g %g\n", v, pos_x, pos_y);
}
}
end_f_loop(f,t)
fprintf(fout, "\n");
----------------------------------------------------------------------------------------------------------------
in this way i have obtained the same nodes more than one time, due to the nodes on the same faces. Can somebody help me?

Thank's in advance

/* Initalize all node marks on the thread to 0 */
begin_f_loop(f, t)
{
f_node_loop(f, t, n)
{
v=F_NODE(f,t,n);
NODE_MARK(v) = 0;
}
}
end_f_loop(f, t);

begin_f_loop(f, t)
{
f_node_loop(f, t, n)
{
v = F_NODE(f,t,n);
pos_x = NODE_X(v);
pos_y = NODE_Y(v);
if(NODE_MARK(v) == 0) /* if not already visited */
fprintf(fout, "f%d %g %g\n", v, pos_x, pos_y);

NODE_MARK(v) = 1;
}
}
end_f_loop(f, t);
fclose(fout);
fchan likes this.
gearboy is offline   Reply With Quote

Old   February 24, 2011, 05:43
Thumbs up
  #3
New Member
 
Join Date: Feb 2011
Posts: 8
Rep Power: 15
EdiVaD is on a distinguished road
Thank you GearBoy ,

it works fine.

I want to underline that to use the macro NODE_MARK(), the udf must be compiled and not interpreted...

where i can find some reference on this and other similar macro?
in the UDF ug there aren't info...
EdiVaD is offline   Reply With Quote

Old   September 20, 2012, 10:13
Default
  #4
Member
 
ThanhToan
Join Date: Sep 2010
Posts: 49
Rep Power: 15
trantoan2008 is on a distinguished road
Send a message via Yahoo to trantoan2008 Send a message via Skype™ to trantoan2008
Quote:
Originally Posted by gearboy View Post
/* Initalize all node marks on the thread to 0 */
begin_f_loop(f, t)
{
f_node_loop(f, t, n)
{
v=F_NODE(f,t,n);
NODE_MARK(v) = 0;
}
}
end_f_loop(f, t);

begin_f_loop(f, t)
{
f_node_loop(f, t, n)
{
v = F_NODE(f,t,n);
pos_x = NODE_X(v);
pos_y = NODE_Y(v);
if(NODE_MARK(v) == 0) /* if not already visited */
fprintf(fout, "f%d %g %g\n", v, pos_x, pos_y);

NODE_MARK(v) = 1;
}
}
end_f_loop(f, t);
fclose(fout);


Hi GearBoy!

I followed your code as shown as above. It works very well. I succeeded to output node data. However, I faced some problem. Could you help me?

I tested DEFINE_CG_MOTION macro with a rotation of a box about x-axis according to "cos(x)" function . I exported several node in this box. When I checked output data from selected node, I compare it to my "cos(x)" function value. I realized that there are slightly different between them.

I really appreciate your help.

Best regards
trantoan2008 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
How to get the Global Node Number by UDF : Fluent Yusuke FLUENT 1 October 23, 2015 11:55
Accessing node values using a UDF Nico FLUENT 2 December 20, 2007 03:50
UDF Global Node Number ? C. H. FLUENT 1 November 24, 2006 11:02
Help: how to get node values with UDF? Dazhi Guo FLUENT 0 February 4, 2001 01:59


All times are GMT -4. The time now is 10:55.