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

UDF - source terms

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 8, 2005, 06:17
Default UDF - source terms
  #1
Fred
Guest
 
Posts: n/a
Dear fluent users, My problem is application of source terms to a zone(s) inside a fluid domain.Here i want to know how to extract the nodal coordinates of the domain and using this x,y,z values of the complete domain, few no.of cells need to be selected to apply source terms. I have tried the following way but could not get it.

#include <"udf.h"> DEFINE_SOURCE(mom_source,c,t,dS,eqn) { Node *node; x = NODE_X(node); y = NODE_Y(node);

real source,x,y; if (x<=0 && x>=10 ..........) */to pick the cells in the domain for the application of source terms*/ { source = 100; dS[eqn]= 0; } else source = 0; dS[eqn]= 0; }

return source;

}

How to solve this problem of extracting the coordinates of the domain.Any suggestions are appreciated.

In STAR-cd directly you can access the nodal cordinates by X,Y and Z varaibles through user coding.In fluent i find UDFs are not that user friendly as other softwares. Thanks in Advance. Fred

  Reply With Quote

Old   October 10, 2005, 04:33
Default Re: UDF - source terms
  #2
RoM
Guest
 
Posts: n/a
To access node values you will first have to loop over all cell nodes using c_node_loop macro. You could also use the cell center coordinates instead of all those node values wich is imho the better option.

RoM


#include "udf.h"

DEFINE_SOURCE(mom_source,c,t,dS,eqn)
{
real source,x,y;
int n;
Node *node;

c_node_loop(c,t,n) /* loop over all cell nodes */
{
node=C_NODE(c,t,n);
x = NODE_X(node);
y = NODE_Y(node);
if (x<=0 && x>=10) /*to pick the cells in the domain for the application of source terms*/
{
source = 100.0;
dS[eqn]= 0.0;
}
else
{
source = 0.0;
dS[eqn]= 0.0;
}
}
return source;
}

/* better */
DEFINE_SOURCE(mom_source,c,t,dS,eqn)
{
real source,x[2];
C_CENTROID(x,c,t); /* store cell center coordinates in vector x : x[0]=x , x[1]=y */

if (x[0]<=0 && x[0]>=10) /*to pick the cells in the domain for the application of source terms*/
{
source = 100.0;
dS[eqn]= 0.0;
}
else
{
source = 0.0;
dS[eqn]= 0.0;
}

return source;
}
  Reply With Quote

Old   October 11, 2005, 21:53
Default Re: UDF - source terms
  #3
Reginaldo Paula
Guest
 
Posts: n/a
Fred

For instance, you can make the procedure following:

If your equation is S = - 0.5 * A * B * u * u * ui

Where A and B are constants, u is the velocity vector and ui is the velocity component. You can write the following UDF:

DEFINE_SOURCE(x_mom, c, t, dS, eqn) { real con, source; real x; real y;

con =0.5 * A*B;

source = - con*fabs(sqrt(pow(C_U(c,t),2)+pow(C_V(c,t),2)))*C_ U(c,t);

dS[eqn]= -2*con*fabs(sqrt(pow(C_U(c,t),2)+pow(C_V(c,t),2)));

return source; }

In GAMBIT you define the boundary of the FLUID REGION.

After the compilation or interpretation of UDF source term in FLUENT, do:

Define - Boundary Conditions â€" Fluid &hellip;

Open Fluid Painel. Thus, set source term option, and introduce your UDF in the X-Momentum list(or Y and Z) list.

  Reply With Quote

Reply


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
UDF for source term in momentum equation Enrico FLUENT 9 May 30, 2014 12:34
UDF source term jerome_ FLUENT 2 July 11, 2011 12:55
Using source terms jsm Main CFD Forum 4 August 20, 2009 07:44
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
I have problem of UDF with turbulent premx source. Z FLUENT 0 February 16, 2005 04:34


All times are GMT -4. The time now is 20:47.