
[Sponsors] 
March 16, 2001, 12:12 
UDF's  linearizing a negative source term

#1 
Guest
Posts: n/a

Sponsored Links
I'm trying to write my own implementation of the ke turbulence model using Fluent's User Defined Functions. I am trying to solve a simple 2D jet flow, and my UDFimplementation predicts a solution which is very similar to the Fluentimplementation solution, provided I use the Fluent solution as the initial field. If I use a uniform field as the initial field, then the solution procedure diverges. The problem is that both the k and eequations contain dissipation terms which are negative. If these are simply included in the source term, then the k and efields diverge: k goes large and negative, whereas e goes large and positive. I have written my own code in the past, and I solved this problem by dividing the dissipation term by the appropriate variable and then adding this to the apcoefficient, i.e. for the kequation, don't add the dissipation term to the source term, instead divide it by k and add it to the apcoefficient in the discretised kequation. Unfortunately, I can't figure out how to do this successfully using the Fluent UDF's. I have identified some variables in the header files  C_UDSI_AP(c,t,i) from sg_mem.h, and C_UDSI_S(c,t,i) from mem.h, which I presume are the apcoefficient and source term respectively. I have also identified the function C_NEGATIVE_SOURCE_LINEARIZE from sg.h which should linearize the source terms as required. However, all attempts to use the above approaches have failed due to several reasons 1)segmentation errors, 2)divergence detected in the amgif solver, 3)getting a significantly different prediction to the Fluentimplementation solution. I've tried all the reasonable approaches that I can think of. Does anyone else have experience with this type of problem, or can anyone help in any way? Thanks in advance, Steve Howell. 

Sponsored Links 
March 18, 2001, 17:21 
Re: UDF's  linearizing a negative source term

#2 
Guest
Posts: n/a

Steve,
Have you used the dS[] variable inside your DEFINE_SOURCE macro? This is supposed to hold the implicit part of the source term, so you can use it to impose a negative linearization. I've implemented the kepsilon model by using something like: DEFINE_SOURCE(k_source,c,t,dS,eqn) { real k = MAX(C_UDSI(c,t,0),1.e10); real d = MAX(C_UDSI(c,t,1),1.e10); real inv_t = d/k; . . . dS[eqn] = C_R(c,t)*inv_t; return Production  C_R(c,t)*d; } DEFINE_SOURCE(eps_source,c,t,dS,eqn) { real k = MAX(C_UDSI(c,t,0),1.e10); real d = MAX(C_UDSI(c,t,1),1.e10); . . . dS[eqn] = 2.*C_EPS_2*C_R(c,t)*d/k; return C_EPS_1*Production*d/k  C_EPS_2*C_R(c,t)*d*d/k; } Here k and epsilon are stored as userdefined scalars 0 and 1 respectively. This has worked pretty well. Keith 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
gradient source term UDF  ak6g08  Fluent UDF and Scheme Programming  0  July 9, 2009 06:37 
Axisymmetrical mesh  Rasmus Gjesing (Gjesing)  OpenFOAM Native Meshers: blockMesh  10  April 2, 2007 14:00 
Adding a momentum source term  segersson  OpenFOAM Running, Solving & CFD  5  March 3, 2006 00:06 
UDF Source Term Units?  Brian  FLUENT  1  October 24, 2005 09:15 
UDFs for Scalar Eqn  Fluid/Solid HT  Greg Perkins  FLUENT  0  October 11, 2000 03:43 
Sponsored Links 