# my udf dos not work

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

 January 7, 2013, 11:44 my udf dos not work #1 New Member   amir Join Date: Dec 2012 Posts: 29 Rep Power: 7 Hi dear friend I wrote a udf code to add a momentum source on flow around my airfoil,but it has no effect on my solution. HTML Code: ```#include "udf.h" DEFINE_SOURCE(my_source,c,t,dS,eqn) { /* Declare Variables */ real xc[ND_ND]; real source, x, y; real m1, m2; real b_bottom, b_left, b_top, b_right; real check_bottom, check_left, check_top, check_right; /* Call x and y data from FLUENT */ C_CENTROID(xc,c,t); x=xc[0]; y=xc[1]; /* Define region. Four inequalities are used to define the rectangular region. */ m1=0.5250; m2=-1.9048; b_bottom=0.0089; b_left=0.0575; b_top=0.0090; b_right=0.0790; check_bottom=m1*x+b_bottom; check_left=m2*x+b_left; check_top=m1*x+b_top; check_right=m2*x+b_right; /* Apply source term to region inside the four inequalities */ if ((y>=check_bottom)&&(y>=check_left)&&(y<=check_top)&&(y<=check_right)) { source = 1000.0; dS[eqn] = 0; } else { source = 0; dS[eqn] = 0; } C_UDMI(c,t,0)=source; return source; }``` Can everybody help me about this ?

 January 7, 2013, 12:35 #2 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,384 Blog Entries: 23 Rep Power: 22 I'm not an expert, please look at this thread : http://www.cfd-online.com/Forums/flu...g-happens.html I hope it can solve your problem... amir_14 likes this. __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/KAOIwm Ali

January 7, 2013, 13:15
#3
New Member

amir
Join Date: Dec 2012
Posts: 29
Rep Power: 7
Quote:
 Originally Posted by diamondx I'm not an expert, please look at this thread : http://www.cfd-online.com/Forums/flu...g-happens.html I hope it can solve your problem...
hi dear M. Ali
1.my mesh is not enough fine and i should adapt mesh near airfoil's wall to be cell centroids within the ranges. Is this wrong?
2.you increase the amount of source from 1000 to 10000.Why?

 January 7, 2013, 13:18 #4 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,384 Blog Entries: 23 Rep Power: 22 back in those days i didn't know the magnitude of the value of the source i was giving. i wa thinking that may be 1000 will do nothing to my flow... Try playing a little bit with your bottom left right limits, see if it can changes the solution amir_14 likes this. __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/KAOIwm Ali

January 7, 2013, 14:44
#5
New Member

amir
Join Date: Dec 2012
Posts: 29
Rep Power: 7
Quote:
 Originally Posted by diamondx back in those days i didn't know the magnitude of the value of the source i was giving. i wa thinking that may be 1000 will do nothing to my flow... Try playing a little bit with your bottom left right limits, see if it can changes the solution
can you help me about Number of User-Defined Memory Locations ?
Is it important?

 January 7, 2013, 14:46 #6 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,384 Blog Entries: 23 Rep Power: 22 no, where do you see that. did you follow the tutorial about UDF integration ??? It can really help __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/KAOIwm Ali

January 7, 2013, 14:53
#7
New Member

amir
Join Date: Dec 2012
Posts: 29
Rep Power: 7
Quote:
 Originally Posted by diamondx no, where do you see that. did you follow the tutorial about UDF integration ??? It can really help
it is necessary because of C_UDMI but i don't know number of this

 January 7, 2013, 14:59 #8 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,384 Blog Entries: 23 Rep Power: 22 are talking about the zero in the C_UDMI __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/KAOIwm Ali

January 7, 2013, 15:04
#9
New Member

amir
Join Date: Dec 2012
Posts: 29
Rep Power: 7
Quote:
 Originally Posted by diamondx are talking about the zero in the C_UDMI
yes
without change of this in define menu i have an error at ansys running
when i define 1 for Number of User-Defined Memory Locations run will start

 January 7, 2013, 15:21 #10 New Member   amir Join Date: Dec 2012 Posts: 29 Rep Power: 7 Dear Ali do you suggest me change magnitude and position of source term?

 January 7, 2013, 15:29 #11 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,384 Blog Entries: 23 Rep Power: 22 yes of course do it so you can pinpoint the problem.... amir_14 likes this. __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/KAOIwm Ali

January 7, 2013, 15:46
#12
New Member

amir
Join Date: Dec 2012
Posts: 29
Rep Power: 7
Quote:
 Originally Posted by diamondx yes of course do it so you can pinpoint the problem....
tanx for your help dear Ali
I will try this

 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 blaid FLUENT 0 March 6, 2012 13:29 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 AndresC FLUENT 0 February 25, 2010 16:50 Matthias FLUENT 1 January 9, 2009 01:44 H.S.Fang FLUENT 0 December 27, 2001 22:21

All times are GMT -4. The time now is 17:51.