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/)
-   -   temperature profile variation -UDF (https://www.cfd-online.com/Forums/fluent-udf/118713-temperature-profile-variation-udf.html)

ahvz June 3, 2013 04:57

temperature profile variation -UDF
 
Does fluent allow the external temperature function to be defined "by branches": i.e. one equation for 0<t<10000s and another for t>10000s for example. This way, the fitting would become much easier with distinct equations for distinct branches of time…


I have this code but it has only one fitting curve equation, while I have two equations for distinct times. how to do this ?


Code:

/***********************************************************************
udfexample.c
UDF for specifying transient temperature profile boundary condition
 ************************************************************************/
#include "udf.h"
#include "mem.h"
DEFINE_PROFILE(Temp_Profile, thread, position)   
{
real x[ND_ND];                                     
real y;
real theProfile;
face_t f;
begin_f_loop(f, thread);
 {
 F_CENTROID(x,f,thread);
 y = CURRENT_TIME;   
  theProfile=(283.7656)+25.44573*exp(-0.5*((y-49657.42)*(y-49657.42)/(11529.66*11529.66)));
 F_PROFILE(f, thread, position) =theProfile;
 }
end_f_loop(f,thread)
}


regards,

ousegui June 10, 2013 14:11

See Added part to your code (in red)
Quote:

Originally Posted by ahvz (Post 431583)
Code:

/***********************************************************************
udfexample.c
UDF for specifying transient temperature profile boundary condition
 ************************************************************************/
#include "udf.h"
#include "mem.h"
DEFINE_PROFILE(Temp_Profile, thread, position)   
{
real x[ND_ND];                                     
real y;
real t1; //time whre your equation profile changes
real theProfile;
face_t f;
begin_f_loop(f, thread);
 {
 F_CENTROID(x,f,thread);
 y = CURRENT_TIME;   
if(y<t1)
  theProfile=(283.7656)+25.44573*exp(-0.5*((y-49657.42)*(y-49657.42)/(11529.66*11529.66)));
 F_PROFILE(f, thread, position) =theProfile;
else
theProfile=other expressions
F_PROFILE(f, thread, position) =theProfile;
 }
end_f_loop(f,thread)
}


regards,


ahvz June 10, 2013 15:10

thank you very much

ahvz June 17, 2013 19:07

I tried to change the domain of my temperature profile by defining time limits:

but the results are very strange. is the code written properly ?

Code:

/***********************************************************************
udfexample.c
UDF for specifying transient temperature profile boundary condition
 ************************************************************************/
#include "udf.h"
#include "mem.h"
DEFINE_PROFILE(Temp_Profile, thread, position)   
{
real x[ND_ND];                                     
real y;
real t1=32399;
real t2=89999;
real t3=118799;
real theProfile;
face_t f;
begin_f_loop(f, thread);
 {
 F_CENTROID(x,f,thread);
 y = CURRENT_TIME;   
if(y<=t1)
 
      theProfile=(-3e-12*pow(y,3.))+(1e-7*pow(y,2.))-(-0.0004*pow(y,1.))+(282.08);
      F_PROFILE(f, thread, position) =theProfile;   
      {
    if(t1<y<=t2)
      theProfile=(-3e-13*pow(y,3.))+(7e-8*pow(y,2.))-(0.0055*pow(y,1.))+426.51;
      F_PROFILE(f, thread, position) =theProfile;
      }
      {
      if(t2<y<=t3)
      theProfile=(-2e-12*pow(y,3.))+(6e-7*pow(y,2.))-(0.0587*pow(y,1.))+2143.9;
      F_PROFILE(f, thread, position) =theProfile;
      }
      {
      if(y>t3)
      theProfile=(-4e-13*pow(y,3.))-(2e-7*pow(y,2.))-(0.0301*pow(y,1.))+1881.6;
      F_PROFILE(f, thread, position) =theProfile;
      }
 }
end_f_loop(f,thread)
}


regards,

str6073 July 23, 2013 07:55

hi

I need a udf for a work.I'm quite new in this area, so i really need your help. i need a linear varying temperature profile boundary condition to be applied on a circular face of a cylinder. temperature varies from 25 to 50 degrees from bottom to top of circle. diameter of circle is 470 mm . can you please help???


All times are GMT -4. The time now is 23:21.