CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   about linearization of source term(udf) (https://www.cfd-online.com/Forums/fluent/45003-about-linearization-source-term-udf.html)

Rebecca June 12, 2007 07:32

about linearization of source term(udf)
 
hello,friends,are you familiar with the user defined sources? i have a questions about linearization of the source: if the source term is caculated by values which are already known, it is the same as a constant, isn't it? so ds=0?


Diego June 12, 2007 14:25

Re: about linearization of source term(udf)
 
Hi Rebecca. Supose you want to include a source in the equation of a property called "x" (temperature, velocity or any UDS).

Your source may or not depend on x. Supose your source is:

S = 2 * x^3;

You evaluate this value for the current iteration (the value that Fluent already has in memory), getting:

S = 2 * (x0) ^3 , where x0 is the current value of x.

But you can give Fluent more information, you can tell him what is the value of the derivative of S respect to x in the current iteration:

dS = 2 * 3 * x0^2

Fluent will evaluate if using this new information boosts the convergence or not, and will use it or not.

You can always give the value dS = 0, but if you give him the derivative you can enhance the convergence.

**** You can also use this to avoid negative values of the variable x. For this purpose you must have an always negative derivative which becomes zero when x = 0.

If the variable in question is volume fraction or mass in a multiphase analysis, I think you cannot pass the value of the derivative to the solver, the treatment of this equation is diferent from the others.

Greetings!

Diego, at Uvigo

sara June 20, 2007 14:23

source term(udf)+two phase flow+urgent
 
I have a two phase problem "one phase is air and the other phase is water", and I want to add source term in continuity equation of air, I wrote bellow udf and I add it to my case, Although there is not any error during interpret of udf, but the flow field doesn't change. I've attached the udf. I'm looking forward to hearing from you. Thank you In Advance sara

#include "udf.h" #define C2 .0009672 DEFINE_SOURCE(mass_source,c,t,dS,eqn) { real xc[ND_ND]; real source, vf, vol, den; vf = C_VOF(c,t); vol = C_VOLUME(c,t); den = C_R(c,t); source = -1*C2*den*(pow(vf,0.6667)/pow(vol,0.333)); dS[eqn] = 0.0; C_CENTROID(xc,c,t); if (xc[1] == 0.84) source =source+80.84; else source =source+0.0; return source; }

maziyarghani September 15, 2017 03:53

Hello
I want to write a negative source term or heat flux UDF which has a linear relation with temperature
I am very beginner in UDF could you help me?


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