CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF: temperature profile (https://www.cfd-online.com/Forums/fluent/33338-udf-temperature-profile.html)

dolores March 29, 2004 03:28

UDF: temperature profile
 
I am modeling an industrial oven using 2d, segregated, laminar, unsteady solver. At some period of time, the temperature of the heater coil is linearly increasing. The next period, the temperature is just constant. I tried DEFINE_PROFILE, can't compile it. How do I make the flow time as a trigger to switch from linear to constant temperature?

thomas March 29, 2004 05:20

Re: UDF: temperature profile
 
you should post your udf !

dolores March 29, 2004 07:12

Re: UDF: temperature profile
 
#include "udf.h"

DEFINE_ADJUST(heater_temp, d) { Thread *t; face_t f; int time=RP_Get_Integer("time-step"); thread_loop_f(t,d) { begin_f_loop (f,t)

{

if (time<50)

F_PROFILE(f,t,0) = 2*time + 273;

else

F_PROFILE(f,t,0) = 373;

} end_f_loop (f,t) } }

sorry, here's the UDF, this one I tried DEFINE_ADJUST since DEFINE_PROFILE doesn't seem to recognize "time element" FLUENT reports syntax error on line 6( Thread *t;); line 8 (int time = RP_Get....) line 9 (thread_loop_f...). FLUENT reports "f:undeclared variable" on line 11 (begin_f_loop...) the heater temperature profile should be like this: heats up from room temp to 100 degree Celcius in 50 minutes, then stays at 100 degree Celcius for an hour

Ajay March 29, 2004 17:43

Re: UDF: temperature profile
 
Should'nt you be using RP_Get_Real("flow-time") ? your UDF looks coorect wonder why the error. I have used RP_Get_Real("flow-time") with define_profile it worked fne. -Ajay

dolores March 29, 2004 23:27

Re: UDF: temperature profile
 
thanks for the replies. another question, how would you use the if/else statement inside the DEFINE_PROFILE function. I somehow always get a "syntax error" on if/else statement. many thanks

Andrew Garrard March 30, 2004 05:53

Re: UDF: temperature profile
 
Right, for a start you are not defining your thread, you will need something like Thread *thread = Lookup_Thread(d, ID), otherwise the face loop will not know what to loop over.

Secondly, I don't think there is anything wrong with your if/else statments, I think the problem is in you F_PROFILE. You are setting the F_PROFILE(f, t, 0), What is 0? You want to set the temperature, if I understood correctly. If you are trying to set the temperature on a boundary you should use a DEFINE_PROFILE and hook it in the boundary conditions panel within the fluent GUI.

Hope some of this helps. :)

mmunige August 5, 2016 20:16

UDF for temperature variation with time and space
 
Respected members

I have to write a UDF for temperature variation along with time and flow domain. actually temperature is varying with time at four points in flow domain, (different relation for time and temperature at these points.
for example at x=0.20m i have following code:
DEFINE_PROFILE(solid_temperature,thread,position )

{
face_t f;
begin_f_loop(f,thread)
{

real t = RP_Get_Real("flow-time");
if ( t <= 100.0 )

{

F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (100.0 < t && t <= 180.0 )
{
F_PROFILE(f,thread,position) = -8.34641*pow(10,-6)*pow(t,4.0)+ 5.49800*pow(10,-3)*pow(t,3.0)- 1.35243*pow(t,2.0)+ 1.47648*pow(10,2.0)*t - 5.51650*pow(10,3.0);
}
else

{
F_PROFILE(f,thread,position) = 727.82;
}
}
end_f_loop(f,thread)

}
at x=0.40m (second point) i have following relations:

if ( t <= 100.0 )

{
F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (100.0 < t && t <= 180.0 )
{
F_PROFILE(f,thread,position) = 0.2716*t + 494.4;
}
else
{
F_PROFILE(f,thread,position) = 727.82;
}
}
end_f_loop(f,thread)
}


and similarly for other 2 points
can any body pl guide me how to include these points in code. i just know how to write variation of temperature with time but i could not find way to write above relations at different points.
Please guide me.
thanks.


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