CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF in fluent (http://www.cfd-online.com/Forums/fluent/28369-udf-fluent.html)

KRISHNA SAMPATH March 27, 2001 17:22

UDF in fluent
 
Hi,

I am a graduate student modeling the flow of air through a rotary valve in an IC engine using fluent. I have the following question. The pressure at the outlet varies as the density of air changes. I would like to use this value of density at the current time step to calculate the pressure at the next time step. I am able to write out the density values into a *.out file. Could someone please tell me how I could read this value back into my UDF and calculate the pressure for the next time step.

Thanks.... -Krishna

Seyoung Oh March 29, 2001 02:20

Re: UDF in fluent
 
In your case, it's better to use a "C_UDMI" function. By using that you can write a density values in a memory stack and use it in your UDF. So, writing the density values into a file and reading it from the file is not required.

Your UDF can be,

DEFINE_ADJUST() { Thread *t=Lookup_Thread(domain,outlet_id)

/* you can find the outlet id in fluent menu-define-boundary condition */ begin_c_loop(c,t) {

C_UDMI(c,t,0)=C_R(c,t); /* write values in memory stack */ }

}

/* use it to update the pressure */ DEFINE_PROFILE() { F_P(f,t)= C_UDMI(c,t,0)*R*T; /* exam. p=rho*R*T */ }

And don't forget to select a adjust function in the fluent menu(defined-function Hooks-Adjust function) to update the density at every time step.

Good luck..

Seyoung



All times are GMT -4. The time now is 18:26.