CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Inlet won't apply UDF and has temperature at 0K! (https://www.cfd-online.com/Forums/fluent-udf/97467-inlet-wont-apply-udf-has-temperature-0k.html)

 tccruise February 17, 2012 13:11

Inlet won't apply UDF and has temperature at 0K!

Hi all. I am quite new here. I have a serious problem when simulating an AC in an empty room. The AC has 2 mass flow inlets and 2 pressure outlets. To simulate realistic AC operation, inlet temperature is set via UDF to be a function of both time and average outlet temperature. Both inlets have the same temperature at a given time. The inlets are seperate and named as INRight and INLeft.

My problem is this: while using the exact same UDF for temperature profile, INLeft had a correct temperature profile, as predicted by the UDF; but INRight was always at 0K (:eek:) throughout its whole face! INRight was actually sending out 1K air (FLUENT will limit temperature to 1K whenever it is below 1K).

I can't have the two inlets as one because they have different inlet directions and should be kept seperate.
To try to find out the problem, I tried setting INLeft to WALL and left only one inlet INRight (Don't know why I did it, just my instinct..) and INRight was still 0K, tried setting temperature with two functions udf_TempL and udf_TempR which had basicly the same code, INRight still 0K. Then I tried setting temperature of INRight to constant, and INLeft turned into 0K! What can that mean? I don't think the UDF is the problem since it gave INLeft a correct temperature with the presence of INRight UDF. But here it is anyway:
#include "udf.h"
real time2=-1;
real cc=0;
{
face_t outf,f;
real sum_t1=0;
real sum_t2=0;
real sum_t3=0;
real sum_t4=0;
real sum_t=0;
real A[ND_ND];
real s=0;
real sz1=0;
real sz2=0;
real sz3=0;
real sz4=0;
real tt;
real time1;
real t=0;
real dT;
real inlet;
real setu;//setting temperature
real setd;

Domain *domain=Get_Domain(1);
int ID1=17;
int ID2=18;
int ID3=19;
int ID4=20;
time1=RP_Get_Real("flow-time");
tt=time1;
setu=294.15;
setd=293.15;
if(time1>time2)
{
//outlet_o5l
{
sz1+=s; //
sum_t1+=t*s;
}
if(sz1==0) sum_t1=t;
else sum_t1=sum_t1*1/sz1;
//outlet_o5r
{
sz2+=s; //
sum_t2+=t*s;
}
if(sz2==0) sum_t2=t;
else sum_t2=sum_t2*1/sz2;
//outleto2l
{
sz3+=s; //
sum_t3+=t*s;
}
if(sz3==0) sum_t3=t;
else sum_t3=sum_t3*1/sz3;
//outleto2r
{
sz4+=s; //
sum_t4+=t*s;
}
if(sz4==0) sum_t4=t;
else sum_t4=sum_t4*1/sz4;
sum_t=(sum_t1+sum_t2+sum_t3+sum_t4)/4;
//decide the air temperature of inlet
if (sum_t<setd) cc=cc+1;
if (cc<1)//start
{
if(tt<53)
dT=0.0002*tt*tt*tt-0.023*tt*tt+0.8658*tt-0.5086;
else
dT=0.0094*tt+10.5207;
}
else
{
if(sum_t<=setd)
dT=4.656;
else
{
if(sum_t>=setu)
dT=13.382;
else dT=4.656;
}
}

inlet=sum_t-dT;
if (inlet<280.15) inlet=280.15;
{

}

printf("temp of inlet:%g\n",inlet);
printf("av-temp of outlet:%g\n",sum_t);
printf("c=%g\n",cc);
time2=time1;
}
}

Would somebody PLZ help me! Pretty desperate here.

 tccruise February 19, 2012 05:10

Found a solution!!! THX for reading the tedious post above!

All I have to do is set another UDF which copies the temperature from the correct inlet and applies it to the once erroneous inlet!!

How could I not have figured that out during the past 2 day!:D

THX again, to those that took their time to read my post! Have a nice day!

 n7310889 September 14, 2012 06:08

Hi,
I'm modeling 3D conjugate heat transfer system, where the fluid domain absorb heat from the tube. The tube itself get heat from some external source, however. Since the resultant temperature of the tube outer surface will be very high I have to consider radiation exchange with the evacuated glass envelope. That means I have to apply two conditions: 1. a spatially variable input heat flux profile and 2. radiation exchange. I'm trying to develop an UDF for that. However, I've written a udf for heat flux, and it is running well. Now I'm trying to add radiation in that macro at a fashion like that: F_PROFILE(x,t,i) = given_heat_flux - some_constant*(pow(F_T(f,t),4-pow(Temp_glass,4));
Whenever I try to interprate this macro, fluent shows me parse error, just at this line. One thing I'm wondering is, I'm assigning input heat to a certain face and again use the temperature of the same face to negate radiation exchange from the resultant heat flux! Input heat will be utilized first to raise the face temperature, then radiation exchange will be function of this temperature, is my understanding. I don't understand actually how should I assign radiation exchange in my model. Could you please help me to get rid of this riddle? I'll be thankful really.
Regards

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