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/)
-   -   UDF Problem (https://www.cfd-online.com/Forums/fluent-udf/113943-udf-problem.html)

rahulshah March 1, 2013 07:01

UDF Problem
 
Hi everyone. I am using UDF to input various atmospheric properties for solving my transient thermal analysis. There are a few doubts that i am having regarding how FLUENT works with UDF. Hope I get my doubts cleared here. Am giving a list of doubts here.

Firstly i am adding the code dat i have written:

"#include "udf.h"

#define gamma 1.4
#define R 218.6 /* J/kg-K */
#define g 9.8 /* m/s^2 */
#define a 3e-3 /* K/m */

/* hg = geopotential altitude (m)*/
/* a = lapse rate */
/* Tin = Temperature at inlet (K)*/

DEFINE_PROFILE(Temp_inlet,thread,index)
{
real hg, Tin;
real t = CURRENT_TIMESTEP;
face_t f;

begin_f_loop(f,thread)
{
if (t <= 1.0)
{
for (hg=26000; hg<=30000; hg=hg+500)
Tin = 216.66 + (a*(hg-25000));
F_PROFILE(f,thread,index) = Tin;
}
}
end_f_loop(f,thread)
}
"

All the doubts are related to the UDF above.

  1. As it is seen am assigning a variable to obtain the current time step from the flow. What i want to know does it get updated after each time step. Meaning does 't' change its value from 0.1 to 0.2 when fluent completes one time step and updates itself. If not then what to do to update it?
  2. It is seen when the value of 't' is compared wid d numerical value, it goes into the inner for-loop . I am implementing the UDF thinking that it always gets updated after each timestep. but from the results got, i am having doubts whether it is getting updated or not. I want to know if the UDF gets updated after each time step does FLUENT start to calculate the full flow field using the values from the previous time step as initial values and the changed input values as new input conditions. If not then wat does it do when at delta-t changes from 0.1 to 0.2?
  3. Finally I also want to know this. When the UDF is used to calculate the temperature, as it is seen the code has a for-loop. From the UDF my aim is, for every increase in time step the height should increase and only once the temperature has to be calculated and has to be given as inlet condition at d beginning of each new time step. But i feel that the for-loop is executed for also the iterations between each time step. Can somebody tell me how d UDF gets executed, i.e. is it getting executed even for the iterations or not (tell me by reading the code).
Well I hope i am clear in my doubt. Hope to get replies form the persons who read it.


All times are GMT -4. The time now is 22:35.