# Udf of circular edge: Help is needed

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

 August 21, 2011, 08:59 Udf of circular edge: Help is needed #1 Member   anonymous Join Date: Feb 2011 Posts: 44 Rep Power: 6 I have a 2D channel that its edge is circular. I am moving the walls in y direction and this working. However, when I am not able to move the circular edge. This is the UDF I am using... #include "udf.h" #include "mem.h" #include "dynamesh_tools.h" /* Constants */ #define b 1.5e-3 #define T 20 #define a 0.0e-3 #define a1 10e-3 #define b1 0.5e-3 #define R 0.5e-3 #define phi 3.1415926535897932384626433832795 #define L 50 #define EdgeHeight 1.0e-3 /************************************************** ***/ DEFINE_GEOM(outlet,domain,dt,position) { Thread *tf = DT_THREAD (dt); face_t f; Node *node_p; real x, y; int n; SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf)); begin_f_loop (f, tf) { f_node_loop (f, tf, n) { node_p = F_NODE (f, tf, n); if (NODE_POS_NEED_UPDATE (node_p)) { NODE_POS_UPDATED (node_p); x = NODE_X (node_p); y[0]=sqrt(fabs(pow(R,2)-pow((x-a1),2)))+(b1+CURRENT_TIME/T); y[1]=-sqrt(fabs(pow(R,2)-pow((x-a1),2)))+(b1+CURRENT_TIME/T); NODE_Y (node_p) = y; } } } end_f_loop (f, tf); }

 August 21, 2011, 09:45 #2 Senior Member     Amir Join Date: May 2009 Location: Shiraz, Iran Posts: 739 Blog Entries: 1 Rep Power: 14 Hi noa, there are some inconsistencies in your code! maybe you mean: real x, y[2]; y[0]=...; y[1]=...; NODE_Y (node_p) = y;// you have to assign it with a scalar not vector, y[0] or y[1] __________________ Amir

 August 23, 2011, 09:24 More help.... #3 Member   anonymous Join Date: Feb 2011 Posts: 44 Rep Power: 6 Hi Amir, Thank you very much for your help. My model is built from half circle at its edge. every x has two y values. However, when I change my udf and define y as vector, its not working since Node_y gets scalar only. #include "udf.h" #include "mem.h" #include "dynamesh_tools.h" /* Constants */ #define b 0 #define T 20 #define a 0.0e-3 #define a1 10e-3 #define b1 0.5e-3 #define R 0.5e-3 #define phi 3.1415926535897932384626433832795 #define L 50 #define EdgeHeight 1.0e-3 /************************************************** ***/ DEFINE_GEOM(outlet,domain,dt,position) { Thread *tf = DT_THREAD (dt); face_t f; Node *node_p; real x, y[2]; int n; SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf)); begin_f_loop (f, tf) { f_node_loop (f, tf, n) { node_p = F_NODE (f, tf, n); if (NODE_POS_NEED_UPDATE (node_p)) { NODE_POS_UPDATED (node_p); x = NODE_X (node_p); y[0]=sqrt(fabs(pow(R,2)-pow((x-a1),2)))+(b1+CURRENT_TIME/T); y[1]=-sqrt(fabs(pow(R,2)-pow((x-a1),2)))+(b1+CURRENT_TIME/T); NODE_Y (node_p) = y[0]; } } } end_f_loop (f, tf); } Thank you

 August 23, 2011, 09:46 #4 Senior Member     Amir Join Date: May 2009 Location: Shiraz, Iran Posts: 739 Blog Entries: 1 Rep Power: 14 Hi, you can use a if-clause or a compatible statement like this: real y; y=NODE_Y(node_p)/abs(NODE_Y(node_p))*sqrt(fabs(pow(R,2)-pow((x-a1),2)))+(b1+CURRENT_TIME/T); Bests, __________________ Amir

 August 23, 2011, 09:56 #5 Member   anonymous Join Date: Feb 2011 Posts: 44 Rep Power: 6 I am sorry to bug u again but still I am not sure I got it. I wish I could use IF but in this case of the half circle I have 2 y for every x and there is not a If statement I can use. I didn't understand why u used y=NODE_Y(node_p)/.... Thank you

 August 23, 2011, 10:08 #6 Senior Member     Amir Join Date: May 2009 Location: Shiraz, Iran Posts: 739 Blog Entries: 1 Rep Power: 14 Ok, every x has 2 y (in circular arch one + and another -) right? so you can use if clause (if y>0 then ... else ....) Or, because the difference is just in a negative mark use such compatible mode. __________________ Amir

 August 24, 2011, 01:23 #7 Member   anonymous Join Date: Feb 2011 Posts: 44 Rep Power: 6 Hi Amir, Thank you for your respond. I can't use If statement since that half circle is not located on the X axis, its moving along the Y axis. Thank you, sarit

August 24, 2011, 03:12
#8
Senior Member

Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Quote:
 Originally Posted by noa Hi Amir, Thank you for your respond. I can't use If statement since that half circle is not located on the X axis, its moving along the Y axis. Thank you, sarit
Dear noa,
It doesn't matter; I just wanted to show the procedure; you can use both methods in this case as well. Here you have to know movement of the interface between 2 y. Suppose the interface moves with this function f(t); then you can substitute this instead of 0 in if-clause. Anyway, if you can post your geometry and your desired moving function, I may help you better.

Bests,
__________________
Amir

August 24, 2011, 04:55
#9
Member

anonymous
Join Date: Feb 2011
Posts: 44
Rep Power: 6
Hi Amir,

My files are attached.

sarit
Attached Files
 wall40.zip (55.7 KB, 5 views)

 August 24, 2011, 06:33 #10 Senior Member     Amir Join Date: May 2009 Location: Shiraz, Iran Posts: 739 Blog Entries: 1 Rep Power: 14 Why don't you separate your outlet and define 2 macro for each(upper_outlet and lower_outlet)? in this case each x has only one y? __________________ Amir

 August 24, 2011, 07:00 #11 Member   anonymous Join Date: Feb 2011 Posts: 44 Rep Power: 6 I tried to do that, but than I get that the parts don't connect smoothly, even when the mesh is denser.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43 SSL FLUENT 2 January 26, 2008 12:55 chris1980 OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 20 May 8, 2006 01:07 Wong Wai Loong FLUENT 1 February 16, 2003 04:39 Luc SEMINEL FLUENT 0 November 25, 2002 05:03

All times are GMT -4. The time now is 04:48.