CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF source terms

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

Like Tree1Likes
  • 1 Post By ap

LinkBack Thread Tools Display Modes
Old   October 28, 2003, 06:40
Default UDF source terms
Andrew Garrard
Posts: n/a
I am starting to learn source terms in UDF, I have looked at the manual in section 4.3.8. I have a couple of questions:

1) Is it necessary to specify you dS term? What if your equation varies with as a function of a variable that you are not setting the source for, eg, you are setting heat source as a function of x velocity.

2) in the example what is the "fabs" part all about?

DEFINE_SOURCE(xmom_source, c, t, dS, eqn)


real x[ND_ND];

real con, source;

C_CENTROID(x, c, t);

con = C2*0.5*C_R(c, t)*x[1];

source = -con*fabs(C_U(c, t))*C_U(c, t);

dS[eqn] = -2.*con*fabs(C_U(c, t));

  Reply With Quote

Old   October 30, 2003, 11:48
Default Re: UDF source terms
Posts: n/a
1) It's not necessary to define dS. You can define it or put dS=0. This, however, may afflict the stability of the solution because it forces FLUENT to explicitly manage the source term.

The dS term has to be defined as the derivative of the source term with respect to the dependent variable of the transport equation.

If your source is not function of the dependent variable of the transport equation, just set dS[eqn] = 0.

2) fabs is the C function which returns the absolute value of a float variable.

It's used to avoid an if statement for the dS[eqn] definition. You can write (supposing con > 0):

-con*(C_U)^2 if C_U >= 0
source = -con*|C_U|*CU =
con*(C_U)^2 if C_U < 0

so you'd have

-2*con*C_U if C_U >= 0
dS =
2*con*C_U if C_U < 0

which is equivalent to dS = -2*con*|C_U|


DungPham likes this.
  Reply With Quote


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
UDF for source term in momentum equation Enrico FLUENT 9 May 30, 2014 11:34
UDF source term jerome_ FLUENT 2 July 11, 2011 11:55
Using source terms jsm Main CFD Forum 4 August 20, 2009 06:44
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17: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 17:52.