regarding the following UDF
Hii friends...i am using UDF for source term of volumetric heat generation for my 2D simulation of heat transfer. Since i am new user for UDF, so i am in doubt whether i have written a correct UDF or not. UDF is given below.
/* sinusoidal heat generation in heater*/ #include "udf.h" DEFINE_SOURCE(heat_gen_1e5,cell,thread,dS,eqn) { double source,time,A,B,omega,pi,time_period ; A = 1.0e2, B=1.0e5; pi= 22.0/7.0; time_period = 900.0; //time in seconds; time = CURRENT_TIME; //taking time value; omega = (2.0*pi)/time_period; source = A+B*(1+sin(omega*time)); //dS[eqn]= B*omega*cos(omega*time); dS[eqn]= 0.0; return source; } Kindly go through this UDF and reply whether it is in correct format or not. Thanking you |
We could (with a lot of effort) check it for you, but I think it is better if you learn how do check it yourself.
Code:
Just use the built-in constant M_PI instead. |
regarding UDF
Thanks Pakk....
I have already compiled and i did not get any error. Actually I was thinking that if antbody have used this type of UDF then they can guide me whether I have written correct UDF or not.. I will run simulation and try to analyse the results.. Thanks for giving your valuble time... |
If your UDF compiles and runs without errors, you have written a correct UDF. But there are billions of correct UDFs; most of them don't have the effect what you want. You haven't specified which effect you want, so nobody here can check that.
|
My two cents, just for you to know.
The term "dS[eqn]", which you have fortunately commented, is intended to be the derivative of the source term with respect to the dependent variable of the equation you are solving for. In your case it should be the derivative with respect to the TEMPERATURE, so for your source term it has to remain 0. |
regarding UDF
Thank u sbaffini for your valuble suggestions..
Ir means whatever code I have written is correct, right? Actually I was not sure that's why I asked for this UDF issue...:) |
I can't see any other obvious mistake.
|
thanks a lot 4 replying...
|
All times are GMT -4. The time now is 08:34. |