CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF Help!!! (https://www.cfd-online.com/Forums/fluent/33341-udf-help.html)

paul March 29, 2004 07:00

UDF Help!!!
 
Hi all,

I'm hoping that someone out there with a grasp of UDF's would be able to help me. I'm trying to model species transport in Fluent. The standard boundary conditions are limited to either zero flux through the wall or a specified, constant value. However, I was hoping to model a flux through the wall that was dependant on both the concentration at the wall and a constant of wall permeability i.e.

q = -D*dc/dn @ the wall

= alpha*c @ the wall

where D is the co-efficient of diffusion and c is the concentration at thhe wall.

I have tried to use both DEFINE_ADJUST and DEFINE_PROFILE in a UDF with a temperature profile, as follows,

#include "udf.h"

#define ALPHA 0.005

real temp;

DEFINE_ADJUST(adjust,t)

{

face_t f;

begin_f_loop(f,t)

{

F_UDMI(F_C0(f,t),THREAD_T0(t),0)=F_T(f,t);

}

end_f_loop(f,t)

}

DEFINE_PROFILE(wall_flux,t,i)

{

face_t f;

begin_f_loop(f,t)

{

temp=F_UDMI(F_C0(f,t),THREAD_T0(t),0);

F_PROFILE(f,t,i)=ALPHA*(temp);

}

end_f_loop(f,tf)

}

I'm not totally familiar with UDF's, but the general idea is that I want to store the values of temperature along the cells at the wall, then apply a profile of temperature at the walls.

I have a few questions regarding the implementation of the UDF.

The UDF compiles correctly in Fluent. THe problem is where do I implement the UDF's i.e. User defined hooks, define - boundary conditions- wall- temperature?

I've tried various approaches but wether I run the model with or without the UDF, makes no difference reagarding the temperature distribution in the flow.

Any suggestions would be greatly appreciated

All the best

Paul

thomas March 30, 2004 03:56

Re: UDF Help!!!
 
are you sure to define correctly you thread cause your define profile is wrong DEFINE_ADJUST(adjust,t) t should be referenced as a domain pointer (commonly named by the letter d).

thomas

paul March 30, 2004 04:28

Re: UDF Help!!!
 
Hi Thomas,

Thanks for the advive on the pointer. I've made the change to the UDF and it compiles. However, there is no change in the temperature profile at the wall.

When I try to plot the UDM values all I get is zero, which leads me to believe that I'm not using the F_UDMI correctly. Do I only need to use the Adjust UDF in the drop-down menu of the "User-defined -> Function Hooks -> Adjust function" or do I use it elsewhere?

Even by chaning the values of ALPHA in the profile has no effect on the overall temperature.

Can you suggest any further ideas?

Thanks again for your time

Paul

thomas March 30, 2004 04:48

Re: UDF Help!!!
 
What is the case you are trying to simulate ?

paul March 30, 2004 05:08

Re: UDF Help!!!
 
For a simple first analysis I am modelling heat transfer in a pipe of 6mm diameter. The model is 3-D

Water is passing through the pipe at a speed of 1 m/s and the temperature of the water is 350k. I have set the wall temperature to the DEFINE_PROFILE described in the UDF.

The analysis is transient with a time-step size of 0.1s and ten time steps in all.

Should I be approaching the problem in a different way?

Thanks for the help so far

Paul

thomas March 30, 2004 08:54

Re: UDF Help!!!
 
try that and tell me.

DEFINE_AJUST(...,d) real ID_WALL= /* put you wal ID here */ Thread *t = Lookup_Thread(d,ID_WALL); . . .

Keep posted. thomas


All times are GMT -4. The time now is 09:39.