CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   DEFINE_SOURCE error? (https://www.cfd-online.com/Forums/fluent-udf/107185-define_source-error.html)

twray September 19, 2012 16:26

DEFINE_SOURCE error?
 
I'm trying to implement the RAS turbulence model and am having a problem with the R transport equation. If I hard code a value for R and turn the equation off I get reasonable results and trends for all my variables. When I turn the R equation on the solution diverges or I get non physical results. Based on trial and error, I think the problem is in my DEFINE_SOURCE.

DEFINE_SOURCE(r_source, c, t, dS, eqn)
{
real source;
source = C_UDMI(c,t,C1)*C_R(c,t)*sqrt(C_UDMI(c,t,P)*C_UDSI( c,t,RTilda))-C_UDMI(c,t,C2)*C_R(c,t)*SQR(C_UDSI_G(c,t,RTilda)[0]+C_UDSI_G(c,t,RTilda)[1]);
dS[eqn] = 0.0;
return source;
}

RTilda is a UDS so that I can use C_UDSI_G to get the gradient easily. Is my use of C_UDSI_G correct? Is there some other error here?


All times are GMT -4. The time now is 00:48.