CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF source term (http://www.cfd-online.com/Forums/fluent-udf/40664-udf-source-term.html)

Rajani Kanth.B April 20, 2006 06:03

UDF source term
 
Hi I am new to UDF in CFD.Iam doing two way coupling(turbulence modulation:particles effecting turbulence) problem in a vertical pipe In writing the code for source term for k equation I am struggling to define ds[eqn]

my source term for k equation is 1-(t*/(t*+t_p))

where 1/t*=[1/(0.135(k/e))]+[urel/(0.22k^1.5/e)(turbulent time scale) t_p=rho_p*d_p^2/18*mu (particle response time or particle time constant)

rho_p density of the particle d_p diameter of the particle mu viscosity of the fluid urel relative velocity whcich is equal to t_p*g

I am trying in this way. #include "udf.h"

#define alpha 1 #define dp 0.003 #define rhop 1020 #define u_rel 1

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

{ /* real x[ND_ND]; */

real source;

t_p=((dp*dp)*rhop)/(18*C_MU_L(c,t)); /* particle time constant */

1/t_t=(1/(0.135*(C_K(c,t)/C_D(c,t))))+(u_rel*C_D(c,t)/(0.22*C_K(c,t)^1.5));/* effective turbulent time scale */

source=(2*C_K(c,t)*alpha/t_p)(1-(t_t/(t_t+t_p));

/* dS[eqn]= */

return source;

}

could you please figure out my problem in writing the proper source code

Kasper Skriver April 20, 2006 11:16

Re: UDF source term
 
I THINK that you have two options:

1) setting dS = 0

or

2) setting dS = d(Source-term)/d(k), where k is the variable that you are solving for. I think k is then you turbulent energy.

Kasper/Denmark

Rajani Kanth.B April 21, 2006 05:05

Re: UDF source term
 
Thank you Kasper.U gave me little idea to work.I think I have to do some more changes to the code to run. If it has to derive the Source term with k do I need to assume all the remaining as constants?Please Let me know


mactech001 January 11, 2013 04:08

Temperature-dependent heat source
 
Dear all,

i want to apply a heat source that is temperature-dependent. It is a copper winding of an electrical machine, and the resistance of the winding increases with temperature, and consequently the heat loss increases with it.

i've look at the following:
1) starting with understanding how DEFINE_PROFILE works for a wall heat generation.
2) looked into a simple code example for DEFINE_SOURCE in ansys help.

But, am i right to take the following approach?

1) use DEFINE_SOURCE
2) use C_T to feedback temperature into the temperature-dependent equation to calculate the 'new' heat source value

Any comments is greatly appreciated. Thanks!

micro11sl May 1, 2013 09:31

It looks you missed a multiply sign in the source term:
source=(2*C_K(c,t)*alpha/t_p)(1-(t_t/(t_t+t_p));
source=(2*C_K(c,t)*alpha/t_p)*(1-(t_t/(t_t+t_p));

Define ds[eqn] is simple for this case. Just find the partial derivative to C_K(c,t) of the source term. An undergraduate level math knowledge can get it.


All times are GMT -4. The time now is 18:37.