CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

regarding the following UDF

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

Like Tree2Likes
  • 1 Post By pakk
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 21, 2014, 09:52
Default regarding the following UDF
  #1
New Member
 
rajendra soni
Join Date: Nov 2013
Location: guwahati
Posts: 7
Rep Power: 12
rp.soni is on a distinguished road
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
rp.soni is offline   Reply With Quote

Old   January 21, 2014, 10:46
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
  • Try to compile it. Do you get errors? Something is wrong, try to understand where the error comes from and fix it.
  • If you don't get errors, try to use it, and see if you get errors when you run the simulation. Do you get errors? Something is wrong, try to understand where the error comes from and fix it.
  • If you still don't have errors, examine the results. Did the UDF do what you expected? In this case, it seems like you want to generate heat in a sinusoidal pattern. So just calculate the generated heat, and see if it indeed a sinuasoidal pattern in time.
One remark already:
Code:
 
 pi= 22.0/7.0;
Although this might be sufficiently accurate in your case, it looks... unprofessionally...
Just use the built-in constant M_PI instead.
rp.soni likes this.
pakk is offline   Reply With Quote

Old   January 22, 2014, 01:25
Default regarding UDF
  #3
New Member
 
rajendra soni
Join Date: Nov 2013
Location: guwahati
Posts: 7
Rep Power: 12
rp.soni is on a distinguished road
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...
rp.soni is offline   Reply With Quote

Old   January 22, 2014, 04:35
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   January 22, 2014, 14:39
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,149
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
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.
rp.soni likes this.
sbaffini is offline   Reply With Quote

Old   January 23, 2014, 09:26
Default regarding UDF
  #6
New Member
 
rajendra soni
Join Date: Nov 2013
Location: guwahati
Posts: 7
Rep Power: 12
rp.soni is on a distinguished road
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...
rp.soni is offline   Reply With Quote

Old   January 26, 2014, 13:27
Default
  #7
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,149
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
I can't see any other obvious mistake.
sbaffini is offline   Reply With Quote

Old   January 27, 2014, 01:08
Default
  #8
New Member
 
rajendra soni
Join Date: Nov 2013
Location: guwahati
Posts: 7
Rep Power: 12
rp.soni is on a distinguished road
thanks a lot 4 replying...
rp.soni is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 00:27.