|
[Sponsors] |
October 23, 2015, 09:07 |
UDF code for heat generating source
|
#1 |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
hi dear friends
I am supposed to write a udf for heat generation rate which is a function at this form: 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... |
|
October 27, 2015, 03:14 |
|
#2 |
New Member
krushna shekde
Join Date: Oct 2015
Posts: 9
Rep Power: 11 |
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 |
|
October 28, 2015, 07:31 |
|
#3 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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?) |
|
October 28, 2015, 08:06 |
|
#4 | |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
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 |
||
October 28, 2015, 08:10 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
October 28, 2015, 08:26 |
|
#6 | |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
Quote:
Error: H:\source.c: line 14: function "CX_Message" not found (pc=128). |
||
October 28, 2015, 08:29 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
||
October 28, 2015, 08:44 |
|
#8 |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
||
October 28, 2015, 08:48 |
|
#9 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
October 28, 2015, 08:53 |
|
#10 | |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
Quote:
it is works.....when i push calculate buttun many of test!!! letter are written in the interfaaaaaaaaaaaaaaaaace! yohuuuuuuuuuuuuuuuuuuuuu |
||
October 28, 2015, 09:06 |
|
#11 | |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
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 |
||
October 31, 2015, 04:56 |
|
#12 | |
New Member
Ganesh K C
Join Date: Oct 2014
Location: Tiruchirappalli, India
Posts: 29
Rep Power: 12 |
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... |
||
November 18, 2015, 12:55 |
|
#13 |
Member
Bhargav Bharathan
Join Date: Jun 2015
Location: Montreal, Canada
Posts: 71
Rep Power: 11 |
Hi,
I'm not sure if it has been addressed already but I think source UDFs can only be compiled and interpreted. Bhargav |
|
November 18, 2015, 15:24 |
|
#14 |
New Member
yashar_aryanfar
Join Date: Oct 2015
Posts: 7
Rep Power: 11 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] difficulties installing swak4foam | newbie29 | OpenFOAM Community Contributions | 120 | October 21, 2022 05:01 |
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc | ofslcm | OpenFOAM Community Contributions | 25 | March 6, 2017 11:03 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 12:44 |
Please help me run UDF code for source | Suga | FLUENT | 1 | February 3, 2006 04:40 |