CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Hard problem in simple a rectangle: UDF not optimal? (http://www.cfd-online.com/Forums/fluent/94492-hard-problem-simple-rectangle-udf-not-optimal.html)

Nano_Cryo November 17, 2011 09:09

Hard problem in simple a rectangle: UDF not optimal?
 
Hi everybody,

Im facing a hard problem which seemed really easy at first sight.

My case here is 2D, steady and purely thermal.
It's a rectangle representing 3 layers:
n1: steel with a thermal conductivity depending on the temperature (~200W/m/K defined in "materials" with piecewise-linear)
n2: a first insulation layer also depending on the temperature (~0.02W/m/K and also defined with piecewise-linear)
n3: another insulation layer, here again depending on T and defined the same way (~0.01W/m/K)

The two sides are defined as Symetries and the bottom wall is defined with a 20K temperature.
I apply a convection flux on the top wall with an UDF, which defines a flux depending on the temperature: phi=f(T)

Here is my UDF:

#include "udf.h"
DEFINE_PROFILE(name,thread,i)
{
real T_p; /* T_p is the top wall temperature*/
face_t f;

begin_f_loop(f,thread)
{
T_p=F_T(f,thread);

if((T_p>=1)&&(T_p<306))
{F_PROFILE(f,thread,i)=-128*T_p+39168;}
if((T_p>=306)&&(T_p<310))
{F_PROFILE(f,thread,i)=-2.075*T_p+634.9;}
if((T_p>=310)&&(T_p<320))
{F_PROFILE(f,thread,i)=-3.57*T_p+1098;}
if((T_p>=320)&&(T_p<1320))
{F_PROFILE(f,thread,i)=-4.6*T_p+1428;}
}
end_f_loop(f,thread)
}

My problem is that this calculation leads to asymetric solutions in temperature (isolated hot cells for instance) which is not physical!
Since I applied a single definition on a perfectly straight wall (im considering rectangle, remember?), i'm expecting a perfectly symetrical solution.
Even worse, if you only consider the first equation, the calulation diverges and fails!


#include "udf.h"
DEFINE_PROFILE(name,thread,i)
{
real T_p;
face_t f;

begin_f_loop(f,thread)
{
T_p=F_T(f,thread);

F_PROFILE(f,thread,i)=-128*T_p+39168;
}
end_f_loop(f,thread)
}

I literaly tried a million things to have it run propely and nothing worked, no collegue found a solution and even the Fluent Support Line could not help me...

The only I could do was reducing the under-relaxation factor for energy down to 0.3 which is too low to be used later on in my model!

I would highly appreciate any help, any idea, any thought which would lead to the very beginning of a solution. :D
Dont hesitate of you have any question to ask or to contact me!

Thanks everybody,
Nano

Nano_Cryo November 21, 2011 09:17

No idea? I'd really appreciate some help!
Has nobody experienced problem in a thermal case (no fluid) involving a profile defined through an UDF?

pstreufert November 21, 2011 15:28

Have you tried running the simulation with a constant heat flux applied rather than using a UDF to try and isolate your problem (pin down whether it's a issue with the model vs. the UDF)?

Nano_Cryo November 22, 2011 06:23

First of all: thx for your answer!

Yes I did and it worked! Which is why Im confused...

I tried udf removing my first linear equation (and leting my materials defined as function of temperature) and it worked perfectly, leading me to the conclusion that the problem was due to that particular equation being too... something ^^

Then I tried my UDF (with the first equation) but replacing each material by regular Aluminim from Fluent database: no problem, everything worked fine, leading to a second conclusion: my first equation can be supported by Fluent in that case. It also meant that maybe the problem was due to the duo fluxe(T) vs lambdaS(T) --> I insist on the "S" since i have 3 different material function of the temperature.

I tried then to define my materials with a common but fixed lambda, which is an approximative value within them: 0.02. I used my regular UDF (with the first equation). Boom! Fluent cant have it work propely. Conclusion: No problem with my UDF but with the lambda.

Summing up:
-UDF minus 1st equation + my materials: OK
-UDF + Aluminum: OK
-UDF + my materials: pb
-UDF + fixed value (0.02): pb

Any ideas???


All times are GMT -4. The time now is 09:51.