CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF for source term in momentum equation (http://www.cfd-online.com/Forums/fluent/34991-udf-source-term-momentum-equation.html)

 Enrico November 4, 2004 05:50

UDF for source term in momentum equation

Hi all I write a UDF for source term in momentum equation this source term is : A.( du/dx) , where u is the x-component of the velocity ...

please can somebody tell me what is the mistacke I have do in this UDF

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

real source;

source = A*C_DUDX(c,t);

return source; }

 Andrew Garrard November 4, 2004 06:50

Re: UDF for source term in momentum equation

you haven't defined A?

 Sun November 5, 2004 04:26

Re: UDF for source term in momentum equation

Not only that you have not defined A, but also you have to add one more statement namely:

dS[eqn]=0;

Good Luck to you. Sun

 enrico November 6, 2004 05:26

Re: UDF for source term in momentum equation

A is a constant

 Bowling November 9, 2004 05:27

Re: UDF for source term in momentum equation

Yes, A is a constant but you must define it. for example; DEFINE_SOURCE(xmom_source, c, t, dS, eqn) { real source; int A; A=22; source = A*C_DUDX(c,t); dS[eqn]=0;

return source; }

"A" can be real or integer. It is up to you.

 enrico November 10, 2004 07:06

Re: UDF for source term in momentum equation

Hi ,Bowling , but why dS[eqn]=0 ? dS[eqn]=dS/dU

 Bowling November 12, 2004 01:58

Re: UDF for source term in momentum equation

You are misunderstand. dS[eqn] in here means d(source)/d(your parameter) eg. x-momentum, your parameter is U your source is A*(dU/dX), so dS[eqn] is second derivative of dU/dX equal d^2U/dX^2. Diff your source by your parameter.

dS[eqn] is the way to define your source solving. I don't know how to explain. You can read more infomation in fluent document.

Bowling

 enrico November 13, 2004 04:33

Re: UDF for source term in momentum equation

Hi Bowling , should i use UDS for calculating dS[eqn] ?

 Bowling November 15, 2004 01:20

Re: UDF for source term in momentum equation

I don't think so. It is the condition in DEFINE_SOURCE. It is the way to solve in the finite volume method not a scalar.

Bowling

 itsme_kit May 30, 2014 11:34

how do we know this formula: source = A*C_DUDX(c,t);

I have a equation for velocity gradient: dudz=const

However, I have no idea how to transfer my equation into this kind of form: source = A*C_DUDX(c,t);

Thanks

 All times are GMT -4. The time now is 16:02.