UDF code for heat generating source
hi dear friends
I am supposed to write a udf for heat generation rate which is a function at this form: http://uupload.ir/files/uyew_cfd123.jpg I prepared this code for simulating : #include "udf.h" #define EPS 0.01 #define SIGMA 0.004 DEFINE_SOURCE(cell_x_source, cell, thread, dS, eqn) { real x[ND_ND]; real source; C_CENTROID(x,cell,thread); source=EPS*exp(((x[0]-0.4)*(x[0]-0.4)+(x[1]-0.004)*(x[1]-0.004))/(-SIGMA*SIGMA)); dS[eqn]=0; return source; } but is not work. this code dont have any effect in my results. dear friend I have less than 5 days for simulating this. please help me and I will thankfull of you... |
hi yashar,
i think first you define scalar for x[0] and x[1] and also write udf for initialization of x[0] and x[1] regards, krushna |
It is not about x[0] and x[1], they are defined in the code and you don't need a udf to initialize them.
Can you tell us what you did with the code? You saved it in a text file, and then what? How did you tell Fluent to use this code? (And are you sure that the source locus, (x0,y0)=(0.4,0.004), is in your domain?) |
Quote:
I have written this code on the notepad and save it with .c format If you see the pictures that I was adding in first post, I am trying to add this code in energy equation user define-->function-->interpreted-->and after choosing the file, I have interpreted the code then I in boundary condition part, I choose fluid and adding the code to the heat source part I want to this code define a heat source in (0.4.0.004) and affect boundary layer but unfortunately it is not work and there is heat source effects in the results as you said I am going to check domain again |
Those seem like good steps...
To check if your code is really used, you can put the following line in: Code:
Message("Test\n"); Another thing you could do is to increase epsilon for testing. Maybe the source is really added, but the effect is too small to notice. Change epsilon from 0.01 to a big value such as 1000, and see if your result changes. |
Quote:
Error: H:\source.c: line 14: function "CX_Message" not found (pc=128). :(:(:(:(:(:(:(:(:( |
Quote:
Use printf instead. printf("test\n"); |
Quote:
:( |
To be clear: the text should show up when you clicked 'Calculate'.
If it doesn't show up then, the code is never run by Fluent, but I can not explain why not. |
Quote:
it is works.....when i push calculate buttun many of test!!! letter are written in the interfaaaaaaaaaaaaaaaaace! yohuuuuuuuuuuuuuuuuuuuuu:p:p:p:p:p |
Quote:
fluent process the problem so as soon as I see the results I will tell you dear friend you are reallllllllllllllly helpful person thank alooooooooooooooooot |
Quote:
what you are trying to do? if you want to include the heat generation source as surface heat flux, you can apply using DEFINE PROFILE... |
Hi,
I'm not sure if it has been addressed already but I think source UDFs can only be compiled and interpreted. Bhargav |
Quote:
|
All times are GMT -4. The time now is 19:31. |