CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   my udf dos not work (http://www.cfd-online.com/Forums/fluent-udf/111441-my-udf-dos-not-work.html)

 amir_14 January 7, 2013 11:44

my udf dos not work

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; }```

 diamondx January 7, 2013 12:35

I hope it can solve your problem...

 amir_14 January 7, 2013 13:15

Quote:
 Originally Posted by diamondx (Post 400533) 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?

 diamondx January 7, 2013 13:18

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 January 7, 2013 14:44

Quote:
 Originally Posted by diamondx (Post 400540) 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?

 diamondx January 7, 2013 14:46

no, where do you see that. did you follow the tutorial about UDF integration ???
It can really help

 amir_14 January 7, 2013 14:53

Quote:
 Originally Posted by diamondx (Post 400558) 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

 diamondx January 7, 2013 14:59

are talking about the zero in the C_UDMI

 amir_14 January 7, 2013 15:04

Quote:
 Originally Posted by diamondx (Post 400567) 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

 amir_14 January 7, 2013 15:21

Dear Ali
do you suggest me change magnitude and position of source term?

 diamondx January 7, 2013 15:29

yes of course do it so you can pinpoint the problem....

 amir_14 January 7, 2013 15:46

Quote:
 Originally Posted by diamondx (Post 400573) yes of course do it so you can pinpoint the problem....
tanx for your help dear Ali
I will try this

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