|October 28, 2003, 06:40||
UDF source terms
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 con, source;
C_CENTROID(x, c, t);
con = C2*0.5*C_R(c, t)*x;
source = -con*fabs(C_U(c, t))*C_U(c, t);
dS[eqn] = -2.*con*fabs(C_U(c, t));
|October 30, 2003, 11:48||
Re: UDF source terms
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
2*con*C_U if C_U < 0
which is equivalent to dS = -2*con*|C_U|
|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|