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

UDF-Source term

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

Like Tree1Likes
  • 1 Post By mingersai

Reply
 
LinkBack Thread Tools Display Modes
Old   August 24, 2011, 13:33
Default UDF-Source term
  #1
New Member
 
zohreh
Join Date: Feb 2011
Location: Tehran
Posts: 20
Rep Power: 6
zhhjll is on a distinguished road
Hello everybody. I have UDF code for define face area but I don't know how can I use it in a source term which is (Ro*u*A)/L, Ro= density, u=velocity, A=area, L= length!!!
this code is for face area but I don't know how can I use it in above source term I am new in UDF!! please help me

DEFINE_ON_DEMAND(calculate_area) { Domain *d = Get_Domain(1); Thread *ft; face_t f; real area = 0.;

thread_loop_f(ft,d) {

begin_f_loop(f,ft)

{

real NV_VEC(farea);

F_AREA(farea,f,ft);

area = NV_MAG(farea);

}

end_f_loop(f,ft) } }
zhhjll is offline   Reply With Quote

Old   August 24, 2011, 13:49
Default
  #2
Member
 
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 6
mingersai is on a distinguished road
what kind of area you want to get?
Area of Single cell or all the cells?
mingersai is offline   Reply With Quote

Old   August 24, 2011, 14:53
Default
  #3
New Member
 
zohreh
Join Date: Feb 2011
Location: Tehran
Posts: 20
Rep Power: 6
zhhjll is on a distinguished road
Quote:
Originally Posted by mingersai View Post
what kind of area you want to get?
Area of Single cell or all the cells?
Dear mingresai thank you for your reply!
I think I should get Area of each face( single face)!!!
zhhjll is offline   Reply With Quote

Old   August 24, 2011, 18:46
Default
  #4
Member
 
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 6
mingersai is on a distinguished road
Quote:
Originally Posted by zhhjll View Post
Dear mingresai thank you for your reply!
I think I should get Area of each face( single face)!!!
The thread pointer in the source term seems to be a phase lever thread,
the geometry data such as area is stored in mixture domain.

I my opinion, you can define a Define on demand function to access the cell face area data and stored them in a udm.

then defined a source term utilize the udm.

If anybody have better ideas, please notice me.
mingersai is offline   Reply With Quote

Old   August 25, 2011, 07:01
Default
  #5
New Member
 
zohreh
Join Date: Feb 2011
Location: Tehran
Posts: 20
Rep Power: 6
zhhjll is on a distinguished road
Quote:
Originally Posted by mingersai View Post
The thread pointer in the source term seems to be a phase lever thread,
the geometry data such as area is stored in mixture domain.

I my opinion, you can define a Define on demand function to access the cell face area data and stored them in a udm.

then defined a source term utilize the udm.

If anybody have better ideas, please notice me.
Dear mingersai
Thanks for your suggestion. would you please help me to write a UDF as you suggest me? really how can I write a udm and then defined a source term utilize the udm.???? I am new in UDF but read alot! thanks
regards
zhhjll is offline   Reply With Quote

Old   August 25, 2011, 09:28
Default
  #6
Member
 
Ming Cai
Join Date: Mar 2011
Posts: 50
Rep Power: 6
mingersai is on a distinguished road
Quote:
Originally Posted by zhhjll View Post
Dear mingersai
Thanks for your suggestion. would you please help me to write a UDF as you suggest me? really how can I write a udm and then defined a source term utilize the udm.???? I am new in UDF but read alot! thanks
regards
I'm not very familiar with face data macros, I was new to udf 2 months ago

I mostly deals with cell data macros.

For cell udm, you just simply need to set udm in the GUI console
Define->user defined-> user defined memory
Set the udm to be the number of udm utilized in the udf

In the case of cell udm, for example I want to store cell volume in udm
I just simply need to write:

DEFINE_ON_DEMAND(name)
{
Domain *d=Get_Domain(1);
Thread *t;
cell_t c;
thread_loop_c
{
begin_c_loop
{
C_UDMI(c,t,0)=C_VOLUME(c,t)
}
end_c_loop
}

DEFINE_SOURCE(name,c,t,dS,eqn) /* For example, source = 1/cell_volume */
{
real source;
source = 1/C_UDMI(c,t,0); /* I'm not sure if it works without Define_on _demand just use source = 1/C_VOLUME(c,t), you can have a try~ */
return source;
}

In the case of face area, you might just need to change cell related macros into face related ones..

Hope it helps. Good Luck
zhhjll likes this.
mingersai is offline   Reply With Quote

Old   August 26, 2011, 07:41
Default
  #7
New Member
 
zohreh
Join Date: Feb 2011
Location: Tehran
Posts: 20
Rep Power: 6
zhhjll is on a distinguished road
Hi, Dear mingresal
Thanks for your help.
I appreciate for your reply to my last post
regards
zohreh
zhhjll is offline   Reply With Quote

Old   August 29, 2011, 02:21
Default velocity inlet udf
  #8
Member
 
Nirav
Join Date: Jul 2011
Posts: 42
Rep Power: 6
niravtm007 is on a distinguished road
Send a message via Skype™ to niravtm007
hiii friends i am entirely new to using udf's in fluent. I have a cubical geometry, with two inlets on perpendicular adjacent faces. i have to implement udf to only one of the conditions.
i have two cases
1) parabolic velocity inlet ( space varient)
2) sinusodial velocity velocity inlet ( time variant)
can any one pls send me the udf ( codes) ...
niravtm007 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Injection of the source term UDF stage81 FLUENT 0 September 27, 2010 07:20
UDF Source Term Christian FLUENT 4 August 1, 2009 05:53
The source term of UDF summer FLUENT 0 August 24, 2006 17:44
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 03:43


All times are GMT -4. The time now is 10:58.